static public ObjectTableStorage GetLiCycleSlipTable(RinexObsFile ObsFile, double maxDiffer = 1)
        {
            var    table     = new ObjectTableStorage("Li Cycle Slips Of Sats of " + ObsFile.SiteInfo.SiteName);
            double interval  = ObsFile.Header.Interval;
            var    lastTimes = new BaseDictionary <SatelliteNumber, Time>();

            var prns = ObsFile.GetPrns();

            foreach (var prn in prns)
            {
                int    index   = 1;
                double lastVal = 0;
                foreach (var epoch in ObsFile)
                {
                    if (epoch.Contains(prn))
                    {
                        var sat = epoch[prn];

                        if (sat.PhaseA == null || sat.PhaseB == null)
                        {
                            lastVal = 0;
                            continue;
                        }

                        if (lastVal == 0)
                        {
                            lastVal = sat.GfValue;
                            continue;
                        }

                        var differ = Math.Abs(sat.GfValue - lastVal);
                        if (differ > maxDiffer)
                        {
                            if (index == 1)
                            {
                                table.NewRow();
                                table.AddItem("Prn", prn.ToString());
                            }
                            //record and reset
                            table.AddItem("Cycle" + (index++), epoch.ReceiverTime);
                        }

                        lastVal = sat.GfValue;
                    }
                }
            }

            return(table);
        }
Beispiel #2
0
        public static ObjectTableStorage GetSatVisiblityTable(RinexObsFile ObsFile)
        {
            var    table     = new ObjectTableStorage("Visiblity Of Sats of " + ObsFile.SiteInfo.SiteName);
            double interval  = ObsFile.Header.Interval;
            var    lastTimes = new BaseDictionary <SatelliteNumber, Time>();

            var prns = ObsFile.GetPrns();

            foreach (var prn in prns)
            {
                Time lastTime    = null;
                Time firstTime   = null;
                int  periodIndex = 1;
                table.NewRow();
                table.AddItem("Prn", prn.ToString());
                foreach (var epoch in ObsFile)
                {
                    if (epoch.Contains(prn))
                    {
                        if (firstTime == null)
                        {
                            lastTime  = epoch.ReceiverTime;
                            firstTime = epoch.ReceiverTime;
                        }

                        if (epoch.ReceiverTime - lastTime > interval + 0.001)
                        {
                            TimePeriod timePeriod = new TimePeriod(firstTime, lastTime);
                            table.AddItem("Period" + (periodIndex++), timePeriod.ToString());

                            firstTime = null;
                        }

                        lastTime = epoch.ReceiverTime;
                    }
                }
                if (firstTime != null)
                {
                    TimePeriod timePeriod = new TimePeriod(firstTime, lastTime);
                    table.AddItem("Period" + (periodIndex++), timePeriod.ToString());
                    firstTime = null;
                }
            }

            return(table);
        }
