浏览代码

添加低轨双星误差椭圆

wyq 1 年之前
父节点
当前提交
ce42a98481

+ 42 - 7
XzXdDw.App/Api/PosApi.cs

@@ -63,13 +63,13 @@ namespace XzXdDw.App.Api
         /// <param name="neigh_sat_pos">邻星星历 长度6</param>
         /// <param name="ref_pos">参考站位置</param>
         /// <param name="Zone">-85, 85, -180, 180</param>
-        /// <param name="target_dto"></param>
-        /// <param name="ref_dto"></param>
+        /// <param name="target_dto">目标时差(s)</param>
+        /// <param name="ref_dto">参考时差(s)</param>
         /// <param name="LOP_Value"></param>
         /// <param name="LOP_Len"></param>
         [DllImport(gzdw, EntryPoint = "TwoStar_SCX", CallingConvention = CallingConvention.Cdecl)]//两星一地
         public extern static void TwoStar_SCX(double[] main_sat_pos, double[] neigh_sat_pos, double[] ref_pos, double[] Zone,
-        double target_dto, double ref_dto, out IntPtr LOP_Value,ref int LOP_Len);
+        double target_dto, double ref_dto, out IntPtr LOP_Value, ref int LOP_Len);
 
         /// <summary>
         /// 地轨双星频差线
@@ -78,10 +78,10 @@ namespace XzXdDw.App.Api
         /// <param name="neigh_sat"></param>
         /// <param name="ref_pos"></param>
         /// <param name="Zone"></param>
-        /// <param name="target_dfo"></param>
-        /// <param name="ref_dfo"></param>
-        /// <param name="fu1"></param>
-        /// <param name="fu2"></param>
+        /// <param name="target_dfo">目标频差(Hz)</param>
+        /// <param name="ref_dfo">参考频差(Hz)</param>
+        /// <param name="fu1">上行频点1(Hz)</param>
+        /// <param name="fu2">上行频点2(Hz)</param>
         /// <param name="LOP_Value"></param>
         /// <param name="LOP_Len"></param>
         [DllImport(gzdw, EntryPoint = "TwoStar_PCX", CallingConvention = CallingConvention.Cdecl)]//两星一地
@@ -104,9 +104,44 @@ namespace XzXdDw.App.Api
 
 
         private const string XdtsDll = @"Api\时差线\Positioning.dll";
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="main_sat_pos"></param>
+        /// <param name="neigh_sat_pos"></param>
+        /// <param name="rec1_pos"></param>
+        /// <param name="rec2_pos"></param>
+        /// <param name="ref_pos"></param>
+        /// <param name="Zone"></param>
+        /// <param name="target_dto">目标时差 (s)</param>
+        /// <param name="ref_dto">参考时差 (s)</param>
+        /// <param name="LOP_Value"></param>
+        /// <param name="LOP_Len"></param>
         [DllImport(XdtsDll, EntryPoint = "CurveByTwoTDOA", CallingConvention = CallingConvention.Cdecl)]//两星一地
         public extern static void CurveByTwoTDOA(double[] main_sat_pos, double[] neigh_sat_pos, double[] rec1_pos, double[] rec2_pos, double[] ref_pos, double[] Zone,
       double target_dto, double ref_dto, out IntPtr LOP_Value, ref int LOP_Len);
+
+
+        private const string GDOPDll = @"Api\低轨GDOP误差椭圆\GDOP\DLL_GDOP_Analysis.dll";
+        /// <summary>
+        /// 低轨双星误差椭圆
+        /// </summary>
+        /// <param name="main_eph">主星位置 长度6</param>
+        /// <param name="neigh_eph">邻星位置 长度6</param>
+        /// <param name="ref_pos">参考位置 长度3</param>
+        /// <param name="Select_Point">定位点长度3</param>
+        /// <param name="dto_err">时差误差(s)</param>
+        /// <param name="dfo_err">频差误差(Hz)</param>
+        /// <param name="eph_pos_err"></param>
+        /// <param name="eph_vel_err"></param>
+        /// <param name="fu"></param>
+        /// <param name="Pe">0.5</param>
+        /// <param name="LOP_Len"></param>
+        /// <returns></returns>
+        [DllImport(GDOPDll, EntryPoint = "Error_Ellipse_DTFO", CallingConvention = CallingConvention.Cdecl)]
+        public extern static IntPtr Error_Ellipse_DTFO(double[] main_eph, double[] neigh_eph, double[] ref_pos, double[] Select_Point, double dto_err, double dfo_err,
+        double eph_pos_err, double eph_vel_err, double fu, double Pe, ref int LOP_Len);
+
         #endregion
 
         /// <summary>

+ 4 - 0
XzXdDw.App/Api/低轨GDOP误差椭圆/ErrEllipseHelper.cs

