zoulei 1 year ago
parent
commit
ccd1d5c168
38 changed files with 604 additions and 75 deletions
  1. 5 0
      Service/CpuCgServer/AddIns/XcorrUtils.cs
  2. 13 9
      Service/CpuCgServer/Controllers/CpuCgController.cs
  3. 6 0
      Service/X2D1TaskServer54/AddIns/时隙获取/SlotHelper.cs
  4. 7 6
      Service/X2D1TaskServer54/Service/HistoryTaskService.cs
  5. BIN
      XdCxRhDW.Api/AddIns/GDOP误差椭圆/DLL_GDOP_Analysis0415.dll
  6. 345 41
      XdCxRhDW.Api/AddIns/定位/PosApi.cs
  7. 3 0
      XdCxRhDW.Api/XdCxRhDW.Api.csproj
  8. 39 17
      XdCxRhDW.App/Controllers/PosController.cs
  9. 15 0
      XdCxRhDW.App/Program.cs
  10. 1 0
      XdCxRhDW.App/UserControl/CtrlHome.cs
  11. 8 0
      XdCxRhDW.Entity/PosData.cs
  12. 1 0
      XdCxRhDW.Framework/01.XdCxRhDW.Framework.csproj
  13. 36 0
      XdCxRhDW.Framework/RandomHelper.cs
  14. 1 1
      XdCxRhDW.Sender/Form1.cs
  15. 6 0
      XdCxRhDw.Dto/CafResultDto.cs
  16. 7 1
      XdCxRhDw.Dto/CpuCgMultiDto.cs
  17. 6 0
      XdCxRhDw.Dto/CpuCgResDto.cs
  18. 5 0
      XdCxRhDw.Dto/PosDto/RHNoParPosDto.cs
  19. 5 0
      XdCxRhDw.Dto/PosDto/RHNoXlNoParPosDto.cs
  20. 5 0
      XdCxRhDw.Dto/PosDto/RHNoXlPosDto.cs
  21. 5 0
      XdCxRhDw.Dto/PosDto/RHPosDto.cs
  22. 5 0
      XdCxRhDw.Dto/PosDto/X1D1NoParPosDto.cs
  23. 5 0
      XdCxRhDw.Dto/PosDto/X1D1NoXlNoParPosDto.cs
  24. 5 0
      XdCxRhDw.Dto/PosDto/X1D1NoXlPosDto.cs
  25. 5 0
      XdCxRhDw.Dto/PosDto/X1D1PosDto.cs
  26. 5 0
      XdCxRhDw.Dto/PosDto/X2D1NoParPosDto.cs
  27. 5 0
      XdCxRhDw.Dto/PosDto/X2D1NoXlNoParlPosDto.cs
  28. 5 0
      XdCxRhDw.Dto/PosDto/X2D1NoXlPosDto.cs
  29. 5 0
      XdCxRhDw.Dto/PosDto/X2D1PosDto.cs
  30. 5 0
      XdCxRhDw.Dto/PosDto/X2DtoDfoNoXlPosDto.cs
  31. 5 0
      XdCxRhDw.Dto/PosDto/X2DtoDfoPosDto.cs
  32. 5 0
      XdCxRhDw.Dto/PosDto/X3TwoDfoNoXlPosDto.cs
  33. 5 0
      XdCxRhDw.Dto/PosDto/X3TwoDfoPosDto.cs
  34. 5 0
      XdCxRhDw.Dto/PosDto/X3TwoDtoNoParPosDto.cs
  35. 5 0
      XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlNoParPosDto.cs
  36. 5 0
      XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlPosDto.cs
  37. 5 0
      XdCxRhDw.Dto/PosDto/X3TwoDtoPosDto.cs
  38. 5 0
      XdCxRhDw.Dto/PosResDto.cs

+ 5 - 0
Service/CpuCgServer/AddIns/XcorrUtils.cs

@@ -73,6 +73,11 @@ namespace CpuCgServer
 
         public long smpCount { get; set; }
 
+        /// <summary>
+        /// 54专用,避免样点转时间出现毫秒级误差
+        /// </summary>
+        public float TimeSeconds { get; set; }
+
 
     }
     public class XcorrUtils

+ 13 - 9
Service/CpuCgServer/Controllers/CpuCgController.cs

@@ -110,23 +110,27 @@ namespace CpuCgServer.Controllers
             xItem.dtRange = dto.dtRange;
             xItem.dfRange = dto.dfRange;
             xItem.snrThreshold = dto.snrThreshold;
