Exemple #1
0
 /// <summary>
 /// 卫星是否可用,进行简单的判断。
 /// </summary>
 /// <param name="prn"></param>
 /// <param name="satTime"></param>
 /// <returns></returns>
 public override bool IsAvailable(SatelliteNumber prn, Time satTime)
 {
     if (!TimePeriod.BufferedContains(satTime))
     {
         //log.Error(prn + "," + time + " 已经超出星历服务时段范围" + Sp3File.TimePeriod);
         return(false);
     }
     return(true);
 }
        //考虑并行情况,2014.09.14
        /// <summary>
        /// 获取指定时刻,某卫星的信息。可能需要拟合计算。
        /// 失败则返回 null。
        /// </summary>
        /// <param name="prn"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public override Ephemeris Get(SatelliteNumber prn, Time time)
        {
            if (Sp3File == null)
            {
                return(null);
            }

            if (!TimePeriod.BufferedContains(time))
            {
                log.Error(prn + "," + time + " 已经超出星历服务时段范围 " + TimePeriod);
                return(null);
            }

            var ephes = EphemerisManager.GetOrCreate(prn);

            if (ephes == null || ephes.Count == 0)
            {
                if (!WarnedPrns.Contains(prn))
                {
                    log.Warn("当前SP3文件 " + Name + " 没有这颗卫星的信息 " + prn);
                    WarnedPrns.Add(prn);
                }
                return(null);
            }

            //获取原始星历
            var storage = ephes.GetSatEphemerises(time);

            if (storage == null)
            {
                return(null);
            }
            if (storage.Count < MinSequentialSatCount)//连续数量太少,拟合将不准确。
            {
                log.Warn(prn + "," + time + " 连续数量太少,拟合将不准确。" + storage.Count + " 至少应 " + MinSequentialSatCount);
                return(null);
            }
            var secondOfWeek = time.SecondsOfWeek;

            //判断防止周日时间退减到周六
            if (time.DayOfWeek == DayOfWeek.Saturday && Math.Abs(TimeConsts.SECOND_PER_WEEK - secondOfWeek) < 2)
            {
                secondOfWeek -= TimeConsts.SECOND_PER_WEEK;//回滚到下一周
            }
            //找出最近的部分
            List <double> indexes  = Utils.DoubleUtil.GetNearst(storage.Keys, secondOfWeek, Order);
            var           entities = storage.GetSubEphemerises(indexes);

            //插值
            using (var interpolator = new EphemerisInterpolator(entities, Order))
            {
                return(interpolator.GetEphemerisInfo(time));
            }

            //return GetInterpolatorResult(prn, time, entities);
        }
