Przeglądaj źródła

添加GDOP接口

wyq 1 rok temu
rodzic
commit
d5aa7a2f8a

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

@@ -98,7 +98,7 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
         public double[] SelectPoint { get; set; }
 
         /// <summary>
-        /// 时差误差(Hz)
+        /// 时差误差(s)
         /// </summary>
         public double DtoErr { get; set; }
 
@@ -159,7 +159,7 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
     }
     public static class ErrEllipseHelper
     {
-        private const string GDOPDll = @"Api\低轨GDOP误差椭圆\GDOP\DLL_GDOP_Analysis.dll";
+        private const string GDOPDll = @"Api\低轨GDOP误差椭圆\GDOP\DLL_GD64.dll";
         /// <summary>
         /// 低轨双星误差椭圆
         /// </summary>
@@ -244,9 +244,6 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
 
         public static IEnumerable<(double lon, double lat)> ErrorEllipse2X1D(ErrorEllipseDTO2X1DOption opt)
         {
-
-            List<DtoLinePoint> list = new List<DtoLinePoint>();
-
             int LOP_Len = 0;
             IntPtr LOP_ValuePtr = Error_Ellipse_2X1D(
                 opt.MsEph,

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


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


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

@@ -1,33 +0,0 @@
-using DevExpress.Charts.Native;
-using DevExpress.Internal.WinApi.Windows.UI.Notifications;
-using DevExpress.XtraPrinting;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using XdCxRhDW.App.DTO;
-using static DevExpress.XtraCharts.GLGraphics.Platform.EGL;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
-
-namespace XzXdDw.App.Api.低轨GDOP误差椭圆
-{
-    /// <summary>
-    /// Gdop误差分布计算帮助类.该类调用了GdopCore.exe进程
-    /// 每种GDOP算法提供了两个接口,这两种接口是完全等价的,一种传入双行根,一种直接传入卫星状态x、y、z等
-    /// </summary>
-    public static class GdopHelper
-    {
-        private const string GDOPDll = @"Api\低轨GDOP误差椭圆\GDOP\DLL_GDOP_Analysis.dll";
-
-
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
-        public static extern void freeBuff(IntPtr buf);
-       
-    }
-    
-}

BIN
XzXdDw.App/Api/星地GDOP误差椭圆/GDOP/GdopCore.exe


+ 80 - 0
XzXdDw.App/Api/星地GDOP误差椭圆/GdopHelper.cs

@@ -367,6 +367,86 @@ namespace XzXdDw.App.Api.星地GDOP误差椭圆
             return ParseResult(2, sb.ToString());
         }
 
+
+        /// <summary>
+        /// 低轨两星GDOP
+        /// </summary>
+        /// <param name="refLonLat">参考站位置 长度2</param>
+        /// <param name="mainTle">主星星历双行根</param>
+        /// <param name="adjaTle">邻星星历双行根</param>
+        /// <param name="time">采集时刻</param>
+        /// <param name="dtousErr">时差误差(us)</param>
+        /// <param name="dfoHzErr">频差误差(Hz)</param>
+        /// <param name="ephLocErr">星历位置误差(m)</param>
+        /// <param name="ephVLocErr">星历速度误差</param>
+        /// <param name="fu1">主星上行频点</param>
+        /// <param name="fu2">邻星上行频点</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public static (List<SatInfo>, List<ErrDistanceMapLines>) GdopLeoTowSatDRef( double[] refLonLat, string mainTle, string adjaTle, DateTime time, double dtousErr,double dfoHzErr, double ephLocErr,double ephVLocErr,double fuHz1,double fuHz2)
+        {
+            if (string.IsNullOrWhiteSpace(exePath))
+                throw new Exception($"请先调用SetExePath指定{exeName}进程所在路径,支持相对路径");
+            if (!Directory.Exists(exePath))
+                throw new Exception($"路径[{exePath}]不存在");
+            var exeFile = Path.Combine(exePath, exeName);
+            if (!File.Exists(exeFile))
+                throw new Exception($"文件[{exeFile}]不存在");
+            Process p = new Process();
+            p.StartInfo.WorkingDirectory = exePath;
+            p.StartInfo.FileName = exeFile;
+            p.StartInfo.Arguments = $"73 \"{mainTle}\" \"{adjaTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", refLonLat)} {dtousErr} {dfoHzErr} {ephLocErr} {ephVLocErr} {fuHz1} {fuHz2}";
+            p.StartInfo.CreateNoWindow = true;
+            p.StartInfo.RedirectStandardError = true;
+            p.StartInfo.RedirectStandardOutput = true;
+            p.StartInfo.UseShellExecute = false;
+            StringBuilder sb = new StringBuilder();
+            p.OutputDataReceived += (sender, e) => sb.Append(e.Data);
+            p.Start();
+            p.BeginOutputReadLine();
+            p.WaitForExit();//WaitForExit加了超时时间的话进程退出后不能保证异步流已经读取完成,这是.NET框架的BUG
+            return ParseResult(2, sb.ToString());
+        }
+
+        /// <summary>
+        /// 单星GDOP
+        /// </summary>
+        /// <param name="mainTle">第一刻时刻星历双行根</param>
+        /// <param name="adjaTle1">第二刻时刻星历双行根</param>
+        /// <param name="adjaTle2">第三刻时刻星历双行根></param>
+        /// <param name="time">采集时刻</param>
+        /// <param name="dfoHzErr">频差误差(Hz)</param>
+        /// <param name="ephLocErr">星历位置误差(m</param>
+        /// <param name="ephVLocErr">星历速度误差</param>
+        /// <param name="fuHz">卫星上行频点(Hz)</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public static (List<SatInfo>, List<ErrDistanceMapLines>) GdopSingleSatDRef(string mainTle, DateTime time1, DateTime time2, DateTime time3, double dfoHzErr, double ephLocErr, double ephVLocErr, double fuHz)
+        {
+            if (string.IsNullOrWhiteSpace(exePath))
+                throw new Exception($"请先调用SetExePath指定{exeName}进程所在路径,支持相对路径");
+            if (!Directory.Exists(exePath))
+                throw new Exception($"路径[{exePath}]不存在");
+            var exeFile = Path.Combine(exePath, exeName);
+            if (!File.Exists(exeFile))
+                throw new Exception($"文件[{exeFile}]不存在");
+            Process p = new Process();
+            p.StartInfo.WorkingDirectory = exePath;
+            p.StartInfo.FileName = exeFile;
+            p.StartInfo.Arguments = $"74 \"{mainTle}\" \"{time1:yyyy-MM-dd HH:mm:ss.000000}\" \"{time2:yyyy-MM-dd HH:mm:ss.000000}\" \"{time3:yyyy-MM-dd HH:mm:ss.000000}\" {dfoHzErr} {ephLocErr} {ephVLocErr} {fuHz}";
+            p.StartInfo.CreateNoWindow = true;
+            p.StartInfo.RedirectStandardError = true;
+            p.StartInfo.RedirectStandardOutput = true;
+            p.StartInfo.UseShellExecute = false;
+            StringBuilder sb = new StringBuilder();
+            p.OutputDataReceived += (sender, e) => sb.Append(e.Data);
+            p.Start();
+            p.BeginOutputReadLine();
+            p.WaitForExit();//WaitForExit加了超时时间的话进程退出后不能保证异步流已经读取完成,这是.NET框架的BUG
+            return ParseResult(1, sb.ToString());
+        }
+
+
         /// <summary>
         /// 两星一地GDOP带参
         /// </summary>

