123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- 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 XdDw.App.Api.时差线;
- using XdDw.App.DTO;
- using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
- namespace XdDw.App.Api.低轨GDOP误差椭圆
- {
- 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>
- /// 时差误差(s)
- /// </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>
- /// 上行频点1(Hz)
- /// </summary>
- public double fu1 { get; set; }
- /// <summary>
- /// 上行频点2(Hz)
- /// </summary>
- public double fu2 { get; set; }
- /// <summary>
- /// 概率 默认0.5
- /// </summary>
- public double Pe { get; set; } = 0.5;
- }
- public class ErrorEllipseDTO2X1DOption
- {
- /// <summary>
- /// 主星星历
- /// </summary>
- public double[] MsEph { get; set; }
- /// <summary>
- /// 邻星星历
- /// </summary>
- public double[] NsEph { get; set; }
- /// <summary>
- /// 超短波位置
- /// </summary>
- public double[] CDBAnt { get; set; }
- /// <summary>
- /// 参考站位置
- /// </summary>
- public double[] RefGeod { get; set; }
- /// <summary>
- /// 定位点
- /// </summary>
- public double[] SelectPoint { get; set; }
- /// <summary>
- /// 时差误差(s)
- /// </summary>
- public double DtoErr { get; set; }
- /// <summary>
- /// 星历误差
- /// </summary>
- public double EphErr { get; set; }
- /// <summary>
- /// 概率 默认0.5
- /// </summary>
- public double Pe { get; set; } = 0.5;
- }
- public class ErrorEllipseDTO1XOption
- {
- /// <summary>
- /// 第一时刻星历
- /// </summary>
- public double[] MsEph { get; set; }
- /// <summary>
- ///第二时刻星历
- /// </summary>
- public double[] NsEph1 { get; set; }
- /// <summary>
- /// 第三时刻星历
- /// </summary>
- public double[] NsEph2 { get; set; }
- /// <summary>
- /// 定位点
- /// </summary>
- public double[] SelectPoint { 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;
- }
- public static class ErrEllipseHelper
- {
- private const string GDOPDll = @"Api\低轨GDOP误差椭圆\GDOP\DLL_GD64.dll";
- /// <summary>
- /// 两星一地误差椭圆
- /// </summary>
- /// <param name="main_eph">主星位置 长度6</param>
- /// <param name="neigh_eph">邻星位置 长度6</param>
- /// <param name="cdbAnt">超短波 长度3</param>
- /// <param name="refStation">参考站 长度3</param>
- /// <param name="Select_Point">定位点 长度3</param>
- /// <param name="dto_err">时差误差(s)</param>
- /// <param name="eph_err"></param>
- /// <param name="Pe">0.5</param>
- /// <param name="LOP_Len"></param>
- /// <returns></returns>
- [DllImport(GDOPDll, EntryPoint = "Error_Ellipse_2X1D", CallingConvention = CallingConvention.Cdecl)]
- public extern static IntPtr Error_Ellipse_2X1D(double[] main_eph, double[] neigh_eph, double[] cdbAnt, double[] refStation, double[] Select_Point, double dto_err,
- double eph_err, double Pe, ref int LOP_Len);
- [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
- public static extern void freeBuff(IntPtr buf);
- public static IEnumerable<(double lon, double lat)> ErrorEllipse2X1D(ErrorEllipseDTO2X1DOption opt)
- {
- int LOP_Len = 0;
- IntPtr LOP_ValuePtr = Error_Ellipse_2X1D(
- opt.MsEph,
- opt.NsEph,
- opt.CDBAnt,
- opt.RefGeod,
- opt.SelectPoint,
- opt.DtoErr,
- opt.EphErr,
- opt.Pe, ref LOP_Len);
- return ParseResult(LOP_ValuePtr, LOP_Len);
- }
-
- private static IEnumerable<(double lon, double lat)> ParseResult(IntPtr LOP_ValuePtr, int LOP_Len)
- {
- List<DtoLinePoint> list = new List<DtoLinePoint>();
- double[] LOP_Value = new double[LOP_Len];
- if (LOP_Len > 0)
- {
- 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;
- }
- }
- }
|