|
@@ -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);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|