Pārlūkot izejas kodu

修改按钮图标

wyq 1 gadu atpakaļ
vecāks
revīzija
6b6515fdc0

+ 0 - 21
XzXdDw.App/Api/PosApi.cs

@@ -121,27 +121,6 @@ namespace XzXdDw.App.Api
         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>

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

@@ -7,368 +7,100 @@ 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.Api.时差线;
 using XdCxRhDW.App.DTO;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
 
 namespace XzXdDw.App.Api.低轨GDOP误差椭圆
 {
-    /// <summary>
-    /// 误差椭圆计算帮助类.该类调用了GdopCore.exe进程
-    /// 每种误差椭圆算法提供了两个接口,这两种接口是完全等价的,一种传入双行根,一种直接传入卫星状态x、y、z等
-    /// </summary>
-    public static class ErrEllipseHelper
+    public class ErrorEllipseDTFOTSOption
     {
-        private static string exePath = "Api\\低轨GDOP误差椭圆\\GDOP";
-        private const string exeName = "GdopCore.exe";
-
-
-
-
-
         /// <summary>
-        /// 三星双时差误差椭圆带参
+        /// 主星星历
         /// </summary>
-        /// <param name="mainSatTle">主星双行根数</param>
-        /// <param name="adja1SatTle">邻1星双行根数</param>
-        /// <param name="adja2SatTle">邻2星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <param name="errProb">误差概率百分比(0-100,默认50)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse3Sat2DtoRef(string mainSatTle, string adja1SatTle, string adja2SatTle, DateTime time, double[] posLonLat, double[] refLonLat, out double R1, out double R2, double dtousErr = 1, double satLocErr = 10000, double errProb = 50)
-        {
-            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 = $"50 \"{mainSatTle}\" \"{adja1SatTle}\" \"{adja2SatTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", posLonLat)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr} {errProb}";
-            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(3, sb.ToString(), out R1, out R2);
-        }
+        public double[] MsEph { get; set; }
 
         /// <summary>
-        /// 三星双时差误差椭圆带参
+        /// 邻星星历
         /// </summary>
-        /// <param name="mainSatEph">主星xyz星历,数组长度=3</param>
-        /// <param name="adja1SatEph">邻1星xyz星历,数组长度=3</param>
-        /// <param name="adja2SatEph">邻2星xyz星历,数组长度=3</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <param name="errProb">误差概率百分比(0-100,默认50)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse3Sat2DtoRef(double[] mainSatEph, double[] adja1SatEph, double[] adja2SatEph, double[] posLonLat, double[] refLonLat, out double R1, out double R2, double dtousErr = 1, double satLocErr = 10000, double errProb = 50)
-        {
-            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 = $"51 {string.Join(" ", mainSatEph)} {string.Join(" ", adja1SatEph)} {string.Join(" ", adja2SatEph)} {string.Join(" ", posLonLat)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr} {errProb}";
-            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(3, sb.ToString(), out R1, out R2);
-        }
+        public double[] NsEph { get; set; }
 
         /// <summary>
-        /// 三星双时差误差椭圆无
+        /// 参考站位置
         /// </summary>
-        /// <param name="mainSatTle">主星双行根数</param>
-        /// <param name="adja1SatTle">邻1星双行根数</param>
-        /// <param name="adja2SatTle">邻2星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <param name="errProb">误差概率百分比(0-100,默认50)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse3Sat2Dto(string mainSatTle, string adja1SatTle, string adja2SatTle, DateTime time, double[] posLonLat, double[] recLonLat, out double R1, out double R2, double dtousErr = 1, double satLocErr = 10000, double errProb = 50)
-        {
-            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 = $"52 \"{mainSatTle}\" \"{adja1SatTle}\" \"{adja2SatTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", posLonLat)} {string.Join(" ", recLonLat)} {dtousErr} {satLocErr} {errProb}";
-            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(3, sb.ToString(), out R1, out R2);
-        }
+        public double[] RefGeod { get; set; }
 
         /// <summary>
-        /// 三星双时差误差椭圆无参
+        /// 定位点
         /// </summary>