-            xItem.TimeoutSeconds= dto.TimeoutSeconds;
-            xItem.xcorrSmps = dto.smpPositions.Select(m => new XcorrSmp(m.smpStart, m.smpCount)).ToList();
+            xItem.TimeoutSeconds = dto.TimeoutSeconds;
+            xItem.xcorrSmps = dto.smpPositions.Select(m => new XcorrSmp(m.smpStart, m.smpCount) { TimeSeconds = m.TimeSeconds }).ToList();
             List<CpuCgResDto> resDtos = new List<CpuCgResDto>();
 
             XcorrUtils xcorr = new XcorrUtils();
             try
             {
                 var result = await xcorr.MultiCalc(xItem);
+
                 foreach (var item in result)
                 {
-                    CpuCgResDto resDto = new CpuCgResDto();
-                    resDto.Smpstart = item.smpstart;
-                    resDto.Smplen = item.smplen;
-                    resDto.TimeMs = item.tm;
-                    resDto.Dt = item.dt.Value;
-                    resDto.Df = item.df.Value;
-                    resDto.Snr = item.snr.Value;
+                    CpuCgResDto resDto = new CpuCgResDto
+                    {
+                        Smpstart = item.smpstart,
+                        Smplen = item.smplen,
+                        TimeMs = item.tm,
+                        Dt = item.dt.Value,
+                        Df = item.df.Value,
+                        Snr = item.snr.Value,
+                        TimeSeconds = xItem.xcorrSmps[0].TimeSeconds,
+                    };
                     resDtos.Add(resDto);
                 }
                 return Success(resDtos);

+ 6 - 0
Service/X2D1TaskServer54/AddIns/时隙获取/SlotHelper.cs

@@ -46,6 +46,7 @@ namespace X3TaskServer54
                     Slot s = new Slot()
                     {
                         StartPoint = (int)(fsampleM * 1e6 / multi * startsF[i]),
+                        TimeSeconds = startsF[i],
                         Len = (int)(fsampleM * 1e6 / multi * lenF[i] * 1e-3)
                     };
                     res.Slots.Add(s);
@@ -105,5 +106,10 @@ namespace X3TaskServer54
         /// 结束样点
         /// </summary>
         public int Len { get; set; }
+
+        /// <summary>
+        /// 时间的秒数,避免误差
+        /// </summary>
+        public float TimeSeconds { get; set; }
     }
 }

+ 7 - 6
Service/X2D1TaskServer54/Service/HistoryTaskService.cs

@@ -35,7 +35,7 @@ namespace X3TaskServer54.Service
             CapDir = ConfigurationManager.AppSettings["CapDir"].Trim();
             DdcDir = ConfigurationManager.AppSettings["DdcDir"].Trim();
             PosResDir = ConfigurationManager.AppSettings["PosResDir"].Trim();
-            var PosDtoFactorstr= ConfigurationManager.AppSettings["PosResDir"].Trim();
+            var PosDtoFactorstr = ConfigurationManager.AppSettings["PosResDir"].Trim();
             int.TryParse(PosDtoFactorstr, out PosDtoFactor);
             if (PosDtoFactor == 0) PosDtoFactor = 1;
         }
@@ -162,7 +162,7 @@ namespace X3TaskServer54.Service
                                     file1 = mainFile,
                                     file2 = adja1File,
                                     samplingRate = ch0File.Fs,
-                                    smpPositions = sig.Slots.Slots.Select(p => new SmpPosition() { smpStart = p.StartPoint, smpCount = p.Len }).ToList(),
+                                    smpPositions = sig.Slots.Slots.Select(p => new SmpPosition() { TimeSeconds = p.TimeSeconds, smpStart = p.StartPoint, smpCount = p.Len }).ToList(),
                                     snrThreshold = 15,
                                 };
                                 var result1 = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", cgDto, token: cts.Token);
@@ -179,7 +179,7 @@ namespace X3TaskServer54.Service
                                     file1 = mainFile,
                                     file2 = adja2File,
                                     samplingRate = ch0File.Fs,
-                                    smpPositions = sig.Slots.Slots.Select(p => new SmpPosition() { smpStart = p.StartPoint, smpCount = p.Len }).ToList(),
+                                    smpPositions = sig.Slots.Slots.Select(p => new SmpPosition() { TimeSeconds = p.TimeSeconds, smpStart = p.StartPoint, smpCount = p.Len }).ToList(),
                                     snrThreshold = 15,
                                 };
                                 var result2 = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", cgDto, token: cts.Token);
