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="service"></param> /// <param name="prn"></param> /// <param name="time"></param> /// <returns></returns> public StationSatInfo GetInstantSatInfo(IEphemerisService service, SatelliteNumber prn, Time time) { Geo.Coordinates.XYZ satPos = service.Get(prn, time).XYZ; GeoCoord coord = CoordTransformer.XyzToGeoCoord(satPos); Geo.Coordinates.Polar p = CoordTransformer.XyzToGeoPolar(satPos, StationPos); if (p.Elevation < EleAngle) { return(null); } this.LonLats.Add(new Vector(coord.Lon, coord.Lat) { Tag = prn.ToString() }); //显示到表格 return(new StationSatInfo() { PRN = prn, Time = time, Azimuth = p.Azimuth, ElevatAngle = p.Elevation, Distance = p.Range, Lat = coord.Lat, Lon = coord.Lon, Height = coord.Height, X = satPos.X, Y = satPos.Y, Z = satPos.Z }); }
/// <summary> /// 构造函数 /// </summary> /// <param name="BasePrn"></param> /// <param name="SetWeightWithSat"></param> /// <param name="maxError"></param> /// <param name="IsOutputDetails"></param> public MultiSiteMwWideLaneSolver(SatelliteNumber BasePrn, bool SetWeightWithSat = false, double maxError = 2, bool IsOutputDetails = true) { this.BasePrn = BasePrn; this.MaxError = maxError; this.IsOutputDetails = IsOutputDetails; this.IsSetWeightWithSat = SetWeightWithSat; }
/// <summary> /// 载波计算 /// </summary> /// <param name="accumulatedDeltaRangeMeters"></param> /// <param name="prn"></param> /// <param name="IsToCylePhase"></param> /// <returns></returns> private static double GetL1(double accumulatedDeltaRangeMeters, SatelliteNumber prn, bool IsToCylePhase) { //计算历元伪距增量 double k = 1; // -1.0;// k ADR double L1 = k * accumulatedDeltaRangeMeters; //??????此处应该计算为周?????? if (IsToCylePhase) { switch (prn.SatelliteType) { case SatelliteType.G: L1 /= Frequence.GpsL1.WaveLength; break; case SatelliteType.C: L1 /= Frequence.CompassB1.WaveLength; break; default: L1 /= Frequence.GpsL1.WaveLength; break; } } return(L1); }
/// <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++; } } } }
/// <summary> /// 通过此设置,可以判断是否改变 /// </summary> /// <param name="BasePrn"></param> public IonoFreeEpochDifferClockEstimationMatrixBuilder SetBasePrn(SatelliteNumber BasePrn) { isBasePrnChange = (this.BasePrn != BasePrn); this.BasePrn = BasePrn; return(this); }
/// <summary> /// 矫正 /// </summary> /// <param name="info"></param> /// <returns></returns> public override bool Revise(ref EpochInformation info) { //第一个历元不计算。 if (PreviousTime.Equals(Time.MinValue)) { Previous = info; return(true); } //为了防止历元跳跃,还是老老实实一步一步的计算 double interVal = (Double)(info.ReceiverTime - PreviousTime); foreach (var sat in info) { SatelliteNumber prn = sat.Prn; if (!Previous.Contains(prn)) { continue; //新卫星第一个历元不计算 } foreach (var item in sat.FrequenceTypes) { if (!Previous[prn].Contains(item)) { continue; } //这是一种近似算法,取得的是这段时间的平均值,但是误差不大,一般在一个频率以下,实际上应该积微分 //这里是前减后,定义如果为负,则远离,如果为正数,则靠近 approach double doppler = (Previous[prn][item].PhaseRange.RawPhaseValue - sat[item].PhaseRange.RawPhaseValue) / interVal; sat[item].Set(ObservationType.D, new Domain.Observation(doppler, new ObservationCode(ObservationType.D, (int)item))); } } return(true); }
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 SmoothTimeValue Create(SatelliteNumber key) { return(new SmoothTimeValue(this.MaxTimeSpan, MaxDifferValue, true, false) { Name = key.ToString() }); }
/// <summary> /// 初始化 /// </summary> /// <param name="from"></param> /// <param name="exceptPrns"></param> public void InitSelector(Time from, SatelliteNumber exceptPrns) { InitSelector(from, new List <SatelliteNumber>() { exceptPrns }); }
/// <summary> /// 直接返回,不做检查。 /// </summary> /// <param name="satelliteType"></param> /// <returns></returns> public long GetCycle(EpochSatellite sat) { SatelliteNumber prn = sat.Prn; var key = GetKey(sat.EpochInfo.SiteName, sat.Prn); return(this[key]); }
/// <summary> /// 当前历元产品,为所在时段的平均。返回对应的各颗卫星数据。 /// </summary> /// <param name="basePrn"></param> /// <param name="epoch"></param> /// <param name="maxRms"></param> /// <returns></returns> public Dictionary <SatelliteNumber, RmsedNumeral> GetWideLaneFcbDic(SatelliteNumber basePrn, Time epoch, double maxRms) { var rawDiffer = GetRawDiffer(basePrn, epoch, maxRms); var eachs = new Dictionary <SatelliteNumber, List <RmsedNumeral> >(); var allPrns = this.GetAllPrns(); foreach (var prn in allPrns) { eachs[prn] = new List <RmsedNumeral>(); //将同一差分卫星归为一个列表,然后求平均 } foreach (var site in rawDiffer) { foreach (var item in site.Data) { eachs[item.Key].Add(item.Value); } } //求加权平均 Dictionary <SatelliteNumber, RmsedNumeral> result = Geo.Utils.DoubleUtil.GetRoundFractionAverageValues(eachs); return(result); }
/// <summary> /// 将所有产品归算到一个卫星上面。取平均。 /// </summary> /// <param name="basePrn"></param> /// <returns></returns> public FcbOfUpd GetWideLaneFcb(SatelliteNumber basePrn) { Dictionary <SatelliteNumber, RmsedNumeral> result = GetFinalFcbOfBsd(basePrn); result[basePrn] = new RmsedNumeral(0, 0); var prns = result.Keys.ToList(); prns.Sort(); //生成产品 FcbOfUpd fcb = new FcbOfUpd(); fcb.BasePrn = basePrn; fcb.WnMarker = FcbOfUpd.WideLaneMaker; fcb.Count = 32;// result.Count; fcb.Epoch = this.First.First.FirstKey.Start; //fcb.Prns = prns; int i = 0; foreach (var prn in prns) { i++; if (i > 32) { break; } fcb.Add(prn, result[prn]); } return(fcb); }
/// <summary> /// 将所有卫星产品归算到一颗卫星上面 /// </summary> /// <param name="basePrn"></param> /// <param name="maxRms"></param> /// <param name="epoch"></param> /// <returns></returns> public FcbOfUpd GetWideLaneFcbOfAllSat(SatelliteNumber basePrn, Time epoch, double maxRms) { //首先,所有的都计算一次 var prns = this.GetAllPrns(); var data = new BaseDictionary <SatelliteNumber, List <RmsedNumeral> >("数据集合", (prn) => new List <RmsedNumeral>()); foreach (var prn in prns) { //计算以当前卫星为基准的差分数据 Dictionary <SatelliteNumber, RmsedNumeral> fcbDic = GetWideLaneFcbDic(prn, epoch, maxRms); if (!fcbDic.ContainsKey(basePrn)) { continue; } // 没有基准星,则不考虑 var baseVal = fcbDic[basePrn]; //其次,归算到指定的卫星 foreach (var item in fcbDic) { var currentPrn = item.Key; var newVal = item.Value - baseVal; newVal.Value = Geo.Utils.DoubleUtil.GetRoundFraction(newVal.Value); data.GetOrCreate(currentPrn).Add(newVal); } } //加权平均 var ave = Geo.Utils.DoubleUtil.GetRoundFractionAverageValues(data); FcbOfUpd fcb = new FcbOfUpd(basePrn, epoch, ave, true); return(fcb); }
/// <summary> /// 所有测站与指定参考星的差分值(浮点数)。 /// 必须与测站共视才可以差分。结果中包括了共视时段。 /// </summary> /// <param name="basePrn"></param> /// <returns></returns> public MultiSitePeriodValueStorage GetRawDiffer(SatelliteNumber basePrn) { if (CasheOfRawDiffers.Contains(basePrn)) { return(CasheOfRawDiffers[basePrn]); } lock (rawDifferLocker) { if (CasheOfRawDiffers.Contains(basePrn)) { return(CasheOfRawDiffers[basePrn]); } log.Info("开始生成 星间单差浮点数,基准星:" + basePrn); MultiSitePeriodValueStorage sitePeriodDifferFloat = new MultiSitePeriodValueStorage("所有站星间单差宽巷浮点数模糊度(MW)"); foreach (var siteKv in this.Data) { if (!siteKv.Value.Contains(basePrn)) { continue; } string siteName = siteKv.Key; var periodVals = siteKv.Value; MultiSatPeriodRmsNumeralStorage newSite = periodVals.GetRawDiffer(basePrn); sitePeriodDifferFloat.Add(siteName, newSite); } log.Info("星间单差浮点数生成完毕,基准星:" + basePrn); CasheOfRawDiffers[basePrn] = sitePeriodDifferFloat; return(sitePeriodDifferFloat); } }
/// <summary> /// 多历元多站双差 /// </summary> /// <param name="periodMaterial"></param> /// <param name="BaseSiteName"></param> /// <param name="CurrentBasePrn"></param> /// <param name="invFactorOfPhase"></param> /// <param name="phaseOnly"></param> /// <param name="isDualFreq"></param> /// <returns></returns> public Matrix BulidDoubleInverseWeightOfObs(MultiSitePeriodInfo periodMaterial, string BaseSiteName, SatelliteNumber CurrentBasePrn, double invFactorOfPhase, bool phaseOnly, bool isDualFreq = false) { var SiteCount = periodMaterial[0].Count; var EpochCount = periodMaterial.Count; var EnabledSatCount = periodMaterial.EnabledSatCount; int satCount = EnabledSatCount; int epochObsCount = (satCount - 1); //一个历元对应的参数数量 int totalObsCount = (SiteCount - 1) * epochObsCount * (EpochCount); //原始非差观测数,only载波 if (!phaseOnly) //包含载波,翻翻 { totalObsCount *= 2; epochObsCount *= 2; } if (isDualFreq)//包含2个频率,翻翻 { totalObsCount *= 2; epochObsCount *= 2; } Matrix result = new Matrix(totalObsCount); for (int i = 0; i < EpochCount; i++) { var epochMaterial = periodMaterial[i]; var subDiag = BulidDoubleInverseWeightOfObs(epochMaterial, BaseSiteName, CurrentBasePrn, invFactorOfPhase, phaseOnly, isDualFreq); var startRowCol = epochObsCount * i; result.SetSub(subDiag, startRowCol, startRowCol); } return(result); }
/// <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); }
//首先,选择在起始时刻所有满足条件的卫星, //查找这些卫星的最大高度角的位置(附近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> /// 解析PRN /// </summary> /// <param name="dic"></param> /// <returns></returns> private static SatelliteNumber ParsePrn(Dictionary <string, object> dic) { int svid = ParseInt(dic, Svid); int constellationType = ParseInt(dic, ConstellationType, 1); SatelliteNumber prn = AnGnssUtil.getSatelliteNumbere(constellationType, svid); return(prn); }
/// <summary> /// 获取数值 /// </summary> /// <param name="site"></param> /// <param name="prn"></param> /// <param name="time"></param> /// <returns></returns> public RmsedNumeral GetValue(string site, SatelliteNumber prn, Time time) { if (!this.Contains(site)) { return(null); } return(this[site].GetValue(prn, time)); }
/// <summary> /// 构造函数 /// </summary> /// <param name="inputPathes"></param> /// <param name="BasePrn"></param> /// <param name="OutputDirectory"></param> public MultiSiteNarrowLineSolver(SatelliteNumber BasePrn, string OutputDirectory, string wideLanePath, int skipCount) : base(BasePrn, OutputDirectory) { this.RunnerFileExtension = "*.*o"; this.PppResultBufferSize = 10; this.PppResultBuffer = new WindowData <Dictionary <string, PppResult> >(PppResultBufferSize); this.DifferFcbManager = DifferFcbManager.Read(wideLanePath); this.SkipCount = skipCount; }
public void CheckOrInit(SatelliteNumber prn) { //if (!this.Contains(satelliteType)) //{ // var queue = new BaseQueue<EpochInformation>(BufferSize, true); // queue.Dequeuing += queue_Dequeuing; // this[satelliteType] = queue; //} }
/// <summary> /// 构造函数 /// </summary> /// <param name="BasePrn"></param> /// <param name="SetWeightWithSat"></param> /// <param name="maxError"></param> /// <param name="IsOutputDetails"></param> public MultiSiteNarrowLaneSolver(SatelliteNumber BasePrn, DifferFcbManager DifferFcbManager, string directory, int skipCount, bool SetWeightWithSat = false, double maxError = 2, bool IsOutputDetails = true) { this.BasePrn = BasePrn; this.MaxError = maxError; this.IsOutputDetails = IsOutputDetails; this.IsSetWeightWithSat = SetWeightWithSat; this.DifferFcbManager = DifferFcbManager; this.TableManager = new ObjectTableManager(directory); this.SkipCount = skipCount; }
/// <summary> /// 获取星历列表,这些信息是可能是拟合的结果。 /// </summary> /// <param name="prn">卫星编号</param> /// <param name="from">起始时间</param> /// <param name="to">终止时间</param> /// <param name="interval">间隔(秒)</param> public virtual List <Ephemeris> Gets(SatelliteNumber prn, Time from, Time to, double interval) { List <Ephemeris> list = new List <Ephemeris>(); for (Time i = from; i <= to; i = i + interval) { list.Add(Get(prn, i)); } return(list); }
/// <summary> /// 创建RINEX观测数据 /// </summary> /// <param name="prn"></param> /// <param name="C1"></param> /// <param name="D1"></param> /// <param name="L1"></param> /// <param name="S1"></param> /// <returns></returns> private static RinexSatObsData BuildRinexSatObsData(SatelliteNumber prn, double C1, double L1, double S1, double D1) { RinexSatObsData satData = new RinexSatObsData(prn); satData.Add("C1", C1); satData.Add("L1", L1); satData.Add("S1", S1); satData.Add("D1", D1);//存储为距离递增量,方便调试 return(satData); }
/// <summary> /// 统计一个卫星编号。 /// </summary> /// <param name="satelliteType"></param> public void Add(SatelliteNumber prn) { if (!Counter.ContainsKey(prn)) { Counter[prn] = 1; } else { Counter[prn] = Counter[prn] + 1; } }
/// <summary> /// 原始输出所有的数据。 /// </summary> /// <param name="prn">卫星编号</param> /// <param name="from">起始时间</param> /// <param name="to">截止时间</param> /// <returns></returns> public override List <Ephemeris> Gets(SatelliteNumber prn, Time from, Time to) { List <Ephemeris> list = new List <Ephemeris>(); foreach (var item in _sources) { list.AddRange(item.Gets(prn, from, to)); } list.Sort();//排序 return(list); }
/// <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); }
//public ClockEstimationResult( // MultiSitePeriodInfo epochInfo, // Adjustment Adjustment, // GnssParamNameBuilder ClockEstimationer, // ClockEstimationResult previousResult = null) // : base(epochInfo, Adjustment, ClockEstimationer) //{ // Vector vector = Adjustment.Corrected; // //update // foreach (var epoch in epochInfo) // { // var keyPrev = NameBuilder.GetReceiverWetTropParamName(epoch); // epoch.NumeralCorrections[Gnsser.ParamNames.Trop] = vector[Adjustment.GetIndexOf(keyPrev)]; // } // this.AmbiguityDic = new Dictionary<string, double>(); // int length = ParamCount; // for (int i = 2 * MaterialObj.Count + EnabledPrns.Count; i < length; i++) // { // double val = vector[i]; // AmbiguityDic.Add(ParamNames[i], val); // } // //this.PrnWithSlips = new List<SatelliteNumber>(); // this.PrnWithSlipss = new List<string>(); // foreach (var key in epochInfo) // { // foreach (var item1 in key) // if (item1.IsUnstable) // { // //PrnWithSlips.Add(item1.Prn); // PrnWithSlipss.Add(key.SiteName + "-" + item1.Prn); // } // } //} /// <summary> /// /// </summary> /// <param name="SiteName"></param> /// <param name="prn"></param> /// <returns></returns> public double GetAmbiguityDistace(string SiteName, SatelliteNumber prn) { if (AmbiguityDic.ContainsKey(SiteName + "-" + prn)) { return(AmbiguityDic[SiteName + "-" + prn]); } else { return(0); } }
/// <summary> /// 如果获取失败,则返回 0 。 /// </summary> /// <param name="prn"></param> /// <param name="time"></param> /// <returns></returns> public double Get(SatelliteNumber prn, Time time) { var items = Get(time); if (items == null || !items.Data.Contains(prn)) { return(0); } return(items.Data[prn]); }