|
@@ -1,4 +1,5 @@
|
|
|
|
|
|
+using DevExpress.XtraBars.Docking.Helpers;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -9,22 +10,122 @@ namespace XdCxRhDW.App.Api.GDOP误差椭圆
|
|
|
public static class GdopHelper
|
|
|
{
|
|
|
|
|
|
- private const string GDOPDll = @"Api\GDOP误差椭圆\GDOP\GDOP_Draw.dll";
|
|
|
-
|
|
|
static readonly DateTime dtZero = new DateTime(1970, 1, 1, 8, 0, 0, 0);
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 两星一地GDOP 无参时参考位置不赋值
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mainLines">主星星历</param>
|
|
|
+ /// <param name="adajLines">邻星星历</param>
|
|
|
+ /// <param name="captime">信号时间</param>
|
|
|
+ /// <param name="cdbPos">超短波位置 3</param>
|
|
|
+ /// <param name="refPos">参考站位置 3</param>
|
|
|
+ /// <param name="dtousErr">时差误差</param>
|
|
|
+ /// <param name="ephLocErr">星历误差</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static (List<SatInfo>, List<ErrDistanceMapPoints>) Gdop2Sat1D(string mainLines, string adajLines, DateTime captime, double[] cdbPos, double dtousErr, double ephLocErr, double[] refPos = null)
|
|
|
+ {
|
|
|
+ int satCount = 2;
|
|
|
+ //该值和points 一一对应
|
|
|
+ double[] level = GdopParam.误差配置.误差距离m;
|
|
|
+ double[] satllh = new double[satCount * 3];
|
|
|
+
|
|
|
+ var timeSpan = (long)(captime - dtZero).TotalSeconds;
|
|
|
+ IntPtr res = IntPtr.Zero;
|
|
|
+ int[] resCount = new int[level.Length];
|
|
|
+ if (refPos == null || refPos.Length == 0)
|
|
|
+ {
|
|
|
+ GDOPApi.Gdop2Sat1DNoRef(mainLines, adajLines, timeSpan, cdbPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GDOPApi.Gdop2Sat1DRef(mainLines, adajLines, timeSpan, cdbPos, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ IntPtr tmp = res;
|
|
|
+
|
|
|
+ //用于绘制的数据
|
|
|
+ List<double[]> points = new List<double[]>();
|
|
|
+ for (int idx = 0; idx < level.Length; ++idx)
|
|
|
+ {
|
|
|
+ double[] levelval = new double[resCount[idx]];
|
|
|
+ Marshal.Copy(tmp, levelval, 0, resCount[idx]);
|
|
|
+ tmp += (resCount[idx] * sizeof(double));
|
|
|
+ points.Add(levelval);
|
|
|
+ }
|
|
|
+ GDOPApi.FreeGDOPBuf(res);
|
|
|
+ List<SatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines);
|
|
|
+ List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
|
|
|
+ for (int i = 0; i < points.Count; i++)
|
|
|
+ {
|
|
|
+ if (!points[i].Any()) continue;
|
|
|
+ ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
|
|
|
+ errDistanceMap.ErrDistance = level[i];
|
|
|
+ errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
|
|
|
+ errs.Add(errDistanceMap);
|
|
|
+ }
|
|
|
+ return (satInfos, errs);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 一星一地GDOP
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mainLines">主星星历</param>
|
|
|
+ /// <param name="captime">信号时间</param>
|
|
|
+ /// <param name="cdbPos">超短波位置 3</param>
|
|
|
+ /// <param name="cxPos">测向站位置 3</param>
|
|
|
+ /// <param name="dtousErr">时差误差</param>
|
|
|
+ /// <param name="doaErr">测向误差</param>
|
|
|
+ /// <param name="ephLocErr">星历误差</param>
|
|
|
+ /// <param name="refPos">参考站位置 3</param>
|
|
|
/// <returns></returns>
|
|
|
-
|
|
|
- [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
|
|
|
- public static extern int Gdop2Sat1DRef(string mainLines, string adajLines, Int64 captime, double[] cdbPos
|
|
|
- , double[] refPos, double dtousErr, double ephLocErr
|
|
|
- , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
|
|
|
+ public static (List<SatInfo>, List<ErrDistanceMapPoints>) Gdop1Sat1D(string mainLines, DateTime captime, double[] cdbPos, double[] cxPos, double dtousErr, double doaErr, double ephLocErr, double[] refPos = null)
|
|
|
+ {
|
|
|
+ int satCount = 2;
|
|
|
+ //该值和points 一一对应
|
|
|
+ double[] level = GdopParam.误差配置.误差距离m;
|
|
|
+ double[] satllh = new double[satCount * 3];
|
|
|
|
|
|
- [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
|
|
|
- public static extern void FreeGDOPBuf(IntPtr val);
|
|
|
+ var timeSpan = (long)(captime - dtZero).TotalSeconds;
|
|
|
+ IntPtr res = IntPtr.Zero;
|
|
|
+ int[] resCount = new int[level.Length];
|
|
|
+ if (refPos == null || refPos.Length == 0)
|
|
|
+ {
|
|
|
+ GDOPApi.GdopXDCXNoRef(mainLines, timeSpan, cdbPos, cxPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GDOPApi.GdopXDCXRef(mainLines, timeSpan, cdbPos, cxPos, refPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+ }
|
|
|
+ IntPtr tmp = res;
|
|
|
|
|
|
-
|
|
|
+ //用于绘制的数据
|
|
|
+ List<double[]> points = new List<double[]>();
|
|
|
+ for (int idx = 0; idx < level.Length; ++idx)
|
|
|
+ {
|
|
|
+ double[] levelval = new double[resCount[idx]];
|
|
|
+ Marshal.Copy(tmp, levelval, 0, resCount[idx]);
|
|
|
+ tmp += (resCount[idx] * sizeof(double));
|
|
|
+ points.Add(levelval);
|
|
|
+ }
|
|
|
+ GDOPApi.FreeGDOPBuf(res);
|
|
|
+ List<SatInfo> satInfos = ParseResult(satCount, satllh, mainLines);
|
|
|
+ List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
|
|
|
+ for (int i = 0; i < points.Count; i++)
|
|
|
+ {
|
|
|
+ if (!points[i].Any()) continue;
|
|
|
+ ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
|
|
|
+ errDistanceMap.ErrDistance = level[i];
|
|
|
+ errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
|
|
|
+ errs.Add(errDistanceMap);
|
|
|
+ }
|
|
|
+ return (satInfos, errs);
|
|
|
+ }
|
|
|
|
|
|
- public static (List<SatInfo>, List<ErrDistanceMapPoints>) Gdop2Sat1DRef(string mainLines, string adajLines, DateTime captime, double[] cdbPos, double[] refPos, double dtousErr, double ephLocErr)
|
|
|
+ private static (List<SatInfo>, List<ErrDistanceMapPoints>) Gdop3Sat(string mainLines, string adajLines, string adajLines2,
|
|
|
+ DateTime captime, double dtousErr, double ephLocErr, double[] refPos = null)
|
|
|
{
|
|
|
int satCount = 2;
|
|
|
//该值和points 一一对应
|
|
@@ -34,7 +135,17 @@ namespace XdCxRhDW.App.Api.GDOP误差椭圆
|
|
|
var timeSpan = (long)(captime - dtZero).TotalSeconds;
|
|
|
IntPtr res = IntPtr.Zero;
|
|
|
int[] resCount = new int[level.Length];
|
|
|
- Gdop2Sat1DRef(mainLines, adajLines, timeSpan, cdbPos, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+ if (refPos == null || refPos.Length == 0)
|
|
|
+ {
|
|
|
+ GDOPApi.Gdop3SatNoRef(mainLines, adajLines, adajLines2, timeSpan, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GDOPApi.Gdop3SatRef(mainLines, adajLines, adajLines2, timeSpan, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
IntPtr tmp = res;
|
|
|
|
|
@@ -47,8 +158,8 @@ namespace XdCxRhDW.App.Api.GDOP误差椭圆
|
|
|
tmp += (resCount[idx] * sizeof(double));
|
|
|
points.Add(levelval);
|
|
|
}
|
|
|
- FreeGDOPBuf(res);
|
|
|
- List<SatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines);
|
|
|
+ GDOPApi.FreeGDOPBuf(res);
|
|
|
+ List<SatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines, adajLines2);
|
|
|
List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
|
|
|
for (int i = 0; i < points.Count; i++)
|
|
|
{
|
|
@@ -61,7 +172,43 @@ namespace XdCxRhDW.App.Api.GDOP误差椭圆
|
|
|
return (satInfos, errs);
|
|
|
}
|
|
|
|
|
|
+ private static (List<SatInfo>, List<ErrDistanceMapPoints>) Gdop3SatDF(string mainLines, string adajLines, string adajLines2,
|
|
|
+ DateTime captime, double fuHz1, double fuHz2, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
|
|
|
+ {
|
|
|
+ int satCount = 2;
|
|
|
+ //该值和points 一一对应
|
|
|
+ double[] level = GdopParam.误差配置.误差距离m;
|
|
|
+ double[] satllh = new double[satCount * 3];
|
|
|
+
|
|
|
+ var timeSpan = (long)(captime - dtZero).TotalSeconds;
|
|
|
+ IntPtr res = IntPtr.Zero;
|
|
|
+ int[] resCount = new int[level.Length];
|
|
|
+ GDOPApi.Gdop3SatDF(mainLines, adajLines, adajLines2, timeSpan, refPos,fuHz1,fuHz2,dfoErr, ephLocErr,ephVErr, level, level.Length, resCount, out res, satllh);
|
|
|
+
|
|
|
+ IntPtr tmp = res;
|
|
|
|
|
|
+ //用于绘制的数据
|
|
|
+ List<double[]> points = new List<double[]>();
|
|
|
+ for (int idx = 0; idx < level.Length; ++idx)
|
|
|
+ {
|
|
|
+ double[] levelval = new double[resCount[idx]];
|
|
|
+ Marshal.Copy(tmp, levelval, 0, resCount[idx]);
|
|
|
+ tmp += (resCount[idx] * sizeof(double));
|
|
|
+ points.Add(levelval);
|
|
|
+ }
|
|
|
+ GDOPApi.FreeGDOPBuf(res);
|
|
|
+ List<SatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines, adajLines2);
|
|
|
+ List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
|
|
|
+ for (int i = 0; i < points.Count; i++)
|
|
|
+ {
|
|
|
+ if (!points[i].Any()) continue;
|
|
|
+ ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
|
|
|
+ errDistanceMap.ErrDistance = level[i];
|
|
|
+ errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
|
|
|
+ errs.Add(errDistanceMap);
|
|
|
+ }
|
|
|
+ return (satInfos, errs);
|
|
|
+ }
|
|
|
private static List<MapDot> ParseResult(double[] ponits)
|
|
|
{
|
|
|
List<MapDot> mapDots = new List<MapDot>();
|
|
@@ -72,7 +219,7 @@ namespace XdCxRhDW.App.Api.GDOP误差椭圆
|
|
|
mapDot.Lat = ponits[count * i + 1];
|
|
|
mapDot.Lon = ponits[count * i];
|
|
|
mapDots.Add(mapDot);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
return mapDots;
|
|
|
|