X2DFGDOPParam.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. 
  2. using DevExpress.XtraMap;
  3. using DxHelper;
  4. using ExtensionsDev;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. using XdCxRhDW.Core.Api;
  10. using XdCxRhDW.Repostory.EFContext;
  11. using XdCxRhDW.Repostory.Model;
  12. namespace XdCxRhDW.App.UserControl
  13. {
  14. public partial class X2DFGDOPParam : DevExpress.XtraEditors.XtraUserControl
  15. {
  16. public MapControl mapControl1;
  17. public X2DFGDOP接口 Model => new X2DFGDOP接口()
  18. {
  19. TleLeo1 = txtTleLeo1.Text.Trim(),
  20. TleLeo2 = txtTleLeo2.Text.Trim(),
  21. CapTime = txtCapTime.DateTime,
  22. RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
  23. RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
  24. DfoErr = Convert.ToDouble(txtDfoErr1.Text),
  25. DtousErr = Convert.ToDouble(txtDtousErr1.Text),
  26. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  27. EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
  28. fu1 = Convert.ToDouble(txtFu1.Text) * 1e6,
  29. fu2 = Convert.ToDouble(txtFu2.Text) * 1e6,
  30. };
  31. public X2DFGDOPParam(PosRes item)
  32. {
  33. InitializeComponent();
  34. txtCapTime.UseDefault();
  35. txtTleLeo1.UseDoubleClickToSelectAll();
  36. txtTleLeo2.UseDoubleClickToSelectAll();
  37. txtRefLocation1.UseDoubleClickToSelectAll();
  38. this.txtCapTime.DateTime = item.SigTime;
  39. this.txtSatLocErr1.EditValue = 1000;
  40. this.txtEphVelErr1.EditValue = 0.1;
  41. this.txtDfoErr1.EditValue = 0.01;
  42. this.txtDtousErr1.EditValue = 1;
  43. List<string> xlall = new List<string>();
  44. string mainTle = string.Empty;
  45. string adjaTle1 = string.Empty;
  46. using (RHDWContext db = new RHDWContext())
  47. {
  48. var sats = db.SatInfos.ToList();
  49. var cg = db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
  50. var station = db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();
  51. if (station != null)
  52. {
  53. this.txtRefLocation1.Text = $"{station.RefLon},{station.RefLat}";
  54. }
  55. this.txtFu1.EditValue = cg.TarFreqUp.HasValue ? cg.TarFreqUp.Value : 950;
  56. this.txtFu2.EditValue = cg.RefFreqUp.HasValue ? cg.RefFreqUp.Value : 950;
  57. var xlList = db.XlInfos.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
  58. xlall.AddRange(xlList.Select(m => m.TwoLine));
  59. if (xlall.Count() == 0) return;
  60. if (cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
  61. {
  62. mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
  63. }
  64. else
  65. {
  66. mainTle = xlList.First().TwoLine;
  67. }
  68. if (cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
  69. {
  70. adjaTle1 = xlList.First(m => m.SatCode == cg.Adja1Code.Value).TwoLine;
  71. }
  72. else
  73. {
  74. adjaTle1 = xlList.First().TwoLine;
  75. }
  76. }
  77. txtTleLeo1.UseDefault().SetStringData(xlall).Text = mainTle;
  78. txtTleLeo2.UseDefault().SetStringData(xlall).Text = adjaTle1;
  79. }
  80. private void btnOK_Click(object sender, EventArgs e)
  81. {
  82. mapControl1.ClearMap();
  83. var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
  84. var (listSat, data) = GdopHelper.Gdop2SatDRef(Model.TleLeo1, Model.TleLeo2,
  85. Model.CapTime, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, refs);
  86. if (data == null)
  87. {
  88. return;
  89. }
  90. foreach (var errLins in data)//画GDOP
  91. {
  92. var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
  93. mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
  94. }
  95. }
  96. private void btnClose_Click(object sender, EventArgs e)
  97. {
  98. PopupHelper.HidePopup(this);
  99. }
  100. }
  101. public class X2DFGDOP接口
  102. {
  103. /// <summary>
  104. /// 主星星历(Tle)
  105. /// </summary>
  106. public string TleLeo1 { get; set; }
  107. /// <summary>
  108. /// 邻星1星历(Tle)
  109. /// </summary>
  110. public string TleLeo2 { get; set; }
  111. /// <summary>
  112. /// 采集时刻
  113. /// </summary>
  114. public DateTime CapTime { get; set; }
  115. /// <summary>
  116. /// 参考站位置经度
  117. /// </summary>
  118. public double RefLon { get; set; }
  119. /// <summary>
  120. /// 参考站位置纬度
  121. /// </summary>
  122. public double RefLat { get; set; }
  123. /// <summary>
  124. /// 时差误差(单位us)
  125. /// </summary>
  126. public double DtousErr { get; set; } = 1;
  127. /// <summary>
  128. /// 频差误差(Hz)
  129. /// </summary>
  130. public double DfoErr { get; set; }
  131. /// <summary>
  132. /// 星历位置误差(单位米)
  133. /// </summary>
  134. public double SatLocErr { get; set; } = 10000;
  135. /// <summary>
  136. ///星历速度误差
  137. /// </summary>
  138. public double EphVelErr { get; set; }
  139. /// <summary>
  140. /// 上行频点1(Hz)
  141. /// </summary>
  142. public double fu1 { get; set; }
  143. /// <summary>
  144. /// 上行频点2(Hz)
  145. /// </summary>
  146. public double fu2 { get; set; }
  147. }
  148. }