Selaa lähdekoodia

更新GDOP动态库

wyq 1 vuosi sitten
vanhempi
commit
0892b11d94

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

@@ -54,10 +54,15 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
         ///星历速度误差
         /// </summary>
         public double EphVelErr { get; set; }
+
         /// <summary>
-        /// 上行频点(Hz)
+        /// 上行频点1(Hz)
         /// </summary>
-        public double fu { get; set; }
+        public double fu1 { get; set; }
+        /// <summary>
+        /// 上行频点2(Hz)
+        /// </summary>
+        public double fu2 { get; set; }
         /// <summary>
         /// 概率 默认0.5
         /// </summary>
@@ -154,13 +159,76 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
     }
     public static class ErrEllipseHelper
     {
+        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 fu1, double fu2, double Pe, ref int LOP_Len);
+
+
+
+        /// <summary>
+        /// 两星一地误差椭圆
+        /// </summary>
+        /// <param name="main_eph">主星位置 长度6</param>
+        /// <param name="neigh_eph">邻星位置 长度6</param>
+        /// <param name="cdbAnt">超短波 长度3</param>
+        /// <param name="refStation">参考站 长度3</param>
+        /// <param name="Select_Point">定位点 长度3</param>
+        /// <param name="dto_err">时差误差(s)</param>
+        /// <param name="eph_err"></param>
+        /// <param name="Pe">0.5</param>
+        /// <param name="LOP_Len"></param>
+        /// <returns></returns>
+        [DllImport(GDOPDll, EntryPoint = "Error_Ellipse_2X1D", CallingConvention = CallingConvention.Cdecl)]
+        public extern static IntPtr Error_Ellipse_2X1D(double[] main_eph, double[] neigh_eph, double[] cdbAnt, double[] refStation, double[] Select_Point, double dto_err,
+       double eph_err, double Pe, ref int LOP_Len);
+
+
+        /// <summary>
+        /// 单星误差椭圆
+        /// </summary>
+        /// <param name="main_eph"></param>
+        /// <param name="neigh_eph1"></param>
+        /// <param name="neigh_eph2"></param>
+        /// <param name="Select_Point"></param>
+        /// <param name="dfo_err"></param>
+        /// <param name="eph_pos_err"></param>
+        /// <param name="eph_vel_err"></param>
+        /// <param name="fu"></param>
+        /// <param name="Pe"></param>
+        /// <param name="LOP_Len"></param>
+        /// <returns></returns>
+        [DllImport(GDOPDll, EntryPoint = "Error_Ellipse_2DFO", CallingConvention = CallingConvention.Cdecl)]
+        public extern static IntPtr Error_Ellipse_2DFO(double[] main_eph, double[] neigh_eph1, double[] neigh_eph2, double[] Select_Point, double dfo_err, double eph_pos_err, double eph_vel_err, double fu, double Pe,
+            ref int LOP_Len);
+
+
+
+        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        public static extern void freeBuff(IntPtr buf);
+
         public static IEnumerable<(double lon, double lat)> ErrorEllipseDTFOTwoStart(ErrorEllipseDTFOTSOption opt)
         {
 
             List<DtoLinePoint> list = new List<DtoLinePoint>();
 
             int LOP_Len = 0;
-            IntPtr LOP_ValuePtr = GdopHelper.Error_Ellipse_DTFO(
+            IntPtr LOP_ValuePtr = Error_Ellipse_DTFO(
                 opt.MsEph,
                  opt.NsEph,
                 opt.RefGeod,
@@ -169,25 +237,8 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
                 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;
+               opt.fu1, opt.fu2, opt.Pe, ref LOP_Len);
+            return ParseResult(LOP_ValuePtr, LOP_Len);
         }
 
 
@@ -197,7 +248,7 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
             List<DtoLinePoint> list = new List<DtoLinePoint>();
 
             int LOP_Len = 0;
-            IntPtr LOP_ValuePtr = GdopHelper.Error_Ellipse_2X1D(
+            IntPtr LOP_ValuePtr = Error_Ellipse_2X1D(
                 opt.MsEph,
                  opt.NsEph,
                  opt.CDBAnt,
@@ -206,34 +257,14 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
                 opt.DtoErr,
                 opt.EphErr,
                 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;
+            return ParseResult(LOP_ValuePtr, LOP_Len);
         }
 
 
         public static IEnumerable<(double lon, double lat)> ErrorEllipseSingleX(ErrorEllipseDTO1XOption opt)
         {
-
-            List<DtoLinePoint> list = new List<DtoLinePoint>();
-
             int LOP_Len = 0;
-            IntPtr LOP_ValuePtr = GdopHelper.Error_Ellipse_2DFO(
+            IntPtr LOP_ValuePtr = Error_Ellipse_2DFO(
                 opt.MsEph,
                  opt.NsEph1,
                  opt.NsEph2,
@@ -242,6 +273,12 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
                opt.EphPosErr,
                opt.EphVelErr,
                opt.fu, opt.Pe, ref LOP_Len);
+            return ParseResult(LOP_ValuePtr, LOP_Len);
+        }
+
+        private static IEnumerable<(double lon, double lat)> ParseResult(IntPtr LOP_ValuePtr, int LOP_Len)
+        {
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
             double[] LOP_Value = new double[LOP_Len];
             if (LOP_Len > 0)
             {

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

@@ -2,25 +2,20 @@
 #define _DLL_LHDWFUNCTION_H
 #include "math.h"
 
-
-extern "C"  double GDOP_Value_2X1D(double *station1,double *station2, double *station3,double *Ref_Station_LLH,double *Select_Point,
-	                               double dto_err,double eph_err);
-								   
-								   //pe   0.5
+//謗陎珨華
+extern "C"  double * GDOP_Matrix_2X1D(double *main_eph,double *neigh_eph, double *CDB_Station_LLH,double *Ref_Station_LLH,double *Zone,double step_len,
+	                               double dto_err,double eph_err, int * Matrix_Size);
 extern "C"  double * Error_Ellipse_2X1D(double *station1,double *station2, double *station3,double *Ref_Station_LLH,double *Select_Point,
 	                                    double dto_err,double eph_err,double Pe, int *len);
-
-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 * GDOP_Matrix_DTFO(double *main_eph,double *neigh_eph,double *Ref_Station_LLH,double *Zone,double step_len,double dto_err,double dfo_err,
+	double eph_pos_err,double eph_vel_err,double fu1,double fu2, int * Matrix_Size);
 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);
-
-//�� �園𡢿 1  2  3
-extern "C"  double GDOP_Value_2DFO(double *main_eph,double *neigh_eph1,double *neigh_eph2,double *Select_Point,double dfo_err,double eph_pos_err
-,double eph_vel_err,double fu);
-
+	                   double eph_pos_err,double eph_vel_err,double fu1,double fu2,double Pe, int *len);
 
+//等陎
+extern "C"  double * GDOP_Matrix_2DFO(double *main_eph,double *neigh_eph1,double *neigh_eph2,double *Zone,double step_len, double dfo_err,
+	                     double eph_pos_err,double eph_vel_err,double fu, int * Matrix_Size);
 extern "C"  double * Error_Ellipse_2DFO(double *main_eph,double *neigh_eph1,double *neigh_eph2,double *Select_Point,double dfo_err,double eph_pos_err,double eph_vel_err,double fu,double Pe, int *len);
 
 extern "C" void freeBuff(void *buf);

BIN
XzXdDw.App/Api/低轨GDOP误差椭圆/GDOP/DLL_GDOP_Analysis.dll


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

@@ -23,62 +23,6 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
     public static class GdopHelper
     {
         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);
-
-
-
-        /// <summary>
-        /// 两星一地误差椭圆
-        /// </summary>
-        /// <param name="main_eph">主星位置 长度6</param>
-        /// <param name="neigh_eph">邻星位置 长度6</param>
-        /// <param name="cdbAnt">超短波 长度3</param>
-        /// <param name="refStation">参考站 长度3</param>
-        /// <param name="Select_Point">定位点 长度3</param>
-        /// <param name="dto_err">时差误差(s)</param>
-        /// <param name="eph_err"></param>
-        /// <param name="Pe">0.5</param>
-        /// <param name="LOP_Len"></param>
-        /// <returns></returns>
-        [DllImport(GDOPDll, EntryPoint = "Error_Ellipse_2X1D", CallingConvention = CallingConvention.Cdecl)]
-        public extern static IntPtr Error_Ellipse_2X1D(double[] main_eph, double[] neigh_eph, double[] cdbAnt, double[] refStation, double[] Select_Point, double dto_err,
-       double eph_err, double Pe, ref int LOP_Len);
-
-
-        /// <summary>
-        /// 单星误差椭圆
-        /// </summary>
-        /// <param name="main_eph"></param>
-        /// <param name="neigh_eph1"></param>
-        /// <param name="neigh_eph2"></param>
-        /// <param name="Select_Point"></param>
-        /// <param name="dfo_err"></param>
-        /// <param name="eph_pos_err"></param>
-        /// <param name="eph_vel_err"></param>
-        /// <param name="fu"></param>
-        /// <param name="Pe"></param>
-        /// <param name="LOP_Len"></param>
-        /// <returns></returns>
-        [DllImport(GDOPDll, EntryPoint = "Error_Ellipse_2DFO", CallingConvention = CallingConvention.Cdecl)]
-        public extern static IntPtr Error_Ellipse_2DFO(double[] main_eph, double[] neigh_eph1, double[] neigh_eph2,  double[] Select_Point, double dfo_err, double eph_pos_err, double eph_vel_err, double fu, double Pe,
-            ref int LOP_Len);
 
 
         [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]

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

@@ -203,6 +203,12 @@ namespace XdCxRhDW.App.Api.时差线
                 opt.RefDfo,
                opt.fu1,
                opt.fu2, out LOP_ValuePtr, ref LOP_Len);
+            return ParseResult(LOP_ValuePtr, LOP_Len);
+        }
+
+        private static IEnumerable<(double lon, double lat)> ParseResult(IntPtr LOP_ValuePtr, int LOP_Len)
+        {
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
             double[] LOP_Value = new double[LOP_Len * 3];
             if (LOP_Len > 0)
             {
@@ -235,7 +241,5 @@ namespace XdCxRhDW.App.Api.时差线
         }
 
 
-      
-
     }
 }