Exemple #3
0
        ///// <summary>
        ///// .斜TEC转垂直TEC的乘法因子。
        ///// </summary>
        ///// <param name="satElevation">卫星高度角,角度degree</param>
        ///// <param name="radiusOfMeanEarth">地球平均半径</param>
        ///// <param name="heightOfIono">电离层模型高度</param>
        ///// <returns></returns>
        //private static double GetSlopeToVerticalFactor(double satElevation, double radiusOfMeanEarth, double heightOfIono)
        //{
        //    return Math.Sqrt(1.0 - Math.Pow(radiusOfMeanEarth * Math.Cos(satElevation * Geo.Coordinates.AngularConvert.DegToRadMultiplier) / (radiusOfMeanEarth + heightOfIono), 2.0));
        //}
        /// <summary>
        /// 垂直TEC转斜TEC的乘法因子。
        /// </summary>
        /// <param name="satElevation">卫星高度角,角度degree</param>
        /// <param name="radiusOfMeanEarth">地球平均半径</param>
        /// <param name="heightOfIono">电离层模型高度</param>
        /// <returns></returns>
        //private static double GetVerticalToSlopeFactor(double satElevation, double radiusOfMeanEarth, double heightOfIono)
        //{
        //    return 1.0 /  GetSlopeToVerticalFactor(satElevation, radiusOfMeanEarth, heightOfIono);
        //}

        /// <summary>
        /// 获取服务为,原始数据。单位 1e16.
        /// </summary>
        /// <param name="time"></param>
        /// <param name="geocentricLonlatDeg"></param>
        /// <returns></returns>
        public RmsedNumeral Get(Time time, LonLat geocentricLonlatDeg)
        {
            double bufferedTime = 2 * 3600;

            this.TimePeriod.SetSameBuffer(bufferedTime);
            if (!TimePeriod.BufferedContains(time))
            {
                log.Error(Name + " 不在有效服务时段内。 " + TimePeriod + ", " + time);
                return(null);

                throw new ApplicationException();
            }

            List <Time> times = TimeUtil.GetNearst(this.IonoFile.Keys, time);

            if (times.Count == 1)//刚好,或在边界,无需拟合
            {
                return(Interpolate(this.IonoFile.Get(times[0]), geocentricLonlatDeg));
            }
            else if (times.Count >= 3)//需要拟合
            {
                var         smallTime  = times[1];
                var         largerTime = times[2];
                IonoSection regoin1    = this.IonoFile.Get(smallTime);
                IonoSection regoin2    = this.IonoFile.Get(largerTime);


                var val1 = Interpolate(regoin1, geocentricLonlatDeg);
                var val2 = Interpolate(regoin2, geocentricLonlatDeg);
                var t    = time.TickTime.SecondsOfWeek;
                var t1   = smallTime.TickTime.SecondsOfWeek;
                var t2   = largerTime.TickTime.SecondsOfWeek;

                if (t2 == 0)
                {
                    t2 = SecondTime.SECOND_PER_WEEK;// 3600 * 24 * 7;
                }

                var val = Geo.Utils.DoubleUtil.Interpolate(t, t1, t2, val1.Value, val2.Value);
                var rms = Geo.Utils.DoubleUtil.Interpolate(t, t1, t2, val1.Rms, val2.Rms);

                return(new RmsedNumeral(val, rms));
            }

            IonoSection   regoin = this.IonoFile.Get(times[0]);
            List <double> lats   = Geo.Utils.DoubleUtil.GetNearst(regoin.Keys, geocentricLonlatDeg.Lat, false);

            IonoRecord    record = regoin.Get(lats[0]);
            List <double> lons   = Geo.Utils.DoubleUtil.GetNearst(record.Keys, geocentricLonlatDeg.Lon, false);

            return(record[lons[0]]);
        }
Exemple #4
0
        /// <returns></returns>
        public override Ephemeris Get(SatelliteNumber prn, Time time)
        {
            if (!TimePeriod.BufferedContains(time))
            {
                log.Error(prn + "," + time + " 已经超出星历服务时段范围 " + TimePeriod);
                return(null);
            }

            var ephes = EphemerisManager.GetOrCreate(prn);

            if (ephes == null || ephes.Count == 0)
            {
                if (!WarnedPrns.Contains(prn))
                {
                    log.Warn("当前SP3文件 " + Name + " 没有这颗卫星的信息 " + prn);
                    WarnedPrns.Add(prn);
                }
                return(null);
            }

            //获取原始星历
            var storage = ephes.GetSatEphemerises(time);

            if (storage == null)
            {
                return(null);
            }
            if (storage.Count < MinSequentialSatCount)//连续数量太少,拟合将不准确。
            {
                log.Warn(prn + "," + time + " 连续数量太少,拟合将不准确。" + storage.Count + " 至少应 " + MinSequentialSatCount);
                return(null);
            }

            var entities = storage.GetGetNearst(time, Order);

            //插值
            using (var interpolator = new EphemerisInterpolator(entities, Order))
            {
                var result = interpolator.GetEphemerisInfo(time);
                if (result.XYZ.Length > 100000000)
                {
                    log.Error("尚不支持轨道半径" + ((result.XYZ.Length) / 1000).ToString("0 000 000.00") + " KM 的 GNSS 卫星 " + result.XYZ);
                }
                return(result);
            }

            //return GetInterpolatorResult(prn, time, entities);
        }