@@ -23,6 +23,10 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
         private static string exePath = "Api\\低轨GDOP误差椭圆\\GDOP";
         private const string exeName = "GdopCore.exe";
 
+
+
+
+
         /// <summary>
         /// 三星双时差误差椭圆带参
         /// </summary>

+ 1 - 1
XzXdDw.App/Api/低轨GDOP误差椭圆/GDOP/DLLFunction.h

@@ -12,7 +12,7 @@ extern "C"  double * Error_Ellipse_2X1D(double *station1,double *station2, doubl
 
 extern "C"  double GDOP_Value_DTFO(double *main_eph,double *neigh_eph,double *Ref_Station_LLH,double *Select_Point,double dto_err,double dfo_err
 ,double eph_pos_err,double eph_vel_err,double fu);
-
+//低轨双星
 extern "C"  double * Error_Ellipse_DTFO(double *main_eph,double *neigh_eph,double *Ref_Station_LLH,double *Select_Point,double dto_err,double dfo_err,
 	                   double eph_pos_err,double eph_vel_err,double fu,double Pe, int *len);
 

+ 42 - 6
XzXdDw.App/Api/时差线/DrawDtoLineHelper.cs

@@ -61,7 +61,7 @@ namespace XdCxRhDW.App.Api.时差线
         #endregion
         private const string exeName = "XingDiSCX.exe";
 
-        public static IEnumerable<(double lon, double lat)> HandleDtoLineXd(DtoLineXdOption opt)
+        public static IEnumerable<(double lon, double lat)> DtoLineXd(DtoLineXdOption opt)
         {
             List<DtoLinePoint> list = new List<DtoLinePoint>();
 
@@ -129,7 +129,7 @@ namespace XdCxRhDW.App.Api.时差线
         }
 
 
-        public static IEnumerable<(double lon, double lat)> HandleDtoLineXDTwoStart(DtoLineTwoStartOption opt)
+        public static IEnumerable<(double lon, double lat)> DtoLineXDTwoStart(DtoLineTwoStartOption opt)
         {
 
             List<DtoLinePoint> list = new List<DtoLinePoint>();
@@ -160,7 +160,7 @@ namespace XdCxRhDW.App.Api.时差线
         }
 
 
-        public static IEnumerable<(double lon, double lat)> HandleDtoLineXZTwoStart(DtoLineTwoStartOption opt)
+        public static IEnumerable<(double lon, double lat)> DtoLineXZTwoStart(DtoLineTwoStartOption opt)
         {
 
             List<DtoLinePoint> list = new List<DtoLinePoint>();
@@ -186,7 +186,7 @@ namespace XdCxRhDW.App.Api.时差线
             return Lines;
         }
 
-        public static IEnumerable<(double lon, double lat)> HandleDfoLineXZTwoStart(DfoLineTwoStartOption opt)
+        public static IEnumerable<(double lon, double lat)> DfoLineXZTwoStart(DfoLineTwoStartOption opt)
         {
 
             List<DtoLinePoint> list = new List<DtoLinePoint>();
@@ -199,8 +199,8 @@ namespace XdCxRhDW.App.Api.时差线
                  opt.NsEph,
                 opt.RefGeod,
                  zone,
-                opt.TargetDfo * 1e-6,
-                opt.RefDfo * 1e-6,
+                opt.TargetDfo,
+                opt.RefDfo,
                opt.fu1,
                opt.fu2, out LOP_ValuePtr, ref LOP_Len);
             double[] LOP_Value = new double[LOP_Len * 3];
@@ -235,5 +235,41 @@ namespace XdCxRhDW.App.Api.时差线
         }
 
 
+        public static IEnumerable<(double lon, double lat)> ErrorEllipseDTFOTwoStart(ErrorEllipseDTFOTSOption opt)
+        {
+
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
+
+            int LOP_Len = 0;
+            IntPtr LOP_ValuePtr = PosApi.Error_Ellipse_DTFO(
+                opt.MsEph,
+                 opt.NsEph,
+                opt.RefGeod,
+                 opt.SelectPoint,
+                opt.DtoErr,
+                opt.DfoErr,
+               opt.EphPosErr,
+               opt.EphVelErr,
+               opt.fu, opt.Pe, ref LOP_Len);
+            double[] LOP_Value = new double[LOP_Len];
+            if (LOP_Len > 0)
+            {
+                Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
+                int len = LOP_Len / 2;
+                for (int i = 0; i < len; i++)
+                {
+                    int temp = i * 2;
+                    list.Add(new DtoLinePoint()
+                    {
+                        Lon = LOP_Value[temp],
+                        Lat = LOP_Value[temp + 1]
+                    });
+                }
+            }
+            var Lines = list.Select(p => (p.Lon, p.Lat));
+            return Lines;
+        }
+
+
     }
 }