+ 11 - 52
XzXdDw.App/UserControl/CtrlPosSingle.cs

@@ -1,4 +1,5 @@
-using DevExpress.Utils.Drawing.Helpers;
+using DevExpress.Internal;
+using DevExpress.Utils.Drawing.Helpers;
 using DevExpress.Utils.Extensions;
 using DevExpress.XtraEditors;
 using DevExpress.XtraExport.Helpers;
@@ -150,67 +151,25 @@ namespace XzXdDw.App.UserControl
                 foreach (var item in lines)
                 {
                     if (stoped) break;
-                    //var items = item.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
-                    //var sxDto = Convert.ToDouble(items[0]);
-                    //var xdDto = Convert.ToDouble(items[1]);
-                    //var mainYbDto = Convert.ToDouble(items[2]);
-                    //var adjaYbDto = Convert.ToDouble(items[3]);
-                    //var mainX = Convert.ToDouble(items[7]);
-                    //var mainY = Convert.ToDouble(items[8]);
-                    //var mainZ = Convert.ToDouble(items[9]);
-                    //var adjaX = Convert.ToDouble(items[10]);
-                    //var adjaY = Convert.ToDouble(items[11]);
-                    //var adjaZ = Convert.ToDouble(items[12]);
-                    //var cgRes = new CgRes()
-                    //{
-                    //    SigTime = DateTime.Now,
-                    //    DtoSx = sxDto * 1e6,
-                    //    DfoSx = 200 + r.Next(1, 5) + Math.Round(r.NextDouble(), 3),
-                    //    SnrSx = r.Next(18, 24) + Math.Round(r.NextDouble(), 1),
-                    //    DtoCdb = xdDto * 1e6,
-                    //    DfoCdb = 600 + r.Next(1, 5) + Math.Round(r.NextDouble(), 3),
-                    //    SnrCdb = r.Next(22, 32) + Math.Round(r.NextDouble(), 1),
-                    //    YbMain = mainYbDto * 1e6,
-                    //    YbAdja = adjaYbDto * 1e6,
-                    //    MainX = mainX,
-                    //    MainY = mainY,
-                    //    MainZ = mainZ,
-                    //    AdjaX = adjaX,
-                    //    AdjaY = adjaY,
-                    //    AdjaZ = adjaZ,
-                    //};
-                    //db.CgRes.Add(cgRes);//参估结果入库
 
-                    //var res = PosApi.X2D1_POS(cgRes, listTx);
-                    //PosRes posRes = new PosRes()
-                    //{
-                    //    SigTime = cgRes.SigTime,
-                    //    CgResID = cgRes.ID,
-                    //    TarName = "未知目标",
-                    //    TsName = "tar2",
-                    //    PosLon = res[0],
-                    //    PosLat = res[1],
-                    //    MirrLon = res[3],
-                    //    MirrLat = res[4],
-                    //};
-                    //db.PosRes.Add(posRes);//定位结果入库
+                    double[] main_eph =new double[6] { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.1580461 };
 
-                    double[] main_sat = { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.158046 };
-                    double[] neigh_sat1 = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
-                    double[] neigh_sat2 = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
-                    double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
-                    double[] Zone = { -80, 80, -150, 150 };
+                    double[] main_eph1 = new double[6] { -3479298.029, 5612482.078, 2187911.486, -5784.105325, -2163.505176, -3632.855383 };
+                    double[] main_eph2 = new double[6] { -5018677.726, 4714449.429, 1001437.615, -4399.327638, -3780.398104, -4206.338078 };
 
-                    double target_dfo1 = 1.595360344349182e+03;
+                    //double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
+                    double[] Ref_Station_LLH = { 115.5, 9.899, 64 }; //*****参考站的位置
+                    double[] Zone =new double[4] { -85, 85, -180, 180 };
 
-                    double target_dfo2 = 1.132007974492508e+04;
+                    double target_dfo1 = 2.002242571242008e+02;
+                    double target_dfo2 = 4.311089914542198e+03;
 
                     double fu1 = 3.1085e8;
 
 
                     double[] target_llh = new double[6];
 
-                    PosApi.SingleStar_DFO_DW(main_sat, neigh_sat1, neigh_sat2,Zone, target_dfo1, target_dfo2, fu1, target_llh);
+                    PosApi.SingleStar_DFO_DW(main_eph, main_eph1, main_eph2, Zone, target_dfo1, target_dfo2, fu1, target_llh);
 
                     PosRes posRes = new PosRes()
                     {

+ 3 - 1
XzXdDw.App/UserControl/CtrlPosXz.cs

@@ -378,6 +378,7 @@ namespace XzXdDw.App.UserControl
                 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;
+                double fu2 = 2.95e8;
 
                 ErrorEllipseDTFOTSOption twoStartOption = new ErrorEllipseDTFOTSOption();
                 twoStartOption.MsEph = main_sat;
@@ -388,7 +389,8 @@ namespace XzXdDw.App.UserControl
                 twoStartOption.DfoErr =1;
                 twoStartOption.EphPosErr = 1;
                 twoStartOption.EphVelErr = 1;
-                twoStartOption.fu = fu1;
+                twoStartOption.fu1 = fu1;
+                twoStartOption.fu2 = fu2;
 
                 var points = ErrEllipseHelper.ErrorEllipseDTFOTwoStart(twoStartOption);
                 mapControl1.DrawDtoPonit($"双星误差椭圆线", points);