-        /// <param name="mainSatEph">主星xyz星历,数组长度=3</param>
-        /// <param name="adja1SatEph">邻1星xyz星历,数组长度=3</param>
-        /// <param name="adja2SatEph">邻2星xyz星历,数组长度=3</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <param name="errProb">误差概率百分比(0-100,默认50)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse3Sat2Dto(double[] mainSatEph, double[] adja1SatEph, double[] adja2SatEph, double[] posLonLat, double[] recLonLat, out double R1, out double R2, double dtousErr = 1, double satLocErr = 10000, double errProb = 50)
-        {
-            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 = $"51 {string.Join(" ", mainSatEph)} {string.Join(" ", adja1SatEph)} {string.Join(" ", adja2SatEph)} {string.Join(" ", posLonLat)} {string.Join(" ", recLonLat)} {dtousErr} {satLocErr} {errProb}";
-            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(3, sb.ToString(), out R1, out R2);
-        }
-
+        public double[] SelectPoint { get; set; }
 
         /// <summary>
-        /// 双星时频差误差椭圆带参
+        /// 时差误差(Hz)
         /// </summary>
-        /// <param name="mainTle">主星双行根数</param>
-        /// <param name="adjaTle">邻星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="refFreqUpMHz">参考上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse2SatDtoDfoRef(string mainTle, string adjaTle, DateTime time, double tarFreqUpMHz, double refFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] posLonLat, double[] refLonLat, out double R1, out double R2)
-        {
-            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 = $"54 \"{mainTle}\" \"{adjaTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {tarFreqUpMHz} {refFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {string.Join(" ", posLonLat)} {string.Join(" ", refLonLat)} ";
-            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(), out R1, out R2);
-        }
-
+        public double DtoErr { get; set; }
         /// <summary>
-        /// 双星时频差误差椭圆带参
+        /// 频差误差(Hz)
         /// </summary>
-        /// <param name="mainSatEph">主星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="adjaSatEph">邻星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="refFreqUpMHz">参考上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse2SatDtoDfoRef(double[] mainSatEph, double[] adjaSatEph, double tarFreqUpMHz, double refFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] posLonLat, double[] refLonLat, out double R1, out double R2)
-        {
-            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 = $"55 {string.Join(" ", mainSatEph)} {string.Join(" ", adjaSatEph)} {tarFreqUpMHz} {refFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {string.Join(" ", posLonLat)} {string.Join(" ", refLonLat)}";
-            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(), out R1, out R2);
-        }
-
+        public double DfoErr { get; set; }
         /// <summary>
-        /// 双星时频差误差椭圆无参
+        /// 星历位置误差
         /// </summary>
-        /// <param name="mainTle">主星双行根数</param>
-        /// <param name="adjaTle">邻星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse2SatDtoDfo(string mainTle, string adjaTle, DateTime time, double tarFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] posLonLat, double[] recLonLat, out double R1, out double R2)
-        {
-            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 = $"56 \"{mainTle}\" \"{adjaTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {tarFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {string.Join(" ", posLonLat)} {string.Join(" ", recLonLat)}";
-            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(), out R1, out R2);
-        }
-
+        public double EphPosErr { get; set; }
         /// <summary>
-        /// 双星时频差误差椭圆无参
+        ///星历速度误差
         /// </summary>
-        /// <param name="mainSatEph">主星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="adjaSatEph">邻星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="posLonLat">定位点经纬度,数组长度=2</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="R1">输出参数:椭圆长轴(km)</param>
-        /// <param name="R2">输出参数:椭圆短轴(km)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) ErrEllipse2SatDtoDfo(double[] mainSatEph, double[] adjaSatEph, double tarFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] posLonLat, double[] recLonLat, out double R1, out double R2)
-        {
-            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 = $"57 {string.Join(" ", mainSatEph)} {string.Join(" ", adjaSatEph)} {tarFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {string.Join(" ", posLonLat)} {string.Join(" ", recLonLat)}";
-            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(), out R1, out R2);
-        }
+        public double EphVelErr { get; set; }
+        /// <summary>
+        /// 上行频点(Hz)
+        /// </summary>
+        public double fu { get; set; }
+        /// <summary>
+        /// 概率 默认0.5
+        /// </summary>
+        public double Pe { get; set; } = 0.5;
 
