/// <summary> /// 增加一个 /// </summary> /// <param name="time"></param> /// <param name="rawRange"></param> /// <param name="rawPhaseRange"></param> public SmoothRangeWindowOld Add(Time time, double rawRange, double rawPhaseRange, double ionoDiffer) { //通过是否相等,判断是否重复设值 if (CurrentData.PseudoRange == rawRange && this.CurrentData.PhaseRange == rawPhaseRange) { return(this); } this.CurrentData = new RangePhasePair(rawRange, rawPhaseRange, ionoDiffer) { Time = time }; this.Add(time, CurrentData); //电离层改正数据 if (IsDeltaIonoCorrect && SmoothRangeType == SmoothRangeSuperpositionType.快速更新算法) { double y = CurrentData.GetRawIonoAndHalfAmbiValue();//.RangeMinusPhase / 2; IonoWindow.Add(time, y); // BigIonoWindow.Add(time, y); } if (IsDeltaIonoCorrect) { var fit = IonoWindow.GetPolyFitValue(CurrentData.Time, OrderOfDeltaIonoPolyFit, IonoFitDataCount); if (fit != null) { CurrentData.FittedIonoAndAmbiValue = fit.Value; } else { CurrentData.FittedIonoAndAmbiValue = CurrentData.GetRawIonoAndHalfAmbiValue(); } } return(this); }
/// <summary> /// 计算平滑的伪距,最快的迭代,带电离层的递推平滑算法,可以大大加快速度。 /// 算法已验证,和窗口单独迭代相同,需要注意的式如果正式平滑时,则不需要加权了。 /// 2018.06.20, czs, 这是推导了好几天才出的结果,并得到了验证,具体公式请参看本人发表的文章:**平滑伪距***。 /// </summary> /// <returns></returns> public RmsedNumeral GetSmoothValueByFastUpdate() { int count = this.Count; RmsedNumeral result = null; double extraP = 0;//外推的结果 double deltaTail = 0; if (this.Count <= 1) { result = GetFirstOrDefault(); extraP = result.Value; CurrentData.FittedIonoAndAmbiValue = CurrentData.GetRawIonoAndHalfAmbiValue(); } else //采用窗口内的数据进行平滑 { double ionDiffer = 0; if (IsDeltaIonoCorrect)//电离层改正赋值 { //var fit = IonoWindow.GetPolyFitValue(CurrentData.Time, OrderOfDeltaIonoPolyFit, IonoFitDataCount); //if (fit != null) //{ // CurrentData.FittedIonoAndAmbiValue = fit.Value; //} //else //{ // CurrentData.FittedIonoAndAmbiValue = CurrentData.GetRawIonoAndHalfAmbiValue(); //} ionDiffer = (CurrentData.FittedIonoAndAmbiValue - PrevData.FittedIonoAndAmbiValue); } //所谓的推估表达式,即不采用当前的伪距观测数据, P0 + (L1 - L0) + 2DI extraP = LastSmoothedRange + (this.CurrentData.PhaseRange - PrevData.PhaseRange) + 2 * ionDiffer; double sP = extraP; if (IsWeighted) //加权,表示采用当前的伪距观测数据 { if (this.LastRemovedItem.Value != null) //当大于指定的窗口,将扣除窗口外的数据(包括电离层延迟)影响。 { double ionoDiffer = 0; if (IsDeltaIonoCorrect) { ionoDiffer = CurrentData.FittedIonoAndAmbiValue - this.LastRemovedPair.FittedIonoAndAmbiValue; //var bigFit = BigIonoWindow.GetTimedLsPolyFit(1); //ionoDiffer = bigFit.GetY( CurrentData.Time) - bigFit.GetY(LastRemovedPair.Time); } deltaTail = 1.0 / (this.Count) * (CurrentData.RangeMinusPhase - this.LastRemovedPair.RangeMinusPhase - 2.0 * ionoDiffer); sP = extraP + deltaTail; } else //原始Hatch滤波 { double weight = GetWeight(this.LastKey, count); sP = weight * this.CurrentData.PseudoRange + (1 - weight) * extraP; } } double stdDev = this.RawRangeStdDev * 0.1 / Math.Sqrt(count); result = new RmsedNumeral(sP, stdDev); //验证算法,2018.06.20, czs, //var result3 = GetSmoothValueByWholeWindowRecursionAk(); //double ionoDiff; //double Ak = GetAk(out ionoDiff); //double akDelta = Ak - PrevAk; //double differOfAkDelta = akDelta - deltaTail; ////var result2 = this.CurrentRaw.PhaseRange + Ak; ////double differ = result2 - result.Value; ////double differ2 = result2 - result3.Value; ////int oo = 0; //PrevAk = Ak; } this.PrevData = this.CurrentData; this.LastSmoothedRange = result.Value; return(result); }