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> /// <returns></returns> protected override BufferedStreamService <EpochInformation> BuildBufferedStream() { var DataSource = new RinexFileObsDataSource(FilePath); var bufferStream = new BufferedStreamService <EpochInformation>(DataSource, Option.BufferSize); return(bufferStream); }
/// <summary> /// 构建数据表,绘制相位数据 /// </summary> /// <param name="isDrawAllPhase"></param> /// <returns></returns> private ObjectTableStorage BuildObjectTable(bool isDrawAllPhase) { var ObsDataSource = new RinexFileObsDataSource(this.ObsPath); ObjectTableStorage table = new ObjectTableStorage(); foreach (var epochInfo in ObsDataSource) { table.NewRow(); //加下划线,确保排序为第一个 table.AddItem("_Epoch", epochInfo.ReceiverTime); foreach (var sat in epochInfo) { if (isDrawAllPhase) { foreach (var phase in sat.Data) { var val = phase.Value.PhaseRange.RawPhaseValue; if (Geo.Utils.DoubleUtil.IsValid(val) || val == 0) { table.AddItem(sat.Prn + "_" + phase.Key, val); } } } else if (Geo.Utils.DoubleUtil.IsValid(sat.FirstAvailable.PhaseRange.RawPhaseValue)) { table.AddItem(sat.Prn, sat.FirstAvailable.PhaseRange.RawPhaseValue); } } table.EndRow(); } return(table); }
/// <summary> /// 每个历元计算一次星间单差宽巷模糊度 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_calWLFCBs_Click(object sender, EventArgs e) { SatelliteNumber refSat; refSat = (SatelliteNumber)this.bindingSource_SDWL.Current; //需要处理的卫星导航系统类型 if (checkBox_BD.Checked) { SatelliteTypes.Add(SatelliteType.C); } if (checkBox_GPS.Checked) { SatelliteTypes.Add(SatelliteType.G); } observationDataSource = new RinexFileObsDataSource(this.textBox_obsPath.Text); pppar = new PppAR(observationDataSource, refSat, SatelliteTypes); pppar.calculateMW(); pppar.CalculateSDWLFCBs(); #region //FilterEpochObservation为需要的卫星导航系统的当前离一按的观测值 //EpochObservation FilterEpochObservation = new EpochObservation(); //List<EpochObservation> ValidEpoch = new List<EpochObservation>(); //foreach(EpochObservation os in obsFile) //{ // FilterEpochObservation = checkeddata(os, types); // if(FilterEpochObservation.Prns.Contains(refSat)) // { // ValidEpoch.Add(FilterEpochObservation); // } // else // { // break;//首次没有出现参考星就退出 // } //} ////对没课卫星组MW组合 //int time=0; //foreach(var os in ValidEpoch) //{ // foreach(var sat in os.Prns) // { // ObservationData currentsatdata = ValidEpoch[time].GetObservationData(sat); // double P1 = currentsatdata._values[GnssDataType.P1].Value; // double P2 = currentsatdata._values[GnssDataType.P2].Value; // double L1 = currentsatdata._values[GnssDataType.L1].Value; // double L2 = currentsatdata._values[GnssDataType.L2].Value; // double MW = (L1 - L2) - ((GnssConst.GPS_L1_FREQ * P1 + GnssConst.GPS_L2_FREQ * P2) / (GnssConst.GPS_L1_FREQ + GnssConst.GPS_L2_FREQ)) * (GnssConst.GPS_L1_FREQ - GnssConst.GPS_L2_FREQ) / GnssConst.LIGHT_SPEED; // } //} #endregion }
/// <summary> /// /// </summary> /// <param name="lines">文件路径</param> public EnableObsCount(string[] lines) { // for (int i = 0; i < lines.Length; i++) { string itemA = lines[i]; RinexFileObsDataSource fileA = new RinexFileObsDataSource(itemA); } }
/// <summary> ///构建一个文件的表格 /// </summary> /// <param name="angleCut"></param> /// <param name="filePath"></param> /// <param name="satType"></param> /// <returns></returns> private ObjectTableStorage BuildMpTable(double angleCut, string filePath, SatelliteType satType) { var name = Path.GetFileName(filePath); MultiPathSolver multiPathSolver = new MultiPathSolver(satType); var stream = new RinexFileObsDataSource(filePath); ObjectTableStorage table = new ObjectTableStorage("MPOf" + name); foreach (var epoch in stream) { epoch.RemoveOtherGnssSystem(satType); if (epoch.Count == 0) { continue; } table.NewRow(); table.AddItem("Epoch", epoch.ReceiverTime); foreach (var sat in epoch) { var eph = GlobalIgsEphemerisService.Instance.Get(sat.Prn, sat.ReceiverTime); if (eph != null) { var polar = Geo.Coordinates.CoordTransformer.XyzToGeoPolar(eph.XYZ, epoch.SiteInfo.ApproxXyz); if (polar.Elevation < angleCut) { continue; } } //var L1 = sat.FrequenceA.PhaseRange.RawPhaseValue; //var L2 = sat.FrequenceB.PhaseRange.RawPhaseValue; var L1 = sat.FrequenceA.PhaseRange.Value; var L2 = sat.FrequenceB.PhaseRange.Value; var P1 = sat.FrequenceA.PseudoRange.Value; var P2 = sat.FrequenceB.PseudoRange.Value; if (L1 == 0 || L2 == 0 || P1 == 0 || P2 == 0 ) { continue; } var mp1 = multiPathSolver.GetMpA(P1, L1, L2); var mp2 = multiPathSolver.GetMpB(P2, L1, L2); table.AddItem(sat.Prn + "_MP1", mp1); table.AddItem(sat.Prn + "_MP2", mp2); } } return(table); }
private void button_readFile_Click(object sender, EventArgs e) { if (!Geo.Utils.FormUtil.CheckExistOrShowWarningForm(FilePath)) { return; } //加载文件数据 ObsDataSource = new RinexFileObsDataSource(FilePath, true); ObsDataAnalyst = new ObsDataAnalyst(ObsDataSource, multiGnssSystemSelectControl1.SatelliteTypes); DrawLine(); SaveAndOpenFile(); }
///// <summary> ///// 初始以Time、GPS等设计 ///// </summary> //public void InitDetect() //{ // if (files.Length <= 0) { throw new Exception("选择独立基线前,请配置好观测数据!"); } // DataOfAllSites = new Dictionary<string, SiteEpochSatData>(); // int m = 0; // foreach (var file in files) // { // Gnsser.Data.Rinex.FileStreamObsDataSource reader = new FileStreamObsDataSource(file, false); // SiteEpochSatData siteEpochSatData = new SiteEpochSatData(); // siteEpochSatData.SiteName = reader.SiteInfo.MarkerName.ToUpper(); // siteEpochSatData.SiteNumber = m; // m++; // foreach (var key in reader) // { // siteEpochSatData.Data.Add(key.Time, key.Prns); // string[] prns = new string[key.Prns.Count]; // int kk = 0; // foreach (var prn in key.Prns) // { // prns[kk] = prn.ToString(); // kk++; // } // siteEpochSatData.EpochSatData.Add(key.Time, prns); // } // DataOfAllSites.Add(reader.SiteInfo.MarkerName.ToUpper(), siteEpochSatData); // } //} /// <summary> /// 更改简洁版 /// </summary> public void Init() { if (files.Length <= 0) { throw new Exception("选择独立基线前,请配置好观测数据!"); } DataOfAllSites = new Dictionary <string, SiteEpochSatData>(); int m = 0; foreach (var file in files) { var reader = new RinexFileObsDataSource(file, false); SiteEpochSatData siteEpochSatData = new SiteEpochSatData(); siteEpochSatData.SiteName = reader.SiteInfo.SiteName.ToUpper(); siteEpochSatData.SiteNumber = m; m++; foreach (var item in reader) { double seconds = item.ReceiverTime.Hour * 60 * 60 + item.ReceiverTime.Minute * 60 + item.ReceiverTime.Seconds; double seconds1 = item.ReceiverTime.SecondsOfDay; if (seconds != seconds1) { throw new Exception("单基线选取中时间统计出错!"); } int[] prn = new int[item.EnabledPrns.Count]; for (int j = 0; j < item.EnabledPrns.Count; j++) { prn[j] = item.EnabledPrns[j].PRN; } siteEpochSatData.Data.Add(seconds, prn); //string[] prns = new string[key.Prns.Count]; //int kk = 0; //foreach (var prn in key.Prns) //{ // prns[kk] = prn.ToString(); // kk++; //} siteEpochSatData.EpochSatData.Add(seconds, prn); } DataOfAllSites.Add(reader.SiteInfo.SiteName.ToUpper(), siteEpochSatData); } }
private void button_showOnMap_Click(object sender, EventArgs e) { List <ISingleSiteObsStream> obsDataSources = RinexFileObsDataSource.LoadObsData(this.textBox_obsPath.Lines); List <AnyInfo.Geometries.Point> pts = new List <AnyInfo.Geometries.Point>(); foreach (var item in obsDataSources) { pts.Add(new AnyInfo.Geometries.Point(item.SiteInfo.ApproxGeoCoord, null, item.SiteInfo.SiteName)); } if (ShowLayer != null && pts.Count != 0) { ShowLayer(LayerFactory.CreatePointLayer(pts)); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="pathes"></param> /// <param name="IsSameSatRequired"></param> /// <param name="BaseSiteSelectType"></param> /// <param name="IndicatedBaseSiteName"></param> public MultiSiteObsStream(IEnumerable <String> pathes, BaseSiteSelectType BaseSiteSelectType, bool IsSameSatRequired, string IndicatedBaseSiteName = null) { this.IsSameSatRequired = IsSameSatRequired; this.IndicatedBaseSiteName = IndicatedBaseSiteName; this.BaseSiteSelectType = BaseSiteSelectType; this.Pathes = new List <string>(pathes); this.DataSources = new BaseDictionary <string, ISingleSiteObsStream>(); foreach (var item in Pathes) { var source = new RinexFileObsDataSource(item); this.DataSources.Add(source.Name, source); } Init(); }
/// <summary> /// 创建单点定位 /// </summary> /// <param name="obsPath">测站信息</param> /// <param name="startTime">起始计算时间</param> /// <returns></returns> private IonFreeDoubleDifferPositioner BuildPositioner(string obsPath, RinexFileObsDataSource refStationPath, BufferedTimePeriod startTime) { GnssProcessOption PositionOption = GetModel(startTime); #region 星历钟差数据源配置 #region 星历数据配置 FileEphemerisService ephemerisDataSource = null; if (IsSetEphemerisFile) { string ephemerisPath = this.textBox_navPath.Text; if (!File.Exists(ephemerisPath)) { throw new FileNotFoundException("指定星历文件不存在!\r\n" + ephemerisPath); } FileEphemerisType ephType = EphemerisDataSourceFactory.GetFileEphemerisTypeFromPath(ephemerisPath); ephemerisDataSource = EphemerisDataSourceFactory.Create(ephemerisPath); } #endregion #region 钟差数据配置 Data.ISimpleClockService clock = null; if (this.checkBox_enableClockFile.Checked) { clock = new Data.SimpleClockService(this.textBox_ClockPath.Text); } #endregion #endregion #region 定位器构造 //加载文件数据 RinexFileObsDataSource refObservationDataSource = (refStationPath); var rovObservationDataSource = new RinexFileObsDataSource(obsPath); DataSourceContext context = DataSourceContext.LoadDefault(PositionOption, rovObservationDataSource, ephemerisDataSource, clock); IonFreeDoubleDifferPositioner pp = new IonFreeDoubleDifferPositioner(context, PositionOption); //pp.Produced += pp_ProgressIncreased; return(pp); #endregion }
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); }
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); }
private void SerialProcess() { //foreach (var path in _obsDataSources) //{ // try // { // //构建 // _curentPositioner = BuildPositioner(path.obsPath, TimePeriod); // //计算 // List<PositionResult> results = _curentPositioner.Gets(path); // //输出 // if (IsOutputResultFile) // SaveToDirectory(results, path); // //通知 // _processedFileCount++; // ShowProcessedFileCount(_processedFileCount); // //释放资源 // results.ForEach(m => m.Dispose()); // results = null; // //是否终止计算 // if (_curentPositioner.IsCancel || _IsCanceled) break; // } // catch (Exception ex) // { // if (!IgnoreException) FormUtil.ShowErrorMessageBox("计算出错了!" + ex.Message); // } //} foreach (var bTask in BaselineTaskList) { try { ISingleSiteObsStream item = new RinexFileObsDataSource(bTask.rovStationPath); RinexFileObsDataSource refObservationDataSource = new RinexFileObsDataSource(bTask.refStationPath); if (bTask.refStationXyz != null || bTask.refStationXyz.Norm != 0) { refObservationDataSource.SiteInfo.SetApproxXyz(bTask.refStationXyz); } if (bTask.rovStationXyz != null || bTask.rovStationXyz.Norm != 0) { item.SiteInfo.SetApproxXyz(bTask.rovStationXyz); } //构建 _curentPositioner = BuildPositioner(bTask.rovStationPath, refObservationDataSource, TimePeriod); //计算 List <BaseGnssResult> results = null;// _curentPositioner.Gets(); //输出 if (IsOutputResultFile) { SaveToFile(results); } //通知 _processedFileCount++; ShowProcessedFileCount(_processedFileCount); //释放资源 results.ForEach(m => m.Dispose()); results = null; //是否终止计算 //if (_curentPositioner.IsCancel || _IsCanceled) break; } catch (Exception ex) { if (!IgnoreException) { FormUtil.ShowErrorMessageBox("计算出错了!" + ex.Message); } } } }
private void ParallelProcess() { _positioners.Clear(); ////Parallel.For(0, obsDataSources.Count, this.parallelConfigControl1.ParallelOptions, (time, state) => //Parallel.ForEach(_obsDataSources, this.parallelConfigControl1.ParallelOptions, (obsData, state) => //{ // try // { // //构建 // IPointPositioner PointPositioner = BuildPositioner(obsData.obsPath, TimePeriod); // _positioners.Add(PointPositioner); // //计算 // List<PositionResult> colName = PointPositioner.Gets(obsData); // //输出 // if (IsOutputResultFile) // SaveToDirectory(colName, obsData); // //通知 // _processedFileCount++; // ShowProcessedFileCount(_processedFileCount); // //释放资源 // _positioners.Remove(PointPositioner); // colName.ForEach(m => m.Dispose()); // colName = null; // //是否终止计算 // if (_IsCanceled || PointPositioner.IsCancel) state.Break(); // } // catch (Exception ex) // { // if (!IgnoreException) FormUtil.ShowErrorMessageBox("并行计算错误!" + ex.Message); // } //}); //Parallel.For(0, obsDataSources.Count, this.parallelConfigControl1.ParallelOptions, (time, state) => Parallel.ForEach(BaselineTaskList, this.parallelConfigControl1.ParallelOptions, (bTask, state) => { try { var obsData = new MultiSiteObsStream(bTask.Pathes, BaseSiteSelectType.GeoCenter, true); RinexFileObsDataSource refObservationDataSource = new RinexFileObsDataSource(bTask.refStationPath); if (bTask.refStationXyz != null || bTask.refStationXyz.Norm != 0) { obsData.OtherDataSource.SiteInfo.SetApproxXyz(bTask.refStationXyz); } if (bTask.rovStationXyz != null || bTask.rovStationXyz.Norm != 0) { obsData.BaseDataSource.SiteInfo.SetApproxXyz(bTask.rovStationXyz); } //构建 var pp = BuildPositioner(bTask.rovStationPath, refObservationDataSource, TimePeriod); _positioners.Add(bTask); //计算 List <BaseGnssResult> list = new List <BaseGnssResult>(); foreach (var item in obsData) { list.Add(pp.Get(item)); } //输出 if (IsOutputResultFile) { SaveToFile(list); } //通知 _processedFileCount++; ShowProcessedFileCount(_processedFileCount); //释放资源 _positioners.Remove(bTask); list.ForEach(m => m.Dispose()); list = null; //是否终止计算 if (_IsCanceled) { state.Break(); } } catch (Exception ex) { if (!IgnoreException) { FormUtil.ShowErrorMessageBox("并行计算错误!" + ex.Message); } } }); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { StartTime = DateTime.Now; int startIndex = int.Parse(textBox_startEpoch.Text); int count = int.Parse(this.textBox_caculateCount.Text); bool isRevseCsUsed = this.checkBox_isreversed.Checked; var path = fileOpenControl1.FilePath; if (!File.Exists(path)) { MessageBox.Show("文件不存在!"); return; } var fileName = Path.GetFileName(path); ResultTables = new ObjectTableManager(this.directorySelectionControl1.Path); var observations = new RinexFileObsDataSource(path); DataSourse = new BufferedStreamService <EpochInformation>(observations); DataSourse.MaterialInputted += DataSourse_MaterialInputted; log.Info("载入数据源 " + DataSourse); GnssSysRemover = new Gnsser.GnssSysRemover(new List <SatelliteType>() { gnssSystemSelectControl1.SatelliteType }); ReverseCycleSlipeReviser = CreateReveredCsReviser(); CycleSlipDetector = CreateCsReviser(); InstantValueStorage = new Geo.InstantValueStorage(); int index = 0; var table = ResultTables.GetOrCreate(DataSourse.Name + "_周跳探测结果"); progressBarComponent1.InitProcess(observations.Header.ObsInfo.Count); foreach (var item in DataSourse) { progressBarComponent1.PerformProcessStep(); if (IsCancel || index >= count + startIndex) { break; } if (index < startIndex) { index++; continue; } var info = item; if (isRevseCsUsed) { ReverseCycleSlipeReviser.Buffers = DataSourse.MaterialBuffers; ReverseCycleSlipeReviser.Revise(ref info); } var list = info.UnstablePrns; if (list.Count > 0) { table.NewRow(); table.AddItem("Epoch", item.ReceiverTime); foreach (var prn in list) { table.AddItem(prn, true); InstantValueStorage.Regist(prn.ToString(), item.ReceiverTime); } } index++; } var obsType = enumRadioControl1.GetCurrent <SatObsDataType>(); CycleSlipDetector.WriteStorageToFile(this.directorySelectionControl1.Path, fileName, obsType); ResultTables.WriteAllToFileAndClearBuffer(); progressBarComponent1.Full(); }
/// <summary> /// 统计两个测站同步观测时段内的共视卫星数 /// </summary> /// <param name="referObsDataSource">观测站数据源</param> /// <param name="rovpath">流动站测站信息</param> public EnableObsCount(RinexFileObsDataSource ObsDataSourceA, RinexFileObsDataSource ObsDataSourceB) { this.ObsDataSourceA = ObsDataSourceA; this.ObsDataSourceB = ObsDataSourceB; }
/// <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()); } }
/// <summary> /// 具体的执行 /// </summary> /// <param name="baseline"></param> /// <param name="outPath"></param> protected void Execute(Baseline baseline, string outPath) { if (PathUtil.IsValidPath(CurrentParam.EphemerisPath)) { if (this.EphemerisDataSource == null || this.EphemerisDataSource.Name != Path.GetFileName(CurrentParam.EphemerisPath)) { var sp3 = InputFileManager.GetLocalFilePath(CurrentParam.EphemerisPath, "*.sp3"); if (PathUtil.IsValidPath(sp3)) { this.EphemerisDataSource = EphemerisDataSourceFactory.Create(sp3); } } } if (PathUtil.IsValidPath(CurrentParam.ClockPath)) { if (this.ClockFile == null || this.ClockFile.Name != Path.GetFileName(CurrentParam.ClockPath)) { var clk = InputFileManager.GetLocalFilePath(CurrentParam.ClockPath, "*.clk"); if (PathUtil.IsValidPath(clk)) { this.ClockFile = new Data.SimpleClockService(clk); } } } var refPath = ObsFiles.Find(m => m.ToLower().Contains(baseline.StartName.ToLower())); var rovPath = ObsFiles.Find(m => m.ToLower().Contains(baseline.EndName.ToLower())); if (refPath == null || rovPath == null) { throw new ArgumentException("没有找到基线对应的文件!" + baseline.ToString()); return; } var inputPathes = new string[] { refPath, rovPath }; RinexFileObsDataSource refObsDataSource = new RinexFileObsDataSource(refPath, true); RinexFileObsDataSource rovObsDataSource = new RinexFileObsDataSource(rovPath, true); if (SiteInfoDics != null) { var siteName = baseline.StartName.ToUpper(); if (SiteInfoDics.ContainsKey(siteName)) { refObsDataSource.SiteInfo.SetApproxXyz(SiteInfoDics[siteName].EstimatedXyz); } siteName = baseline.EndName.ToUpper(); if (SiteInfoDics.ContainsKey(siteName)) { rovObsDataSource.SiteInfo.SetApproxXyz(SiteInfoDics[siteName].EstimatedXyz); } } GnssProcessOption option = GnssProcessOption.GetDefault(GnsserConfig, refObsDataSource.ObsInfo); option.GnssSolverType = GnssSolverType.无电离层双差; var source = new MultiSiteObsStream(inputPathes, BaseSiteSelectType.GeoCenter, true, ""); DataSourceContext context = DataSourceContext.LoadDefault(option, source, EphemerisDataSource, ClockFile); IntegralGnssFileSolver Solver = new IntegralGnssFileSolver(); Solver.Completed += Solver_Completed; Solver.Option = option; Solver.IsCancel = false; Solver.Solver = GnssSolverFactory.Create(context, option);; Solver.Init(inputPathes); Solver.Run(); var last = Solver.CurrentGnssResult; lock (locker) { Geo.Utils.FileUtil.CheckOrCreateDirectory(Path.GetDirectoryName(outPath)); SaveLastResult(last); } }