Beispiel #3
0
        public void Run(string[] InputRawPathes)
        {
            this.InputRawPathes = InputRawPathes;
            table = new ObjectTableStorage();

            foreach (var inputPath in InputRawPathes)
            {
                if (IsCancel)
                {
                    log.Info("Canceled at :" + inputPath);
                    break;
                }
                string subDir = Gdp.Utils.PathUtil.GetSubDirectory(InputRawPathes, inputPath);

                Process(subDir, inputPath);
            }

            Complete();
        }
        /// <summary>
        /// 转换为表格
        /// </summary>
        /// <returns></returns>
        public ObjectTableStorage ToTable()
        {
            ObjectTableStorage table = new ObjectTableStorage();
            int i = 0;

            foreach (var kv in this.KeyValues)
            {
                foreach (var item in kv.Value.KeyValues)
                {
                    table.NewRow();
                    table.AddItem("Index", i);
                    table.AddItem("Name", kv.Key);
                    table.AddItem("TimePeriod", item.Key.ToString());
                    table.AddItem("Value", item.Value.Value.ToString("G8"));
                    table.AddItem("Rms", item.Value.Rms.ToString("G8"));

                    i++;
                }
            }
            return(table);
        }
        /// <summary>
        /// 构建行
        /// </summary>
        /// <param name="table"></param>
        /// <param name="index"></param>
        /// <param name="outName"></param>
        /// <param name="outValue"></param>
        /// <returns></returns>
        public void AddDetailRowsToTable(ObjectTableStorage table, ref int index, string outName = null, object outValue = null)
        {
            foreach (var topKv in this.Data)         //分组遍历
            {
                foreach (var kv in topKv.Value.Data) //一个分组一个数据
                {
                    index++;
                    table.NewRow();
                    table.AddItem("Index", index);

                    if (!String.IsNullOrWhiteSpace(outName) && outValue != null)
                    {
                        table.AddItem(outName, outValue);
                    }

                    table.AddItem("Name", topKv.Key);
                    table.AddItem("Group", kv.Key);
                    table.AddItem("Value", kv.Value.Value);
                    table.AddItem("Rms", kv.Value.StdDev);
                }
            }
        }
        /// <summary>
        /// 解析
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public static PeriodRmsedNumeralStoarge Parse(ObjectTableStorage table)
        {
            var storage = new PeriodRmsedNumeralStoarge();

            foreach (var row in table.BufferedValues)
            {
                var    paramName  = row["Name"].ToString();
                var    timePeriod = TimePeriod.Parse(row["TimePeriod"].ToString());
                double val        = Double.NaN;
                double rms        = Double.NaN;
                if (row.ContainsKey("Value"))
                {
                    val = double.Parse(row["Value"].ToString());
                }
                if (row.ContainsKey("Rms"))
                {
                    rms = double.Parse(row["Rms"].ToString());
                }
                storage.GetOrCreate(paramName)[timePeriod] = new RmsedNumeral(val, rms);
            }
            return(storage);
        }
        /// <summary>
        /// 通过缓存,按照系统类型,转换为表格,以便统计。
        /// </summary>
        /// <returns></returns>
        private Dictionary <SatelliteType, ObjectTableStorage> BuildObsCodeTables(Dictionary <SatelliteType, List <string> > ObsCodes)
        {
            var SatelliteTypes = ObsCodes.Keys;
            var buffer         = this.BufferedStream.MaterialBuffers;
            var tables         = new Dictionary <SatelliteType, ObjectTableStorage>();

            foreach (var epoch in buffer)
            {
                foreach (var sat in epoch)
                {
                    var satType = sat.Prn.SatelliteType;
                    //如果已经过滤则不考虑了
                    if (!SatelliteTypes.Contains(satType))
                    {
                        continue;
                    }

                    if (!tables.ContainsKey(satType))
                    {
                        tables.Add(satType, new ObjectTableStorage());
                    }
                    ObjectTableStorage table = tables[satType];
                    table.NewRow();
                    var types = ObsCodes[satType];
                    foreach (var obsType in sat.ObsTypes)
                    {
                        if (!types.Contains(obsType))
                        {
                            continue;
                        }

                        table.AddItem(obsType.ToString(), sat.TryGetValue(obsType));
                    }
                    table.EndRow();
                }
            }
            return(tables);
        }
