XZErrEllipseParam.cs 5.6 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.Model;
  18. namespace XdCxRhDW.App.UserControl
  19. {
  20. public partial class XZErrEllipseParam : 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. TleAdja = txtTleAdja.Text.Trim(),
  29. CapTime = txtCapTime.DateTime,
  30. RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
  31. RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
  32. DtousErr = Convert.ToDouble(txtDtousErr1.Text),
  33. DfoErr= Convert.ToDouble(txtDfoErr1.Text),
  34. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  35. EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
  36. fu1 = Convert.ToDouble(txtFu1.Text) * 1e6,
  37. fu2 = Convert.ToDouble(txtFu2.Text) * 1e6,
  38. };
  39. public XZErrEllipseParam(TxInfo refTx, DateTime sigTime,double upfreqHz1, double upfreqHz2)
  40. {
  41. InitializeComponent();
  42. txtCapTime.UseDefault();
  43. txtTleMain.UseDoubleClickToSelectAll();
  44. txtTleAdja.UseDoubleClickToSelectAll();
  45. txtRefLocation1.UseDoubleClickToSelectAll();
  46. this.txtCapTime.DateTime = sigTime;
  47. this.txtRefLocation1.Text = $"{refTx.Lon},{refTx.Lat}";
  48. txtTleMain.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
  49. txtTleAdja.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo2;
  50. this.txtDtousErr1.EditValue = TestData.DtousErr;
  51. this.txtDfoErr1.EditValue = TestData.DfoHzErr;
  52. this.txtSatLocErr1.EditValue = TestData.SatLocErr;
  53. this.txtEphVelErr1.EditValue = TestData.EphVelErr;
  54. this.txtFu1.EditValue = upfreqHz1 * 1e-6;
  55. this.txtFu2.EditValue = upfreqHz2 * 1e-6;
  56. }
  57. private void btnOK_Click(object sender, EventArgs e)
  58. {
  59. mapControl1.ClearMap();
  60. double[] main_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime);
  61. double[] adja_sat = Tle2XYZ.GetXyz(Model.TleAdja, Model.CapTime);
  62. 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);
  63. }
  64. 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)
  65. {
  66. try
  67. {
  68. ErrorEllipseDTFOTSOption twoStartOption = new ErrorEllipseDTFOTSOption();
  69. twoStartOption.MsEph = main_sat;
  70. twoStartOption.NsEph = neigh_sat;
  71. twoStartOption.RefGeod = Ref_Station_LLH;
  72. twoStartOption.SelectPoint = new double[3] { posLon, posLat, 0 };
  73. twoStartOption.DtoErr = DtoErr * 1e-6;
  74. twoStartOption.DfoErr = DfoErr;
  75. twoStartOption.EphPosErr = EphPosErr;
  76. twoStartOption.EphVelErr = EphVelErr;
  77. twoStartOption.fu1 = fu1;
  78. twoStartOption.fu2 = fu2;
  79. var points = ErrEllipseHelper.ErrorEllipseDTFOTwoStart(twoStartOption);
  80. mapControl1.DrawDtoPonit($"双星误差椭圆线", 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. /// 主星星历(Tle)
  97. /// </summary>
  98. public string TleMain { get; set; }
  99. /// <summary>
  100. /// 邻星星历(Tle)
  101. /// </summary>
  102. public string TleAdja { get; set; }
  103. /// <summary>
  104. /// 采集时刻
  105. /// </summary>
  106. public DateTime CapTime { get; set; }
  107. /// <summary>
  108. /// 参考站位置经度
  109. /// </summary>
  110. public double RefLon { get; set; }
  111. /// <summary>
  112. /// 参考站位置纬度
  113. /// </summary>
  114. public double RefLat { get; set; }
  115. /// <summary>
  116. /// 时差误差(单位us)
  117. /// </summary>
  118. public double DtousErr { get; set; } = 1;
  119. /// <summary>
  120. /// 频差误差(Hz)
  121. /// </summary>
  122. public double DfoErr { get; set; }
  123. /// <summary>
  124. /// 星历位置误差(单位米)
  125. /// </summary>
  126. public double SatLocErr { get; set; } = 10000;
  127. /// <summary>
  128. ///星历速度误差
  129. /// </summary>
  130. public double EphVelErr { get; set; }
  131. /// <summary>
  132. /// 上行频点1(Hz)
  133. /// </summary>
  134. public double fu1 { get; set; }
  135. /// <summary>
  136. /// 上行频点2(Hz)
  137. /// </summary>
  138. public double fu2 { get; set; }
  139. }
  140. }