@@ -207,7 +207,8 @@ namespace X3TaskServer54.Service
                                         X3TwoDtoNoParPosDto x2D1 = new X3TwoDtoNoParPosDto()
                                         {
                                             TaskID = dto.ID,
-                                            SigTime = capTime.AddSeconds(data1[i].Smpstart / ch0File.Fs),
+                                            //SigTime = capTime.AddSeconds(data1[i].Smpstart / (double)ch0File.Fs),//该方法有误差
+                                            SigTime = capTime.AddSeconds(data1[i].TimeSeconds),
                                             MainCode = MainSatCode,
                                             Adja1Code = Adja1SatCode,
                                             Adja2Code = Adja2SatCode,
@@ -220,10 +221,10 @@ namespace X3TaskServer54.Service
                                             Adja2X = Adja2SatXYZ[0],
                                             Adja2Y = Adja2SatXYZ[1],
                                             Adja2Z = Adja2SatXYZ[2],
-                                            Dto1 = PosDtoFactor*data1[i].Dt,
+                                            Dto1 = PosDtoFactor * data1[i].Dt,
                                             Dfo1 = data1[i].Df,
                                             Snr1 = data1[i].Snr,
-                                            Dto2 = PosDtoFactor*data2[i].Dt,
+                                            Dto2 = PosDtoFactor * data2[i].Dt,
                                             Dfo2 = data2[i].Df,
                                             Snr2 = data2[i].Df,
                                             SatTxLon = dto.CapLon,

BIN
XdCxRhDW.Api/AddIns/GDOP误差椭圆/DLL_GDOP_Analysis0415.dll


+ 345 - 41
XdCxRhDW.Api/AddIns/定位/PosApi.cs

@@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;
 using XdCxRhDW.Entity;
+using XdCxRhDW.Framework;
 
 namespace XdCxRhDW.Api
 {
@@ -13,6 +14,12 @@ namespace XdCxRhDW.Api
     /// </summary>
     public static class PosApi
     {
+        //置信度统计次数
+        private static int confidenceCount = 100;
+
+        //置信度有效距离(m)
+        private static int confidenceDistance = 10000;
+
         #region cpp dll Interop 
 
         //一星一地测向带参定位
@@ -48,18 +55,19 @@ namespace XdCxRhDW.Api
         private extern static void X2_Pos20240305_Core(double[] mainSat, double[] adjaSat, double[] mainSatTarStation, double[] adjaSatTarStation, double[] refStation, double[] zone
             , double tarDto, double tarDfo, double refDto, double refDfo, double fu1, double fd1, double fu2, double fd2, double[] res);
 
-      
+
 
         #endregion
 
         /// <summary>
-        /// 一星一地带参,返返回经度纬度高度及镜像点,数组长度为6
+        /// 一星一地带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
         /// <param name="cxRes">测向结果</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X1D1_Pos(CgRes cgRes, StationRes sRes, CxRes cxRes)
+        public static double[] X1D1_Pos(CgRes cgRes, StationRes sRes, CxRes cxRes, bool CalcConfidence = false)
         {
             double[] mainSat = new double[3] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value };
             double[] satStation = new double[3] { sRes.SatTxLon, sRes.SatTxLat, 0 };
@@ -72,16 +80,45 @@ namespace XdCxRhDW.Api
             double[] res = new double[6];
             var ybDto1 = cgRes.YbMainDto.Value / 1e6;
             X1D1_Pos20240305_Core(mainSat, satStation, cdbStation, cxStation, refStation, zone, theta, dtoCdb, ybDto1, res);
-            return ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+                    };
+                    var dtoCdbNew = (dtoCdb * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var ybDtoNew = (ybDto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var thetaNew = theta + RandomHelper.Normal(0, 0.4);//单位°
+                    X1D1_Pos20240305_Core(mainSatNew, satStation, cdbStation, cxStation, refStation, zone, thetaNew, dtoCdbNew, ybDtoNew, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
         /// <summary>
-        /// 两星一地带参,返回经度纬度高度及镜像点,数组长度为6
+        /// 两星一地带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X2D1_Pos(CgRes cgRes, StationRes sRes)
+        public static double[] X2D1_Pos(CgRes cgRes, StationRes sRes, bool CalcConfidence = false)
         {
 
             double[] mainSat = new double[3] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value };
@@ -96,16 +133,54 @@ namespace XdCxRhDW.Api
             double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
             double[] res = new double[6];
             X2D1_Pos20240305_Core(mainSat, adjaSat, cdbStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, dto1, dtoCdb, ybDto1, ybDto2, res);
-            return ConvertToGeoPoint(res);
+            ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+
+                    };
+                    var adjaSatNew = new double[3]
+                    {
+                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var dto1New = (dto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var dtoCdbNew = (dtoCdb * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var ybDto1New = (ybDto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var ybDto2New = (ybDto2 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    X2D1_Pos20240305_Core(mainSatNew, adjaSatNew, cdbStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, dto1New, dtoCdbNew, ybDto1New, ybDto2New, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
         /// <summary>
-        /// 两星一地无参,返回经度纬度高度及镜像点,数组长度为6
+        /// 两星一地无参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X2D1_PosNoRef(CgRes cgRes, StationRes sRes)
+        public static double[] X2D1_PosNoRef(CgRes cgRes, StationRes sRes, bool CalcConfidence = false)
         {
             double[] mainSat = new double[3] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value };
             double[] adjaSat = new double[3] { cgRes.Adja1X.Value, cgRes.Adja1Y.Value, cgRes.Adja1Z.Value };
@@ -116,50 +191,88 @@ namespace XdCxRhDW.Api
             double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
             double[] res = new double[6];
             X2D1_PosNoRef20240305_Core(mainSat, adjaSat, cdbStation, satStation, satStation, satStation, zone, dto1, dtoCdb, res);
-            return ConvertToGeoPoint(res);
+            ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+
+                    };
+                    var adjaSatNew = new double[3]
+                    {
+                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var dto1New = (dto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var dtoCdbNew = (dtoCdb * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    X2D1_PosNoRef20240305_Core(mainSatNew, adjaSatNew, cdbStation, satStation, satStation, satStation, zone, dto1New, dtoCdbNew, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
         /// <summary>
-        /// 融合定位带参,返回经度纬度高度及镜像点,数组长度为6
+        /// 融合定位带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
         /// <param name="cxRes">测向结果</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] RH_Pos(CgRes cgRes, StationRes sRes, CxRes cxRes)
+        public static double[] RH_Pos(CgRes cgRes, StationRes sRes, CxRes cxRes, bool CalcConfidence = false)
         {
-            var res1 = X1D1_Pos(cgRes, sRes, cxRes);
-            var res2 = X2D1_Pos(cgRes, sRes);
-            double[] res = new double[] { 999, 999, 0, 999, 999, 0 };
+            var res1 = X1D1_Pos(cgRes, sRes, cxRes, CalcConfidence);
+            var res2 = X2D1_Pos(cgRes, sRes, CalcConfidence);
+            double[] res = new double[] { 999, 999, 0, 999, 999, 0, 100 };
             var p1 = res1.Take(3).ToArray();
             var p2 = res1.Skip(3).ToArray();
             var p3 = res2.Take(3).ToArray();
             var p4 = res2.Skip(3).ToArray();
             if (IsGeoPoint(p1) && IsGeoPoint(p2) && IsGeoPoint(p3) && IsGeoPoint(p4))
             {
-                res = new double[6] {
+                res = new double[7] {
                     (p1[0] + p3[0]) / 2 + 0.003,
                     (p1[1] + p3[1]) / 2 - 0.002,
                     0,
                     (p2[0] + p4[0]) / 2 + 0.003,
                     (p2[1] + p4[1]) / 2 - 0.002,
                     0,
+                    (res1[6]+res2[6])/2
                 };
             }
             else if (IsGeoPoint(p1) && IsGeoPoint(p3))
             {
-                res = new double[6] {
+                res = new double[7] {
                     (p1[0] + p3[0]) / 2 + 0.003,
                     (p1[1] + p3[1]) / 2 - 0.002,
                     0,
                     999,
                     999,
                     0,
+                   (res1[6]+res2[6])/2
                 };
             }
             else if (IsGeoPoint(p1) && IsGeoPoint(p2))
             {
-                res = new double[6]
+                res = new double[7]
                 {
                     p1[0] + 0.003,
                     p1[1] - 0.002,
@@ -167,12 +280,12 @@ namespace XdCxRhDW.Api
                     p2[0] + 0.003,
                     p2[1] - 0.002,
                     0,
-
+                    (res1[6]+res2[6])/2
                 };
             }
             else if (IsGeoPoint(p3) && IsGeoPoint(p4))
             {
-                res = new double[6]
+                res = new double[7]
                {
                     p3[0] + 0.003,
                     p3[1] - 0.002,
@@ -180,19 +293,20 @@ namespace XdCxRhDW.Api
                     p4[0] + 0.003,
                     p4[1] - 0.002,
                     0,
-
+                    (res1[6]+res2[6])/2
                };
             }
             return res;
         }
 
         /// <summary>
-        /// 三星双时差带参,返回经度纬度高度及镜像点,数组长度为6
+        /// 三星双时差带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X3_Pos(CgRes cgRes, StationRes sRes)
+        public static double[] X3_Pos(CgRes cgRes, StationRes sRes, bool CalcConfidence = false)
         {
             double[] mainSat = new double[3] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value };
             double[] adjaSat1 = new double[3] { cgRes.Adja1X.Value, cgRes.Adja1Y.Value, cgRes.Adja1Z.Value };
@@ -207,16 +321,61 @@ namespace XdCxRhDW.Api
             double[] res = new double[6];
             X3_Pos20240305_Core(mainSat, adjaSat1, adjaSat2, satStation, satStation, satStation, satStation,
                 satStation, satStation, refStation, zone, tarDto1, tarDto2, refDto1, refDto2, res);
-            return ConvertToGeoPoint(res);
+            ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+
+                    };
+                    var adjaSat1New = new double[3]
+                    {
+                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var adjaSat2New = new double[3]
+                    {
+                        cgRes.Adja2X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja2Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja2Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var tarDto1New = (tarDto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var tarDto2New = (tarDto2 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var refDto1New = (refDto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var refDto2New = (refDto2 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+
+                    X3_Pos20240305_Core(mainSatNew, adjaSat1New, adjaSat2New, satStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, tarDto1New, tarDto2New, refDto1New, refDto2New, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
         /// <summary>
-        /// 三星双时差无参,返回经度纬度高度及镜像点,数组长度为6
+        /// 三星双时差无参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X3_PosNoRef(CgRes cgRes, StationRes sRes)
+        public static double[] X3_PosNoRef(CgRes cgRes, StationRes sRes, bool CalcConfidence = false)
         {
             double[] mainSat = new double[3] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value };
             double[] adjaSat1 = new double[3] { cgRes.Adja1X.Value, cgRes.Adja1Y.Value, cgRes.Adja1Z.Value };
@@ -227,16 +386,59 @@ namespace XdCxRhDW.Api
             var tarDto2 = cgRes.Dto2.Value / 1e6;
             double[] res = new double[6];
             X3_PosNoRef20240305_Core(mainSat, adjaSat1, adjaSat2, satStation, satStation, satStation, zone, tarDto1, tarDto2, res);
-            return ConvertToGeoPoint(res);
+            ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+
+                    };
+                    var adjaSat1New = new double[3]
+                    {
+                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var adjaSat2New = new double[3]
+                    {
+                        cgRes.Adja2X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja2Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja2Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var tarDto1New = (tarDto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var tarDto2New = (tarDto2 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+
+                    X3_PosNoRef20240305_Core(mainSatNew, adjaSat1New, adjaSat2New, satStation, satStation, satStation, zone, tarDto1New, tarDto2New, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
         /// <summary>
-        /// 三星双频差带参,返回经度纬度高度及镜像点,数组长度为6
+        /// 三星双频差带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X3_PosTwoDfo(CgRes cgRes, StationRes sRes)
+        public static double[] X3_PosTwoDfo(CgRes cgRes, StationRes sRes, bool CalcConfidence = false)
         {
             double[] mainSat = new double[6] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value, cgRes.MainVx.Value, cgRes.MainVy.Value, cgRes.MainVz.Value };
             double[] adjaSat1 = new double[6] { cgRes.Adja1X.Value, cgRes.Adja1Y.Value, cgRes.Adja1Z.Value, cgRes.Adja1Vx.Value, cgRes.Adja1Vy.Value, cgRes.Adja1Vz.Value };
@@ -255,16 +457,61 @@ namespace XdCxRhDW.Api
             double[] res = new double[6];
             X3_PosTwoDfo20240305_Core(mainSat, adjaSat1, adjaSat2, satStation, satStation, satStation,
                 refStation, zone, tarDfo1, tarDfo2, refDfo1, refDfo2, fu1, fd1, fu2, fd2, res);
-            return ConvertToGeoPoint(res);
+            ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+
+                    };
+                    var adjaSat1New = new double[3]
+                    {
+                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var adjaSat2New = new double[3]
+                    {
+                        cgRes.Adja2X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja2Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja2Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var tarDfo1New = (tarDfo1 * 1e6 + RandomHelper.Normal(0, 5)) / 1e6;
+                    var tarDfo2New = (tarDfo2 * 1e6 + RandomHelper.Normal(0, 5)) / 1e6;
+                    var refDfo1New = (refDfo1 * 1e6 + RandomHelper.Normal(0, 5)) / 1e6;
+                    var refDfo2New = (refDfo2 * 1e6 + RandomHelper.Normal(0, 5)) / 1e6;
+
+                    X3_PosTwoDfo20240305_Core(mainSatNew, adjaSat1New, adjaSat2New, satStation, satStation, satStation, refStation, zone, tarDfo1New, tarDfo2New, refDfo1New, refDfo2New, fu1, fd1, fu2, fd2, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
         /// <summary>
-        /// 双星时频差带参,返回经度纬度高度及镜像点,数组长度为6
+        /// 双星时频差带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
         /// <param name="cgRes">参估结果</param>
         /// <param name="sRes">站点信息</param>
+        /// <param name="CalcConfidence">是否计算置信度</param>
         /// <returns></returns>
-        public static double[] X2_PosDtoDfo(CgRes cgRes, StationRes sRes)
+        public static double[] X2_PosDtoDfo(CgRes cgRes, StationRes sRes, bool CalcConfidence = false)
         {
             double[] mainSat = new double[6] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value, cgRes.MainVx.Value, cgRes.MainVy.Value, cgRes.MainVz.Value };
             double[] adjaSat = new double[6] { cgRes.Adja1X.Value, cgRes.Adja1Y.Value, cgRes.Adja1Z.Value, cgRes.Adja1Vx.Value, cgRes.Adja1Vy.Value, cgRes.Adja1Vz.Value };
@@ -281,14 +528,53 @@ namespace XdCxRhDW.Api
             double fd2 = cgRes.RefFreqDown.Value;
             double[] res = new double[6];
             X2_Pos20240305_Core(mainSat, adjaSat, satStation, satStation, refStation, zone, tarDto, tarDfo, refDto, refDfo, fu1, fd1, fu2, fd2, res);
-            return ConvertToGeoPoint(res);
+            ConvertToGeoPoint(res);
+            var posRes = ConvertToGeoPoint(res);
+            if (CalcConfidence && IsGeoPoint2(posRes))
+            {
+                int succeedCount = 0;
+                for (int i = 0; i < confidenceCount; i++)
+                {
+                    var mainSatNew = new double[3]
+                    {
+                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
+                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
+
+                    };
+                    var adjaSatNew = new double[3]
+                    {
+                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
+                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
+                    };
+                    var tarDtoNew = (tarDto * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var refDtoNew = (refDto * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    var tarDfoNew = (tarDfo * 1e6 + RandomHelper.Normal(0, 5)) / 1e6;
+                    var refDfoNew = (refDfo * 1e6 + RandomHelper.Normal(0, 5)) / 1e6;
+
+                    X2_Pos20240305_Core(mainSatNew, adjaSatNew, satStation, satStation, refStation, zone, tarDtoNew, tarDfoNew, refDtoNew, refDfoNew, fu1, fd1, fu2, fd2, res);
+                    var posResNew = ConvertToGeoPoint(res);
+                    if (IsGeoPoint2(posResNew))
+                    {
+                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        if (distance <= confidenceDistance)
+                        {
+                            succeedCount++;
+                        }
+                    }
+                }
+                posRes[6] = (int)(succeedCount / (double)confidenceCount * 100);
+            }
+            return posRes;
         }
 
+
         private static double[] ConvertToGeoPoint(double[] res)
         {
             if (res == null || res.Length == 0)
             {
-                return new double[6] { 999, 999, 0, 999, 999, 0 };
+                return new double[7] { 999, 999, 0, 999, 999, 0, 100 };
             }
             else if (res.Length != 3 && res.Length != 6)
             {
@@ -298,17 +584,18 @@ namespace XdCxRhDW.Api
             var list = res.Select(p => Math.Round(p, 4)).ToArray();
             if (list.Length == 3)
             {
-                list = list.Concat(new double[3] { 999, 999, 0 }).ToArray();
+                list = list.Concat(new double[4] { 999, 999, 0, 100 }).ToArray();
             }
             list[2] = list[5] = 0;//高度
-            if (double.IsNaN(list[3]) || double.IsNaN(list[4]))
-            {
-                list[3] = list[4] = 999;
-            }
+
             if (double.IsNaN(list[0]) || double.IsNaN(list[1]))
             {
                 list[0] = list[1] = 999;
             }
+            if (double.IsNaN(list[3]) || double.IsNaN(list[4]))
+            {
+                list[3] = list[4] = 999;
+            }
             if (list[0] < -180 || list[0] > 180)
             {
                 list[0] = list[1] = 999;
@@ -325,7 +612,12 @@ namespace XdCxRhDW.Api
             {
                 list[3] = list[4] = 999;
             }
-            
+            if (list.Length == 6)
+            {
+                var listNew = list.ToList();
+                listNew.Add(100);
+                list = listNew.ToArray();
+            }
             return list;
         }
 
@@ -342,6 +634,18 @@ namespace XdCxRhDW.Api
             }
             return true;
         }
-
+        private static bool IsGeoPoint2(double[] res)
+        {
+            if (res.Length < 3) return false;
+            if (res[0] < -180 || res[0] > 180)
+            {
+                return false;
+            }
+            else if (res[1] < -90 || res[1] > 90)
+            {
+                return false;
+            }
+            return true;
+        }
     }
 }

+ 3 - 0
XdCxRhDW.Api/XdCxRhDW.Api.csproj

@@ -159,6 +159,9 @@
     <None Include="AddIns\GDOP误差椭圆\Tle2XYZ.h" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="AddIns\GDOP误差椭圆\DLL_GDOP_Analysis0415.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <Content Include="AddIns\频差线\Positioning.h" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

+ 39 - 17
XdCxRhDW.App/Controllers/PosController.cs

@@ -104,7 +104,7 @@ namespace XdCxRhDW.App.Controllers
                     SigTime = dto.SigTime,
                     Fx = dto.CxRes,
                 });
-                var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes);
+                var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -118,6 +118,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X1D1CX,
                 };
                 posRes = db.PosRes.Add(posRes);
@@ -224,7 +225,7 @@ namespace XdCxRhDW.App.Controllers
                     SigTime = dto.SigTime,
                     Fx = dto.CxRes,
                 });
-                var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes);
+                var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -238,6 +239,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X1D1CX,
                 };
                 posRes = db.PosRes.Add(posRes);
@@ -335,7 +337,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X2D1_Pos(cgRes, StationRes);
+                var res = PosApi.X2D1_Pos(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -348,10 +350,15 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X2D1,
                 };
                 if (dto.TheoryDfoCalc)
                     posRes.TargetState = TheoryDtoDfoApi.TheoryDfo(cgRes, StationRes, posRes, SysConfig.Config.YDPZThreshold);
+                if (dto.CalcConfidence)
+                {
+
+                }
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 Messenger.Defalut.Pub("新增定位点", MapModel(posRes));
@@ -475,7 +482,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X2D1_Pos(cgRes, StationRes);
+                var res = PosApi.X2D1_Pos(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -488,6 +495,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X2D1,
                 };
                 if (dto.TheoryDfoCalc)
@@ -580,7 +588,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqUp = dto.FreqUp,
                     TarFreqDown = dto.FreqDown,
                 });
-                var res = PosApi.X2D1_PosNoRef(cgRes, StationRes);
+                var res = PosApi.X2D1_PosNoRef(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -593,6 +601,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X2D1NoRef,
                 };
                 if (dto.TheoryDfoCalc)
@@ -716,7 +725,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X2D1_PosNoRef(cgRes, StationRes);
+                var res = PosApi.X2D1_PosNoRef(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -729,6 +738,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X2D1NoRef,
                 };
                 if (dto.TheoryDfoCalc)
@@ -830,7 +840,7 @@ namespace XdCxRhDW.App.Controllers
                     Fx = dto.CxRes,
                 });
 
-                var res = PosApi.RH_Pos(cgRes, StationRes, cxRes);
+                var res = PosApi.RH_Pos(cgRes, StationRes, cxRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -844,6 +854,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.RH,
                 };
                 if (dto.TheoryDfoCalc)
@@ -977,7 +988,7 @@ namespace XdCxRhDW.App.Controllers
                     SigTime = dto.SigTime,
                     Fx = dto.CxRes,
                 });
-                var res = PosApi.RH_Pos(cgRes, StationRes, cxRes);
+                var res = PosApi.RH_Pos(cgRes, StationRes, cxRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -991,6 +1002,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.RH,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1096,7 +1108,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X3_Pos(cgRes, StationRes);
+                var res = PosApi.X3_Pos(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -1109,6 +1121,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X3,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1257,7 +1270,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X3_Pos(cgRes, StationRes);
+                var res = PosApi.X3_Pos(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -1270,6 +1283,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X3,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1368,7 +1382,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X3_PosNoRef(cgRes, StationRes);
+                var res = PosApi.X3_PosNoRef(cgRes, StationRes, dto.CalcConfidence);
                 PosRes posRes = new PosRes()
                 {
                     FreqUpHz = (long)cgRes.TarFreqUp.Value,
@@ -1380,6 +1394,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X3NoRef,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1523,7 +1538,7 @@ namespace XdCxRhDW.App.Controllers
                     TarFreqDown = dto.FreqDown,
                 });
 
-                var res = PosApi.X3_PosNoRef(cgRes, StationRes);
+                var res = PosApi.X3_PosNoRef(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -1536,6 +1551,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X3NoRef,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1643,7 +1659,7 @@ namespace XdCxRhDW.App.Controllers
                     Adja2Vz = dto.Adja2Vz,
                 });
 
-                var res = PosApi.X3_PosTwoDfo(cgRes, StationRes);
+                var res = PosApi.X3_PosTwoDfo(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -1656,6 +1672,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X3TwoDfo,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1806,7 +1823,7 @@ namespace XdCxRhDW.App.Controllers
                     Adja2Vz = ephAdja2.data.VZ,
                 });
 
-                var res = PosApi.X3_PosTwoDfo(cgRes, StationRes);
+                var res = PosApi.X3_PosTwoDfo(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -1819,6 +1836,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X3TwoDfo,
                 };
                 if (dto.TheoryDfoCalc)
@@ -1917,7 +1935,7 @@ namespace XdCxRhDW.App.Controllers
                     Adja1Vz = dto.AdjaVz,
                 });
 
-                var res = PosApi.X2_PosDtoDfo(cgRes, StationRes);
+                var res = PosApi.X2_PosDtoDfo(cgRes, StationRes, dto.CalcConfidence);
 
                 PosRes posRes = new PosRes()
                 {
@@ -1930,6 +1948,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X2Dfo,
                 };
                 if (dto.TheoryDfoCalc)
@@ -2056,7 +2075,7 @@ namespace XdCxRhDW.App.Controllers
                     Adja1Vz = ephAdja.data.VZ,
                 });
 
-                var res = PosApi.X2_PosDtoDfo(cgRes, StationRes);
+                var res = PosApi.X2_PosDtoDfo(cgRes, StationRes, dto.CalcConfidence);
                 PosRes posRes = new PosRes()
                 {
                     FreqUpHz = (long)cgRes.TarFreqUp.Value,
@@ -2068,6 +2087,7 @@ namespace XdCxRhDW.App.Controllers
                     PosLat = res[1],
                     MirrLon = res[3],
                     MirrLat = res[4],
+                    Confidence = (int)res[6],
                     PosResType = EnumPosResType.X2Dfo,
                 };
                 if (dto.TheoryDfoCalc)
@@ -2360,7 +2380,8 @@ namespace XdCxRhDW.App.Controllers
                 MirrLat = res.MirrLat,
                 CheckType = res.CheckRes?.PosCheckType == null ? "" : res.CheckRes?.PosCheckType?.GetEnumDisplayName(),
                 TargetState = (EnumTargetStateDto)res.TargetState,
-                PosResType = (EnumPosResTypeDto)res.PosResType
+                PosResType = (EnumPosResTypeDto)res.PosResType,
+                Confidence = res.Confidence,
             };
         }
 
@@ -2389,6 +2410,7 @@ namespace XdCxRhDW.App.Controllers
                 TargetInfo = res.TargetInfo,
                 TargetInfoID = res.TargetInfoID,
                 UpdateTime = res.UpdateTime,
+                Confidence = res.Confidence,
             };
         }
 

+ 15 - 0
XdCxRhDW.App/Program.cs

@@ -15,6 +15,7 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 using XdCxRhDW.App;
 using XdCxRhDW.Dto;
+using XdCxRhDW.Framework;
 
 namespace XdCxRhDW
 {
@@ -92,6 +93,20 @@ namespace XdCxRhDW
         [STAThread]
         static void Main()
         {
+            //double max = 0;
+            //double min = 99999;
+            //for (int i = 0; i < 1000000; i++)
+            //{
+            //    var res = RandomHelper.Normal(0, 1);
+            //    if (max < res)
+            //    {
+            //        max = res;
+            //    }
+            //    if (min > res)
+            //    {
+            //        min = res;
+            //    }
+            //}
             string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
             Serilog.Log.Logger = new Serilog.LoggerConfiguration()
                 .WriteTo.Console(outputTemplate: outputTemplate)

+ 1 - 0
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -402,6 +402,7 @@ namespace XdCxRhDW.App.UserControl
                         find.UpdateTime = DateTime.Now;
                         find.MainSat = editItem.MainSat;
                         find.CapDir = editItem.CapDir;
+                        find.TaskType = editItem.TaskType;
                         find.CapDirFormat = editItem.CapDirFormat;
                         if (find.PosType == EnumPosType.X1D1CX)
                         {

+ 8 - 0
XdCxRhDW.Entity/PosData.cs

@@ -121,6 +121,14 @@ namespace XdCxRhDW.Entity
         [ToolTip("f4")]
         public double MirrLat { get; set; }
 
+        /// <summary>
+        /// 置信度
+        /// </summary>
+        [Display(Name = "置信度")]
+        [ExportCell()]
+        [ToolTip()]
+        public int Confidence { get; set; }
+
         /// <summary>
         /// 当前点是否被选中(默认false)
         /// </summary>

+ 1 - 0
XdCxRhDW.Framework/01.XdCxRhDW.Framework.csproj

@@ -77,6 +77,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="RandomHelper.cs" />
     <Compile Include="ColorHelper.cs" />
     <Compile Include="ColorRGB.cs" />
     <Compile Include="DebounceDispatcher.cs" />

+ 36 - 0
XdCxRhDW.Framework/RandomHelper.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.Framework
+{
+    public static class RandomHelper
+    {
+
+        //标准正态分布
+        public static double Normal()
+        {
+            Random aa = new Random(Guid.NewGuid().ToString().GetHashCode());
+            double s = 0, u = 0, v = 0;
+            while (s > 1 || s == 0)
+            {
+                u = aa.NextDouble() * 2 - 1;
+                v = aa.NextDouble() * 2 - 1;
+                s = u * u + v * v;
+            }
+            var z = Math.Sqrt(-2 * Math.Log(s) / s) * u;
+            return (z);
+        }
+
+        //符合要求的正态分布随机数
+        public static double Normal(double miu, double sigma)
+        {
+            var z = Normal() * sigma + miu;
+            return (z);
+        }
+
+
+    }
+}

+ 1 - 1
XdCxRhDW.Sender/Form1.cs

@@ -97,7 +97,7 @@ namespace XdCxRhDW.Sender
                                                 CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat"),
                                                 RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
                                                 RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
-                                                CheckRes= checkResDto
+                                                CheckRes= checkResDto,
                                             };
                                             var result = await HttpHelper.PostRequestAsync<PosResDto>(url, dto);
                                             if (result.code != 200)

+ 6 - 0
XdCxRhDw.Dto/CafResultDto.cs

@@ -12,6 +12,12 @@ namespace XdCxRhDW.Dto
     /// </summary>
     public class CafResultDto
     {
+        /// <summary>
+        /// 54所专用
+        /// </summary>
+        [Obsolete]
+        public float TimeSeconds { get; set; }
+
         /// <summary>
         /// 相关时差,单位:us
         /// </summary>

+ 7 - 1
XdCxRhDw.Dto/CpuCgMultiDto.cs

@@ -28,8 +28,8 @@ namespace XdCxRhDW.Dto
         /// <summary>
         /// 样点位置
         /// </summary>
-
         public List<SmpPosition> smpPositions { get; set; } = new List<SmpPosition>();
+
         /// <summary>
         /// 采样率(Hz)
         /// </summary>
@@ -100,6 +100,12 @@ namespace XdCxRhDW.Dto
             this.smpCount = smpCount;
         }
 
+        /// <summary>
+        /// 54专用,避免样点转时间出现毫秒级误差
+        /// </summary>
+        [Obsolete]
+        public float TimeSeconds { get; set; }
+
         /// <summary>
         /// 开始样点
         /// </summary>

+ 6 - 0
XdCxRhDw.Dto/CpuCgResDto.cs

@@ -16,6 +16,12 @@ namespace XdCxRhDW.Dto
         /// </summary>
         public long Smpstart { get; set; }
 
+        /// <summary>
+        /// 54专用,避免样点转时间出现毫秒级误差
+        /// </summary>
+        [Obsolete]
+        public float TimeSeconds { get; set; }
+
         /// <summary>
         /// 样点长度
         /// </summary>

+ 5 - 0
XdCxRhDw.Dto/PosDto/RHNoParPosDto.cs

@@ -126,6 +126,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/RHNoXlNoParPosDto.cs

@@ -101,6 +101,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/RHNoXlPosDto.cs

@@ -151,5 +151,10 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/RHPosDto.cs

@@ -181,6 +181,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X1D1NoParPosDto.cs

@@ -116,6 +116,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         public CheckResDto CheckRes { get; set; }
 
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
+
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X1D1NoXlNoParPosDto.cs

@@ -99,5 +99,10 @@ namespace XdCxRhDW.Dto
         /// 检测结果(可空)
         /// </summary>
         public CheckResDto CheckRes { get; set; }
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X1D1NoXlPosDto.cs

@@ -118,5 +118,10 @@ namespace XdCxRhDW.Dto
         /// 检测结果(可空)
         /// </summary>
         public CheckResDto CheckRes { get; set; }
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X1D1PosDto.cs

@@ -132,6 +132,11 @@ namespace XdCxRhDW.Dto
         /// 检测结果(可空)
         /// </summary>
         public CheckResDto CheckRes { get; set; }
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X2D1NoParPosDto.cs

@@ -172,6 +172,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X2D1NoXlNoParlPosDto.cs

@@ -113,6 +113,11 @@ namespace XdCxRhDW.Dto
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
 
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
+
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X2D1NoXlPosDto.cs

@@ -136,5 +136,10 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X2D1PosDto.cs

@@ -194,6 +194,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X2DtoDfoNoXlPosDto.cs

@@ -131,6 +131,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X2DtoDfoPosDto.cs

@@ -191,6 +191,11 @@ namespace XdCxRhDW.Dto
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
 
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
+
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X3TwoDfoNoXlPosDto.cs

@@ -148,6 +148,11 @@ namespace XdCxRhDW.Dto
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
 
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
+
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X3TwoDfoPosDto.cs

@@ -235,6 +235,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X3TwoDtoNoParPosDto.cs

@@ -197,6 +197,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlNoParPosDto.cs

@@ -107,6 +107,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlPosDto.cs

@@ -135,6 +135,11 @@ namespace XdCxRhDW.Dto
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
 
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
+
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosDto/X3TwoDtoPosDto.cs

@@ -224,6 +224,11 @@ namespace XdCxRhDW.Dto
         /// </summary>
         [Obsolete]
         public bool TheoryDfoCalc { get; set; } = true;
+
+        /// <summary>
+        /// 是否计算置信度
+        /// </summary>
+        public bool CalcConfidence { get; set; } = true;
     }
 
 }

+ 5 - 0
XdCxRhDw.Dto/PosResDto.cs

@@ -73,5 +73,10 @@ namespace XdCxRhDW.Dto
         /// </summary>
         public EnumTargetStateDto TargetState { get; set; }
 
+        /// <summary>
+        /// 置信度
+        /// </summary>
+        public int Confidence { get; set; }
+
     }
 }