X3DFGDOPParam .cs 6.1 KB

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