Ejemplo n.º 1
0
        /// <summary>
        /// 电离层拟合器返回最后或第一相邻历元的电离层偏差
        /// </summary>
        /// <returns></returns>
        public double GetDeltaIonoPolyFitValue(bool isFirstOrLast, int fitDataCount = 10)
        {
            if (this.Count < 5) //数据太少,不如不算
            {
                return(0);
            }
            if (OrderOfDeltaIonoPolyFit > this.Count - 1)
            {
                return(0);
            }
            if (fitDataCount > this.Count)
            {
                fitDataCount = Count;
            }
            int startCount = isFirstOrLast ? 0 : Count - fitDataCount;

            LsPolyFit fit = new LsPolyFit(OrderOfDeltaIonoPolyFit);

            Dictionary <double, double> dic = new Dictionary <double, double>();
            var keys = this.OrderedKeys.GetRange(startCount, fitDataCount);


            var first = keys[0];

            foreach (var item in keys)
            {
                var    data = this[item];
                double x    = (item - first);
                double y    = 0.5 * (data.PseudoRange - data.PhaseRange);
                dic.Add(x, y);
            }

            fit.InitAndFitParams <double>(dic, m => m);
            //fit.InitAndFitParams<Time>(dic, m => m.SecondsOfWeek);

            double firstVal = fit.GetY(0);

            if (isFirstOrLast)
            {
                double secondKey   = keys[1] - first;
                double secondVal   = fit.GetY(secondKey);
                double firstDiffer = secondVal - firstVal;
                return(firstDiffer);
            }
            else
            {
                double lastKeyDiffer       = keys.Last() - first;
                double lastSeocndKeyDiffer = keys[keys.Count - 2] - first;
                double fitVal       = fit.GetY(lastKeyDiffer);
                double fitSecondVal = fit.GetY(lastSeocndKeyDiffer);
                double lastDiffer   = fitVal - fitSecondVal;
                return(lastDiffer);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回一个距离历元最近的结果。
        /// </summary>
        /// <param name="prn"></param>
        /// <param name="epoch">需要精确的时刻</param>
        /// <returns></returns>
        public double Get(SatelliteNumber prn, Time epoch)
        {
            if (Data != null)
            {
                if (Data.ContainsKeyBA(prn.ToString(), epoch))
                {
                    return(Data[epoch, prn.ToString()]);
                }

                if (!Data.ContainsKeyB(prn.ToString()))
                {
                    return(0);
                }

                if (!TimePeriod.Contains(epoch))
                {
                    return(0);
                }

                var vals = Data.GetValuesByKeyB(prn.ToString());

                //获取最近几个
                var dic = Geo.Utils.DoubleUtil.GetNearst(vals, m => m.SecondsOfWeek, epoch, FitCount);
                if (IsAverageOrFit)
                {
                    var ave = dic.Values.Average();
                    return(ave);
                }
                else
                {
                    LsPolyFit fit = new LsPolyFit(2);
                    fit.InitAndFitParams <Time>(dic, m => m.SecondsOfWeek);
                    var y = fit.GetY(epoch.SecondsOfWeek);
                    return(y);
                }
            }
            return(0);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  拟合下一个数据。
        /// </summary>
        /// <param name="nextIndex">下一个编号,0为推1个单位,1为外推2个单位</param>
        /// <param name="order"></param>
        /// <returns></returns>
        public RmsedNumeral GetNextLsPolyFitValue(double nextIndex = 0, int order = 2)
        {
            LsPolyFit fit = GetLsPolyFit(order);

            return(new RmsedNumeral(fit.GetY(this.Count + nextIndex), fit.StdDev));
        }