DXErrEllipseParam.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using DevExpress.XtraEditors;
  2. using DevExpress.XtraMap;
  3. using DxHelper;
  4. using ExtensionsDev;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. using XdCxRhDW.App.Api.星历推算;
  15. using XzXdDw.App;
  16. using XzXdDw.App.EFContext;
  17. using XzXdDw.App.Model;
  18. namespace XdCxRhDW.App.UserControl
  19. {
  20. public partial class DXErrEllipseParam : DevExpress.XtraEditors.XtraUserControl
  21. {
  22. public MapControl mapControl1;
  23. public double lon;
  24. public double lat;
  25. public ErrEllipse单星协同接口 Model => new ErrEllipse单星协同接口()
  26. {
  27. TleMain = txtTleMain.Text.Trim(),
  28. CapTime = txtCapTime.DateTime,
  29. CapTime1=txtCapTime1.DateTime,
  30. CapTime2=txtCapTime2.DateTime,
  31. DfoErr = Convert.ToDouble(txtDfoErr1.Text),
  32. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  33. EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
  34. fu = Convert.ToDouble(txtFu1.Text)*1e6,
  35. };
  36. public DXErrEllipseParam(double MBfu, DateTime sigTime)
  37. {
  38. InitializeComponent();
  39. txtTleMain.UseDoubleClickToSelectAll();
  40. txtTleMain.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
  41. this.txtCapTime.DateTime = sigTime;
  42. this.txtCapTime1.DateTime = sigTime.AddMinutes(5);
  43. this.txtCapTime2.DateTime = sigTime.AddMinutes(10);
  44. this.txtDfoErr1.EditValue = TestData.DfoHzErr;
  45. this.txtSatLocErr1.EditValue = TestData.SatLocErr;
  46. this.txtEphVelErr1.EditValue = TestData.EphVelErr;
  47. this.txtFu1.EditValue = MBfu * 1e-6;
  48. }
  49. private void btnOK_Click(object sender, EventArgs e)
  50. {
  51. mapControl1.ClearMap();
  52. double[] main_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime);
  53. double[] adja1_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime1);
  54. double[] adja2_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime2);
  55. DrawErrorEllipse1X(lon, lat, main_sat, adja1_sat, adja2_sat, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.fu);
  56. }
  57. private void DrawErrorEllipse1X(double posLon, double posLat, double[] MsEph, double[] NsEph1, double[] NsEph2, double DfoErr, double EphPosErr, double EphVelErr, double fu)
  58. {
  59. try
  60. {
  61. List<TxInfo> listTx = new List<TxInfo>();
  62. List<XzXdDw.App.Model.SatInfo> listSat = new List<XzXdDw.App.Model.SatInfo>();
  63. using (RHDWContext db = new RHDWContext())
  64. {
  65. listTx = db.TxInfos.ToList();
  66. listSat = db.SatInfos.ToList();
  67. }
  68. var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
  69. #warning 但凡是和频差相关的 星历必须给速度
  70. XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO1XOption Option = new XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO1XOption();
  71. Option.MsEph = MsEph;
  72. Option.NsEph1 = NsEph1;
  73. Option.NsEph2 = NsEph2;
  74. Option.SelectPoint = new double[3] { posLon, posLat, 0 };
  75. Option.DfoErr = DfoErr;
  76. Option.EphPosErr = EphPosErr;
  77. Option.EphVelErr = EphVelErr;
  78. Option.fu = fu;
  79. var points = XzXdDw.App.Api.低轨GDOP误差椭圆.ErrEllipseHelper.ErrorEllipseSingleX(Option);
  80. mapControl1.DrawDtoPonit($"单星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat}]误差椭圆线", points);
  81. }
  82. catch (Exception ex)
  83. {
  84. Serilog.Log.Error("绘制误差椭圆线失败", ex);
  85. XtraMessageBox.Show($"绘制误差椭圆线失败,失败信息:{ex.Message}");
  86. }
  87. }
  88. private void btnClose_Click(object sender, EventArgs e)
  89. {
  90. PopupHelper.HidePopup(this);
  91. }
  92. }
  93. public class ErrEllipse单星协同接口
  94. {
  95. /// <summary>
  96. /// 主星星历
  97. /// </summary>
  98. public string TleMain { get; set; }
  99. /// <summary>
  100. /// 采集时刻1
  101. /// </summary>
  102. public DateTime CapTime { get; set; }
  103. /// <summary>
  104. /// 采集时刻2
  105. /// </summary>
  106. public DateTime CapTime1 { get; set; }
  107. /// <summary>
  108. /// 采集时刻3
  109. /// </summary>
  110. public DateTime CapTime2 { get; set; }
  111. /// <summary>
  112. /// 频差误差(Hz)
  113. /// </summary>
  114. public double DfoErr { get; set; }
  115. /// <summary>
  116. /// 星历位置误差
  117. /// </summary>
  118. public double SatLocErr { get; set; } = 10000;
  119. /// <summary>
  120. ///星历速度误差
  121. /// </summary>
  122. public double EphVelErr { get; set; }
  123. /// <summary>
  124. /// 上行频点(Hz)
  125. /// </summary>
  126. public double fu { get; set; }
  127. }
  128. }