示例#1
0
        static public ObjectTableStorage GetRangeErrorTable(RinexObsFile ObsFile, double k1, double k2, FileEphemerisService FileEphemerisService)
        {
            var    table     = new ObjectTableStorage("Range Error 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;
                foreach (var epoch in ObsFile)
                {
                    if (epoch.Contains(prn))
                    {
                        var sat     = epoch[prn];
                        var isError = sat.IsRangeGrossError(k1, k2);
                        if (isError)
                        {
                            if (index == 1)
                            {
                                table.NewRow();
                                table.AddItem("Prn", prn.ToString());
                            }
                            table.AddItem("Error" + (index++), epoch.ReceiverTime);
                        }
                    }
                }
            }
            return(table);
        }
        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);
        }
示例#3
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);
        }
示例#4
0
        public void DrawVisibility(RinexObsFile ObsFile, float fontSize = 10)
        {
            this.Text = "Visibility of " + ObsFile.Header.SiteName;
            chart1.Series.Clear();
            double interval = ObsFile.Header.Interval;
            var    prns     = ObsFile.GetPrns();
            int    prnIndex = 1;

            foreach (var prn in prns)
            {
                List <DateTime> txData = new List <DateTime>();
                List <int>      tyData = new List <int>();
                foreach (var epoch in ObsFile)
                {
                    if (epoch.Contains(prn))
                    {
                        txData.Add(epoch.ReceiverTime.DateTime);
                        tyData.Add(prnIndex);
                    }
                }

                var series = chart1.Series.Add(prn.ToString());
                //    series.Font = new Font("Times New Roman", 12);
                var color = Color.DarkBlue;

                switch (prn.SatelliteType)
                {
                case SatelliteType.U:
                    break;

                case SatelliteType.G:
                    color = Color.Blue;
                    break;

                case SatelliteType.R:
                    color = Color.DimGray;
                    break;

                case SatelliteType.S:
                    break;

                case SatelliteType.E:
                    color = Color.DarkSeaGreen;
                    break;

                case SatelliteType.C:
                    color = Color.OrangeRed;
                    break;

                case SatelliteType.M:
                    break;

                case SatelliteType.J:
                    break;

                case SatelliteType.D:
                    break;

                case SatelliteType.I:
                    break;

                default:
                    break;
                }
                series.Color = color;
                //    series.IsValueShownAsLabel = true;
                series.IsVisibleInLegend = false;
                series.ChartType         = SeriesChartType.Point;
                series.Points.DataBindXY(txData, tyData);
                series.BorderWidth = 1;

                prnIndex++;
            }

            ChartArea chartArea = chart1.ChartAreas[0];

            //    chartArea.AxisX.Minimum = 0;
            ////      chartArea.AxisX.Maximum = 24 * 60 * 60;
            chartArea.AxisY.Minimum = 0;
            chartArea.AxisY.Maximum = prns.Count + 1;

            //chartArea.AxisX.ScrollBar.IsPositionedInside = true; //滚动条
            //chartArea.AxisX.ScrollBar.Enabled = true;

            chartArea.CursorX.IsUserEnabled          = true; //设置坐标轴可以用鼠标点击放大
            chartArea.CursorX.IsUserSelectionEnabled = true; //用户可以选择从那里放大
                                                             //chartArea.AxisX.Title = "Time/s";  //设置下方横坐标名称,当然AxisX2为上方的横坐标。

            //string Ytitle = null;
            //for (int i = prns.Count - 1; i >= 0; i--)
            //{
            //    Ytitle += prns[i].ToString() + "\r\n";
            //}
            //   chartArea.AxisY.Title = "PRN";// Ytitle; //Y轴的标题名字是对应的卫星编号
            //    chartArea.AxisY.TextOrientation = TextOrientation.Horizontal;
            chartArea.AxisX.IsLabelAutoFit = true;
            //   chartArea.AxisX.LabelStyle.Angle = 90;
            chartArea.AxisX.LabelStyle.Format = "HH:mm";
            chartArea.AxisX.LabelStyle.Font   = new Font("Times New Roman", fontSize);
            //此处无用
            chartArea.AxisY.LabelStyle.Font = new Font("Times New Roman", fontSize);
            chartArea.AxisX.Minimum         = ObsFile.Header.StartTime.DateTime.ToOADate();
            chartArea.AxisX.Maximum         = ObsFile.Header.EndTime.DateTime.ToOADate();

            var    totalHours = (int)(Math.Round(ObsFile.Header.TimePeriod.Span / 3600)); //hour
            double xInterval  = 4 / 24.0;                                                 // 0.0416666667;

            if (totalHours < 1)                                                           //10m
            {
                xInterval = 4 / 24.0 / 6;
            }
            if (totalHours < 10)//30m
            {
                xInterval = 4 / 24.0 / 2;
            }
            chartArea.AxisX.Interval       = xInterval;
            chartArea.AxisY.IsLabelAutoFit = true;
            chartArea.AxisY.Interval       = 1;
            for (int i = 0; i < prns.Count; i++)
            {
                var p = prns[i];

                chartArea.AxisY.CustomLabels.Add(i + 0.5, i + 1.5, p.ToString());//
            }

            chartArea.CursorY.IsUserEnabled          = true; //设置坐标轴可以用鼠标点击放大
            chartArea.CursorY.IsUserSelectionEnabled = true; //用户可以选择从那里放大
        }
        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);
        }