//首先,选择在起始时刻所有满足条件的卫星, //查找这些卫星的最大高度角的位置(附近6小时内),选择距离远的, //查找其结束点高度角时刻, //继续遍历 public PeriodPrn BuildOnePeriodPrnByCenterTop(Time startTime) { var endTime = startTime + SearchTimeSpan; List <String> prnsString = GetStartPrns(startTime); List <TableCell> maxCells = new List <TableCell>(); foreach (var colName in prnsString) { if (SatElevationTable.MinusNext(colName, startTime) < 0) //方向必须朝上 { var max = SatElevationTable.GetFirstSlopeApproxTo(colName, CutOffAngle, startTime, false); // var max = SatElevationTable.GetMaxCell(colName, startTime, endTime); maxCells.Add(max); } } if (maxCells.Count == 0) { return(null); } var longest = maxCells.OrderByDescending(m => m.RowNumber).First(); SatelliteNumber selectedPrn = SatelliteNumber.Parse(longest.ColName); var endTimePeriod = (Time)SatElevationTable.GetIndexValue(longest.RowNumber); TimePeriod TimePeriod = new Geo.Times.TimePeriod(startTime, endTimePeriod); var PeriodPrn = new PeriodPrn(TimePeriod, selectedPrn); return(PeriodPrn); }
/// <summary> /// 读取到历元存储对象 /// </summary> /// <param name="tables"></param> /// <returns></returns> public static MultiSiteEpochValueStorage ReadToEpochStorage(ObjectTableManager tables) { MultiSiteEpochValueStorage multiSiteStorage = new MultiSiteEpochValueStorage("无电离层双差结果"); foreach (var table in tables) { MultiSatEpochRmsNumeralStorage multiSatStorage = multiSiteStorage.GetOrCreate(table.Name); var indexName = table.GetIndexColName(); foreach (var row in table.BufferedValues) { var epoch = (Time)row[indexName]; foreach (var item in row) { if (item.Key == indexName) { continue; } var prn = SatelliteNumber.Parse(item.Key); var val = (double)item.Value; multiSatStorage.GetOrCreate(epoch).Add(prn, new RmsedNumeral(val, 0)); } } } return(multiSiteStorage); }
/// <summary> /// 参数名称分解器 /// </summary> /// <param name="nameStr"></param> public ParamNameSpliter(string nameStr) { this.ParamType = ParseParamType(nameStr); this.ParamDifferType = ParseParamDifferType(nameStr); if (ParamDifferType == ParamDifferType.Double) { var paramGroups = nameStr.Split(new string[] { ParamNames.Divider }, StringSplitOptions.RemoveEmptyEntries); //如果是双差,一般有以下几种情况,包含测站名称或不包含 if (paramGroups.Length == 3) { int i = 0; foreach (var item in paramGroups) { var strs = item.Split(new string[] { ParamNames.Pointer }, StringSplitOptions.RemoveEmptyEntries); if (i == 0) { SiteName = strs[0]; RefSiteName = strs[1]; } if (i == 1 && strs[0].Length == 3) { Prn = SatelliteNumber.Parse(strs[0]); RefPrn = SatelliteNumber.Parse(strs[1]); } i++; } } } }
private PeriodPrn BuildOnePeriodPrnByCenterTop2(Time startTime) { var endTime = startTime + SearchTimeSpan; List <String> prnsString = GetStartPrns(startTime); List <TableCell> maxCells = new List <TableCell>(); foreach (var item in prnsString) { if (SatElevationTable.MinusNext(item, startTime) < 0) //方向必须朝上 { var max = SatElevationTable.GetMaxCell(item, startTime, endTime); maxCells.Add(max); } } var longest = maxCells.FindAll(m => (double)m.Value > CutOffAngle).OrderByDescending(m => m.RowNumber).First(); SatelliteNumber selectedPrn = SatelliteNumber.Parse(longest.ColName); //查找其结尾处,满足条件的时刻或历元 var startTime2 = (Time)SatElevationTable.GetIndexValue(longest.RowNumber); var endTime2 = startTime2 + SearchTimeSpan; TableCell endCell = SatElevationTable.GetCellApproxTo(longest.ColName, CutOffAngle, startTime2, endTime2); var endTimePeriod = (Time)SatElevationTable.GetIndexValue(endCell.RowNumber); TimePeriod TimePeriod = new Geo.Times.TimePeriod(startTime, endTimePeriod); var PeriodPrn = new PeriodPrn(TimePeriod, selectedPrn); return(PeriodPrn); }
public override PeriodPrn Parse(string[] items) { var span = TimePeriod.Parse(items[0]); var prn = SatelliteNumber.Parse(items[1]); return(new PeriodPrn(span, prn)); }
/// <summary> /// 解析为卫星表格集合。 /// </summary> /// <param name="prnPathes"></param> /// <returns></returns> public static BaseDictionary <SatelliteNumber, MultiSitePeriodValueStorage> ParsePrnTables(string [] prnPathes) { var mgr = new BaseDictionary <SatelliteNumber, MultiSitePeriodValueStorage>("卫星表格集合"); foreach (var path in prnPathes) { var prn = SatelliteNumber.Parse(Path.GetFileName(path)); mgr[prn] = ParseDetailTable(path); } return(mgr); }
/// <summary> /// 常用构造函数 /// </summary> /// <param name="key"></param> /// <param name="time"></param> /// <param name="wValue"></param> public DifferFcbOfSatDcbItem(string key, Time time, double wValue) { string[] prnString = key.Trim().Substring(0, 7).Split('-'); SatelliteNumber rovPrn = SatelliteNumber.Parse(prnString[0]); SatelliteNumber refPrn = SatelliteNumber.Parse(prnString[1]); this.BasePrn = refPrn; this.Prn = rovPrn; this.Time = time; this.WideLaneValue = wValue; this.OrderedProperties = new List <string>() { "Time", "Key", "WideLaneValue", "NarrowLaneValue" }; }
/// <summary> /// 解析表格获取对象 /// </summary> /// <param name="table"></param> /// <returns></returns> public static MultiSitePeriodValueStorage ParseDetailTable(ObjectTableStorage table) { MultiSitePeriodValueStorage store = new MultiSitePeriodValueStorage(table.Name); store.DetailTable = table; foreach (var row in table.BufferedValues) { var site = row["Site"].ToString(); var prn = SatelliteNumber.Parse(row["Name"].ToString()); var period = TimePeriod.Parse(row["Group"].ToString()); var val = (double)row["Value"]; var rms = (double)row["RMS"]; store.GetOrCreate(site).GetOrCreate(prn)[period] = new RmsedNumeral(val, rms); } return(store); }
/// <summary> /// 解析字符串 /// </summary> /// <param name="path"></param> /// <returns></returns> public static DifferFcbOfSatDcbItem Parse(string line) { var strs = line.Split(new char[] { '\t', ',' }, StringSplitOptions.RemoveEmptyEntries); var time = Time.Parse(strs[0]); var prns = strs[1].Split('-'); var prn = SatelliteNumber.Parse(prns[0]); var basePrn = SatelliteNumber.Parse(prns[1]); var wValue = double.Parse(strs[2]); var nValue = double.Parse(strs[3]); return(new DifferFcbOfSatDcbItem() { Time = time, BasePrn = basePrn, Prn = prn, WideLaneValue = wValue, NarrowLaneValue = nValue }); }
/// <summary> /// 解析字符串为卫星编号 /// </summary> /// <param name="str"></param> /// <param name="splitter"></param> /// <returns></returns> public static List <SatelliteNumber> ParseString(string str, char [] splitter = null) { if (splitter == null) { splitter = new char[] { ',', ';', '\t', ' ' }; } List <SatelliteNumber> prns = new List <SatelliteNumber>(); var strs = str.Split(splitter, StringSplitOptions.RemoveEmptyEntries); foreach (var item in strs) { var prn = SatelliteNumber.Parse(item); if (prn.SatelliteType != SatelliteType.U) { prns.Add(prn); } } return(prns); }
/// <summary> /// 执行选星 /// </summary> /// <returns></returns> public override SatelliteNumber Select() { var start = TimePeriod.Start; var end = TimePeriod.End; TableCell maxCell = null; if (EnableCenterMaxSelection) { var windowSpan = Math.Min(CenterCount, TimePeriod.Span); var middle = Time.Parse(start + TimeSpan.FromSeconds(TimePeriod.Span / 2.0)); maxCell = SatEleTable.GetMax(middle, CenterCount); return(SatelliteNumber.Parse(maxCell.ColName)); //start = middle - TimeSpan.FromSeconds(windowSpan / 2.0); //end = middle + TimeSpan.FromSeconds(windowSpan / 2.0); } maxCell = SatEleTable.GetMax(start, end); return(SatelliteNumber.Parse(maxCell.ColName)); }
/// <summary> /// 计算差分产品,小数部分,区间[-0.5, 0.5] /// </summary> /// <param name="basePrn">基准卫星</param> /// <returns>正小数的产品</returns> public Dictionary <SatelliteNumber, RmsedNumeral> GetDifferFractionProduct(SatelliteNumber basePrn) { var rawDiffer = this.GetRawDiffer(basePrn); //首先获取各站内的卫星差分 var fractions = rawDiffer.GetAverageRoundFractionTable(); //计算小数部分的平均,以表格返回,列名为卫星,行索引为测站 //字典法 var dic = new Dictionary <SatelliteNumber, RmsedNumeral>(); var results = fractions.GetAveragesWithRms(); //所有卫星差分值求平均 foreach (var item in results) { var prn = SatelliteNumber.Parse(item.Key); if (prn == SatelliteNumber.Default) { continue; } var frac = Geo.Utils.DoubleUtil.GetRoundFraction(item.Value.Value); //产品为 [-0.5, 0.5] 区间的小数 dic[prn] = new RmsedNumeral(frac, item.Value.Rms); } return(dic); }
/// <summary> /// 执行选星 /// </summary> /// <returns></returns> public override SatelliteNumber Select() { var start = TimePeriod.Start; var end = TimePeriod.End; var subTable = SatEleTable.GetSub(start, end); var dic = subTable.GetValidDataCount(m => m >= CutOffAngle); var max = dic.Where(m => m.Value == dic.Max(n => n.Value)).ToList(); var maxItem = max.First(); double maxValue = double.MinValue; foreach (var item in max) { var thisVal = subTable.GetMaxValue(item.Key, start, end); if (maxValue < thisVal) { maxValue = thisVal; maxItem = item; } } return(SatelliteNumber.Parse(maxItem.Key)); }
/// <summary> /// 获取指定时刻卫星信息 /// </summary> /// <param name="prnName">卫星编号</param> /// <param name="gpsTime">时间</param> /// <returns></returns> public override Ephemeris Get(string prnName, Time gpsTime) { return(Get(SatelliteNumber.Parse(prnName), gpsTime)); }
/// <summary> /// 构建电离层输出表格 /// </summary> /// <param name="epoch"></param> /// <param name="Adjustment"></param> /// <param name="ParamNames"></param> private void BuildIonoResult(ISiteSatObsInfo epoch, Geo.Algorithm.Adjust.AdjustResultMatrix Adjustment, List <string> ParamNames) { if (epoch is EpochInformation) //这里只处理单站单历元情况 { var epochInfo = epoch as EpochInformation; //电离层汇总 var allInOneTable = TableTextManager.GetOrCreate(epoch.Name + "_All_" + Gnsser.ParamNames.Iono); allInOneTable.NewRow(); allInOneTable.AddItem("Epoch", epoch.ReceiverTime); ObjectTableStorage tableIonoParam = null; ObjectTableStorage tableIf = null; ObjectTableStorage tableGridFile = null; ObjectTableStorage tableHarmoFile = null; ObjectTableStorage tableOfIonoParamService = null; //电离层参数 if (Geo.Utils.StringUtil.Contanis(ParamNames, Gnsser.ParamNames.Iono, true))//参数化电离层文件 { tableIonoParam = TableTextManager.GetOrCreate(epoch.Name + "_Param_" + Gnsser.ParamNames.Iono); tableIonoParam.NewRow(); tableIonoParam.AddItem("Epoch", epoch.ReceiverTime); var ionoResult = Adjustment.Estimated.GetAll(Gnsser.ParamNames.Iono); foreach (var item in ionoResult) { //斜距转换为垂距 //计算穿刺点 var prn = SatelliteNumber.Parse(item.Key); var sat = epochInfo.Get(prn); tableIonoParam.AddItem(prn.ToString(), item.Value.Value); } } //双频电离层 if (epochInfo.First.Count > 1) { tableIf = TableTextManager.GetOrCreate(epoch.Name + "_IFofC_" + Gnsser.ParamNames.Iono); tableIf.NewRow(); foreach (var sat in epochInfo.EnabledSats) { //斜距转换为垂距 //计算穿刺点 var prn = sat.Prn; var ionXyz = sat.GetIntersectionXyz(); var geoCoordOfIono = CoordTransformer.XyzToGeoCoord(ionXyz); var ionoFreeRange = sat.Combinations.IonoFreeRange.Value; var rangeA = sat.FrequenceA.PseudoRange.Value; var ionoError = rangeA - ionoFreeRange; tableIf.AddItem("Epoch", epoch.ReceiverTime); tableIf.AddItem(prn.ToString(), ionoError); } } if (Context.IgsGridIonoFileService != null && Context.IgsGridIonoFileService.TimePeriod.Contains(epoch.ReceiverTime)) { tableGridFile = TableTextManager.GetOrCreate(epoch.Name + "_Grid_" + Gnsser.ParamNames.Iono); tableGridFile.NewRow(); foreach (var sat in epochInfo.EnabledSats) { //斜距转换为垂距 //计算穿刺点 var prn = sat.Prn; tableGridFile.AddItem("Epoch", epoch.ReceiverTime); double val = IonoGridModelCorrector.GetGridModelCorrection(sat, FrequenceType.A, Context.IgsGridIonoFileService); tableGridFile.AddItem(prn.ToString(), val); } } if (Context.IgsCodeHarmoIonoFileService != null && Context.IgsCodeHarmoIonoFileService.TimePeriod.Contains(epoch.ReceiverTime)) { tableHarmoFile = TableTextManager.GetOrCreate(epoch.Name + "_Harmo_" + Gnsser.ParamNames.Iono); tableHarmoFile.NewRow(); foreach (var sat in epochInfo.EnabledSats) { //斜距转换为垂距 //计算穿刺点 var prn = sat.Prn; tableHarmoFile.AddItem("Epoch", epoch.ReceiverTime); double val = IonoGridModelCorrector.GetGridModelCorrection(sat, FrequenceType.A, Context.IgsCodeHarmoIonoFileService); tableHarmoFile.AddItem(prn.ToString(), val); } } if (Context.IonoKlobucharParamService != null) { var ionoParam = Context.IonoKlobucharParamService.Get(epoch.ReceiverTime);// if (ionoParam != null) { tableOfIonoParamService = TableTextManager.GetOrCreate(epoch.Name + "_ParamModel_" + Gnsser.ParamNames.Iono); tableOfIonoParamService.NewRow(); foreach (var sat in epochInfo.EnabledSats) { tableOfIonoParamService.AddItem("Epoch", epoch.ReceiverTime); var val = IonoParamModelCorrector.GetCorrectorInDistance(sat, ionoParam); tableOfIonoParamService.AddItem(sat.Prn.ToString(), val); } } } //保存到总表中 foreach (var sat in epochInfo.EnabledSats) { var prn = sat.Prn; CheckAndAddIonoValueToMainTable(allInOneTable, tableIonoParam, prn, "Param"); CheckAndAddIonoValueToMainTable(allInOneTable, tableIf, prn, "IfofC"); CheckAndAddIonoValueToMainTable(allInOneTable, tableGridFile, prn, "Grid"); CheckAndAddIonoValueToMainTable(allInOneTable, tableHarmoFile, prn, "Harmo"); CheckAndAddIonoValueToMainTable(allInOneTable, tableOfIonoParamService, prn, "ParamModel"); } } }
/// <summary> /// 处理过程 /// </summary> /// <param name="current"></param> public override void Process(RinexEpochObservation current) { if (this.CurrentIndex == 0) { InitSeconds = current.ReceiverTime.DateTime.TimeOfDay.TotalSeconds; if (Option.IsEnableInterval && Option.Interval > 1 && InitSeconds % 5 != 0) // 若非0, 5秒整数倍的采样间隔,则强制采用10秒整数倍间隔 { InitSeconds = 0; } //首次建立头文件,需要缓存支持 this.CurrentHeader = BuildOutputHeader(OldHeader); } //移除其它系统 if (Option.IsEnableSatelliteTypes) { current.RemoveOther(Option.SatelliteTypes); } //采样间隔 if (Option.IsEnableInterval) { //首先考虑采样率大于1s var diff = Math.Round(current.ReceiverTime.DateTime.TimeOfDay.TotalSeconds - InitSeconds) % Option.Interval; if (diff > 0.5 && Option.Interval > 1) { return; } else { int i = 0; } //采样率小于1s if (current.ReceiverTime - PrevOkEpoch < Option.Interval) { return; } } if (current.ReceiverTime >= new Time(2017, 8, 11, 23)) { int i = 0; } PrevOkEpoch = current.ReceiverTime; current.Header = this.CurrentHeader; //时段过滤 if (Option.IsEnableTimePeriod) { if (!Option.TimePeriod.Contains(current.ReceiverTime)) { return; } } if (Option.IsEnableRemoveSats && Option.SatsToBeRemoved != null && Option.SatsToBeRemoved.Count > 0) { current.Remove(Option.SatsToBeRemoved); } //删除指定数据为空的卫星 if (Option.IsDeleteVacantSat) { List <SatelliteNumber> tobeDeletes = new List <SatelliteNumber>(); foreach (var sat in current) { if (sat.Prn == SatelliteNumber.Parse("G15")) { int ii = 0; } foreach (var item in Option.NotVacantCodeList) { if (sat.TryGetValue(item) == 0) { tobeDeletes.Add(sat.Prn); } } } current.Remove(tobeDeletes); } //移除观测值为 0 的 if (Option.IsRemoveZeroPhaseSat) { List <SatelliteNumber> tobeDeletes = new List <SatelliteNumber>(); foreach (var sat in current) { foreach (var item in CurrentHeader.ObsCodes) { if (sat.Prn.SatelliteType == item.Key) { foreach (var code in item.Value) { if (code.StartsWith("L") && sat.TryGetValue(code) == 0) { tobeDeletes.Add(sat.Prn); } } } } } current.Remove(tobeDeletes); } //移除观测值为 0 的 if (Option.IsRemoveZeroRangeSat) { List <SatelliteNumber> tobeDeletes = new List <SatelliteNumber>(); foreach (var sat in current) { foreach (var item in CurrentHeader.ObsCodes) { if (sat.Prn.SatelliteType == item.Key) { foreach (var code in item.Value) { if ((code.StartsWith("C") || code.StartsWith("P")) && sat.TryGetValue(code) == 0) { tobeDeletes.Add(sat.Prn); } } } } } current.Remove(tobeDeletes); } //是否启用卫星系统过滤,此处多余,只需在头部判断即可。 //if(Option.IsEnableSatelliteTypes){ // current.RemoveOthers(Option.SatelliteTypes); //} ////观测类型过滤凭借第一字母判断 //if (Option.IsEnableObsTypes) //{ // current.RemoveOthers(Option.ObsTypes); //} //观测码数量不足的移除 if (ObsCodesToBeRemove != null && ObsCodesToBeRemove.Count > 0) { foreach (var sat in current) { if (!ObsCodesToBeRemove.ContainsKey(sat.Prn.SatelliteType)) { continue; } var codes = this.ObsCodesToBeRemove[sat.Prn.SatelliteType]; foreach (var item in codes) { sat.Remove(item); } } } if (Option.SatCutOffAngle.Enabled && !XYZ.IsZeroOrEmpty(CurrentHeader.ApproxXyz)) { List <RinexSatObsData> list = new List <RinexSatObsData>(); foreach (var item in current) { var eph = GlobalNavEphemerisService.Instance.Get(item.Prn, current.ReceiverTime); var angle = CoordTransformer.XyzToGeoPolar(eph.XYZ, CurrentHeader.ApproxXyz); if (angle.Elevation < Option.SatCutOffAngle.Value) { list.Add(item); } } foreach (var item in list) { current.Remove(item.Prn); } } if (Option.IsConvertPhaseToLength) { foreach (var item in current) { if (item.Prn.SatelliteType == SatelliteType.G) { foreach (var val in item) { if (val.Key.Contains("L1")) { val.Value.Value = val.Value.Value * Frequence.GpsL1.WaveLength; } if (val.Key.Contains("L2")) { val.Value.Value = val.Value.Value * Frequence.GpsL2.WaveLength; } } } } } //判断并写入文件 WriteToFile(current); }
public override SatelliteNumber ParseKeyB(object keyBData) { return(SatelliteNumber.Parse(keyBData.ToString())); }