/// <summary> /// GNSS 结果构造器 /// </summary> /// <param name="context"></param> /// <param name="Option"></param> public GnssResultBuilder(GnssProcessOption Option, DataSourceContext context) { this.Context = context; this.TableTextManager = new ObjectTableManager(Option.OutputDirectory); this.AioAdjustFileBuilder = new AioAdjustFileBuilder(Option.OutputDirectory); this.AdjustEquationFileBuilder = new AdjustEquationFileBuilder(Option.OutputDirectory); this.Option = Option; this.OutputMinInterval = this.Option.OutputMinInterval; var fileName = Path.Combine(Setting.TempDirectory, Geo.Utils.DateTimeUtil.GetDateTimePathStringNow() + ".sp3"); Sp3Writer = new Sp3Writer(fileName, null); ResultFileNameBuilder = new ResultFileNameBuilder(Option.OutputDirectory); }
/// <summary> /// 初始化 /// </summary> public void Init() { if (String.IsNullOrWhiteSpace(IndicatedBaseSiteName)) { IndicatedBaseSiteName = DataSources.First.SiteInfo.SiteName; } List <string> otherNames = new List <string>(); foreach (var item in this.OtherDataSources) { otherNames.Add(item.SiteInfo.SiteName); } string name = ResultFileNameBuilder.BuildMultiSiteEpochInfoName(this.BaseDataSource.SiteInfo.SiteName, otherNames); this.Name = name; this.TimePeriod = GetSameTimePeriod(); log.Info(this.Name + " " + this.DataSources.Count + "个数据源的公共时段为:" + TimePeriod); }
/// <summary> /// 输出算后残差 /// </summary> /// <param name="epoch"></param> /// <param name="gnssResult"></param> private void AddResidual(ISiteSatObsInfo epoch, SimpleGnssResult gnssResult) { var fileName = ResultFileNameBuilder.BuildEpochResidualFileName(epoch.Name); var table = TableTextManager.GetOrCreate(fileName); table.NewRow(); table.AddItem("Epoch", epoch.ReceiverTime);//ToShortTimeString()); var names = gnssResult.ResultMatrix.ObsMatrix.Observation.ParamNames; int i = 0; //var obs = gnssResult.ResultMatrix.ObsMatrix.Observation - gnssResult.ResultMatrix.ObsMatrix.FreeVector; var obs = gnssResult.ResultMatrix.PostfitResidual;//.ObsMatrix.Observation - gnssResult.ResultMatrix.ObsMatrix.FreeVector; foreach (var item in obs) { string name = i + ""; if (names != null) { name = names[i] ?? i + ""; } table.AddItem(name, obs[i]); i++; } }
/// <summary> /// GNSS 结果构造器 /// </summary> /// <param name="TableTextManager"></param> /// <param name="AioAdjustFileBuilder"></param> /// <param name="Option"></param> /// <param name="context"></param> /// <param name="AdjustEquationFileBuilder"></param> public GnssResultBuilder( ObjectTableManager TableTextManager, AioAdjustFileBuilder AioAdjustFileBuilder, AdjustEquationFileBuilder AdjustEquationFileBuilder, GnssProcessOption Option, DataSourceContext context) { this.Context = context; this.AdjustEquationFileBuilder = AdjustEquationFileBuilder; this.TableTextManager = TableTextManager; this.AioAdjustFileBuilder = AioAdjustFileBuilder; this.Option = Option; this.OutputMinInterval = this.Option.OutputMinInterval; var fileName = Path.Combine(Setting.TempDirectory, Geo.Utils.DateTimeUtil.GetDateTimePathStringNow() + ".sp3"); Sp3Writer = new Sp3Writer(fileName, null); PrevEpoch = Time.MinValue; this.EpochParamAnalyzer = new EpochParamAnalyzer(new List <string>(this.Option.AnalysisParamNames), this.Option.SequentialEpochCountOfAccuEval, this.Option.MaxDifferOfAccuEval, this.Option.MaxAllowedConvergenceTime, this.Option.KeyLabelCharCount, this.Option.MaxAllowedDifferAfterConvergence, this.Option.MaxAllowedRmsOfAccuEval); ResultFileNameBuilder = new ResultFileNameBuilder(Option.OutputDirectory); }
/// <summary> /// 增加参数到存储表 /// </summary> /// <param name="epoch"></param> /// <param name="result"></param> private void AddEpochParam(ISiteSatObsInfo epoch, SimpleGnssResult result) { var fileName = ResultFileNameBuilder.BuildEpochParamFileName(epoch.Name); var table = TableTextManager.GetOrCreate(fileName); table.NewRow(); table.AddItem("Epoch", epoch.ReceiverTime);//ToShortTimeString()); if (result is SingleSiteGnssResult || result is IWithEstimatedBaselines || result is SingleSitePeriodInfoGnssResult || result is IWithEstimatedBaseline) { XYZ appXyz = new XYZ(); XYZ estXyz = new XYZ(); if (result is SingleSiteGnssResult) { var singleSiteResult = result as SingleSiteGnssResult; appXyz = singleSiteResult.ApproxXyz; estXyz = singleSiteResult.EstimatedXyz; } if (result is SingleSitePeriodInfoGnssResult) { var period = result as SingleSitePeriodInfoGnssResult; appXyz = period.MaterialObj[0].SiteInfo.ApproxXyz; } if (result is IWithEstimatedBaseline) { var info = result as IWithEstimatedBaseline; var baseLine = info.GetEstimatedBaseline(); estXyz = baseLine.EstimatedXyzOfRov; appXyz = baseLine.ApproxXyzOfRov; } if (result is IWithEstimatedBaselines) { var info = result as IWithEstimatedBaselines; var baseLine = info.GetEstimatedBaselines().First; estXyz = baseLine.EstimatedXyzOfRov; appXyz = baseLine.ApproxXyzOfRov; } var dxyz = ((BaseGnssResult)result).XyzCorrection; // XYZ.Parse(result.Adjustment.Estimated); if (dxyz != null) //&& epoch.ReceiverTime.SecondsOfDay % 30 == 0 { ENU enu = null; if (this.Option.IsUpdateEstimatePostition) { dxyz = estXyz - appXyz; enu = CoordTransformer.XyzToEnu(estXyz, appXyz); } else { enu = CoordTransformer.LocaXyzToEnu(dxyz, appXyz); } table.AddItem(Gnsser.ParamNames.De, enu.E); table.AddItem(Gnsser.ParamNames.Dn, enu.N); table.AddItem(Gnsser.ParamNames.Du, enu.U); if (this.Option.IsUpdateEstimatePostition || this.Option.PositionType == PositionType.动态定位) { table.AddItem("EstX", estXyz.X); table.AddItem("EstY", estXyz.Y); table.AddItem("EstZ", estXyz.Z); } } } #region 添加钟结果改正 if (result is ClockEstimationResult) { var mEpochInfo = epoch as MultiSiteEpochInfo; List <string> paranames = result.ResultMatrix.ParamNames; int CountOfSat = epoch.EnabledSatCount * 2; foreach (var item in epoch.EnabledPrns) { double qq = result.ResultMatrix.Corrected.CorrectedValue[paranames.IndexOf(item + "_" + ParamNames.SatClkErrDistance)]; table.AddItem(item.ToString(), qq); int count = 0; double time = 0; Time EmissionSatClockTime = new Time();// Time.Default; //Time EmissionSatClockTime1 = Time.Default; foreach (var item2 in mEpochInfo) { foreach (var item3 in item2) { if (item3.Prn == item) { count++; time += item3.Ephemeris.ClockBias - ((Ephemeris)item3.Ephemeris).RelativeCorrection; //EmissionSatClockTime.TickTime.SecondTicks += item3.EmissionTime.TickTime.SecondTicks; EmissionSatClockTime.TickTime += item3.EmissionTime.TickTime; break; } } } double aa = qq / 0.3 + time * 1e9 / count; double time1 = (EmissionSatClockTime.TickTime.SecondTicks + EmissionSatClockTime.TickTime.Fraction) / count; EmissionSatClockTime.TickTime = SecondTime.FromSecond(time1); table.AddItem(item + "EmissionSatClockTime", EmissionSatClockTime.ToString()); table.AddItem(item + "_Corrected", aa); } } #endregion //table.AddItem((IVector)result.Adjustment.Estimated); foreach (var name in result.ParamNames) { //if (item.Length == 6 && item.Substring(3, 3) == "_λN") //{ // table.AddItem(item.Substring(0, 3), result.Adjustment.Estimated[item]); //} //else { table.AddItem(name, result.ResultMatrix.Estimated[name]); } } if (epoch.UnstablePrns.Count > 0 || epoch.RemovedPrns.Count > 0) { StringBuilder sb = new StringBuilder(); if (epoch.UnstablePrns.Count > 0) { sb.Append(String.Format(new EnumerableFormatProvider(), "{0}", epoch.UnstablePrns)); } if (epoch.RemovedPrns.Count > 0) { sb.Append(";" + String.Format(new EnumerableFormatProvider(), "{0}", epoch.RemovedPrns)); } table.AddItem("CsOrRemoved", sb.ToString()); } table.AddItem(ParamNames.ResultType, result.ResultMatrix.ResultType); table.AddItem(ParamNames.StdDev, result.ResultMatrix.StdDev); table.EndRow(); }
/// <summary> /// 增加参数RMS到存储表 /// </summary> /// <param name="epoch"></param> /// <param name="result"></param> private void AddParamRms(ISiteSatObsInfo epoch, SimpleGnssResult result) { var fileName = ResultFileNameBuilder.BuildEpochParamRmsFileName(epoch.Name); var tableRms = TableTextManager.GetOrCreate(fileName); tableRms.NewRow(); tableRms.AddItem("Epoch", epoch.ReceiverTime); if (result is SingleSiteGnssResult || result is SingleSitePeriodInfoGnssResult) { if (result.ParamNames.Contains(ParamNames.Dx)) { XYZ xyz = new XYZ(); CovaedXyz covaedXyz = null; if (result is SingleSiteGnssResult) { var singleSiteResult = result as SingleSiteGnssResult; xyz = singleSiteResult.ApproxXyz; covaedXyz = singleSiteResult.CovaedEstXyz; } if (result is SingleSitePeriodInfoGnssResult) { var period = result as SingleSitePeriodInfoGnssResult; xyz = period.MaterialObj[0].SiteInfo.ApproxXyz; covaedXyz = period.CovaedEstXyz; } var dxyz = ((BaseGnssResult)result).EstimatedXyzRms;// result.EstimatedXyzRms;// XYZ.Parse(result.Adjustment.Estimated); if (dxyz != null && dxyz != XYZ.Zero) { // var tmsenu = CoordTransformer.LocaXyzToEnu(dxyz, xyz); var cova = ((BaseGnssResult)result).CovaOfFirstThree; var tmsenu = CoordTransformer.XyzToEnuRms(cova, xyz); tableRms.AddItem(Gnsser.ParamNames.De, Math.Abs(tmsenu.E)); tableRms.AddItem(Gnsser.ParamNames.Dn, Math.Abs(tmsenu.N)); tableRms.AddItem(Gnsser.ParamNames.Du, Math.Abs(tmsenu.U)); } } } if (result is IWithEstimatedBaseline) { var info = result as IWithEstimatedBaseline; var baseLine = info.GetEstimatedBaseline(); var xyz = baseLine.EstimatedXyzOfRov; var dxyz = ((BaseGnssResult)result).EstimatedXyzRms; // var tmsenu = CoordTransformer.LocaXyzToEnu(dxyz, xyz); var cova = ((BaseGnssResult)result).CovaOfFirstThree; var tmsenu = CoordTransformer.XyzToEnuRms(cova, xyz); tableRms.AddItem(Gnsser.ParamNames.De, Math.Abs(tmsenu.E)); tableRms.AddItem(Gnsser.ParamNames.Dn, Math.Abs(tmsenu.N)); tableRms.AddItem(Gnsser.ParamNames.Du, Math.Abs(tmsenu.U)); } tableRms.AddItem(result.ResultMatrix.StdOfEstimatedParam); if (epoch.UnstablePrns.Count > 0 || epoch.RemovedPrns.Count > 0) { StringBuilder sb = new StringBuilder(); if (epoch.UnstablePrns.Count > 0) { sb.Append(String.Format(new EnumerableFormatProvider(), "{0}", epoch.UnstablePrns)); } if (epoch.RemovedPrns.Count > 0) { sb.Append(";" + String.Format(new EnumerableFormatProvider(), "{0}", epoch.RemovedPrns)); } tableRms.AddItem("CsOrRemoved", sb.ToString()); } tableRms.AddItem(ParamNames.ResultType, result.ResultMatrix.ResultType); tableRms.AddItem(ParamNames.StdDev, result.ResultMatrix.StdDev); tableRms.EndRow(); }