+ 53 - 4
XzXdDw.App/Api/时差线/DtoLineModel.cs

@@ -122,22 +122,71 @@ namespace XdCxRhDW.App.Api.时差线
         public double[] RefGeod { get; set; }
 
         /// <summary>
-        /// 目标频差 (us)
+        /// 目标频差(Hz)
         /// </summary>
         public double TargetDfo { get; set; }
         /// <summary>
-        /// 参考频差 (us)
+        /// 参考频差 (Hz)
         /// </summary>
         public double RefDfo { get; set; }
 
         /// <summary>
-        /// 上行频点1
+        /// 上行频点1(Hz)
         /// </summary>
         public double fu1 { get; set; }
         /// <summary>
-        /// 上行频点2
+        /// 上行频点2(Hz)
         /// </summary>
         public double fu2 { get; set; }
 
     }
+
+    public class ErrorEllipseDTFOTSOption
+    {
+        /// <summary>
+        /// 主星星历
+        /// </summary>
+        public double[] MsEph { get; set; }
+
+        /// <summary>
+        /// 邻星星历
+        /// </summary>
+        public double[] NsEph { get; set; }
+
+        /// <summary>
+        /// 参考站位置
+        /// </summary>
+        public double[] RefGeod { get; set; }
+
+        /// <summary>
+        /// 定位点
+        /// </summary>
+        public double[] SelectPoint { get; set; }
+
+        /// <summary>
+        /// 时差误差(Hz)
+        /// </summary>
+        public double DtoErr { get; set; }
+        /// <summary>
+        /// 频差误差(Hz)
+        /// </summary>
+        public double DfoErr { get; set; }
+        /// <summary>
+        /// 星历位置误差
+        /// </summary>
+        public double EphPosErr { get; set; }
+        /// <summary>
+        ///星历速度误差
+        /// </summary>
+        public double EphVelErr { get; set; }
+        /// <summary>
+        /// 上行频点(Hz)
+        /// </summary>
+        public double fu { get; set; }
+        /// <summary>
+        /// 概率 默认0.5
+        /// </summary>
+        public double Pe { get; set; } = 0.5;
+
+    }
 }

+ 1 - 0
XzXdDw.App/Api/星地GDOP误差椭圆/GDOP/args.txt

@@ -0,0 +1 @@
+68 "1 39206U 13036A   23202.42807559  .00000070  00000+0  00000+0 0  9997;2 39206   3.1191  34.4939 0054311 175.9148  65.5730  1.00271529 36651" "1 40892U 15046A   23201.78591034 -.00000153  00000+0  00000+0 0  9992;2 40892   0.0465 209.7898 0002849 182.8710 343.4998  1.00270904 28905" "2023-07-22 18:00:00.000000" 109.31 18.15 121.52 31.92 1 10000

二进制
XzXdDw.App/Api/星地GDOP误差椭圆/GDOP/星历推算/Tle2XYZ.exe


+ 8 - 0
XzXdDw.App/Api/星地GDOP误差椭圆/GDOP/星历推算/readme.txt

@@ -0,0 +1,8 @@
+Tle2XYZ输入及输出的时间戳都是UTC时间戳
+-t 时间  相对于1970-1-1 8时的秒数
+-a "line1" -b "line2" -t 1672718400
+-p 周期
+-c 次数
+
+
+-a "1 23467U 95003A   22364.32362671 -.00000025  00000+0  00000+0 0  9992" -b "2 23467   9.8007  17.1777 0001795 205.8937 164.3833  1.00270390102276" -t 1672718400 -p 1 -c 1

+ 2 - 2
XzXdDw.App/UserControl/CtrlPosXd.cs

@@ -373,7 +373,7 @@ namespace XzXdDw.App.UserControl
                 dtoLineXd.RefDto = cg.YbMain;
                 dtoLineXd.PosLon = item.PosLon;
                 dtoLineXd.PosLat = item.PosLat;
-                var xdDtoLine = DrawDtoLineHelper.HandleDtoLineXd(dtoLineXd);
+                var xdDtoLine = DrawDtoLineHelper.DtoLineXd(dtoLineXd);
                 mapControl1.DrawDtoPonit($"星地[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat},{listSat.FirstOrDefault(m => m.ID == cdbTx.ID)?.Sat}]时差线", xdDtoLine);
 
                 DtoLineTwoStartOption twoStartOption = new DtoLineTwoStartOption();
@@ -386,7 +386,7 @@ namespace XzXdDw.App.UserControl
                 twoStartOption.RefDto = cg.YbMain - cg.YbAdja;
                 twoStartOption.PosLon = item.PosLon;
                 twoStartOption.PosLat = item.PosLat;