+ 11 - 10
XzXdDw.App/UserControl/CtrlPosXd.cs

@@ -120,7 +120,7 @@ namespace XzXdDw.App.UserControl
                             if (hideReason == HideReason.Defalut) return;
                             var model = ctrl.Model;
                             var (listSat, data) = GdopHelper.Gdop2Sat1DRef(new double[] { model.StationLon, model.StationLat },
-                                new double[] { model.RefLon, model.RefLat }, model.TleMain, model.TleAdja, model.CapTime, model.DtousErr, model.SatLocErr);
+                              new double[] { model.RefLon, model.RefLat }, model.TleMain, model.TleAdja, model.CapTime, model.DtousErr, model.SatLocErr);
                             if (data == null)
                             {
                                 return;
@@ -430,26 +430,27 @@ namespace XzXdDw.App.UserControl
                     XtraMessageBox.Show($"未找到定位相关的计算[{item.CgResID}]信息");
                     return;
                 }
+
                 var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
                 var satNTx = listTx.Find(p => p.TxType == EnumTxType.AdjaSat);
                 var cdbTx = listTx.Find(p => p.TxType == EnumTxType.Cdb);
                 var refTx = listTx.Find(p => p.TxType == EnumTxType.Ref);
                 XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO2X1DOption Option = new XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO2X1DOption();
