/// <summary> /// 探测是否钟跳,返回结果 /// </summary> /// <param name="prev"></param> /// <param name="current"></param> /// <param name="MaxThresholdSeconds"></param> /// <param name="Ratio"></param> /// <returns></returns> private static ClockJumpState Detect(EpochInformation prev, EpochInformation current, double MaxThresholdSeconds, double Ratio) { ClockJumpState clockJumpState = ClockJumpState.Ok; int jumpCountOfL = 0; int jumpCountOfP = 0; foreach (var sat in current) { if (prev.Contains(sat.Prn)) { var prevSat = prev[sat.Prn]; //这里只比较载波A即可 var differLSecond = (sat.FrequenceA.PhaseRange.Value - prevSat.FrequenceA.PhaseRange.Value) / GnssConst.LIGHT_SPEED; if (Math.Abs(differLSecond) > MaxThresholdSeconds) { jumpCountOfL++; } var differPSecond = (sat.FrequenceA.PseudoRange.Value - prevSat.FrequenceA.PseudoRange.Value) / GnssConst.LIGHT_SPEED; if (Math.Abs(differPSecond) > MaxThresholdSeconds) { jumpCountOfP++; } } } var minCount = Ratio * current.Count; if (jumpCountOfL > minCount) { if (jumpCountOfP > minCount) { clockJumpState = ClockJumpState.ClockJumped; current.EpochState = EpochState.ClockJumped; } else { clockJumpState = ClockJumpState.ClockJumpedPhaseOnly; current.EpochState = EpochState.ClockJumpedPhaseOnly; } } else if (jumpCountOfP > minCount) { clockJumpState = ClockJumpState.ClockJumpedRangeOnly; current.EpochState = EpochState.ClockJumpedRangeOnly; } return(clockJumpState); }
/// <summary> /// 直接修复,按照指定的修复。 /// </summary> /// <param name="obj"></param> /// <param name="seonds"></param> /// <param name="clockJumpState"></param> public void Repair(ref EpochInformation obj, double seonds, ClockJumpState clockJumpState = ClockJumpState.ClockJumped) { obj.CorrectClockJump(seonds, clockJumpState); }
/// <summary> /// 探测 /// </summary> /// <param name="current"></param> /// <returns></returns> public override bool Revise(ref EpochInformation current) { if (Prev == null) { SetPrev(current); return(true); } if (Prev.ReceiverTime == current.ReceiverTime) { return(true); } //避免重复调用 //如果选择了修复,需要将进来的修理成以前的一个尺度,再进行判断 if (IsRepaire && CorrectionOfTotalJumpedSeconds != 0) { Repair(ref current, CorrectionOfTotalJumpedSeconds, TotalClockJumpState); } //探测,只需要上一个和当前比较 var ClockJumpState = Detect(this.Prev, current, MaxThresholdSeconds, Ratio); if (ClockJumpState != ClockJumpState.Ok) { TotalClockJumpState = ClockJumpState; log.Warn(current.Name + " " + current.ReceiverTime + " 发生钟跳!" + ClockJumpState); if (Buffers == null || Buffers.Count == 0) { return(true); } //计算跳秒改正数 double jumped = GetJumpSecondCorrection(current); CorrectionOfCurrrentJumpedSeconds = jumped; CorrectionOfTotalJumpedSeconds += CorrectionOfCurrrentJumpedSeconds; log.Warn(current.Name + " " + current.ReceiverTime + " 钟跳大小:" + CorrectionOfCurrrentJumpedSeconds + ", 总跳: " + CorrectionOfTotalJumpedSeconds); if (IsRepaire) { Repair(ref current, CorrectionOfCurrrentJumpedSeconds, ClockJumpState); //前面已经修复过一次了,这里补充修复 log.Info(current.Name + " " + current.ReceiverTime + " 尝试修复了周跳!" + current.EpochState); //探测检核一下 //var checkState = Detect(this.Prev, current, MaxThresholdSeconds, Ratio); //if (checkState != ClockJumpState.Ok) //{ // int i = 0; //} //var check = GetClockJumpSeconds(this.Prev2, this.Prev, current, next, FrequenceType.A); //if (Math.Abs(check) > 0.00001) //{ // int a = 0; //} } } SetPrev(current); return(true); }