123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using DevExpress.XtraEditors;
- using DevExpress.XtraMap;
- using DxHelper;
- using ExtensionsDev;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using XdCxRhDW.App.Api.星历推算;
- using XzXdDw.App;
- using XzXdDw.App.EFContext;
- using XzXdDw.App.Model;
- namespace XdCxRhDW.App.UserControl
- {
- public partial class DXErrEllipseParam : DevExpress.XtraEditors.XtraUserControl
- {
- public MapControl mapControl1;
- public double lon;
- public double lat;
- public ErrEllipse单星协同接口 Model => new ErrEllipse单星协同接口()
- {
- TleMain = txtTleMain.Text.Trim(),
- CapTime = txtCapTime.DateTime,
- CapTime1=txtCapTime1.DateTime,
- CapTime2=txtCapTime2.DateTime,
- DfoErr = Convert.ToDouble(txtDfoErr1.Text),
- SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
- EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
- fu = Convert.ToDouble(txtFu1.Text)*1e6,
- };
- public DXErrEllipseParam(double MBfu, DateTime sigTime)
- {
- InitializeComponent();
- txtTleMain.UseDoubleClickToSelectAll();
- txtTleMain.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
- this.txtCapTime.DateTime = sigTime;
- this.txtCapTime1.DateTime = sigTime.AddMinutes(5);
- this.txtCapTime2.DateTime = sigTime.AddMinutes(10);
- this.txtDfoErr1.EditValue = TestData.DfoHzErr;
- this.txtSatLocErr1.EditValue = TestData.SatLocErr;
- this.txtEphVelErr1.EditValue = TestData.EphVelErr;
- this.txtFu1.EditValue = MBfu * 1e-6;
- }
- private void btnOK_Click(object sender, EventArgs e)
- {
- mapControl1.ClearMap();
- double[] main_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime);
- double[] adja1_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime1);
- double[] adja2_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime2);
- DrawErrorEllipse1X(lon, lat, main_sat, adja1_sat, adja2_sat, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.fu);
- }
- private void DrawErrorEllipse1X(double posLon, double posLat, double[] MsEph, double[] NsEph1, double[] NsEph2, double DfoErr, double EphPosErr, double EphVelErr, double fu)
- {
- try
- {
- List<TxInfo> listTx = new List<TxInfo>();
- List<XzXdDw.App.Model.SatInfo> listSat = new List<XzXdDw.App.Model.SatInfo>();
- using (RHDWContext db = new RHDWContext())
- {
- listTx = db.TxInfos.ToList();
- listSat = db.SatInfos.ToList();
- }
- var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
- #warning 但凡是和频差相关的 星历必须给速度
- XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO1XOption Option = new XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO1XOption();
- Option.MsEph = MsEph;
- Option.NsEph1 = NsEph1;
- Option.NsEph2 = NsEph2;
- Option.SelectPoint = new double[3] { posLon, posLat, 0 };
- Option.DfoErr = DfoErr;
- Option.EphPosErr = EphPosErr;
- Option.EphVelErr = EphVelErr;
- Option.fu = fu;
- var points = XzXdDw.App.Api.低轨GDOP误差椭圆.ErrEllipseHelper.ErrorEllipseSingleX(Option);
- mapControl1.DrawDtoPonit($"单星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat}]误差椭圆线", points);
- }
- catch (Exception ex)
- {
- Serilog.Log.Error("绘制误差椭圆线失败", ex);
- XtraMessageBox.Show($"绘制误差椭圆线失败,失败信息:{ex.Message}");
- }
- }
- private void btnClose_Click(object sender, EventArgs e)
- {
- PopupHelper.HidePopup(this);
- }
- }
- public class ErrEllipse单星协同接口
- {
- /// <summary>
- /// 主星星历
- /// </summary>
- public string TleMain { get; set; }
- /// <summary>
- /// 采集时刻1
- /// </summary>
- public DateTime CapTime { get; set; }
- /// <summary>
- /// 采集时刻2
- /// </summary>
- public DateTime CapTime1 { get; set; }
- /// <summary>
- /// 采集时刻3
- /// </summary>
- public DateTime CapTime2 { get; set; }
- /// <summary>
- /// 频差误差(Hz)
- /// </summary>
- public double DfoErr { get; set; }
- /// <summary>
- /// 星历位置误差
- /// </summary>
- public double SatLocErr { get; set; } = 10000;
- /// <summary>
- ///星历速度误差
- /// </summary>
- public double EphVelErr { get; set; }
- /// <summary>
- /// 上行频点(Hz)
- /// </summary>
- public double fu { get; set; }
- }
- }
|