-                var tsDtoLine= DrawDtoLineHelper.HandleDtoLineXDTwoStart(twoStartOption);
+                var tsDtoLine= DrawDtoLineHelper.DtoLineXDTwoStart(twoStartOption);
                 mapControl1.DrawDtoPonit($"双星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat},{listSat.FirstOrDefault(m => m.ID == satNTx.ID)?.Sat}]时差线", tsDtoLine);
                
 

+ 46 - 5
XzXdDw.App/UserControl/CtrlPosXz.cs

@@ -85,7 +85,7 @@ namespace XzXdDw.App.UserControl
                     .AddMenu("加载仿真数据", SvgHelper.LoadFromFile("Image\\LoadData.svg"), LoadTestData)
                      .AddMenu("绘制时差线", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawDtoLine)
                      .AddMenu("绘制频差线", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawDfoLine)
-                     .AddMenu("绘制误差椭圆", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawDfoLine)
+                     .AddMenu("绘制误差椭圆", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawErrorEllipseDTFO)
                     .AddMenu("停止加载", SvgHelper.LoadFromFile("Image\\Stop.svg"), () => stoped = true);
 
 
@@ -303,7 +303,7 @@ namespace XzXdDw.App.UserControl
                 twoStartOption.TargetDto = target_dto * 1e6;
                 twoStartOption.RefDto = ref_dto * 1e6;
 
-                var tsDtoLine = DrawDtoLineHelper.HandleDtoLineXZTwoStart(twoStartOption);
+                var tsDtoLine = DrawDtoLineHelper.DtoLineXZTwoStart(twoStartOption);
                 mapControl1.DrawDtoPonit($"双星时差线", tsDtoLine);
 
 
@@ -344,12 +344,12 @@ namespace XzXdDw.App.UserControl
                 twoStartOption.MsEph = main_sat;
                 twoStartOption.NsEph = neigh_sat;
                 twoStartOption.RefGeod = Ref_Station_LLH;
-                twoStartOption.TargetDfo = target_dfo * 1e6;
-                twoStartOption.RefDfo = ref_dfo * 1e6;
+                twoStartOption.TargetDfo = target_dfo;
+                twoStartOption.RefDfo = ref_dfo;
                 twoStartOption.fu1 = fu1;
                 twoStartOption.fu2 = fu2;
 
-                var tsDtoLine = DrawDtoLineHelper.HandleDfoLineXZTwoStart(twoStartOption);
+                var tsDtoLine = DrawDtoLineHelper.DfoLineXZTwoStart(twoStartOption);
                 mapControl1.DrawDtoPonit($"双星频差线", tsDtoLine);
 
 
@@ -360,6 +360,47 @@ namespace XzXdDw.App.UserControl
                 XtraMessageBox.Show($"绘制频差线失败,失败信息:{ex.Message}");
             }
         }
+
+        private void DrawErrorEllipseDTFO()
+        {
+            try
+            {
+                var ids = gridView1.GetSelectedRows();
+                if (ids.Length <= 0)
+                {
+                    XtraMessageBox.Show("请选择需要绘制误差椭圆线的定位数据信息!");
+                    return;
+                }
+                var item = gridView1.GetRow(ids[0]) as PosRes;
+
+
+                double[] main_sat = { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.158046 };
+                double[] neigh_sat = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
+                double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
+                double fu1 = 3.1085e8;
+
+                ErrorEllipseDTFOTSOption twoStartOption = new ErrorEllipseDTFOTSOption();
+                twoStartOption.MsEph = main_sat;
+                twoStartOption.NsEph = neigh_sat;
+                twoStartOption.RefGeod = Ref_Station_LLH;
+                twoStartOption.SelectPoint = new double[3] { item.PosLon,item.PosLat,0 };
+                twoStartOption.DtoErr =1;
+                twoStartOption.DfoErr =1;
+                twoStartOption.EphPosErr = 1;
+                twoStartOption.EphVelErr = 1;
+                twoStartOption.fu = fu1;
+
+                var points = DrawDtoLineHelper.ErrorEllipseDTFOTwoStart(twoStartOption);
+                mapControl1.DrawDtoPonit($"双星误差椭圆线", points);
+
+
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error("绘制误差椭圆线失败", ex);
+                XtraMessageBox.Show($"绘制误差椭圆线失败,失败信息:{ex.Message}");
+            }
+        }
         public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
         {
             var dots = line.Line;

+ 6 - 0
XzXdDw.App/XzXdDw.App.csproj

@@ -496,6 +496,12 @@
     <Content Include="Api\时差线\XingDiSCX.exe">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="Api\星地GDOP误差椭圆\GDOP\星历推算\readme.txt">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Api\星地GDOP误差椭圆\GDOP\星历推算\Tle2XYZ.exe">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="DLL_GZDW.dll" />
     <Content Include="Image\DrawLine.svg">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>