/// <summary> /// 多时段 /// </summary> /// <returns></returns> public BaseLineNetManager GetBaseLineNetManager() { BaseLineNetManager result = new BaseLineNetManager(); foreach (var item in this.KeyValues) { var period = new BufferedTimePeriod(item.Key, item.Key); result[period] = item.Value.GetBaseLineNet(); } return(result); }
/// <summary> /// 默认构造函数 /// </summary> /// <param name="SatelliteType">系统类型</param> /// <param name="timePeriod">时段信息</param> public IgsProductSourceOption(BufferedTimePeriod timePeriod, List <SatelliteType> SatelliteType) { this.TimePeriod = timePeriod; this.SatelliteTypes = SatelliteType; this.IsDownloadingSurplurseIgsProducts = false; this.Sp3EphMaxBreakingCount = 5; this.MinSequentialSatCount = 11; this.MaxIgsProductCacheCount = 32; IsSkipIonoContent = false; InterpolateOrder = 10; IsConnectIgsProduct = true; }
/// <summary> /// 计算选项。!!此处采用同一的解算模型。如果多系统解算,需要修改。 /// </summary> /// <returns></returns> private GnssProcessOption GetModel(BufferedTimePeriod startTime) { GnssProcessOption model = new GnssProcessOption() { FilterCourceError = checkBox_ignoreCourceError.Checked, CaculateType = CaculateType.Filter, MaxStdDev = double.Parse(this.textBox_maxStd.Text), EnableClockService = this.checkBox_enableClockFile.Checked, SatelliteTypes = this.multiGnssSystemSelectControl1.SatelliteTypes }; return(model); }
/// <summary> /// 有效时间段。用于多文件。性能已优化。 /// </summary> public List <BufferedTimePeriod> GetTimePeriods(SatelliteType satelliteType) { if (periodsDic.ContainsKey(satelliteType)) { return(periodsDic[satelliteType]); } List <BufferedTimePeriod> spans = GetTimePeriodsDirectly(satelliteType); //合并时段 periodsDic[satelliteType] = BufferedTimePeriod.Merge(spans); return(periodsDic[satelliteType]); }
/// <summary> /// 获取天线,通常是卫星天线 /// </summary> /// <param name="serial">序号,通常是卫星的PRN</param> /// <param name="epoch">历元时间</param> /// <returns></returns> public Antenna Get(string serial, Time epoch) { lock (obj) { if (serialEpochBuffer.ContainsKey(serial)) { Dictionary <BufferedTimePeriod, Antenna> dic = serialEpochBuffer[serial]; foreach (var item in dic) { if (item.Key.Contains(epoch) || (item.Key.BufferedStart <= epoch && item.Key.BufferedEnd >= epoch)) { return(item.Value); } } } Antenna antenna = null; //lock (locker) { antenna = antexReader.GetAntenna(serial, epoch); } //无论是否为空null,都加进去, 下次直接提取,以保证速度。这是和 Reader 的区别。 if (serialEpochBuffer.ContainsKey(serial))//包含,但不包含这个时段 { BufferedTimePeriod span = new BufferedTimePeriod(antenna.ValidDateFrom, antenna.ValidDateUntil); serialEpochBuffer[serial].Add(span, antenna); } else if (antenna != null)//不包含,且不为空,则 { Dictionary <BufferedTimePeriod, Antenna> dic = new Dictionary <BufferedTimePeriod, Antenna>(); BufferedTimePeriod span = new BufferedTimePeriod(antenna.ValidDateFrom, antenna.ValidDateUntil); dic.Add(span, antenna); serialEpochBuffer[serial] = dic; } else//不包含,文件中也没有,则认为本次计算时段内(1年)都没有,其中10秒为钟差预留 { Dictionary <BufferedTimePeriod, Antenna> dic = new Dictionary <BufferedTimePeriod, Antenna>(); BufferedTimePeriod span = new BufferedTimePeriod(epoch.Date - 10, epoch.Date + TimeSpan.FromDays(365)); dic.Add(span, antenna); serialEpochBuffer[serial] = dic; } return(antenna); } }
/// <summary> /// 设置 /// </summary> /// <param name="key"></param> /// <param name="val"></param> public override void Set(BufferedTimePeriod key, TService val) { if (this.Count > MaxHoulderCount) { lock (getLocker) { var serviceKey = LastVisitTime.FirstKey;// GetEarlistVisitedTimePeriod(); var passedTime = DateTime.Now - (LastVisitTime[serviceKey]); if (passedTime > MinExpireTime) { log.Info("移除缓存服务:" + typeof(TService).Name + ", " + serviceKey); this.Remove(serviceKey); LastVisitTime.Remove(serviceKey); } } } base.Set(key, val); }
/// <summary> /// 创建单点定位 /// </summary> /// <param name="obsPath">测站信息</param> /// <param name="startTime">起始计算时间</param> /// <returns></returns> private IGnssSolver BuildPositioner(string rovObsPath, BufferedTimePeriod startTime) { GnssProcessOption PositionOption = GetModel(startTime); #region 星历钟差数据源配置 #region 星历数据配置 FileEphemerisService ephemerisDataSource = null; if (IsSetEphemerisFile) { string ephemerisPath = this.textBox_navPath.Text; if (!File.Exists(ephemerisPath)) { throw new FileNotFoundException("指定星历文件不存在!\r\n" + ephemerisPath); } FileEphemerisType ephType = EphemerisDataSourceFactory.GetFileEphemerisTypeFromPath(ephemerisPath); ephemerisDataSource = EphemerisDataSourceFactory.Create(ephemerisPath); } #endregion #region 钟差数据配置 Data.ISimpleClockService clock = null; if (this.checkBox_enableClockFile.Checked) { clock = new Data.SimpleClockService(this.textBox_ClockPath.Text); } #endregion #endregion #region 定位器构造 //加载文件数据 RefObservationDataSource = new RinexFileObsDataSource(this.textBox_baseLinePath.Text); var RovObservationDataSource = new RinexFileObsDataSource(rovObsPath); DataSourceContext context = DataSourceContext.LoadDefault(PositionOption, RovObservationDataSource, ephemerisDataSource, clock); IonFreeDoubleDifferPositioner pp = new IonFreeDoubleDifferPositioner(context, PositionOption); //pp.Produced += pp_ProgressIncreased; return(pp); #endregion }
/// <summary> /// 获取IGS星历数据源选项 /// </summary> /// <returns></returns> public IgsProductSourceOption GetIgsProductSourceOption(BufferedTimePeriod TimePeriod, List <SatelliteType> SatelliteTypes) { var option = new IgsProductSourceOption(TimePeriod, SatelliteTypes) { IgsProductLocalDirectories = IgsProductLocalDirectories, // this.GetIgsProductLocalDirectory().FilePath, IgsProductLocalDirectory = IgsProductLocalDirectory, // this.GetIgsProductLocalDirectory().FilePath, IgsProductSourceDic = GetSysBasedIgsProductSourceDic(), // IgsProductSources = option.IgsProductSourceDic[SatelliteType.U], IgsProductUrlDirectories = this.IgsProductUrlDirectories, IgsProductUrlModels = this.IgsProductUrlModels, IsDownloadingSurplurseIgsProducts = this.IsDownloadingSurplurseIgsProducts, IsUniqueSource = this.IsUniqueSource, IndicatedSourceCode = this.IndicatedSourceCode,// "ig", Sp3EphMaxBreakingCount = this.Sp3EphMaxBreakingCount, //MinSequentialSatCount = this.MinSequentialSatCount, IsSkipIonoContent = IsSkipIonoContent, }; return(option); }
/// <summary> /// 指定时间中,剩余时段(往未来方向)最长(从大到小)的卫星排序。 /// 注意:与默认的排序(从小到大)是相反的。 /// </summary> /// <param name="gpsTime">时间</param> /// <returns></returns> public List <SatPeriod> GetSortedSatPeriods(Time gpsTime) { List <SatPeriod> list = new List <SatPeriod>(); foreach (var kv in this.Data) { var period = kv.Value.GetSegment(gpsTime); if (period == null) { continue; } BufferedTimePeriod newPeriod = new BufferedTimePeriod(gpsTime, period.End + 0.1, period.EndBuffer); list.Add(new SatPeriod(kv.Key, newPeriod)); } list.Sort(); list.Reverse(); return(list); }
/// <summary> /// 数据变动后,应该初始化测站名称 /// </summary> public new void Init() { //检查,确保测站名称对应的否坐标一致 SiteCoordsManager siteCoords = new SiteCoordsManager(); foreach (var baseLine in this) { siteCoords.GetOrCreate(baseLine.BaseLineName.RefName).Add(baseLine.ApproxXyzOfRef); siteCoords.GetOrCreate(baseLine.BaseLineName.RovName).Add(baseLine.ApproxXyzOfRov); } foreach (var item in siteCoords) { if (item.Coords.Count > 0 && !item.IsCoordSame()) //坐标不一致 { SetSiteCoord(item.Name, item.Coord); //采用第一个进行赋值 } } //默认时段 if (TimePeriod == null && this.Count > 0) { TimePeriod = new BufferedTimePeriod(First.ApporxNetPeriod); } }
public override Dictionary <GnssBaseLineName, BaseLineRepeatError> Create(BufferedTimePeriod key) { return(new Dictionary <GnssBaseLineName, BaseLineRepeatError>()); }
public EmptySimpleClockService(BufferedTimePeriod timePeriod) { this.TimePeriod = timePeriod; }
/// <summary> /// 添加观测时段 /// </summary> /// <param name="satelliteType">卫星</param> /// <param name="period">一个时段</param> public void AddTimePeriod(SatelliteNumber prn, BufferedTimePeriod period) { GetPeriods(prn).Add(period); }
/// <summary> /// 默认构造函数 /// </summary> /// <param name="SatelliteType">系统类型</param> /// <param name="timePeriod">时段信息</param> public SessionInfo(BufferedTimePeriod timePeriod, List <SatelliteType> SatelliteType) { this.TimePeriod = timePeriod; this.SatelliteTypes = SatelliteType; }
/// <summary> /// 指定时段内,可以看见的卫星。 /// </summary> /// <returns></returns> public List <VisibilityOfSat> GetPeriodSatAppearTimes() { this.LonLats.Clear(); List <VisibilityOfSat> sats = new List <VisibilityOfSat>(); List <StationSatInfo> infos = new List <StationSatInfo>(); List <SatelliteNumber> prns = new List <SatelliteNumber>(); // EphemerisService.EphemerisDataSource.GetEphemerisInfos( foreach (SatelliteNumber rec in EphemerisService.Prns)//卫星一颗一颗的算 { if (prns.Contains(rec)) { continue; } prns.Add(rec); VisibilityOfSat satA = new VisibilityOfSat() { PRN = rec, VisibleTimes = new List <BufferedTimePeriod>() }; sats.Add(satA); Polar lastP = null; DateTime f = DateTime.MinValue; for (int i = 0; i < Count; i++) { DateTime time = From + TimeSpan.FromMinutes(i * SpanMinutes); Time g = new Time(time); Geo.Coordinates.XYZ xyz = EphemerisService.Get(rec, g).XYZ; GeoCoord coord = CoordTransformer.XyzToGeoCoord(xyz); Polar p = CoordTransformer.XyzToGeoPolar(xyz, StationPos); if (lastP == null) { lastP = p; continue; } if (p.Elevation >= EleAngle) { if (f.Equals(DateTime.MinValue) || lastP.Elevation < EleAngle) { f = time; lastP = p; continue; } } if (p.Elevation < EleAngle || i == Count - 1) //当前小于指定高度角 { if (!f.Equals(DateTime.MinValue) && lastP.Elevation > EleAngle) //且上一个时刻是大于的,则终端出现了。 { BufferedTimePeriod s = new BufferedTimePeriod(f, time); satA.VisibleTimes.Add(s); this.LonLats.Add(new Vector(coord.Lon, coord.Lat) { Tag = rec.PRN.ToString() }); } } lastP = p; } } sats.Sort(); return(sats); }
public void SetTimePerid(BufferedTimePeriod TimePerid) { TimeFrom = TimePerid.Start.DateTime; TimeTo = TimePerid.End.DateTime; }
/// <summary> /// 构造函数。 /// </summary> public SatPeriodWeight(SatelliteNumber Prn, BufferedTimePeriod Period, int CycleSlipCount) : base(Prn, Period) { this.CycleSlipCount = CycleSlipCount; }
/// <summary> /// 构造函数。一颗卫星的时段。 /// </summary> /// <param name="Prn">卫星编号</param> /// <param name="TimePeriod">时段</param> public SatPeriod(SatelliteNumber Prn, BufferedTimePeriod TimePeriod) { this.Prn = Prn; this.TimePeriod = TimePeriod; }