XZErrEllipseParam.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.Api.低轨GDOP误差椭圆;
  17. using XzXdDw.App.EFContext;
  18. using XzXdDw.App.Model;
  19. namespace XdCxRhDW.App.UserControl
  20. {
  21. public partial class XZErrEllipseParam : DevExpress.XtraEditors.XtraUserControl
  22. {
  23. public MapControl mapControl1;
  24. public double lon;
  25. public double lat;
  26. public ErrEllipse星座协同接口 Model => new ErrEllipse星座协同接口()
  27. {
  28. TleMain = txtTleMain.Text.Trim(),
  29. TleAdja = txtTleAdja.Text.Trim(),
  30. CapTime = txtCapTime.DateTime,
  31. RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
  32. RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
  33. DtousErr = Convert.ToDouble(txtDtousErr1.Text),
  34. DfoErr= Convert.ToDouble(txtDfoErr1.Text),
  35. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  36. EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
  37. fu1 = Convert.ToDouble(txtFu1.Text) * 1e6,
  38. fu2 = Convert.ToDouble(txtFu2.Text) * 1e6,
  39. };
  40. public XZErrEllipseParam(TxInfo refTx, DateTime sigTime, double upfreqHz1, double upfreqHz2)
  41. {
  42. InitializeComponent();
  43. txtCapTime.UseDefault();
  44. txtTleMain.UseDoubleClickToSelectAll();
  45. txtTleAdja.UseDoubleClickToSelectAll();
  46. txtRefLocation1.UseDoubleClickToSelectAll();
  47. this.txtCapTime.DateTime = sigTime;
  48. this.txtRefLocation1.Text = $"{refTx.Lon},{refTx.Lat}";
  49. txtTleMain.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
  50. txtTleAdja.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo2;
  51. this.txtDtousErr1.EditValue = TestData.DtousErr;
  52. this.txtDfoErr1.EditValue = TestData.DfoHzErr;
  53. this.txtSatLocErr1.EditValue = TestData.SatLocErr;
  54. this.txtEphVelErr1.EditValue = TestData.EphVelErr;
  55. this.txtFu1.EditValue = upfreqHz1 * 1e-6;
  56. this.txtFu2.EditValue = upfreqHz2 * 1e-6;
  57. }
  58. private void btnOK_Click(object sender, EventArgs e)
  59. {
  60. mapControl1.ClearMap();
  61. double[] main_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime);
  62. double[] adja_sat = Tle2XYZ.GetXyz(Model.TleAdja, Model.CapTime);
  63. DrawErrorEllipseDTFO(lon, lat, main_sat, adja_sat, new double[] { Model.RefLon, Model.RefLat, 0 }, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.fu1, Model.fu2);
  64. }
  65. private void DrawErrorEllipseDTFO(double posLon, double posLat, double[] main_sat, double[] neigh_sat, double[] Ref_Station_LLH, double DtoErr, double DfoErr, double EphPosErr, double EphVelErr, double fu1, double fu2)
  66. {
  67. try
  68. {
  69. ErrorEllipseDTFOTSOption twoStartOption = new ErrorEllipseDTFOTSOption();
  70. twoStartOption.MsEph = main_sat;
  71. twoStartOption.NsEph = neigh_sat;
  72. twoStartOption.RefGeod = Ref_Station_LLH;
  73. twoStartOption.SelectPoint = new double[3] { posLon, posLat, 0 };
  74. twoStartOption.DtoErr = DtoErr * 1e-6;
  75. twoStartOption.DfoErr = DfoErr;
  76. twoStartOption.EphPosErr = EphPosErr;
  77. twoStartOption.EphVelErr = EphVelErr;
  78. twoStartOption.fu1 = fu1;
  79. twoStartOption.fu2 = fu2;
  80. var points = ErrEllipseHelper.ErrorEllipseDTFOTwoStart(twoStartOption);
  81. mapControl1.DrawDtoPonit($"双星误差椭圆线", points);
  82. }
  83. catch (Exception ex)
  84. {
  85. Serilog.Log.Error("绘制误差椭圆线失败", ex);
  86. XtraMessageBox.Show($"绘制误差椭圆线失败,失败信息:{ex.Message}");
  87. }
  88. }
  89. private void btnClose_Click(object sender, EventArgs e)
  90. {
  91. PopupHelper.HidePopup(this);
  92. }
  93. }
  94. public class ErrEllipse星座协同接口
  95. {
  96. /// <summary>
  97. /// 主星星历(Tle)
  98. /// </summary>
  99. public string TleMain { get; set; }
  100. /// <summary>
  101. /// 邻星星历(Tle)
  102. /// </summary>
  103. public string TleAdja { get; set; }
  104. /// <summary>
  105. /// 采集时刻
  106. /// </summary>
  107. public DateTime CapTime { get; set; }
  108. /// <summary>
  109. /// 参考站位置经度
  110. /// </summary>
  111. public double RefLon { get; set; }
  112. /// <summary>
  113. /// 参考站位置纬度
  114. /// </summary>
  115. public double RefLat { get; set; }
  116. /// <summary>
  117. /// 时差误差(单位us)
  118. /// </summary>
  119. public double DtousErr { get; set; } = 1;
  120. /// <summary>
  121. /// 频差误差(Hz)
  122. /// </summary>
  123. public double DfoErr { get; set; }
  124. /// <summary>
  125. /// 星历位置误差(单位米)
  126. /// </summary>
  127. public double SatLocErr { get; set; } = 10000;
  128. /// <summary>
  129. ///星历速度误差
  130. /// </summary>
  131. public double EphVelErr { get; set; }
  132. /// <summary>
  133. /// 上行频点1(Hz)
  134. /// </summary>
  135. public double fu1 { get; set; }
  136. /// <summary>
  137. /// 上行频点2(Hz)
  138. /// </summary>
  139. public double fu2 { get; set; }
  140. }
  141. }