-        private static (List<SatInfo>, List<ErrDistanceMapLines>) ParseResult(int satCount, string txt, out double errR1, out double errR2)
+    }
+    public static class ErrEllipseHelper
+    {
+        public static IEnumerable<(double lon, double lat)> ErrorEllipseDTFOTwoStart(ErrorEllipseDTFOTSOption opt)
         {
-            if (string.IsNullOrWhiteSpace(txt))
-            {
-                throw new Exception("误差椭圆计算出现未知错误!");
-            }
-            if (txt.StartsWith("1 "))
-            {
-                throw new Exception(txt.Remove(0, 2));
-            }
-            var arr = txt.Split(' ');
-            List<SatInfo> list = new List<SatInfo>();
-            for (int i = 0; i < satCount; i++)
+
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
+
+            int LOP_Len = 0;
+            IntPtr LOP_ValuePtr = GdopHelper.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)
             {
-                SatInfo satInfo = new SatInfo();
-                var satCode = Convert.ToInt32(arr[3 * i + 1]);
-                if (satCode > 0)
-                    satInfo.SatCode = satCode;
-                satInfo.SatLon = Convert.ToDouble(arr[3 * i + 2]);
-                satInfo.SatLat = Convert.ToDouble(arr[3 * i + 3]);
-                list.Add(satInfo);
+                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]
+                    });
+                }
             }
-            errR1 = Convert.ToDouble(arr[1 + satCount * 3]);//椭圆长轴
-            errR2 = Convert.ToDouble(arr[2 + satCount * 3]);//椭圆短轴
-            var jsonStr = arr[3 + satCount * 3];
-            var res = JsonConvert.DeserializeObject<List<ErrDistanceMapLines>>(jsonStr);
-            return (list, res);
+            var Lines = list.Select(p => (p.Lon, p.Lat));
+            return Lines;
         }
+
     }
 }

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

