public RinexEpochObservation GetEpochObservation(GlonassEpochMessage EpochMessage) { RinexEpochObservation rinex = new RinexEpochObservation(); rinex.ReceiverTime = EpochMessage.Header.Time; foreach (var item in EpochMessage) { var msg = item as GlonassNormalMessage1012; RinexSatObsData satData = GetSatObsData(msg); rinex.Add(satData.Prn, satData); } return(rinex); }
/// <summary> /// RTCM MSM文件信息转换为观测文件信息.此处返回的是RINEX3.0的数据类型。 /// </summary> /// <param name="msg"></param> /// <param name="HeaderOfMSM"></param> /// <returns></returns> public RinexEpochObservation GetRinexEpochObservation(BaseMSM msg, HeaderOfMSM HeaderOfMSM) { RinexEpochObservation RinexEpochObservation = new RinexEpochObservation(); uint messageNumber = HeaderOfMSM.MessageNumber; double wavelength = 0; int frequencyBand = 0; string str = null; string attribute = null; double P = 0, L = 0, D = 0, S = 0; int j = 0; int index = 0; double p = 0; SatelliteType satType = SatelliteType.G; for (int i = 0; i < HeaderOfMSM.SatCount; i++) { RinexSatObsData SatObsData = new RinexSatObsData(); for (int k = 0; k < HeaderOfMSM.Nsig; k++) { if (HeaderOfMSM.CellMask[index++] == 0) { continue; } if (messageNumber >= 1071 && messageNumber <= 1077)//GPS { satType = SatelliteType.G; SatObsData.Prn = new SatelliteNumber(HeaderOfMSM.SatlliteMask[i], SatelliteType.G); str = msm_sig_gps[HeaderOfMSM.SignalMask[k] - 1]; frequencyBand = int.Parse(str.Substring(0, 1)); attribute = str.Substring(1, 1); if (frequencyBand == 1) { wavelength = Frequence.GpsL1.WaveLength; } else if (frequencyBand == 2) { wavelength = Frequence.GpsL2.WaveLength; } else if (frequencyBand == 5) { wavelength = Frequence.GpsL5.WaveLength; } } else if (messageNumber >= 1081 && messageNumber <= 1087)//GLONASS { satType = SatelliteType.R; SatObsData.Prn = new SatelliteNumber(HeaderOfMSM.SatlliteMask[i], SatelliteType.R); } else if (messageNumber >= 1091 && messageNumber <= 1097)//GALILEO { satType = SatelliteType.E; SatObsData.Prn = new SatelliteNumber(HeaderOfMSM.SatlliteMask[i], SatelliteType.E); } else if (messageNumber >= 1101 && messageNumber <= 1017)//SBS { satType = SatelliteType.S; SatObsData.Prn = new SatelliteNumber(HeaderOfMSM.SatlliteMask[i], SatelliteType.S); } else if (messageNumber >= 1111 && messageNumber <= 1117)//QZS { satType = SatelliteType.J; SatObsData.Prn = new SatelliteNumber(HeaderOfMSM.SatlliteMask[i], SatelliteType.J); } else if (messageNumber >= 1121 && messageNumber <= 1127)//BDS { satType = SatelliteType.C; SatObsData.Prn = new SatelliteNumber(HeaderOfMSM.SatlliteMask[i], SatelliteType.C); str = msm_sig_gps[HeaderOfMSM.SignalMask[k] - 1]; frequencyBand = int.Parse(str.Substring(0, 1)); attribute = str.Substring(1, 1); if (frequencyBand == 2) { wavelength = Frequence.CompassB1.WaveLength; } else if (frequencyBand == 6) { wavelength = Frequence.CompassB3.WaveLength; } else if (frequencyBand == 7) { wavelength = Frequence.CompassB2.WaveLength; } } var ObservationCodeOfC = new ObservationCode(ObservationType.C, frequencyBand, attribute); var ObservationCodeOfL = new ObservationCode(ObservationType.L, frequencyBand, attribute); var ObservationCodeOfS = new ObservationCode(ObservationType.S, frequencyBand, attribute); var ObservationCodeOfD = new ObservationCode(ObservationType.D, frequencyBand, attribute); if (msg.NumberOfIntegerMsInSatRoughRange.Count != 0) { p = msg.NumberOfIntegerMsInSatRoughRange[i] * 0.001 + msg.SatelliteRoughRangesModulo1ms[i] * Math.Pow(2, -13); } else { p = msg.SatelliteRoughRangesModulo1ms[i] * Math.Pow(2, -13); } if (msg.SignalFinePseudorange.Count != 0) { P = msg.SignalFinePseudorange[j] * Math.Pow(2, -24) + p; } else if (msg.SignalFinePseudorangeWithExtendedResolution.Count != 0) { P = msg.SignalFinePseudorangeWithExtendedResolution[j] * Math.Pow(2, -29) + p; } P = P * RtcmConst.LightSpeedPerMillisecond; if (msg.SignalFinePhaseRange.Count != 0) { L = msg.SignalFinePhaseRange[j] * Math.Pow(2, -29) + p; } else if (msg.SignalFinePhaseRangeWithExtendedResolution.Count != 0) { L = msg.SignalFinePhaseRangeWithExtendedResolution[j] * Math.Pow(2, -31) + p; } L = L * RtcmConst.LightSpeedPerMillisecond / wavelength; if (msg.PhaseRangeLockTimeIndicator.Count != 0) { S = msg.PhaseRangeLockTimeIndicator[j]; } else if (msg.PhaseRangeLockTimeIndicatorWithExtendedRangeAndResolution[j] != 0) { S = msg.PhaseRangeLockTimeIndicatorWithExtendedRangeAndResolution[j]; } if (messageNumber % 10 == 5 || messageNumber % 10 == 7 && msg.SatRoughPhaseRangeRate.Count != 0) { if (msg.SatRoughPhaseRangeRate[i] > -1638.4) { D = -(msg.SatRoughPhaseRangeRate[i] * 0.001 + msg.SignalFinePhaseRangeRate[j] * 0.0001) / wavelength; } } SatObsData.Add(ObservationCodeOfC.ToString(), P); SatObsData.Add(ObservationCodeOfL.ToString(), L); SatObsData.Add(ObservationCodeOfS.ToString(), S); SatObsData.Add(ObservationCodeOfD.ToString(), D); //更新头部信息 var obsCodes = new List <string>(); obsCodes.Add(ObservationCodeOfC.ToString()); obsCodes.Add(ObservationCodeOfL.ToString()); obsCodes.Add(ObservationCodeOfS.ToString()); obsCodes.Add(ObservationCodeOfD.ToString()); if (ObsHeader != null) { ObsHeader.ObsCodes[satType] = obsCodes; } j++; } RinexEpochObservation.Add(SatObsData.Prn, SatObsData); } RinexEpochObservation.Header = ObsHeader; RinexEpochObservation.ReceiverTime = HeaderOfMSM.EpochTime; return(RinexEpochObservation); }