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); }
private void button_viewObs_Click(object sender, EventArgs e) { if (ObsFile == null) { MessageBox.Show("请先读取数据!"); return; } EnableRunButton(false); double cutOff = namedFloatControl_satCutoff.GetValue(); int smoothWindow = this.namedIntControl_smoothWindow.GetValue(); var EpochInfoBuilder = new RinexEpochInfoBuilder(ObsFile.Header); var _obsDataSource = new RinexFileObsDataSource(ObsPath); SmoothedRangeBuilderManagerP1 = BuildPhaseSmoothRangeBulider(); ObjectTableManager txtManager = new ObjectTableManager(10000000, OutDirectory); ObjectTableStorage table = txtManager.GetOrCreate(System.IO.Path.GetFileNameWithoutExtension(ObsPath) + "_Data");// new TableTextStorage(); var option = new GnssProcessOption(); option.VertAngleCut = this.namedFloatControl_satCutoff.GetValue(); var context = DataSourceContext.LoadDefault(option, _obsDataSource); var bufferedStream = new BufferedStreamService <EpochInformation>(_obsDataSource, option.BufferSize); //var EphemerisEndTime = context.EphemerisService.TimePeriod.BufferedEnd; SatTimeInfoManager SatTimeInfoManager = new Gnsser.SatTimeInfoManager(_obsDataSource.ObsInfo.Interval); //var Reviser = EpochInfoReviseManager.GetDefaultCycleSlipDetectReviser(context, option); var Reviser = new BufferPolyRangeSmoothReviser(option); //.GetDefaultEpochInfoReviser(context, option, SatTimeInfoManager); var checker = EpochCheckingManager.GetDefaultCheckers(context, option); int i = -1; progressBarComponent1.InitProcess(ObsFile.Count); foreach (var item in bufferedStream) { i++; progressBarComponent1.PerformProcessStep(); //原始数据检核 var epochInfo = item; if (!checker.Check(item)) { continue; } //数据矫正 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 rangeVal = sat.FrequenceA.PseudoRange.Value; // sat[type].CorrectedValue; var phaseVal = sat.FrequenceA.PhaseRange.Value; // sat[option.PhaseTypeToSmoothRange].CorrectedValue; var manager = SmoothedRangeBuilderManagerP1.GetOrCreate(sat.Prn); var smoothRangeVal = manager.SetRawValue(sat.ReceiverTime, rangeVal, phaseVal, 0) .SetReset(sat.IsUnstable).Build().Value; table.AddItem(sat.Prn + "_P1_Raw", rangeVal); table.AddItem(sat.Prn + "_P1_PolySmooth", sat.FrequenceA.PseudoRange.CorrectedValue); table.AddItem(sat.Prn + "_P1_PhaseSmooth", smoothRangeVal); } i++; } progressBarComponent1.Full(); table.EndRow(); this.objectTableControl1.DataBind(table); txtManager.WriteAllToFileAndCloseStream(); Geo.Utils.FormUtil.ShowIfOpenDirMessageBox(OutDirectory); EnableRunButton(true); }
/// <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> /// <returns></returns> protected override IChecker <EpochInformation> BuildChecker() { return(EpochCheckingManager.GetDefaultCheckers(Context, Option)); }