@@ -7,6 +7,7 @@ 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;
@@ -21,518 +22,30 @@ namespace XzXdDw.App.Api.低轨GDOP误差椭圆
     /// </summary>
     public static class GdopHelper
     {
-        private static string exePath = "Api\\低轨GDOP误差椭圆\\GDOP";
-        private const string exeName = "GdopCore.exe";
-
-        /// <summary>
-        /// 三星双时差GDOP误差分布带参
-        /// </summary>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatTle">主星双行根数</param>
-        /// <param name="adja1SatTle">邻1星双行根数</param>
-        /// <param name="adja2SatTle">邻2星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop3Sat2DtoRef(double[] refLonLat, string mainSatTle, string adja1SatTle, string adja2SatTle, DateTime time, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"60 \"{mainSatTle}\" \"{adja1SatTle}\" \"{adja2SatTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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(3, sb.ToString());
-        }
-
-        /// <summary>
-        /// 三星双时差GDOP误差分布带参
-        /// </summary>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星xyz星历,数组长度=3</param>
-        /// <param name="adja1SatEph">邻1星xyz星历,数组长度=3</param>
-        /// <param name="adja2SatEph">邻2星xyz星历,数组长度=3</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        /// <exception cref="Exception"></exception>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop3Sat2DtoRef(double[] refLonLat, double[] mainSatEph, double[] adja1SatEph, double[] adja2SatEph, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"61 {string.Join(" ", mainSatEph)} {string.Join(" ", adja1SatEph)} {string.Join(" ", adja2SatEph)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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(3, sb.ToString());
-        }
-
-        /// <summary>
-        /// 三星双时差GDOP误差分布无参
-        /// </summary>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="mainSatTle">主星双行根数</param>
-        /// <param name="adja1SatTle">邻1星双行根数</param>
-        /// <param name="adja2SatTle">邻2星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop3Sat2Dto(double[] recLonLat, string mainSatTle, string adja1SatTle, string adja2SatTle, DateTime time, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"62 \"{mainSatTle}\" \"{adja1SatTle}\" \"{adja2SatTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", recLonLat)} {dtousErr} {satLocErr}";
-            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(3, sb.ToString());
-        }
-
-        /// <summary>
-        /// 三星双时差GDOP误差分布无参
-        /// </summary>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星xyz星历,数组长度=3</param>
-        /// <param name="adja1SatEph">邻1星xyz星历,数组长度=3</param>
-        /// <param name="adja2SatEph">邻2星xyz星历,数组长度=3</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        /// <exception cref="Exception"></exception>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop3Sat2Dto(double[] recLonLat, double[] mainSatEph, double[] adja1SatEph, double[] adja2SatEph, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"63 {string.Join(" ", mainSatEph)} {string.Join(" ", adja1SatEph)} {string.Join(" ", adja2SatEph)} {string.Join(" ", recLonLat)} {dtousErr} {satLocErr}";
-            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(3, sb.ToString());
-        }
-
-
-        /// <summary>
-        /// 双星时频差GDOP误差分布带参
-        /// </summary>
-        /// <param name="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="refFreqUpMHz">参考上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <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="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop2SatDtoDfoRef(double tarFreqUpMHz, double refFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] recLonLat, double[] refLonLat, string mainTle, string adjaTle, DateTime time, double dtousErr = 1, double dfoHzErr = 1, double satLocErr = 10000)
-        {
-            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 = $"64 \"{mainTle}\" \"{adjaTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", recLonLat)} {string.Join(" ", refLonLat)} {tarFreqUpMHz} {refFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {dtousErr} {dfoHzErr} {satLocErr}";
-            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="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="refFreqUpMHz">参考上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="adjaSatEph">邻星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="dfoHzErr">频差误差(单位Hz)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop2SatDtoDfoRef(double tarFreqUpMHz, double refFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] recLonLat, double[] refLonLat, double[] mainSatEph, double[] adjaSatEph, double dtousErr = 1, double dfoHzErr = 1, double satLocErr = 10000)
-        {
-            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 = $"65 {string.Join(" ", mainSatEph)} {string.Join(" ", adjaSatEph)} {string.Join(" ", recLonLat)} {string.Join(" ", refLonLat)} {tarFreqUpMHz} {refFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {dtousErr} {dfoHzErr} {satLocErr}";
-            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="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="refFreqUpMHz">参考上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <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="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop2SatDtoDfo(double tarFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] recLonLat, string mainTle, string adjaTle, DateTime time, double dtousErr = 1, double dfoHzErr = 1, double satLocErr = 10000)
-        {
-            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 = $"66 \"{mainTle}\" \"{adjaTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", recLonLat)} {tarFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {dtousErr} {dfoHzErr} {satLocErr}";
-            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="tarFreqUpMHz">目标上行频点MHz</param>
-        /// <param name="refFreqUpMHz">参考上行频点MHz</param>
-        /// <param name="mainSatTransMHz">主星转发器本振MHz</param>
-        /// <param name="adjaSatTransMHz">邻星转发器本振MHz</param>
-        /// <param name="recLonLat">接收站经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="adjaSatEph">邻星星历xyz vx vy vz,数组长度=6</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="dfoHzErr">频差误差(单位Hz)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop2SatDtoDfo(double tarFreqUpMHz, double mainSatTransMHz, double adjaSatTransMHz, double[] recLonLat, double[] mainSatEph, double[] adjaSatEph, double dtousErr = 1, double dfoHzErr = 1, double satLocErr = 10000)
-        {
-            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 = $"67 {string.Join(" ", mainSatEph)} {string.Join(" ", adjaSatEph)} {string.Join(" ", recLonLat)} {tarFreqUpMHz} {mainSatTransMHz} {adjaSatTransMHz} {dtousErr} {dfoHzErr} {satLocErr}";
-            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="cdbLonLat">超短波天线经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainTle">主星双行根数</param>
-        /// <param name="adjaTle">邻星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop2Sat1DRef(double[] cdbLonLat, double[] refLonLat, string mainTle, string adjaTle, DateTime time, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"68 \"{mainTle}\" \"{adjaTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", cdbLonLat)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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="cdbLonLat">超短波天线经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星星历xyz,数组长度=3</param>
-        /// <param name="adjaSatEph">邻星星历xyz,数组长度=3</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop2Sat1DRef(double[] cdbLonLat, double[] refLonLat, double[] mainSatEph, double[] adjaSatEph, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"69 {string.Join(" ", mainSatEph)} {string.Join(" ", adjaSatEph)} {string.Join(" ", cdbLonLat)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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="cdb1LonLat">超短波阵地1天线经纬度,数组长度=2</param>
-        /// <param name="cdb2LonLat">超短波阵地2天线经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainTle">主星双行根数</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop1Sat2DRef(double[] cdb1LonLat, double[] cdb2LonLat, double[] refLonLat, string mainTle, DateTime time, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"70 \"{mainTle}\" \"{time:yyyy-MM-dd HH:mm:ss.000000}\" {string.Join(" ", cdb1LonLat)} {string.Join(" ", cdb2LonLat)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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>
-        /// <param name="cdb1LonLat">超短波阵地1天线经纬度,数组长度=2</param>
-        /// <param name="cdb2LonLat">超短波阵地2天线经纬度,数组长度=2</param>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星星历xyz,数组长度=3</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop1Sat2DRef(double[] cdb1LonLat, double[] cdb2LonLat, double[] refLonLat, double[] mainSatEph, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"71 {string.Join(" ", mainSatEph)} {string.Join(" ", cdb1LonLat)} {string.Join(" ", cdb2LonLat)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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>
-        /// <param name="refLonLat">参考站经纬度,数组长度=2</param>
-        /// <param name="mainSatEph">主星星历xyz,数组长度=3</param>
-        /// <param name="adjaSatEph">邻星星历xyz,数组长度=3</param>
-        /// <param name="lowSatEph">低轨卫星星历xyz,数组长度=3</param>
-        /// <param name="time">采集时刻</param>
-        /// <param name="dtousErr">时差误差(单位us)</param>
-        /// <param name="satLocErr">星历位置误差(单位米)</param>
-        /// <returns></returns>
-        public static (List<SatInfo>, List<ErrDistanceMapLines>) Gdop3Sat2High1LowRef(double[] refLonLat, double[] mainSatEph, double[] adjaSatEph, double[] lowSatEph, double dtousErr = 1, double satLocErr = 10000)
-        {
-            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 = $"72 {string.Join(" ", mainSatEph)} {string.Join(" ", adjaSatEph)} {string.Join(" ", lowSatEph)} {string.Join(" ", refLonLat)} {dtousErr} {satLocErr}";
-            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(3, sb.ToString());
-        }
-        private static (List<SatInfo>, List<ErrDistanceMapLines>) ParseResult(int satCount, string txt)
-        {
-            if (string.IsNullOrWhiteSpace(txt))
-            {
-                throw new Exception("GDOP计算出现未知错误!");
-            }
-            if (txt.StartsWith("1 "))
-            {
-                throw new Exception(txt.Remove(0, 2));
-            }
-            var arr = txt.Split(' ');
-            List<SatInfo> list = new List<SatInfo>();
-            for (int i = 0; i < satCount; i++)
-            {
-                SatInfo satInfo = new SatInfo();
-                var satCode = Convert.ToInt32(arr[3 * i + 1]);
-                if (satCode > 0)
-                    satInfo.SatCode = satCode;
-                satInfo.SatLon = Convert.ToDouble(arr[3 * i + 2]);
-                satInfo.SatLat = Convert.ToDouble(arr[3 * i + 3]);
-                list.Add(satInfo);
-            }
-            var jsonStr = arr[1 + satCount * 3];
-            var res = JsonConvert.DeserializeObject<List<ErrDistanceMapLines>>(jsonStr);
-            return (list, res);
-        }
+        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);
+
+
+        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        public static extern void freeBuff(IntPtr buf);
+       
     }
     
 }

