/// <summary> /// Android 测量数据解码器 /// </summary> /// <param name="gnssLogerRawTable"></param> /// <param name="Option">参数选项</param> public AndroidMeasureDecoder(ObjectTableStorage gnssLogerRawTable, AndroidMeasureDecoderOption Option = null) { this.RawTable = gnssLogerRawTable; if (Option == null) { Option = new AndroidMeasureDecoderOption(); } this.Option = Option; NumericalAlignerManager = new NumericalAlignerManager <SatelliteNumber, Time>(3, m => m.SecondsOfWeek); this.IsCancel = false; }
/// <summary> /// 解析一行数据。 /// </summary> /// <param name="item"></param> /// <returns></returns> private RinexSatObsData ParseOneRecord(Dictionary <string, object> item) { RinexSatObsData satData = null; #region 赋值 long timeNanos = ParseLong(item, TimeNanos); //当前时间到GPS起始时间的纳秒数,为负数。 long fullBiasNanos = ParseLong(item, FullBiasNanos); double biasNanos = ParseDouble(item, BiasNanos); double timeOffsetNanos = ParseDouble(item, TimeOffsetNanos); long receivedSvTimeNanos = ParseLong(item, ReceivedSvTimeNanos); long receivedSvTimeUncertaintyNanos = ParseLong(item, ReceivedSvTimeUncertaintyNanos); int hardwareClockDiscontinuityCount = ParseInt(item, HardwareClockDiscontinuityCount); int accumulatedDeltaRangeState = ParseInt(item, AccumulatedDeltaRangeState); double cn0DbHz = ParseDouble(item, Cn0DbHz); double accumulatedDeltaRangeMeters = ParseDouble(item, AccumulatedDeltaRangeMeters); #endregion SatelliteNumber prn = ParsePrn(item); //伪距不确定度太大,本数据作废 if (receivedSvTimeUncertaintyNanos > 1e8) { log.Debug(prn + " 卫星时间不确定度太大,忽略本数据 " + receivedSvTimeUncertaintyNanos); return(satData); }//简单判断伪距 //如果钟跳发生了,或指定的被减伪距值无效,则重置被减伪距 bool isClockDisCountChanged = (_prevHardwareClockDisCount != hardwareClockDiscontinuityCount); _prevHardwareClockDisCount = hardwareClockDiscontinuityCount; //决定是否新建时间计算器。 if (TimeConverter == null || !TimeConverter.IsEpochValid) { TimeConverter = new AndroidGnssTimeConverter(fullBiasNanos, Option.IsFromFirstEpoch);//fullBiasNanos值并不准确,含有偏差,不能用于计算所有伪距。 if (!TimeConverter.IsEpochValid) { log.Debug("当前历元时间不合法," + TimeConverter.FirstEpochOfUtc + ",将重试。"); return(satData); } } TimeConverter.SetFullBias(fullBiasNanos) .SetTimeNanos(timeNanos) .SeBiasNanos(biasNanos) .SetTimeOffsetNanos(timeOffsetNanos); Time currentUtcTime = TimeConverter.GetReceiverUtcTime(); TimeConverter.SetSatelliteType(prn.SatelliteType); //若是新历元 if (IsNewEpoch(CurrentEpochInfo, _currentTimeNanos, timeNanos)) //新历元 { _currentTimeNanos = timeNanos; //记录当接收机时间,用于判断是否是同一个历元 CurrentEpochInfo = new RinexEpochObservation(currentUtcTime); RinexOFile.Add(CurrentEpochInfo); } //计算伪距 double transTime = TimeConverter.GetTransmissionTime(receivedSvTimeNanos); double C1 = transTime * GnssConst.LIGHT_SPEED; bool isPassed = CheckPsuedorange(ref prn, C1); if (!isPassed) { C1 = 0; } if (C1 == 0 && Option.IsSkipZeroPseudorange) { log.Debug(currentUtcTime + ", " + prn + "伪距为0,忽略本数据 "); return(satData); } if (accumulatedDeltaRangeMeters == 0 && Option.IsSkipZeroPhase) { log.Debug(currentUtcTime + ", " + prn + "载波为 0,忽略本数据 "); return(satData); } //时间积累差,带来的近距离变化差 double timeErrorDistance = TimeConverter.GetDifferDistance(); var phaseRange = accumulatedDeltaRangeMeters - timeErrorDistance;//相位距离 var aligner = NumericalAlignerManager.GetOrCreate(prn); if (isClockDisCountChanged) //如果钟跳发生,则将第一个差分伪距设置为当前伪距值。 { aligner.IsReset = true; } phaseRange = aligner.GetAlignedValue(currentUtcTime, phaseRange, C1); double L1 = GetL1(phaseRange, prn, Option.IsToCylePhase); double S1 = cn0DbHz; double D1 = phaseRange; //test for range satData = BuildRinexSatObsData(prn, C1, L1, S1, D1); return(satData); }