/// <summary> /// 指定系统MW组合频率 /// </summary> /// <param name="prn"></param> /// <param name="time">时间,历元</param> /// <returns></returns> static public Frequence GetMwFrequence(SatelliteNumber prn, Time time) { var f1 = GetFrequenceA(prn, time); var f2 = GetFrequenceB(prn, time); var f = f1.Value - f2.Value; return(GetCompositFreqence(1, f1, -1, f2, "MwOf" + prn)); //return new Frequence("MwOf" + satType, f); }
/// <summary> /// 指定系统窄巷组合频率 /// </summary> /// <param name="prn"></param> /// <param name="time">时间,历元</param> /// <returns></returns> static public Frequence GetNarrowLaneFrequence(SatelliteNumber prn, Time time) { var f1 = GetFrequenceA(prn, time); var f2 = GetFrequenceB(prn, time); //var f = f1.Value + f2.Value; return(GetCompositFreqence(1, f1, 1, f2, "NarrowLaneOf" + prn)); }
/// <summary> /// 获取星历列表,这些信息是可能是拟合的结果。 /// </summary> /// <param name="prn">卫星编号</param> /// <param name="from">起始时间</param> /// <param name="to">终止时间</param> /// <param name="interval">间隔(秒)</param> public virtual List <Ephemeris> Gets(SatelliteNumber prn, Time from, Time to, double interval) { List <Ephemeris> list = new List <Ephemeris>(); for (Time i = from; i <= to; i = i + interval) { list.Add(Get(prn, i)); } return(list); }
/// <summary> /// 解析字符串为卫星编号 /// </summary> /// <param name="str"></param> /// <param name="splitter"></param> /// <returns></returns> public static List <SatelliteNumber> ParseString(string str, char [] splitter = null) { if (splitter == null) { splitter = new char[] { ',', ';', '\t', ' ' }; } List <SatelliteNumber> prns = new List <SatelliteNumber>(); var strs = str.Split(splitter, StringSplitOptions.RemoveEmptyEntries); foreach (var item in strs) { var prn = SatelliteNumber.Parse(item); if (prn.SatelliteType != SatelliteType.U) { prns.Add(prn); } } return(prns); }
/// <summary> /// 指定了卫星编号的构造函数 /// </summary> /// <param name="prn"></param> public SingleSatService(SatelliteNumber prn) { this.Prn = prn; }
/// <summary> /// 获取指定卫星和时刻的产品 /// </summary> /// <param name="prn"></param> /// <param name="time"></param> /// <returns></returns> public abstract TProduct Get(SatelliteNumber prn, Time time);
/// <summary> /// 获取时段服务 /// </summary> /// <param name="prn"></param> /// <param name="timeStart"></param> /// <param name="timeEnd"></param> /// <returns></returns> public abstract List <TProduct> Gets(SatelliteNumber prn, Time timeStart, Time timeEnd);
/// <summary> /// 获取频率带宽 /// </summary> /// <param name="type">系统类型</param> /// <param name="freqType">频率类型</param> /// <param name="satNumber">卫星编号,GLONASS 系统需要</param> /// <param name="time">time,GLONASS 系统需要</param> /// <returns></returns> public static Frequence GetFrequenceBand(GnssType type, FrequenceType freqType, int satNumber = -1, Time time = default(Time)) { switch (type) { case GnssType.GPS: case GnssType.SBAS: switch (freqType) { case FrequenceType.A: return(Frequence.GpsL1); case FrequenceType.B: return(Frequence.GpsL2); case FrequenceType.C: return(Frequence.GpsL5); default: return(null); // throw new ArgumentException("GPS 有三个频率。分别以编号1、2、3表示。"); } case GnssType.Galileo: switch (freqType) { case FrequenceType.A: return(Frequence.GalileoE1); case FrequenceType.B: return(Frequence.GalileoE5a); case FrequenceType.C: return(Frequence.GalileoE5b); case FrequenceType.D: return(Frequence.GalileoE5); case FrequenceType.E: return(Frequence.GalileoE6); default: return(null); // throw new ArgumentException("Galileo 有5个频率。分别以编号 1-5 表示。"); } case GnssType.BeiDou: //215786 switch (freqType) { case FrequenceType.A: return(Frequence.CompassB1); case FrequenceType.B: return(Frequence.CompassB2); case FrequenceType.C: return(Frequence.CompassB3); default: return(null); // throw new ArgumentException("BeiDou 有三个频率。分别以编号1、2、3表示。"); } case GnssType.GLONASS: if (satNumber == -1) { throw new ArgumentException("GLONASS是频分多址,需要指定卫星编号,此处有待改进!!!!请联系开发人员。"); } var prn = new SatelliteNumber(satNumber, SatelliteType.R); var k = (int)GlobalGlonassSlotFreqService.Instance.Get(prn, time); // var k = Setting.GnsserConfig.GlonassSlotFrequences[prn]; switch (freqType) { case FrequenceType.A: return(Frequence.GetGlonassG1(k)); case FrequenceType.B: return(Frequence.GetGlonassG2(k)); case FrequenceType.C: return(Frequence.GlonassG3); default: return(null); // throw new ArgumentException("GLONASS 有2个载波。分别以编号1、2表示。"); } case GnssType.QZSS: switch (freqType) { case FrequenceType.A: return(Frequence.GpsL1); case FrequenceType.B: return(Frequence.GpsL2); case FrequenceType.C: return(Frequence.GpsL5); case FrequenceType.D: return(Frequence.QzssL6); default: return(null); } case GnssType.NAVIC: switch (freqType) { case FrequenceType.A: return(Frequence.NavicL5); default: return(null); } default: switch (freqType) { case FrequenceType.A: return(Frequence.GpsL1); case FrequenceType.B: return(Frequence.GpsL2); case FrequenceType.C: return(Frequence.GpsL5); default: return(null); } } throw new ArgumentException(type + "尚不支持,请联系管理员。"); }
/// <summary> /// 构造函数 /// </summary> /// <param name="prn"></param> /// <param name="rinexNum"></param> public RinexSatFrequency(SatelliteNumber prn, int rinexNum) : this(prn.SatelliteType, rinexNum) { }
/// <summary> /// 获取第3频率,推荐方法 /// </summary> /// <param name="prn">卫星编号</param> /// <param name="time">时间,GLONASS需要</param> /// <returns></returns> public static Frequence GetFrequenceC(SatelliteNumber prn, Time time = default(Time)) { return(ObsCodeConvert.GetFrequenceBand(GnssSystem.GetGnssType(prn.SatelliteType), FrequenceType.C, prn.PRN, time)); }
/// <summary> /// 获取频率 /// </summary> /// <param name="prn"></param> /// <param name="frequenceType"></param> /// <param name="time">时间,历元,GLONASS或频分多址需要</param> /// <returns></returns> public static Frequence GetFrequence(SatelliteNumber prn, FrequenceType frequenceType, Time time = default(Time)) { return(GetFrequence(prn.SatelliteType, frequenceType, prn.PRN, time)); }
/// <summary> /// 构造函数 /// </summary> /// <param name="prn"></param> /// <param name="time"></param> public Ephemeris(SatelliteNumber prn, Time time) : this() { this.Prn = prn; this.Time = time; }
/// <summary> /// 获取数据源中存储的离散的星历信息,这些信息是原始存储的。 /// </summary> /// <param name="prn"></param> /// <returns></returns> public virtual List <Ephemeris> Gets(SatelliteNumber prn) { return(Gets(prn, TimePeriod.Start, TimePeriod.End)); }
/// <summary> /// 是否健康 /// </summary> /// <param name="prn"></param> /// <param name="satTime"></param> /// <returns></returns> public abstract bool IsAvailable(SatelliteNumber prn, Time satTime);
/// <summary> /// 获取指定时刻卫星信息 /// </summary> /// <param name="prnName">卫星编号</param> /// <param name="gpsTime">时间</param> /// <returns></returns> public override Ephemeris Get(string prnName, Time gpsTime) { return(Get(SatelliteNumber.Parse(prnName), gpsTime)); }
/// <summary> /// 获取插值后的 EphemerisInfo。 /// 注意:不对钟差相对论误差进行改正,此处时间是卫星钟时间,没有相对信息。2014.09.08 /// 失败,如超过时间,则返回null /// 由于一般没有卫星速度的数据,必须通过插值坐标计算速度。2015.03. /// 如果有速度信息,以下的方法就不合适了。 /// </summary> /// <param name="gpsTime">时间</param> /// <returns></returns> public Ephemeris GetEphemerisInfo(Time gpsTime) { var first = SatEphemerises.First; if (first == null) { return(null); } SatelliteNumber PRN = first.Prn; double gpsSecond = (gpsTime - first.Time); //减去序列中第一个数 // gpsSecond /= 60.0; int count = SatEphemerises.Count; int order = Math.Min(Order, count); //定义差值列表 double[] tList = new double[order]; double[] xList = new double[order]; double[] yList = new double[order]; double[] zList = new double[order]; double[] clockList = new double[order]; //初始化差值列表 int i = 0; foreach (var ephemeris in SatEphemerises) { if (i >= order) { break; } //方案1:顾及地球自转效应 XYZ newXyz = GetSatPosWithEarthRotateCorrection(gpsTime, ephemeris); // 方案2:不顾及地球自转效应 // newXyz = ephemeris.XYZ; xList[i] = newXyz.X; yList[i] = newXyz.Y; zList[i] = newXyz.Z; var sec = (ephemeris.Time - first.Time); //秒。 // sec = sec / 60.0; tList[i] = sec; clockList[i] = ephemeris.ClockBias; i++; } InterpolatingManager manager = new InterpolatingManager(tList); manager.Add("X", xList); manager.Add("Y", yList); manager.Add("Z", zList); manager.Add("C", clockList); #region 并行差值测试 //测试发现,采用并行后,速度下降了至少4倍。初步估计和插值数量太少有关。czs,2016.10.15,found and tested in hongqing. //DateTime start = DateTime.Now; //var length = 20000; //for (int j = 0; j < length; j++) //{ // var values0 = manager.GetInterpolateValuesParallel(gpsSecond); //} //var span1 = DateTime.Now - start; //start = DateTime.Now; //for (int j = 0; j < length; j++) //{ // var values2 = manager.GetInterpolateValues(gpsSecond); //} //var span2 = DateTime.Now - start; #endregion var values = manager.GetInterpolateValues(gpsSecond); //计算位置,速度和钟差 double x = 0, y = 0, z = 0; double dtime = 0; double dx = 0, dy = 0, dz = 0; double ddtime = 0; var xVal = values["X"]; var yVal = values["Y"]; var zVal = values["Z"]; var dtimeVal = values["C"]; x = xVal.Value; dx = xVal.Rate; y = yVal.Value; dy = yVal.Rate; z = zVal.Value; dz = zVal.Rate; dtime = dtimeVal.Value; ddtime = dtimeVal.Rate; //Lagrange(tList, xList, gpsSecond, ref x, ref dx); //Lagrange(tList, yList, gpsSecond, ref y, ref dy); //Lagrange(tList, zList, gpsSecond, ref z, ref dz); //Lagrange(tList, clockList, gpsSecond, ref dtime, ref ddtime); //fitX.GetYdY(gpsSecond, ref x, ref dx); //fitY.GetYdY(gpsSecond, ref y, ref dy); //fitZ.GetYdY(gpsSecond, ref z, ref dz); //fitClock.GetYdY(gpsSecond, ref dtime, ref ddtime); XYZ SatXyz = new XYZ(x, y, z); //精度赋值,算法有待考虑//???2016.09.28,czs XYZ SatXyzSig = first.Rms; double clockSig = first.ClockBiasRms; XYZ SatXyzDotSig = first.XyzDotRms; //计算速度 //double nextSecond = gpsSecond + 0.001; //XYZ xyzNext = new XYZ(fitX.GetY(nextSecond), fitY.GetY(nextSecond), fitZ.GetY(nextSecond)); //XYZ speed = (xyzNext-xyz) / 0.001; XYZ SatSpeed = new XYZ(dx, dy, dz); if (SatSpeed.Length > 50000000000) { log.Error(PRN + " 卫星速度计算错误,不可能飞这么快!" + SatSpeed); } //Add relativity correction to dtime //This only for consistency with GPSEphemerisInter //dtr=-2*dot(R,V)/(C*C) //dtime +=EphemerisUtil.GetRelativeCorrection(SatXyz, SatSpeed); return(new Ephemeris() { Prn = PRN, XYZ = SatXyz, Rms = SatXyzSig, // Clock = fitClock.GetY(gpsSecond), ClockBias = dtime, ClockBiasRms = clockSig, ClockDrift = ddtime, Time = gpsTime, XyzDot = SatSpeed, XyzDotRms = SatXyzDotSig }); }