+ 1 - 35
XzXdDw.App/Api/时差线/DrawDtoLineHelper.cs

@@ -235,41 +235,7 @@ 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;
-        }
-
+      
 
     }
 }

+ 1 - 48
XzXdDw.App/Api/时差线/DtoLineModel.cs

@@ -141,52 +141,5 @@ namespace XdCxRhDW.App.Api.时差线
 
     }
 
-    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;
-
-    }
+  
 }

+ 29 - 0
XzXdDw.App/Image/DfoLine.svg

@@ -0,0 +1,29 @@
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+	.Red{fill:#D11C1C;}
+	.Yellow{fill:#FFB115;}
+	.Blue{fill:#1177D7;}
+	.Green{fill:#039C23;}
+	.Black{fill:#727272;}
+	.White{fill:#FFFFFF;}
+	.st0{opacity:0.5;}
+	.st1{opacity:0.75;}
+	.st2{opacity:0.35;}
+	.st3{opacity:0.65;}
+</style>
+<g id="Spline3D">
+	<g class="st1">
+		<path class="Green" d="M20.6,8.6C17.8,10.8,16,14.2,16,18c0,0.6-0.1,1.1-0.4,1.6C15,21,13.6,22,12,22c-2.2,0-4-1.8-4-4
+			c0-3.3-2.7-6-6-6v2v2c1.1,0,2,0.9,2,2c0,4.4,3.6,8,8,8c0.7,0,1.4-0.1,2-0.3c0,0,0.1,0,0.1,0c0.2-0.1,0.5-0.1,0.7-0.2
+			c0.1,0,0.1,0,0.2-0.1c0.3-0.1,0.5-0.2,0.8-0.4c0.1-0.1,0.3-0.2,0.4-0.2c0.1-0.1,0.2-0.1,0.3-0.2c0.2-0.1,0.3-0.2,0.4-0.3
+			c0.1-0.1,0.2-0.2,0.3-0.2c1.7-1.5,2.7-3.6,2.7-6c0-2.7,1.4-5.1,3.4-6.6c1.3-0.9,2.9-1.4,4.6-1.4V8.3V6C25.2,6,22.6,7,20.6,8.6z"/>
+	</g>
+	<path class="Green" d="M14,20c0.6,0,1.1-0.1,1.6-0.4C15,21,13.6,22,12,22c-2.2,0-4-1.8-4-4c0-3.3-2.7-6-6-6l2-2c3.3,0,6,2.7,6,6
+		C10,18.2,11.8,20,14,20z M20,18c0,2.4-1.1,4.5-2.7,6c0.1-0.1,0.3-0.2,0.4-0.3l2-2c1.4-1.4,2.3-3.4,2.3-5.7c0-1.7,0.5-3.3,1.4-4.6
+		C21.4,12.9,20,15.3,20,18z M28,6v2.3V10l2-2V4L28,6z"/>
+	<g class="st0">
+		<path class="Green" d="M20.6,8.6C22.6,7,25.2,6,28,6l2-2C26.2,4,22.8,5.8,20.6,8.6z"/>
+	</g>
+</g>
+</svg>

+ 14 - 0
XzXdDw.App/Image/ErrorEllipse.svg

@@ -0,0 +1,14 @@
+<svg version="1.1" id="Layer_4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+	.Yellow{fill:#FFB115;}
+	.st0{fill:#727272;}
+	.st1{fill:#D11C1C;}
+	.st2{fill:#039C23;}
+	.st3{fill:#1177D7;}
+</style>
+<path class="Yellow" d="M16,10c8,8,16,8,16,8v4c0,0-10-1-16-6C7.9,9.2,5,8.1,0.1,8C0.9,8,6.7,8.7,16,18c8,8,16,8,16,8v4
+	c0,0-10-1-16-6c-8.2-6.8-11-7.9-16-8l0-8l0-6C0,2,7,1,16,10z"/>
+<path class="st2" d="M16,10c-8,8-16,8-16,8v4c0,0,10-1,16-6c8.1-6.8,11-7.9,15.9-8C31.1,8,25.3,8.7,16,18c-8,8-16,8-16,8v4
+	c0,0,10-1,16-6c8.2-6.8,11-7.9,16-8V8V2C32,2,25,1,16,10z"/>
+</svg>

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

@@ -84,8 +84,8 @@ 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"), DrawErrorEllipseDTFO)
+                     .AddMenu("绘制频差线", SvgHelper.LoadFromFile("Image\\DfoLine.svg"), DrawDfoLine)
+                     .AddMenu("绘制误差椭圆", SvgHelper.LoadFromFile("Image\\ErrorEllipse.svg"), DrawErrorEllipseDTFO)
                     .AddMenu("停止加载", SvgHelper.LoadFromFile("Image\\Stop.svg"), () => stoped = true);
 
 
@@ -390,7 +390,7 @@ namespace XzXdDw.App.UserControl
                 twoStartOption.EphVelErr = 1;
                 twoStartOption.fu = fu1;
 
-                var points = DrawDtoLineHelper.ErrorEllipseDTFOTwoStart(twoStartOption);
+                var points = ErrEllipseHelper.ErrorEllipseDTFOTwoStart(twoStartOption);
                 mapControl1.DrawDtoPonit($"双星误差椭圆线", points);
 
 

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

@@ -503,9 +503,15 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     <Content Include="DLL_GZDW.dll" />
+    <Content Include="Image\DfoLine.svg">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="Image\DrawLine.svg">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="Image\ErrorEllipse.svg">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="Image\Pos.svg">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>