public override void Init() { this.DataSource = new RinexFileObsDataSource(FilePath); this.Result = new ObjectTableStorage(); //最后结果 this.Result.Name = DataSource.SiteInfo.SiteName + namePostfix; // if (String.IsNullOrWhiteSpace(Result.Name)) { Result.Name = Path.GetFileNameWithoutExtension(FilePath); } this.BuffferStream = new BufferedStreamService <EpochInformation>(DataSource); //如果平滑伪距,则需要周跳探测 Revisers = new EpochInfoReviseManager(); if (IsSmoothRange) { var interval = DataSource.ObsInfo.Interval; int smoothEpochCount = (int)(600 / interval);//10 min windowData.MaxKeyGap = source.ObsInfo.Interval * 5;//已经包含着周跳探测中了 var CycleSlipDetector = CycleSlipDetectReviser.DefaultDoubleFrequencyDetector(); var rangeReviser = new PhaseSmoothRangeReviser(true, false, smoothEpochCount, true, IonoDifferCorrectionType.DualFreqCarrier); Revisers.AddProcessor(CycleSlipDetector); Revisers.AddProcessor(rangeReviser); } }
public override void Init() { this.DataSource = new RinexFileObsDataSource(FilePath); var interval = DataSource.ObsInfo.Interval == 0? 30: DataSource.ObsInfo.Interval; this.WindowDataManager = new WindowDataManager <SatelliteNumber, Time, WeightedNumeral>(int.MaxValue / 2, interval * 3); //过程计算工具 this.BuffferStream = new BufferedStreamService <EpochInformation>(DataSource); //如果平滑伪距,则需要周跳探测 Revisers = new EpochInfoReviseManager(); if (IsSmoothRange) { int smoothEpochCount = (int)(600 / interval);//10 min windowData.MaxKeyGap = source.ObsInfo.Interval * 5;//已经包含着周跳探测中了 var CycleSlipDetector = CycleSlipDetectReviser.DefaultDoubleFrequencyDetector(); var rangeReviser = new PhaseSmoothRangeReviser(true, false, smoothEpochCount, true, IonoDifferCorrectionType.DualFreqCarrier); Revisers.AddProcessor(CycleSlipDetector); Revisers.AddProcessor(rangeReviser); } this.Result = new MultiSatPeriodRmsNumeralStorage(Path.GetFileName(FilePath) + "_MW最后结果"); //最后结果 this.Result.Name = DataSource.SiteInfo.SiteName; // if (String.IsNullOrWhiteSpace(Result.Name)) { Result.Name = Path.GetFileNameWithoutExtension(FilePath); } }
private void button_viewObs_Click(object sender, EventArgs e) { if (ObsFile == null) { MessageBox.Show("请先读取数据!"); return; } var window = this.namedIntControl_smoothWindow.GetValue(); SmoothedRangeBuilderManager = new CarrierSmoothedRangeBuilderManager(true, window, true, IonoDifferCorrectionType.DualFreqCarrier); ObjectTableStorage table = new ObjectTableStorage(); var EpochInfoBuilder = new RinexEpochInfoBuilder(ObsFile.Header); var _obsDataSource = new RinexFileObsDataSource(ObsPath); var option = new GnssProcessOption(); var context = DataSourceContext.LoadDefault(option, _obsDataSource); var bufferedStream = new BufferedStreamService <EpochInformation>(_obsDataSource, option.BufferSize); SatTimeInfoManager SatTimeInfoManager = new Gnsser.SatTimeInfoManager(_obsDataSource.ObsInfo.Interval); var Reviser = EpochInfoReviseManager.GetDefaultEpochInfoReviser(context, option, SatTimeInfoManager); var checker = EpochCheckingManager.GetDefaultCheckers(context, option); int i = -1; foreach (var item in bufferedStream) { i++; //原始数据检核 var epochInfo = item; if (!checker.Check(item)) { continue; } //数据矫正 bool result = Reviser.Revise(ref epochInfo); if (!result) { continue; } table.NewRow(); table.AddItem("Epoch", epochInfo.ReceiverTime.ToShortTimeString()); //计算伪距平滑值 foreach (var sat in epochInfo) { //观测值,或组合值 var rangeVal = sat.FrequenceA.PseudoRange.CorrectedValue; // sat[type].CorrectedValue; var phaseVal = sat.FrequenceA.PhaseRange.CorrectedValue; // sat[option.PhaseTypeToSmoothRange].CorrectedValue; var manager = SmoothedRangeBuilderManager.GetOrCreate(sat.Prn); var smoothRangeVal = manager.SetRawValue(sat.ReceiverTime, rangeVal, phaseVal, sat.IonoLenOfL1ByDifferL1L2).SetReset(sat.IsUnstable).Build(); table.AddItem(sat.Prn + "_Raw", rangeVal + ""); table.AddItem(sat.Prn + "_Smooth", smoothRangeVal + ""); } i++; } table.EndRow(); this.BindDataSource(table); }
/// <summary> /// 快速计算一个坐标。自动重置数据流。 /// </summary> /// <param name="DataSourceContext"></param> /// <returns></returns> public static SingleSiteGnssResult GetApproxPosition(DataSourceContext DataSourceContext) { GnssProcessOption PositionOption = GnssProcessOption.GetDefaultSimplePseudoRangePositioningOption(); var p = new SimpleRangePositioner(DataSourceContext, PositionOption) { IsUpdateEstimatePostition = true, IsPostCheckEnabled = false,//取消检查,否则报错,2019.05.16, czs }; var Reviser = EpochInfoReviseManager.GetDefaultEpochInfoReviser(DataSourceContext, PositionOption, null); var checker = EpochCheckingManager.GetDefaultCheckers(DataSourceContext, PositionOption); var EpochEphemerisSetter = new EpochEphemerisSetter(DataSourceContext, PositionOption); lock (locker) { var initMaxRms = PositionOption.MaxStdDev; var initType = PositionOption.CaculateType; var initUpdate = PositionOption.IsUpdateEstimatePostition; var initPostCheck = PositionOption.IsResidualCheckEnabled; var initResultCheck = PositionOption.IsResultCheckEnabled; PositionOption.CaculateType = CaculateType.Independent; PositionOption.MaxStdDev = 9999999; PositionOption.IsResidualCheckEnabled = false; PositionOption.IsResultCheckEnabled = false; PositionOption.IsUpdateEstimatePostition = initUpdate; int i = 0; SingleSiteGnssResult GnssResult = null; List <SingleSiteGnssResult> results = new List <SingleSiteGnssResult>(); foreach (var item in DataSourceContext.ObservationDataSource) { i++; if (!checker.Check(item)) { continue; } var info = item; // if (!Reviser.Revise(ref info)) { continue; } Reviser.Revise(ref info); if (info.EnabledSatCount < 4) { continue; } GnssResult = p.Get(item); if (GnssResult != null) { item.SiteInfo.SetApproxXyz(item.SiteInfo.EstimatedXyz); results.Add(GnssResult); } if (i > 5 && results.Count > 0) { results.Sort(new Comparison <SingleSiteGnssResult>(delegate(SingleSiteGnssResult a, SingleSiteGnssResult b) { return((int)(1000 * (a.EstimatedXyzRms.Length - b.EstimatedXyzRms.Length))); })); GnssResult = results[0]; break; } } PositionOption.IsResidualCheckEnabled = initPostCheck; PositionOption.IsUpdateEstimatePostition = initUpdate; PositionOption.IsResultCheckEnabled = initResultCheck; PositionOption.CaculateType = initType; DataSourceContext.ObservationDataSource.Reset(); PositionOption.MaxStdDev = initMaxRms; return(GnssResult); } }
private void button_multiSolve_Click(object sender, EventArgs e) { CheckAndReadObsFile(); double cutOff = namedFloatControl_satCutoff.GetValue(); int smoothWindow = this.namedIntControl_smoothWindow.GetValue(); bool isUserRawValue = this.radioButton_isUserRawValue.Checked; bool isUseSphaseSmoothP = this.radioButton_isUsePhaaseSmoothP.Checked; bool isUserPolyFitValue = this.radioButton_isUserPolyFitVal.Checked; var PhaseSmoothRangeBulider = new NamedCarrierSmoothedRangeBuilderManager(true, smoothWindow, true, IonoDifferCorrectionType.DualFreqCarrier); GlobalIgsGridIonoService ionoService = GlobalIgsGridIonoService.Instance; GlobalIgsGridIonoDcbService ionoDcbService = GlobalIgsGridIonoDcbService.Instance; GlobalIgsEphemerisService ephemerisService = GlobalIgsEphemerisService.Instance; ObjectTableStorage table = new ObjectTableStorage(Path.GetFileName(ObsPath) + "_硬件延迟"); var EpochInfoBuilder = new RinexEpochInfoBuilder(ObsFile.Header); var _obsDataSource = new RinexFileObsDataSource(ObsPath); var option = new GnssProcessOption(); var context = DataSourceContext.LoadDefault(option, _obsDataSource); var bufferedStream = new BufferedStreamService <EpochInformation>(_obsDataSource, option.BufferSize); SatTimeInfoManager SatTimeInfoManager = new Gnsser.SatTimeInfoManager(_obsDataSource.ObsInfo.Interval); var CycleReviser = EpochInfoReviseManager.GetDefaultCycleSlipDetectReviser(context, option); var Reviser = new BufferPolyRangeSmoothReviser(option); //EpochInfoReviseManager.GetDefaultEpochInfoReviser(context, option, SatTimeInfoManager); var checker = EpochCheckingManager.GetDefaultCheckers(context, option); int i = -1; var siteXyz = ObsFile.Header.ApproxXyz; progressBarComponent1.InitProcess(ObsFile.Count); foreach (var item in bufferedStream) { i++; progressBarComponent1.PerformProcessStep(); //原始数据检核 var epochInfo = item; //if (!checker.Check(item)) //{ // continue; //} ////数据矫正 if (isUseSphaseSmoothP) //需要周跳探测 { bool result = CycleReviser.Revise(ref epochInfo); if (!result) { continue; } } if (isUserPolyFitValue)//缓存与多项式拟合改正 { Reviser.Buffers = bufferedStream.MaterialBuffers; bool result = Reviser.Revise(ref epochInfo); if (!result) { continue; } } table.NewRow(); table.AddItem("Epoch", epochInfo.ReceiverTime.ToShortTimeString()); //计算伪距平滑值 foreach (var sat in epochInfo) { var prn = sat.Prn; var time = sat.ReceiverTime; var eph = ephemerisService.Get(prn, time); if (eph == null) { continue; } var satXyz = eph.XYZ; var polar = Geo.Coordinates.CoordTransformer.XyzToGeoPolar(satXyz, siteXyz, AngleUnit.Degree); if (polar.Elevation < cutOff) { continue; } double P1_P2sat = ionoDcbService.GetDcb(time, prn).Value *GnssConst.MeterPerNano; // double P1_P2recMeter = ionoDcbService.GetDcbMeterForP1(time, Path.GetFileName(ObsPath).Substring(0, 4).ToLower()); var F1 = sat.FrequenceA.Frequence; // Frequence.GetFrequence(prn, 1, time); var F2 = sat.FrequenceB.Frequence; //Frequence.GetFrequence(prn, 2, time); var f1 = F1.Value * 1e6; //恢复单位 var f2 = F2.Value * 1e6; double f1f1 = f1 * f1; double f2f2 = f2 * f2; double a = -40.28 * (f2f2 - f1f1) / (f1f1 * f2f2); //观测值,或组合值 var P1 = sat.FrequenceA.PseudoRange.Value; var P2 = sat.FrequenceB.PseudoRange.Value; var L1 = sat.FrequenceA.PhaseRange.Value; var L2 = sat.FrequenceB.PhaseRange.Value; double differP = P1 - P2;//raw Value if (isUseSphaseSmoothP) { var smootherP1 = PhaseSmoothRangeBulider.GetOrCreate(prn + "_P1"); var smootherP2 = PhaseSmoothRangeBulider.GetOrCreate(prn + "_P2"); var P1s = smootherP1 .SetReset(sat.IsUnstable) .SetRawValue(sat.ReceiverTime, P1, L1, sat.IonoLenOfL1ByDifferL1L2) .Build(); var P2s = smootherP2 .SetReset(sat.IsUnstable) .SetRawValue(sat.ReceiverTime, P2, L2, sat.IonoLenOfL2ByDifferL1L2) .Build(); differP = P1s.Value - P2s.Value; } if (isUserPolyFitValue) { differP = sat.FrequenceA.PseudoRange.CorrectedValue - sat.FrequenceB.PseudoRange.CorrectedValue; } var cTEC = ionoService.GetSlope(time, siteXyz, satXyz); double ionoRange = a * cTEC.Value * 1e16; // 单位是1e16 double rawDifferP = P1 - P2; double ionoP1 = ionoService.GetSlopeDelayRange(time, siteXyz, satXyz, F1.Value); double ionoP2 = ionoService.GetSlopeDelayRange(time, siteXyz, satXyz, F2.Value); double rawDifferIonoP = ionoP1 - ionoP2; var recDcb = differP - P1_P2sat - rawDifferIonoP; //table.AddItem("L1", L1); //table.AddItem("L2", L2); //table.AddItem("P1", P1); //table.AddItem("P2", P2); //table.AddItem("P1S", P1s); //table.AddItem("P2S", P2s); //table.AddItem("P1-P2", rawDifferP); //table.AddItem("IonoDiffer", rawDifferIonoP); //table.AddItem("SatDcb", P1_P2sat); //table.AddItem("P1-P2_rec", P1_P2recMeter); table.AddItem(prn + "", recDcb); //table.AddItem("SmRecDcb", smRecDcb); //table.AddItem(sat.Prn + "_Raw", rangeVal + ""); //table.AddItem(sat.Prn + "_Smooth", smoothRangeVal + ""); } i++; } progressBarComponent1.Full(); table.EndRow(); this.BindDataSource(table); }
/// <summary> /// 具体的执行 /// </summary> /// <param name="inPath"></param> /// <param name="outPath"></param> protected override void Execute(string inPath, string outPath) { this.EphemerisDataSource = EphemerisDataSourceFactory.Create(CurrentParam.EphemerisPath); if (File.Exists(CurrentParam.ClockPath)) { this.ClockFile = new Data.SimpleClockService(CurrentParam.ClockPath); } RinexFileObsDataSource obsDataSource = new RinexFileObsDataSource(inPath, true); GnssProcessOption option = GnssProcessOption.GetDefault(GnsserConfig, obsDataSource.ObsInfo); DataSourceContext DataSourceContext = DataSourceContext.LoadDefault(option, obsDataSource, this.EphemerisDataSource, ClockFile); EpochInfoReviseManager reviser = new EpochInfoReviseManager(DataSourceContext, option); //写入到流 Gnsser.Data.Rinex.RinexObsFileWriter writer = new Data.Rinex.RinexObsFileWriter(outPath, CurrentParam.OutputVersion); EpochInfoToRinex EpochInfoToRinex = new Domain.EpochInfoToRinex(this.CurrentParam.OutputVersion, true); //直接写入数据流,并不存储,以节约空间。 Gnsser.Data.Rinex.RinexObsFileHeader newHeader = null; int maxBufferEpoch = 200; int i = 0; foreach (var item in obsDataSource) { //预处理在此进行!!! var processed = item; reviser.Revise(ref processed); if (processed != null) { var epochObs = EpochInfoToRinex.Build(processed); if (newHeader == null) { newHeader = epochObs.Header; writer.WriteHeader(newHeader); } writer.WriteEpochObservation(epochObs); if (i > maxBufferEpoch) { writer.Writer.Flush(); } } i++; } writer.Writer.Close(); TimeSpan span = DateTime.Now - startTime; StringBuilder sb = new StringBuilder(); sb.Append("耗时:" + DateTimeUtil.GetFloatString(span)); sb.AppendLine(",输出到 " + outPath); //信息汇总 lock (locker) { var path = Path.Combine(Path.GetDirectoryName(outPath), "PositionPreprocess.summery"); Geo.Utils.FileUtil.CheckOrCreateDirectory(Path.GetDirectoryName(path)); File.AppendAllText(path, sb.ToString()); } }