-                /*Option.MsEph = new double[] { cg.MainX, cg.MainY, cg.MainZ, 0, 0, 0 };
+                Option.MsEph = new double[] { cg.MainX, cg.MainY, cg.MainZ, 0, 0, 0 };
                 Option.NsEph = new double[] { cg.AdjaX, cg.AdjaY, cg.AdjaZ, 0, 0, 0 };
                 Option.CDBAnt = new double[] { cdbTx.Lon, cdbTx.Lat, 0 };
                 Option.RefGeod = new double[] { refTx.Lon, refTx.Lat, 0 };
                 Option.SelectPoint = new double[3] { item.PosLon, item.PosLat, 0 };
                 Option.DtoErr = 1.0e-6;
-                Option.EphErr = 1.0e3;*/
-
-                Option.MsEph = new double[] { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.1580461 };
-                Option.NsEph = new double[] { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
-                Option.CDBAnt = new double[] { cdbTx.Lon, cdbTx.Lat, 0 };
-                Option.RefGeod = new double[] { 115.5, 9.899, 64 };
-                Option.SelectPoint = new double[2] { -180, -85 }; ;
-                Option.DtoErr = 1.0e-6;
                 Option.EphErr = 1.0e3;
+
+                /*Option.MsEph = new double[] { -41250768, 5295530, 6825975, 0, 0, 0 };
+                Option.NsEph = new double[] { -38198363, 17843895, 8881, 0, 0, 0 };
+                Option.CDBAnt = new double[] { 115, 10, 0 };
+                Option.RefGeod = new double[] { 121, 32, 0 };
+                Option.SelectPoint = new double[3] { -180, -85, 0 };
+                Option.DtoErr = 1.0e-6; //*****目标时差,单位是秒
+                Option.EphErr = 1.0e3;*/
                 var points = XzXdDw.App.Api.低轨GDOP误差椭圆.ErrEllipseHelper.ErrorEllipse2X1D(Option);
                 mapControl1.DrawDtoPonit($"双星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat},{listSat.FirstOrDefault(m => m.ID == satNTx.ID)?.Sat}]误差椭圆线", points);
 

+ 1 - 2
XzXdDw.App/XzXdDw.App.csproj

@@ -144,7 +144,6 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Api\低轨GDOP误差椭圆\ErrEllipseHelper.cs" />
-    <Compile Include="Api\低轨GDOP误差椭圆\GdopHelper.cs" />
     <Compile Include="Api\时差粗值预测\DtApi.cs" />
     <Compile Include="Api\时差线\DrawDtoLineHelper.cs" />
     <Compile Include="Api\时差线\DtoLineModel.cs" />
@@ -482,7 +481,7 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <Content Include="Api\低轨GDOP误差椭圆\GDOP\DLLFunction.h" />
-    <Content Include="Api\低轨GDOP误差椭圆\GDOP\DLL_GDOP_Analysis.dll">
+    <Content Include="Api\低轨GDOP误差椭圆\GDOP\DLL_GD64.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     <Content Include="Api\时差线\DLL_LHDW32.dll">