/// <summary> /// 依据输入和平差信息,构建平差结果Sinex文件 /// </summary> /// <param name="fileA"></param> /// <param name="fileB"></param> /// <param name="apriori"></param> private void BuildResultSinex(SinexFile fileA, SinexFile fileB, double[][] apriori) { //统计信息 SinexStatistic stat = SinexStatistic.Merge(fileA.GetStatistic(), fileB.GetStatistic()); stat.NumberOfDegreesOfFreedom = p.Freedom; stat.NumberOfObservations = p.ObsMatrix.Observation.Count; stat.NumberOfUnknown = p.ParamCount; stat.VarianceOfUnitWeight = p.VarianceOfUnitWeight; result.SolutionStattisticsBlock.Items = stat.GetSolutionStatistics(); //先验值 result.SolutionAprioriBlock.Items.AddRange(fileA.SolutionAprioriBlock.Items); foreach (var item in fileB.SolutionAprioriBlock.Items) { if (!result.SolutionAprioriBlock.Items.Contains(item)) { result.SolutionAprioriBlock.Items.Add(item); } } //测站估值 result.SolutionEstimateBlock.Items.AddRange(fileA.SolutionEstimateBlock.Items); foreach (var item in fileB.SolutionEstimateBlock.Items) { if (!result.SolutionEstimateBlock.Items.Contains(item)) { result.SolutionEstimateBlock.Items.Add(item); } } int i = 0; foreach (var item in result.SolutionEstimateBlock.Items) { item.ParameterValue = apriori[i][0]; item.StdDev = p.CovaOfEstimatedParam[i, i]; i++; } //矩阵 result.SolutionMatrixEstimateCova.Items = SinexMatrixConvertor.GetMatrixLines(p.CovaOfEstimatedParam.Array); }
/// <summary> /// 单点定位结果转化为Sinex文件 /// </summary> /// <returns></returns> public static SinexFile Build(SingleSiteGnssResult result) { SinexFile sinex = new SinexFile("Gnsser"); sinex.SolutionEpochBlock.Items.Add(new SolutionEpoch() { DateStart = result.ReceiverTime, DateEnd = result.ReceiverTime, DateMean = result.ReceiverTime, ObservationCode = "P", PointCode = "A", SiteCode = result.SiteInfo.SiteName, SolutionID = "0001" }); SinexStatistic stat = new SinexStatistic() { NumberOfUnknown = result.ResultMatrix.ParamCount, NumberOfObservations = result.ResultMatrix.ObsMatrix.Observation.Count, VarianceOfUnitWeight = result.ResultMatrix.VarianceOfUnitWeight, NumberOfDegreesOfFreedom = result.ResultMatrix.Freedom }; sinex.SolutionStattisticsBlock.Items = stat.GetSolutionStatistics(); GeoCoord approxGeo = CoordTransformer.XyzToGeoCoord(result.ApproxXyz); sinex.SiteIdBlock.Items.Add(new SiteId() { SiteCode = result.SiteInfo.SiteName, PointCode = "A", UniqueMonumentId = result.SiteInfo.MarkerNumber, ApproximateHeight = approxGeo.Height, ApproximateLatitude = approxGeo.Lat, ApproximateLongitude = approxGeo.Lon, ObservationCode = "P", GeoCoord = result.GeoCoord, StationDescription = "Single Point" }); int index = 0; sinex.SolutionEstimateBlock.Items.AddRange(new SolutionValue[] { new SolutionValue() { Index = 1 + index++, ParameterType = "STAX", ParameterValue = result.EstimatedXyz.X, SiteCode = result.SiteInfo.SiteName, RefEpoch = result.ReceiverTime, PointCode = "A", ParameterUnits = "m", ConstraintCode = "2", StdDev = Math.Sqrt(result.ResultMatrix.CovaOfEstimatedParam[index - 1, index - 1]), SolutionID = "0001" }, new SolutionValue() { Index = 1 + index++, ParameterType = "STAY", ParameterValue = result.EstimatedXyz.Y, SiteCode = result.SiteInfo.SiteName, RefEpoch = result.ReceiverTime, PointCode = "A", ParameterUnits = "m", ConstraintCode = "2", StdDev = Math.Sqrt(result.ResultMatrix.CovaOfEstimatedParam[index - 1, index - 1]), SolutionID = "0001" }, new SolutionValue() { Index = 1 + index++, ParameterType = "STAZ", ParameterValue = result.EstimatedXyz.Z, SiteCode = result.SiteInfo.SiteName, RefEpoch = result.ReceiverTime, PointCode = "A", ParameterUnits = "m", ConstraintCode = "2", StdDev = Math.Sqrt(result.ResultMatrix.CovaOfEstimatedParam[index - 1, index - 1]), SolutionID = "0001" }, new SolutionValue() { Index = 1 + index++, ParameterType = "RBIAS", ParameterValue = result.RcvClkErrDistance, SiteCode = result.SiteInfo.SiteName, RefEpoch = result.ReceiverTime, PointCode = "A", ParameterUnits = "m", ConstraintCode = "2", StdDev = Math.Sqrt(result.ResultMatrix.CovaOfEstimatedParam[index - 1, index - 1]), SolutionID = "0001" } }); // sinex. sinex.SolutionMatrixEstimateCova.Items = SinexMatrixConvertor.GetMatrixLines(result.ResultMatrix.CovaOfEstimatedParam.Array); return(sinex); }