private SingleSiteGnssResult Caculate(EpochInformation epochInfo) { if (epochInfo.EnabledSatCount < Option.MinSatCount) { log.Error("不足4颗可用卫星:" + epochInfo.EnabledSatCount); return(null); } SingleFreqSelfIonoRangeReviser.Revise(ref epochInfo); RangePointPositionResult result = null; var prev = this.CurrentProduct; double differ = double.MaxValue; int index = 0; do { if (index > 0) { EpochEphemerisSetter.Revise(ref epochInfo); //采用修正后的钟差重新计算卫星坐标。 BuildAdjustMatrix(); //重新生成矩阵 } var obsMatrix = BuildAdjustObsMatrix(epochInfo);// new AdjustObsMatrix(this.MatrixBuilder); // var text = obsMatrix.ToReadableText(); this.Adjustment = this.RunAdjuster(obsMatrix); result = new RangePointPositionResult(epochInfo, Adjustment, this.MatrixBuilder.GnssParamNameBuilder); if (prev != null) { differ = result.EstimatedXyz.Distance(prev.EstimatedXyz); } prev = result; //实时更新测站坐标 if (true && this.IsUpdateEstimatePostition) { epochInfo.SiteInfo.EstimatedXyz = result.EstimatedXyz; } SingleFreqSelfIonoRangeReviser.Revise(ref epochInfo); // recInfo.ApproxXyz = result.EstimatedXyz; //log.Info(index + ", " + result.EstimatedXyz + ", " + result.EstimatedXyzRms); index++; } while (false && index < this.Option.MaxLoopCount && differ > 1e-6); //result.EstimatedXyzRms.Length > 1 && return(result); }
/// <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); } }