/// <summary> /// 初始化计算器 /// </summary> private void InitSolver() { this.Solver = new SingleSiteGnssSolveStreamer(OutpuDirectory); var Option = GnssProcessOptionManager.Instance.Get(GnssSolverType.无电离层组合PPP); Option.OutputDirectory = OutpuDirectory; // Option.EnableAutoFindingFile = false; Setting.EnableNet = false; var epheService = EphemerisService; if (epheService == null) { epheService = new SingleParamNavFileEphService(NavFile); } var obsData = new MemoRinexFileObsDataSource(ObsFile); this.Solver.Context = DataSourceContext.LoadDefault(Option, obsData, epheService, null); this.Solver.BufferedStream = BuildBufferedStream(); this.Solver.Option = Option; this.Solver.DataSource = obsData; //Solver.InfoProduced += Solver_InfoProduced; //Solver.ResultProduced += Solver_ResultProduced; //Solver.EpochEntityProduced += Solver_EpochEntityProduced; //Solver.Completed += OneSolver_Completed; this.Solver.Init(); }
/// <summary> /// 自动判断路径文件类型,进行星历数据源类的初始化。 /// </summary> /// <param name="naviFilePath"></param> /// <param name="fileType"></param> /// <param name="IsAvailableOnly"></param> /// <param name="MinSequentialSatCount"></param> /// <param name="MaxBreakingCount"></param> /// <param name="ephInterOrder"></param> /// <returns></returns> public static FileEphemerisService Create(string naviFilePath, FileEphemerisType fileType = FileEphemerisType.Unkown, bool IsAvailableOnly = true, int MinSequentialSatCount = 11, int MaxBreakingCount = 5, int ephInterOrder = 10 ) { if (!File.Exists(naviFilePath) || new FileInfo(naviFilePath).Length == 0) { return(null); } var fileName = Path.GetFileName(naviFilePath); if (FileEphemerisServicePool.Contains(fileName)) { return(FileEphemerisServicePool[fileName]); } //如果没有手动指定,则自动判断,大多数情况下是可行的。 if (fileType == FileEphemerisType.Unkown) { fileType = GetFileEphemerisTypeFromPath(naviFilePath); } FileEphemerisService ephemerisFile = null; switch (fileType) { case FileEphemerisType.Mixed: var reader2 = new MixedNavFileReader(naviFilePath); ephemerisFile = new MixedNavFileEphService(reader2.ReadGnssNavFlie()); break; case FileEphemerisType.Compass: case FileEphemerisType.Galileo: case FileEphemerisType.GpsNFile: ParamNavFileReader reader = new ParamNavFileReader(naviFilePath); ephemerisFile = new SingleParamNavFileEphService(reader.ReadGnssNavFlie()); break; case FileEphemerisType.Glonass: ephemerisFile = new SingleGlonassNavFileEphService(new GlonassNaviFileReader(naviFilePath).Read()); break; case FileEphemerisType.Sp3: //MinSequentialSatCount = 11, int MaxBreakingCount = 5 ephemerisFile = new SingleSp3FileEphService(naviFilePath, MinSequentialSatCount, MaxBreakingCount, IsAvailableOnly, ephInterOrder); break; default: break; } FileEphemerisServicePool[fileName] = ephemerisFile; return(ephemerisFile); }
/// <summary> /// 返回服务 /// </summary> /// <returns></returns> public override IEphemerisService GetDataSourceService() { var data = BuildMultiSysServices(); var first = data.FirstOrDefault(); if (first.Value == null) { return(null); } var list = first.Value; var file = list.FirstOrDefault(); if (file.Value == null || file.Value.Count == 0) { return(null); } //可以把两个都读入服务中 var file1 = file.Value[0]; var service = new SingleParamNavFileEphService(file1); return(service); }
private void button_read_Click(object sender, EventArgs e) { string path = this.textBox_Path.Text; if (!File.Exists(path)) { Geo.Utils.FormUtil.ShowWarningMessageBox("文件不存在 " + path); return; } this.textBox_source.Text = File.ReadAllText(path); ParamNavFileReader reader = new ParamNavFileReader(path); navFile = new SingleParamNavFileEphService(reader.ReadGnssNavFlie()); this.bindingSource1.DataSource = navFile.Gets(); bindingSource_prn.DataSource = navFile.Prns; //设置时间间隔 this.dateTimePicker_from.Value = navFile.TimePeriod.Start.DateTime; this.dateTimePicker_to.Value = navFile.TimePeriod.End.DateTime; //MessageBox.Show("已经成功导入!"); }
/// <summary> /// 实时星历改正。 /// </summary> /// <param name="obs"></param> /// <param name="maxCorrectionSecond">允许的最大改正秒数,是否该每颗卫星单独考虑</param> protected void RTSp3InfoCorrected(RinexEpochObservation obs, double maxCorrectionSecond = 60)//Time time, SatelliteType satType) { Time time = obs.ReceiverTime; if (SSRSp3Section.Count == 0) { return; } if (time - SSRSp3Section.GetMaxTime() > maxCorrectionSecond) { return; } Sp3Section Sp3Section = new Sp3Section(); var keys = SSRSp3Section.Keys; foreach (var key in keys) { var obj = SSRSp3Section[key]; foreach (var item in obj) { if (!NavFile.Prns.Contains(item.Prn)) { continue; } var ss = new SingleParamNavFileEphService(NavFile); var unkown = NavFile.GetEphemerisParams(item.Prn).Find(b => Math.Abs(b.Time.TickTime.TotalSeconds - time.TickTime.TotalSeconds) < 3 * 3600); if (unkown == null) { continue; } if (ss == null) { continue; } Ephemeris ss1 = ss.Get(item.Prn, time); XYZ eA = ss1.XyzDot / ss1.XyzDot.Length; XYZ eC = ss1.XYZ.Cross(ss1.XyzDot) / (ss1.XYZ.Cross(ss1.XyzDot)).Length; XYZ eR = eA.Cross(eC) / (eA.Cross(eC)).Length; XYZ deltaO = item.XYZ + item.XyzDot * (time.TickTime.TotalSeconds - item.Time.TickTime.TotalSeconds); double x = eR.X * deltaO.X + eA.X * deltaO.Y + eC.X * deltaO.Z; double y = eR.Y * deltaO.X + eA.Y * deltaO.Y + eC.Y * deltaO.Z; double z = eR.Z * deltaO.X + eA.Z * deltaO.Y + eC.Z * deltaO.Z; if (x * x + y * y + z * z > 100) { } Ephemeris Sp3Record = new Ephemeris(); Sp3Record.Prn = item.Prn; Sp3Record.XYZ = ss1.XYZ - new XYZ(x, y, z); Sp3Record.Time = time; if (item.Prn.SatelliteType == SatelliteType.R) { Sp3Record.ClockBias = ss1.ClockBias + item.ClockBias; } else { double relativetime = 2 * ss1.XYZ.Dot(ss1.XyzDot) / (GnssConst.LIGHT_SPEED * GnssConst.LIGHT_SPEED); Sp3Record.ClockBias = ss1.ClockBias - ss1.RelativeCorrection - item.ClockBias; //relativetime + key.ClockBias; } Sp3Section.Add(Sp3Record.Prn, Sp3Record); } } if (Sp3Section.Count != 0) { Sp3Section.Time = time; Sp3File.Add(Sp3Section); } else { int a = 0; } if (Sp3File.Count > 11) { // Sp3File.Header = new Sp3Header(); Sp3File.Header.EpochInterval = 1; //Sp3File.TimePeriod = new BufferedTimePeriod(Sp3File.First.Time, Sp3File.Last.Time, 60); if (EphemerisService == null) { EphemerisService = new SingleSp3FileEphService(this.Sp3File.GetSatEphemerisCollection(), 10); } else { ((SingleSp3FileEphService)EphemerisService).SetSp3File(Sp3File.GetSatEphemerisCollection()); } } if (Sp3File.Count > 20) { Sp3File.RemoveFirst(); } }