예제 #1
0
        private DcbFile GetNearDcbFile(Time nearTime, string fileType)
        {
            DcbFile nearDcbFile = null;
            var     newName     = TimeTokey(nearTime, fileType) + ".DCB";
            string  newpath     = Path.Combine(this.Option.FilePath, newName);

            if (File.Exists(newpath))
            {
                nearDcbFile = new DcbFileReader(newpath).Read();
                log.Info("DCB 载入临近时间 " + newpath);
            }
            return(nearDcbFile);
        }
예제 #2
0
        /// <summary>
        /// P2C2与P1C1和P1P2不同
        /// </summary>
        /// <param name="prn"></param>
        /// <param name="time"></param>
        /// <param name="fileType"></param>
        /// <returns></returns>
        public RmsedNumeral GetP2C2_rinex(SatelliteNumber prn, Time time, string fileType = "P2C2")
        {
            lock (locker)
            {
                string  key     = TimeTokey(time, fileType);
                DcbFile dcbFile = null;
                if (!data.ContainsKey(key))
                {
                    string fileName = key + "_RINEX.DCB";

                    var allPathes = GetPosibleFilePathes(fileName);
                    foreach (var path in allPathes)
                    {
                        if (File.Exists(path))
                        {
                            dcbFile = new DcbFileReader(path).ReadP2C2();
                            log.Info("DCB 载入 " + path);
                            //是 null 也存储
                            data[key] = dcbFile;
                            break;//匹配成功一个即中断
                        }
                    }

                    //首先尝试下载
                    if (dcbFile == null && Setting.IsInternetEnabled)
                    {
                        var url       = BuildUrl(time, fileType);
                        var localPath = InputFileManager.GetLocalFilePath(url, "*_RINEX.DCB", "*_RINEX.DCB.Z");
                        if (File.Exists(localPath))
                        {
                            dcbFile = new DcbFileReader(localPath).Read();
                            log.Info("DCB 载入 " + localPath);
                            //是 null 也存储
                            data[key] = dcbFile;
                        }
                    }
                    #region 其它情况
                    //如果网络不通,或下载失败,则查找附近几个月的结果,先前2月,后考虑后两月。
                    //if (dcbFile == null)
                    //{
                    //    var nearTime = time - TimeSpan.FromDays(30.5); ;
                    //    dcbFile = GetNearDcbFile(nearTime, fileType);
                    //}
                    //if (dcbFile == null)
                    //{
                    //    var nearTime = time + TimeSpan.FromDays(30.5);
                    //    dcbFile = GetNearDcbFile(nearTime, fileType);
                    //} if (dcbFile == null)
                    //{
                    //    var nearTime = time - TimeSpan.FromDays(61);
                    //    dcbFile = GetNearDcbFile(nearTime, fileType);
                    //} if (dcbFile == null)
                    //{
                    //    var nearTime = time + TimeSpan.FromDays(61);
                    //    dcbFile = GetNearDcbFile(nearTime, fileType);
                    //}
                    #endregion

                    if (dcbFile != null)
                    {
                        data[key] = dcbFile;
                        log.Info("本次处理 DCB 采用相邻时间文件 " + dcbFile);
                    }
                }
                else
                {
                    dcbFile = data[key];
                }

                if (dcbFile == null)
                {
                    return(RmsedNumeral.Zero);
                }

                return(dcbFile.GetSatInfo(prn));
            }
        }