Beispiel #8
0
        static public ObjectTableStorage GetLiTable(RinexObsFile ObsFile, FileEphemerisService FileEphemerisService)
        {
            var table = new ObjectTableStorage("LI values of " + ObsFile.SiteInfo.SiteName);

            foreach (var epoch in ObsFile)
            {
                table.NewRow();
                table.AddItem("Epoch", epoch.ReceiverTime);
                foreach (var sat in epoch)
                {
                    table.AddItem(sat.Prn + "_Li", sat.GfValue);
                    if (FileEphemerisService != null)
                    {
                        var eph = FileEphemerisService.Get(sat.Prn, epoch.ReceiverTime);
                        if (eph != null)
                        {
                            var polar = CoordTransformer.XyzToGeoPolar(eph.XYZ, ObsFile.Header.ApproxXyz);
                            table.AddItem(sat.Prn + "_Ele", polar.Elevation);
                        }
                    }
                }
            }
            return(table);
        }
        /// <summary>
        /// 获取表格
        /// </summary>
        /// <returns></returns>
        public ObjectTableStorage GetTable(string tableName = "所有站MW计算结果")
        {
            ObjectTableStorage table = new ObjectTableStorage(tableName);

            return(ExtractRowToTable(table));
        }
        static public ObjectTableStorage GetMp3Table(RinexObsFile ObsFile, FileEphemerisService FileEphemerisService, double maxGfDiffer = 0.15, double maxMwDiffer = 2)
        {
            var           table     = new ObjectTableStorage("Mp2 values of " + ObsFile.SiteInfo.SiteName);
            var           prns      = ObsFile.GetPrns();
            double        interval  = ObsFile.Header.Interval;
            List <double> validData = new List <double>();

            foreach (var prn in prns)
            {
                //if (prn.SatelliteType != SatelliteType.C)
                //{
                //    continue;
                //}
                double                    lastGfVal = 0;
                double                    lastMwVal = 0;
                Time                      lastTime  = null;
                Time                      firstTime = null;
                List <Time>               Times     = new List <Time>();
                List <double>             DataMp3   = new List <double>();
                Dictionary <Time, double> dicMp3    = new Dictionary <Time, double>();

                foreach (var epoch in ObsFile)
                {
                    dicMp3.Add(epoch.ReceiverTime, 0);
                    if (epoch.Contains(prn))
                    {
                        var sat = epoch[prn];
                        if (FileEphemerisService != null)
                        {
                            var eph = FileEphemerisService.Get(sat.Prn, epoch.ReceiverTime);
                            if (eph != null)
                            {
                                var    polar     = CoordTransformer.XyzToGeoPolar(eph.XYZ, ObsFile.Header.ApproxXyz);
                                double elevation = polar.Elevation;
                                if (elevation < 5)
                                {
                                    continue;
                                }
                            }
                        }

                        if (sat.PhaseA == null || sat.RangeA == null || sat.PhaseC == null || sat.RangeC == null)
                        {
                            if (Times.Count > 30)
                            {
                                double averageMp2 = DataMp3.Average();

                                for (int i = 0; i < Times.Count - 1; i++)
                                {
                                    if (dicMp3.ContainsKey(Times[i]))
                                    {
                                        dicMp3[Times[i]] = DataMp3[i] - averageMp2;
                                    }
                                }
                            }
                            lastGfVal = 0;
                            lastMwVal = 0;
                            Times     = new List <Time>();
                            DataMp3   = new List <double>();

                            firstTime = null;
                            // table.AddItem(strEpoch, " ");
                            continue;
                        }

                        if (firstTime == null)
                        {
                            lastTime  = epoch.ReceiverTime;
                            firstTime = epoch.ReceiverTime;
                        }
                        if (lastGfVal == 0 || lastMwVal == 0)
                        {
                            lastGfVal = sat.GfValue;
                            lastMwVal = sat.MwCycle;
                        }
                        var differGf = Math.Abs(sat.GfValue - lastGfVal);
                        var differMw = Math.Abs(sat.MwCycle - lastMwVal);

                        if (epoch.ReceiverTime - lastTime > interval + 0.05 || differGf > maxGfDiffer || differMw > maxMwDiffer || epoch == ObsFile.Last())
                        {
                            double averageMp2 = DataMp3.Average();

                            if (Times.Count > 30) //arc
                            {
                                for (int i = 0; i < Times.Count - 1; i++)
                                {
                                    if (dicMp3.ContainsKey(Times[i]))
                                    {
                                        dicMp3[Times[i]] = DataMp3[i] - averageMp2;
                                    }
                                }
                            }
                            Times     = new List <Time>();
                            DataMp3   = new List <double>();
                            lastGfVal = 0;
                            lastMwVal = 0;
                            firstTime = epoch.ReceiverTime;
                        }
                        Times.Add(epoch.ReceiverTime);
                        DataMp3.Add(sat.Mp3Value);
                        lastTime  = epoch.ReceiverTime;
                        lastGfVal = sat.GfValue;
                        lastMwVal = sat.MwCycle;
                    }
                }
                if (Times.Count > 30) //last arc
                {
                    double averageMp3 = DataMp3.Average();
                    for (int i = 0; i < Times.Count - 1; i++)
                    {
                        if (dicMp3.ContainsKey(Times[i]))
                        {
                            dicMp3[Times[i]] = DataMp3[i] - averageMp3;
                        }
                    }
                }

                table.NewRow();
                table.AddItem("Prn", prn.ToString());

                foreach (var item in dicMp3)
                {
                    string strEpoch = item.Key.Hour.ToString() + ":" + item.Key.Minute.ToString() + ":" + item.Key.Seconds.ToString();
                    if (item.Value != 0)
                    {
                        table.AddItem(strEpoch, item.Value);
                        validData.Add(item.Value);
                    }
                    else
                    {
                        table.AddItem(strEpoch, "");
                    }
                }
            }

            //RMS to evaluate the MP
            //double average = validData.Average();
            //double countData = 0;
            //double countData1 = 0;
            //for (int i = 0; i < validData.Count - 1; i++)
            //{
            //    countData += (validData[i] - average) * (validData[i] - average);
            //    countData1 += validData[i] * validData[i];
            //}

            //double rmsMp = Math.Sqrt(countData / validData.Count);
            //double rmsMp3 = Math.Sqrt(countData1 / validData.Count);

            //table.NewRow();
            //table.AddItem("rmsMp", rmsMp);
            //table.AddItem("rmsMp3", rmsMp3);

            return(table);
        }