private void button_export_Click(object sender, EventArgs e)
        {
            bool fillWithZero = checkBox1.Checked;
            var  directory    = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);
            var prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });

            string[] pathes = this.textBox_Pathes.Lines;
            foreach (var sp3item in pathes)
            {
                ClockFileReader r = new ClockFileReader(sp3item, false);
                ClockFile = r.ReadAll();
                string PredictedClockBiasPath = this.textBox_predictedresultPath.ToString();

                ClockBias = new Dictionary <Time, clockbias>();

                GetPredictedClockBias(PredictedClockBiasPath);
                ClockFileofPredicted        = new ClockFile();
                ClockFileofPredicted.Header = ClockFile.Header;

                foreach (var item in ClockFile.Data.Values)
                {
                    foreach (var clock in item)
                    {
                        if (clock.ClockType == Data.Rinex.ClockType.Satellite)
                        {
                            clockbias section = ClockBias[clock.Time];
                            clock.ClockBias = section.sat[clock.Prn];
                            ClockFileofPredicted.GetClockItems(clock.Name).Add(clock);
                        }
                        else
                        {
                            ClockFileofPredicted.GetClockItems(clock.Name).Add(clock);
                        }
                    }
                }

                ClockFileofPredicted.Header.Comments.Add("Processd by Gnsser");
                ClockFileofPredicted.Header.Comments.Add("Predicted clock bias replace original precise data");
                var             path            = Path.Combine(directory, "P" + r.Name + ".clk");
                ClockFileWriter ClockFileWriter = new ClockFileWriter(sp3item, ClockFileofPredicted);
                ClockFileWriter.SaveToFile();
                ClockFile.Clear();
            }
            Geo.Utils.FileUtil.OpenDirectory(directory);
        }
        private void button_read_Click(object sender, EventArgs e)
        {
            bool fillWithZero = checkBox1.Checked;
            var  directory    = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);

            var prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });
            Dictionary <SatelliteNumber, StreamWriter> prnWritersOfBroadcast      = new Dictionary <SatelliteNumber, StreamWriter>();
            Dictionary <SatelliteNumber, StreamWriter> prnWritersOfBroadcastError = new Dictionary <SatelliteNumber, StreamWriter>();

            FileEphemerisService coll;
            FileEphemerisService coll0;
            ClockService         collOfPrecise;

            string[] pathes          = this.textBox_Broadcast.Lines;
            string[] pathesOfPrecise = this.textBox_Pathes.Lines;
            string   firstDayOfWeek  = GetDayOfWeekFromBroadcastFileName(pathes[0]);
            string   lastDayOfWeek   = GetDayOfWeekFromBroadcastFileName(pathes[pathes.Length - 1]);
            string   filename        = Path.GetFileNameWithoutExtension(pathesOfPrecise[0]).Substring(0, 3) + GetFileEphemerisTypeFromPath(pathesOfPrecise[0]).ToString();;

            foreach (var item in prns)
            {
                var pathOfBroadcast      = Path.Combine(directory, item.ToString() + "Broadcast" + "-" + firstDayOfWeek + "-" + lastDayOfWeek + ".txt");
                var pathOfBroadcastError = Path.Combine(directory, item.ToString() + "BroadcastError" + "-" + filename + firstDayOfWeek + "-" + lastDayOfWeek + ".txt");
                prnWritersOfBroadcast[item]      = new StreamWriter(new FileStream(pathOfBroadcast, FileMode.Create));
                prnWritersOfBroadcastError[item] = new StreamWriter(new FileStream(pathOfBroadcastError, FileMode.Create));
            }

            List <string> listPath = new List <string> ();

            for (int i = 0; i < pathesOfPrecise.Length; i++)
            {
                listPath.Add(pathesOfPrecise[i]);
            }

            #region
            coll0 = EphemerisDataSourceFactory.Create(pathes[0]);
            foreach (var pathItem in pathes)
            {
                coll = EphemerisDataSourceFactory.Create(pathItem);
                string dayOfWeek = GetDayOfWeekFromBroadcastFileName(pathItem);
                for (int index = 0; index < listPath.Count; index++)
                {
                    if (listPath[index].Contains(dayOfWeek))
                    {
                        collOfPrecise = new ClockService(listPath[index]);
                        Time end = collOfPrecise.TimePeriod.End;
                        foreach (var prn in prns)
                        {
                            var writerOfBroadcast      = prnWritersOfBroadcast[prn];
                            var writerOfBroadcastError = prnWritersOfBroadcastError[prn];
                            var allOfBroadcast         = coll.Gets(prn, coll.TimePeriod.Start, end);
                            var allOfBroadcast0        = coll0.Gets(prn, coll0.TimePeriod.Start, coll0.TimePeriod.End);
                            var allOfPrecise           = collOfPrecise.GetClocks(prn);
                            if (allOfBroadcast == null)// || allOfPrecise == null || allOfPrecise.Count==0)
                            {
                                continue;
                            }
                            allOfBroadcast.Sort();
                            allOfBroadcast0.Sort();
                            if (prn.SatelliteType == SatelliteType.E)
                            {
                            }
                            int  interval = 0;
                            Time start0   = collOfPrecise.TimePeriod.Start;
                            switch (prn.SatelliteType)
                            {
                            case SatelliteType.E: interval = 600; break;

                            case SatelliteType.C: interval = 3600; break;

                            case SatelliteType.G: interval = 7200; break;

                            case SatelliteType.R: interval = 1800; start0 = collOfPrecise.TimePeriod.Start + 900; break;

                            case SatelliteType.J: interval = 896; break;

                            default: break;
                            }
                            for (Time i = start0; i <= end; i += interval)
                            {
                                var findOfPrecise   = allOfPrecise.SingleOrDefault(m => m.Time == i);
                                var findOfBroadcast = allOfBroadcast.SingleOrDefault(m => m.Time == i);
                                if (findOfBroadcast == null)
                                {
                                    findOfBroadcast = allOfBroadcast0.SingleOrDefault(m => m.Time == i);
                                }
                                if (findOfPrecise == null || findOfBroadcast == null)
                                {
                                    findOfPrecise = new AtomicClock()
                                    {
                                        Time = i, Prn = prn, ClockBias = 9999999999.0
                                    };

                                    if (findOfBroadcast == null)
                                    {
                                        findOfBroadcast = new Ephemeris()
                                        {
                                            Time = i, Prn = prn, ClockBias = 9999999999.0
                                        }
                                    }
                                    ;
                                }
                                else
                                {
                                    findOfPrecise.ClockBias = findOfPrecise.ClockBias - findOfBroadcast.ClockBias;
                                }

                                if (findOfBroadcast.ClockBias == 9999999999.0 && prn.SatelliteType == SatelliteType.G)
                                {
                                    findOfBroadcast = allOfBroadcast.FirstOrDefault(m => Math.Abs((m.Time - i) * 1.0) < 60);
                                    if (findOfBroadcast == null)
                                    {
                                        findOfBroadcast = allOfBroadcast0.FirstOrDefault(m => Math.Abs((m.Time - i) * 1.0) < 60);
                                    }
                                    if (findOfBroadcast == null)
                                    {
                                        findOfBroadcast = new Ephemeris()
                                        {
                                            Time = i, Prn = prn, ClockBias = 9999999999.0
                                        }
                                    }
                                    ;
                                }
                                writerOfBroadcast.WriteLine(findOfBroadcast.GetSimpleTabValues());
                                writerOfBroadcastError.WriteLine(findOfPrecise.GetTabValues());
                            }


                            //for (Time i = collOfPrecise.TimePeriod.Start; i <= end1; i = i + intervalSec)
                            //{
                            //    var findOfBroadcast = allOfBroadcast.SingleOrDefault(m => m.Time == i);
                            //    var findOfPrecise = allOfBroadcast.SingleOrDefault(m => m.Time == i);
                            //    if (findOfBroadcast == null || findOfPrecise == null)
                            //    {
                            //        if (!fillWithZero) continue;

                            //        findOfBroadcast = new Ephemeris() { Time = i, Prn = prn };
                            //    }
                            //    writerOfBroadcast.WriteLine(findOfBroadcast.GetTabValues());
                            //    findOfPrecise.ClockBias = findOfPrecise.ClockBias - findOfBroadcast.ClockBias;
                            //    writerOfBroadcastError.WriteLine(findOfPrecise.GetTabValues());
                            //}
                        }
                        coll0 = EphemerisDataSourceFactory.Create(pathItem);
                        listPath.RemoveAt(index);
                        break;
                    }
                }
            }


            #endregion

            foreach (var item in prnWritersOfBroadcast)
            {
                item.Value.Flush();
                item.Value.Close();
            }
            foreach (var item in prnWritersOfBroadcastError)
            {
                item.Value.Flush();
                item.Value.Close();
            }

            Geo.Utils.FileUtil.OpenDirectory(directory);
        }
示例#3
0
        private void button_run_Click(object sender, EventArgs e)
        {
            EphemerisService = GlobalNavEphemerisService.Instance;
            var prnStrs = namedStringControl_prn.GetValue();

            Prns    = SatelliteNumber.ParsePRNsBySplliter(prnStrs);
            cutOff  = namedFloatControl1AngleCut.GetValue();
            siteXyz = XYZ.Parse(this.namedStringControl_coord.GetValue());

            TableObject = new ObjectTableStorage();


            Geo.TimeLooper looper = timeLoopControl1.GetTimeLooper();
            looper.Looping   += Looper_Looping;
            looper.Completed += Looper_Completed;

            looper.Run();
            looper.Complete();


            var indexName = TableObject.GetIndexColName();

            var chart = chart1.ChartAreas[0];

            chart.BorderDashStyle = ChartDashStyle.Dash;
            chart.BorderWidth     = 1;
            //chart.AxisY.LineWidth = 5;
            chart.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash;

            var seriesDic = new BaseDictionary <SatelliteNumber, Series>("卫星雷达图",
                                                                         new Func <SatelliteNumber, Series>(key =>
            {
                Series series     = new Series(key.ToString());
                series.ChartType  = SeriesChartType.Polar;
                series.YValueType = ChartValueType.Double;
                series.XValueType = ChartValueType.Double;
                //series["PolarDrawingStyle"] = "Line";
                //series["PolarDrawingStyle"] = "Line";
                series.MarkerSize  = 5;
                series.MarkerStyle = MarkerStyle.Circle;

                series.MarkerSize  = 5;
                series.BorderWidth = 5;

                return(series);
            }));

            foreach (var row in TableObject.BufferedValues)
            {
                var rowData = new BaseDictionary <SatelliteNumber, DataPoint>("", m => new DataPoint());
                foreach (var item in row)
                {
                    if (item.Key == indexName)
                    {
                        continue;
                    }
                    var prn = SatelliteNumber.Parse(item.Key);

                    var valName = item.Key;
                    if (valName.Contains(Elevation))
                    {
                        rowData.GetOrCreate(prn).SetValueY(item.Value);
                    }
                    if (valName.Contains(Azimuth))
                    {
                        rowData.GetOrCreate(prn).XValue = Geo.Utils.ObjectUtil.GetNumeral(item.Value);
                    }
                }

                foreach (var kv in rowData.Data)
                {
                    seriesDic.GetOrCreate(kv.Key).Points.Add(kv.Value);
                }
            }

            chart1.Series.Clear();
            foreach (var item in seriesDic)
            {
                chart1.Series.Add(item);
            }

            CommonChartForm form  = new CommonChartForm();
            var             char1 = form.Chart.ChartAreas[0];

            char1.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash;
            int defaulFontSize = 14;

            form.Chart.Series.Clear();
            var chart0 = form.Chart.ChartAreas[0];

            chart0.AxisX.IsLabelAutoFit              = true;
            chart0.AxisX.LabelAutoFitMinFontSize     = defaulFontSize;
            chart0.AxisY.IsLabelAutoFit              = true;
            chart0.AxisY.LabelAutoFitMinFontSize     = defaulFontSize;
            chart0.AxisX.LabelStyle.Font             = new Font(FontSettingOption.DefaultFontFamily, defaulFontSize, FontStyle.Regular, GraphicsUnit.Pixel);
            chart0.AxisY.LabelStyle.Font             = new Font(FontSettingOption.DefaultFontFamily, defaulFontSize, FontStyle.Regular, GraphicsUnit.Pixel);
            form.Chart.Legends[0].AutoFitMinFontSize = defaulFontSize;

            foreach (var item in seriesDic)
            {
                form.Chart.Series.Add(item);
            }
            form.Show();
        }
示例#4
0
        private void button_read_Click(object sender, EventArgs e)
        {
            bool fillWithZero = checkBox1.Checked;
            var  intervalSec  = int.Parse(textBox_interval.Text) * 60;
            var  directory    = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);

            var prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });
            Dictionary <SatelliteNumber, StreamWriter> prnWriters = new Dictionary <SatelliteNumber, StreamWriter>();


            string[] pathes         = this.textBox_Pathes.Lines;
            string   fileName       = Path.GetFileName(pathes[0]).Substring(0, 3);
            string   firstDayOfWeek = Path.GetFileNameWithoutExtension(pathes[0]).Substring(3, 5);
            string   lastDayOfWeek  = Path.GetFileNameWithoutExtension(pathes[pathes.Length - 1]).Substring(3, 5);
            string   timePeriod     = firstDayOfWeek + "-" + lastDayOfWeek;

            string type = EphemerisDataSourceFactory.GetFileEphemerisTypeFromPath(pathes[0]).ToString();

            foreach (var item in prns)
            {
                var path = Path.Combine(directory, item.ToString() + "-" + fileName + "." + type + timePeriod + ".txt");
                prnWriters[item] = new StreamWriter(new FileStream(path, FileMode.Create));
            }

            Time start = Time.MaxValue;

            foreach (var path in pathes)
            {
                singleColl = EphemerisDataSourceFactory.Create(path);
                Time start0 = singleColl.TimePeriod.Start;
                Time end0   = singleColl.TimePeriod.End + intervalSec;
                if (start < start0)
                {
                    start0 = start;
                }
                foreach (var prn in prns)
                {
                    var writer = prnWriters[prn];

                    var all = singleColl.Gets(prn, start0, end0);
                    if (all == null)
                    {
                        continue;
                    }
                    for (Time i = start0; i < end0; i = i + intervalSec)
                    {
                        var find = all.SingleOrDefault(m => m.Time == i);
                        if (find == null)
                        {
                            if (!fillWithZero)
                            {
                                continue;
                            }

                            find = new Ephemeris()
                            {
                                Time = i, Prn = prn
                            };
                        }
                        writer.WriteLine(find.GetTabValues());
                    }
                }
                start = end0;
            }

            foreach (var item in prnWriters)
            {
                item.Value.Flush();
                item.Value.Close();
            }

            Geo.Utils.FileUtil.OpenDirectory(directory);
        }
        private void button_export_Click(object sender, EventArgs e)
        {
            bool fillWithZero    = checkBox1.Checked;
            int  intervalSec     = (int)(double.Parse(textBox_interval.Text) * 60);
            var  ModelLength     = (int)(24 * double.Parse(textBox_ModelLength.Text)) * 3600 / intervalSec;
            var  PredictedLength = (int)(24 * double.Parse(textBox_PredictedLength.Text)) * 3600 / intervalSec;
            var  directory       = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);

            var PredictedNumber = int.Parse(textBox_PredictedNumber.Text);

            string[] pathes = this.textBox_Pathes.Lines;
            EphemerisDataSourceFactory fac = new EphemerisDataSourceFactory();

            coll = new SequentialFileEphemerisService(fac, pathes);
            int  allSec = (int)coll.TimePeriod.Span;
            Time end    = coll.TimePeriod.End + intervalSec;

            List <SatelliteNumber> prns = new List <SatelliteNumber> ();

            if (this.IsSelectedPrn.Checked)
            {
                prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });
            }
            else
            {
                prns = coll.Prns;
            }

            List <double>            list      = new List <double>();
            Dictionary <string, SSE> ListOfSSE = new Dictionary <string, SSE>();
            string approach = null;

            #region 逐个卫星进行钟差预报
            for (int number = 0; number < PredictedNumber; number++)
            {
                sp3ofPredicted = new Sp3File();
                foreach (var prn in prns)
                {
                    int         GlideEpochNumber = int.Parse(this.textBox1_GlideEpochNumber.Text);//滑动历元历元数
                    ArrayMatrix OringalClock     = new ArrayMatrix(ModelLength, 1);
                    ArrayMatrix CompareClock     = new ArrayMatrix(PredictedLength, 1);

                    #region 获取建模,比较数据等
                    Time StartOfModel       = coll.TimePeriod.Start + number * GlideEpochNumber * intervalSec;
                    Time EndOfModel         = StartOfModel + (ModelLength - 1) * intervalSec;
                    Time StartOfPredicted   = EndOfModel + intervalSec;
                    Time EndOfPredicted     = StartOfPredicted + (PredictedLength - 1) * intervalSec;
                    var  OriginalClockData  = coll.Gets(prn, StartOfModel, EndOfModel);
                    var  PredictedClockData = coll.Gets(prn, StartOfPredicted, EndOfPredicted);

                    int  ModelDataNumberIndex     = 0;
                    int  PredictedDataNumberIndex = 0;
                    bool IsNeedFilling            = false;
                    for (Time i = StartOfModel; i <= EndOfModel; i = i + intervalSec)
                    {
                        var findofmodel = OriginalClockData.SingleOrDefault(m => m.Time == i);
                        if (findofmodel == null)
                        {
                            if (!fillWithZero)
                            {
                                continue;
                            }
                            IsNeedFilling = true;
                            findofmodel   = new Ephemeris()
                            {
                                Time = i, Prn = prn
                            };
                        }
                        OringalClock[ModelDataNumberIndex, 0] = findofmodel.ClockBias;
                        ModelDataNumberIndex++;
                    }
                    if (IsNeedFilling)
                    {
                        QuadraticPolynomialModel Filling = new QuadraticPolynomialModel();
                        Filling.FillingCalculate(OringalClock, intervalSec);
                    }
                    for (Time i = StartOfPredicted; i <= EndOfPredicted; i = i + intervalSec)
                    {
                        var findofpredicted = PredictedClockData.SingleOrDefault(m => m.Time == i);
                        if (findofpredicted == null)
                        {
                            if (!fillWithZero)
                            {
                                continue;
                            }

                            findofpredicted = new Ephemeris()
                            {
                                Time = i, Prn = prn
                            };
                        }
                        CompareClock[PredictedDataNumberIndex, 0] = findofpredicted.ClockBias;
                        PredictedDataNumberIndex++;
                    }
                    #endregion
                    ArrayMatrix Data = null;
                    if (radioButton_QP.Checked)
                    {
                        approach = "QP"; QuadraticPolynomialModel QuadraticPolynomialModel = new QuadraticPolynomialModel(); QuadraticPolynomialModel.Calculate(OringalClock, CompareClock, intervalSec); Data = QuadraticPolynomialModel.PredictedData;
                    }
                    if (radioButton_QPT1.Checked)
                    {
                        approach = "QPT1"; QuadraticPolynomialT1 QuadraticPolynomialT1 = new QuadraticPolynomialT1(); QuadraticPolynomialT1.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT1.PredictedRms); Data = QuadraticPolynomialT1.PredictedData;
                    }
                    if (radioButton_QPT2.Checked)
                    {
                        approach = "QPT2"; QuadraticPolynomialT2 QuadraticPolynomialT2 = new QuadraticPolynomialT2(); QuadraticPolynomialT2.Calculate(OringalClock, CompareClock, intervalSec, prn); list.Add(QuadraticPolynomialT2.PredictedRms); Data = QuadraticPolynomialT2.PredictedData;
                    }
                    if (radioButton_QPT3.Checked)
                    {
                        approach = "QPT3"; QuadraticPolynomialT3 QuadraticPolynomialT3 = new QuadraticPolynomialT3(); QuadraticPolynomialT3.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT3.PredictedRms); Data = QuadraticPolynomialT3.PredictedData;
                    }
                    if (radioButton_QPT4.Checked)
                    {
                        approach = "QPT4"; QuadraticPolynomialT4 QuadraticPolynomialT4 = new QuadraticPolynomialT4(); QuadraticPolynomialT4.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT4.PredictedRms); Data = QuadraticPolynomialT4.PredictedData;
                    }
                    if (radioButton_QPGM.Checked)
                    {
                        approach = "QPGM"; QuadraticPolynomialGM QuadraticPolynomialGM = new QuadraticPolynomialGM(); QuadraticPolynomialGM.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialGM.PredictedRms); Data = QuadraticPolynomialGM.PredictedData;
                    }
                    if (radioButton_QPT2GM.Checked)
                    {
                        approach = "QPT2GM"; QuadraticPolynomialT2GM QuadraticPolynomialT2GM = new QuadraticPolynomialT2GM(); QuadraticPolynomialT2GM.Calculate(OringalClock, CompareClock, intervalSec, prn); list.Add(QuadraticPolynomialT2GM.PredictedRms); Data = QuadraticPolynomialT2GM.PredictedData;
                    }
                    if (radioButton_QPT4GM.Checked)
                    {
                        approach = "QPT4GM"; QuadraticPolynomialT4GM QuadraticPolynomialT4GM = new QuadraticPolynomialT4GM(); QuadraticPolynomialT4GM.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT4GM.PredictedRms); Data = QuadraticPolynomialT4GM.PredictedData;
                    }

                    if (radioButton_LP.Checked)
                    {
                        approach = "LP"; LinearPolynomialModel LinearPolynomialModel = new LinearPolynomialModel(); LinearPolynomialModel.Calculate(OringalClock, CompareClock, intervalSec); list.Add(LinearPolynomialModel.PredictedRms); Data = LinearPolynomialModel.PredictedData;
                    }
                    if (radioButton_DLP.Checked)
                    {
                        approach = "DLP"; DLinearPolynomialModel DLinearPolynomialModel = new DLinearPolynomialModel(); DLinearPolynomialModel.Calculate(OringalClock, CompareClock, intervalSec); list.Add(DLinearPolynomialModel.PredictedRms); Data = DLinearPolynomialModel.PredictedData;
                    }
                    if (radioButton_RobustDLP.Checked)
                    {
                        approach = "RobustDLP";
                        RobustDLinearPolynomial RobustDLinearPolynomial = new RobustDLinearPolynomial();
                        RobustDLinearPolynomial.Calculate(OringalClock, CompareClock, intervalSec);
                        list.Add(RobustDLinearPolynomial.PredictedRms);
                        Data = RobustDLinearPolynomial.PredictedData;
                        SSE a = new SSE();
                        a = GetSSE(RobustDLinearPolynomial);
                        ListOfSSE.Add(prn.ToString() + '-' + number, a);
                    }
                    if (radioButton_RobustLP.Checked)
                    {
                        approach = "RobustLP"; RobustLinearPolynomial RobustLinearPolynomial = new RobustLinearPolynomial(); RobustLinearPolynomial.Calculate(OringalClock, CompareClock, intervalSec); list.Add(RobustLinearPolynomial.PredictedRms); Data = RobustLinearPolynomial.PredictedData;
                    }

                    if (radioButton_GM.Checked)
                    {
                        approach = "GM";
                        ArrayMatrix GMOringalClock1 = new ArrayMatrix(8, 1);
                        for (int GMIndex = 0; GMIndex < 8; GMIndex++)
                        {
                            GMOringalClock1[GMIndex, 0] = OringalClock[ModelLength - (8 - GMIndex), 0];
                        }
                        GreyModel GreyModel1 = new GreyModel();
                        SSE       a          = new SSE();
                        GreyModel1.Calculate(GMOringalClock1, CompareClock, intervalSec);
                        a = GetSSE(GreyModel1);
                        ListOfSSE.Add(prn.ToString() + '-' + number, a);
                        Data = GreyModel1.PredictedData;
                    }
                    if (radioButton_KFAllan.Checked)
                    {
                        approach = "KFAllan"; KalmanAllan KalmanAllan = new KalmanAllan(); KalmanAllan.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanAllan.PredictedRms); Data = KalmanAllan.PredictedData;
                    }
                    if (radioButton_KFHardamard.Checked)
                    {
                        approach = "KFHardamard"; KalmanHardamard KalmanHardamard = new KalmanHardamard(); KalmanHardamard.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanHardamard.PredictedRms); Data = KalmanHardamard.PredictedData;
                    }
                    if (radioButton_KFReHardamard.Checked)
                    {
                        approach = "KFReHardamard"; KalmanRecursionHardamard KalmanRecursionHardamard = new KalmanRecursionHardamard(); KalmanRecursionHardamard.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanRecursionHardamard.PredictedRms); Data = KalmanRecursionHardamard.PredictedData;
                    }
                    if (radioButton_KFReAllan.Checked)
                    {
                        approach = "KFReAllan"; KalmanRecursionAllan KalmanRecursionAllan = new KalmanRecursionAllan(); KalmanRecursionAllan.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanRecursionAllan.PredictedRms); Data = KalmanRecursionAllan.PredictedData;
                    }
                    for (int i0 = 0; i0 < Data.RowCount; i0++)
                    {
                        var sat = new Ephemeris();
                        sat.Prn       = prn;
                        sat.Time      = StartOfPredicted + i0 * intervalSec;
                        sat.ClockBias = Data[i0, 0];
                        if (!(sp3ofPredicted.Contains(sat.Time)))
                        {
                            sp3ofPredicted.Add(sat.Time, new Sp3Section());
                        }
                        sp3ofPredicted[sat.Time].Add(sat.Prn, sat);
                    }
                    sp3ofPredicted.Prns.Add(prn);
                }
                OutputOfPredictedClock(directory, approach, number);
            }
            #endregion
            OutputOfSSE(directory, ListOfSSE, approach);

            Geo.Utils.FileUtil.OpenDirectory(directory);
        }
示例#6
0
        private void button_read_Click(object sender, EventArgs e)
        {
            bool fillWithZero = checkBox1.Checked;
            var  intervalSec  = int.Parse(textBox_interval.Text) * 60;
            var  directory    = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);

            var prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });
            Dictionary <SatelliteNumber, StreamWriter> prnWriters            = new Dictionary <SatelliteNumber, StreamWriter>();
            Dictionary <SatelliteNumber, StreamWriter> prnWritersOfPredicted = new Dictionary <SatelliteNumber, StreamWriter>();

            foreach (var item in prns)
            {
                var path            = Path.Combine(directory, item.ToString() + "IGU-O" + ".xls");
                var pathOfPredicted = Path.Combine(directory, item.ToString() + "IGU-P" + ".xls");
                prnWriters[item]            = new StreamWriter(new FileStream(path, FileMode.Create));
                prnWritersOfPredicted[item] = new StreamWriter(new FileStream(pathOfPredicted, FileMode.Create));
            }


            FileEphemerisService coll;

            string[] pathes = this.textBox_Pathes.Lines;
            var      st1    = int.Parse(pathes[0].Substring(pathes[0].Length - 6, 2));
            var      st2    = int.Parse(pathes[1].Substring(pathes[0].Length - 6, 2));

            #region  进行合并,即没有重合部分
            if (st2 - st1 == 0)
            {
                foreach (var pathItem in pathes)
                {
                    coll = EphemerisDataSourceFactory.Create(pathItem);
                    Time end1 = coll.TimePeriod.Start + 24 * 3600 - intervalSec;
                    Time end  = coll.TimePeriod.End;
                    foreach (var prn in prns)
                    {
                        var writer         = prnWriters[prn];
                        var writer1        = prnWritersOfPredicted[prn];
                        var all            = coll.Gets(prn, coll.TimePeriod.Start, end1);
                        var allOfPredicted = coll.Gets(prn, end1 + intervalSec, end);
                        for (Time i = coll.TimePeriod.Start; i <= end1; i = i + intervalSec)
                        {
                            var find = all.SingleOrDefault(m => m.Time == i);
                            if (find == null)
                            {
                                if (!fillWithZero)
                                {
                                    continue;
                                }

                                find = new Ephemeris()
                                {
                                    Time = i, Prn = prn
                                };
                            }
                            writer.WriteLine(find.GetTabValues());
                        }
                        for (Time i = end1 + intervalSec; i <= end; i = i + intervalSec)
                        {
                            var find = allOfPredicted.SingleOrDefault(m => m.Time == i);
                            if (find == null)
                            {
                                if (!fillWithZero)
                                {
                                    continue;
                                }

                                find = new Ephemeris()
                                {
                                    Time = i, Prn = prn
                                };
                            }
                            writer1.WriteLine(find.GetTabValues());
                        }
                    }
                }
            }

            #endregion
            #region 合并,即每个文件选取最新的6小时或12小时、18小时等
            else
            {
                foreach (var pathItem in pathes)
                {
                    coll = EphemerisDataSourceFactory.Create(pathItem);
                    Time end1             = coll.TimePeriod.Start + (st2 - st1) * 3600 - intervalSec;
                    Time end              = coll.TimePeriod.Start + (st2 - st1 + 24) * 3600 - intervalSec;
                    Time startOfPredicted = coll.TimePeriod.Start + 24 * 3600 - intervalSec;
                    foreach (var prn in prns)
                    {
                        var writer         = prnWriters[prn];
                        var writer1        = prnWritersOfPredicted[prn];
                        var all            = coll.Gets(prn, coll.TimePeriod.Start, end1);
                        var allOfPredicted = coll.Gets(prn, startOfPredicted, end);
                        for (Time i = coll.TimePeriod.Start; i <= end1; i = i + intervalSec)
                        {
                            var find = all.SingleOrDefault(m => m.Time == i);
                            if (find == null)
                            {
                                if (!fillWithZero)
                                {
                                    continue;
                                }

                                find = new Ephemeris()
                                {
                                    Time = i, Prn = prn
                                };
                            }
                            writer.WriteLine(find.GetTabValues());
                        }
                        for (Time i = startOfPredicted; i <= end; i = i + intervalSec)
                        {
                            var find = allOfPredicted.SingleOrDefault(m => m.Time == i);
                            if (find == null)
                            {
                                if (!fillWithZero)
                                {
                                    continue;
                                }

                                find = new Ephemeris()
                                {
                                    Time = i, Prn = prn
                                };
                            }
                            writer1.WriteLine(find.GetTabValues());
                        }
                    }
                }
            }
            #endregion
            foreach (var item in prnWriters)
            {
                item.Value.Flush();
                item.Value.Close();
            }
            foreach (var item in prnWritersOfPredicted)
            {
                item.Value.Flush();
                item.Value.Close();
            }

            Geo.Utils.FileUtil.OpenDirectory(directory);
        }
示例#7
0
        private void button_export_Click(object sender, EventArgs e)
        {
            bool fillWithZero = checkBox1.Checked;
            var  intervalSec  = int.Parse(textBox_interval.Text) * 60;
            var  directory    = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);
            var ModelLength     = (int)(24 * double.Parse(textBox_ModelLength.Text)) * 3600 / intervalSec;
            var PredictedLength = (int)(24 * double.Parse(textBox_PredictedLength.Text)) * 3600 / intervalSec;
            var PredictedNumber = int.Parse(textBox_PredictedNumber.Text);

            var prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });
            Dictionary <SatelliteNumber, StreamWriter> prnWriters = new Dictionary <SatelliteNumber, StreamWriter>();

            foreach (var item in prns)
            {
                var path = Path.Combine(directory, item.ToString() + ".xls");
                prnWriters[item] = new StreamWriter(new FileStream(path, FileMode.Create));
            }

            string[] pathes = this.textBox_Pathes.Lines;
            coll = new MultiFileClockService(pathes);

            int                      allSec    = (int)coll.TimePeriod.Span;
            Time                     end       = coll.TimePeriod.End + intervalSec;
            List <double>            list      = new List <double>();
            Dictionary <string, SSE> ListOfSSE = new Dictionary <string, SSE>();
            string                   approach  = null;

            #region 逐个卫星进行钟差预报
            clkofPredicted                = new ClockFile();
            clkofPredicted.Header         = new ClockFileHeader();
            clkofPredicted.Header.PrnList = new List <SatelliteNumber>();
            for (int number = 0; number < PredictedNumber; number++)
            {
                foreach (var prn in prns)
                {
                    var writer = prnWriters[prn];
                    //List<double> colName = new List<double>();
                    var         all          = coll.Gets(prn, coll.TimePeriod.Start, end);
                    ArrayMatrix OringalClock = new ArrayMatrix(ModelLength, 1);
                    ArrayMatrix CompareClock = new ArrayMatrix(PredictedLength, 1);

                    Time StartOfModel     = coll.TimePeriod.Start;
                    Time EndOfModel       = StartOfModel + (ModelLength - 1) * intervalSec;
                    Time StartOfPredicted = EndOfModel + intervalSec;
                    Time EndOfPredicted   = StartOfPredicted + (PredictedLength - 1) * intervalSec;

                    int DataNumberIndex          = 0;
                    int ModelDataNumberIndex     = 0;
                    int PredictedDataNumberIndex = 0;
                    GetClockData(fillWithZero, intervalSec, ModelLength, PredictedLength, end, prn, all, OringalClock, CompareClock, number, DataNumberIndex, ModelDataNumberIndex, PredictedDataNumberIndex);
                    if (IsNeedFilling)
                    {
                        QuadraticPolynomialModel Filling = new QuadraticPolynomialModel();
                        Filling.FillingCalculate(OringalClock, intervalSec);
                    }


                    ArrayMatrix Data = null;
                    if (radioButton_QP.Checked)
                    {
                        approach = "QP"; QuadraticPolynomialModel QuadraticPolynomialModel = new QuadraticPolynomialModel(); QuadraticPolynomialModel.Calculate(OringalClock, CompareClock, intervalSec); Data = QuadraticPolynomialModel.PredictedData;
                    }
                    if (radioButton_QPT1.Checked)
                    {
                        approach = "QPT1"; QuadraticPolynomialT1 QuadraticPolynomialT1 = new QuadraticPolynomialT1(); QuadraticPolynomialT1.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT1.PredictedRms); Data = QuadraticPolynomialT1.PredictedData;
                    }
                    if (radioButton_QPT2.Checked)
                    {
                        approach = "QPT2"; QuadraticPolynomialT2 QuadraticPolynomialT2 = new QuadraticPolynomialT2(); QuadraticPolynomialT2.Calculate(OringalClock, CompareClock, intervalSec, prn); list.Add(QuadraticPolynomialT2.PredictedRms); Data = QuadraticPolynomialT2.PredictedData;
                    }
                    if (radioButton_QPT3.Checked)
                    {
                        approach = "QPT3"; QuadraticPolynomialT3 QuadraticPolynomialT3 = new QuadraticPolynomialT3(); QuadraticPolynomialT3.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT3.PredictedRms); Data = QuadraticPolynomialT3.PredictedData;
                    }
                    if (radioButton_QPT4.Checked)
                    {
                        approach = "QPT4"; QuadraticPolynomialT4 QuadraticPolynomialT4 = new QuadraticPolynomialT4(); QuadraticPolynomialT4.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT4.PredictedRms); Data = QuadraticPolynomialT4.PredictedData;
                    }
                    if (radioButton_QPGM.Checked)
                    {
                        approach = "QPGM"; QuadraticPolynomialGM QuadraticPolynomialGM = new QuadraticPolynomialGM(); QuadraticPolynomialGM.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialGM.PredictedRms); Data = QuadraticPolynomialGM.PredictedData;
                    }
                    if (radioButton_QPT2GM.Checked)
                    {
                        approach = "QPT2GM"; QuadraticPolynomialT2GM QuadraticPolynomialT2GM = new QuadraticPolynomialT2GM(); QuadraticPolynomialT2GM.Calculate(OringalClock, CompareClock, intervalSec, prn); list.Add(QuadraticPolynomialT2GM.PredictedRms); Data = QuadraticPolynomialT2GM.PredictedData;
                    }
                    if (radioButton_QPT4GM.Checked)
                    {
                        approach = "QPT4GM"; QuadraticPolynomialT4GM QuadraticPolynomialT4GM = new QuadraticPolynomialT4GM(); QuadraticPolynomialT4GM.Calculate(OringalClock, CompareClock, intervalSec); list.Add(QuadraticPolynomialT4GM.PredictedRms); Data = QuadraticPolynomialT4GM.PredictedData;
                    }

                    if (radioButton_LP.Checked)
                    {
                        approach = "LP"; LinearPolynomialModel LinearPolynomialModel = new LinearPolynomialModel(); LinearPolynomialModel.Calculate(OringalClock, CompareClock, intervalSec); list.Add(LinearPolynomialModel.PredictedRms); Data = LinearPolynomialModel.PredictedData;
                    }
                    if (radioButton_DLP.Checked)
                    {
                        approach = "DLP"; DLinearPolynomialModel DLinearPolynomialModel = new DLinearPolynomialModel(); DLinearPolynomialModel.Calculate(OringalClock, CompareClock, intervalSec); list.Add(DLinearPolynomialModel.PredictedRms); Data = DLinearPolynomialModel.PredictedData;
                    }
                    if (radioButton_RobustDLP.Checked)
                    {
                        approach = "RobustDLP";
                        RobustDLinearPolynomial RobustDLinearPolynomial = new RobustDLinearPolynomial();
                        RobustDLinearPolynomial.Calculate(OringalClock, CompareClock, intervalSec);
                        list.Add(RobustDLinearPolynomial.PredictedRms);
                        Data = RobustDLinearPolynomial.PredictedData;
                        SSE a = new SSE();
                        a = GetSSE(RobustDLinearPolynomial);
                        ListOfSSE.Add(prn.ToString() + '-' + number, a);
                    }
                    if (radioButton_RobustLP.Checked)
                    {
                        approach = "RobustLP"; RobustLinearPolynomial RobustLinearPolynomial = new RobustLinearPolynomial(); RobustLinearPolynomial.Calculate(OringalClock, CompareClock, intervalSec); list.Add(RobustLinearPolynomial.PredictedRms); Data = RobustLinearPolynomial.PredictedData;
                    }



                    if (radioButton_GM.Checked)
                    {
                        approach = "GM";
                        ArrayMatrix GMOringalClock1 = new ArrayMatrix(ModelLength, 1);
                        for (int GMIndex = 0; GMIndex < ModelLength; GMIndex++)
                        {
                            GMOringalClock1[GMIndex, 0] = OringalClock[ModelLength - (ModelLength - GMIndex), 0];
                        }
                        GreyModel GreyModel1 = new GreyModel();
                        SSE       a          = new SSE();
                        GreyModel1.Calculate(GMOringalClock1, CompareClock, intervalSec);
                        a = GetSSE(GreyModel1);
                        ListOfSSE.Add(prn.ToString() + '-' + number, a);
                        Data = GreyModel1.PredictedData;
                    }
                    if (radioButton_KFAllan.Checked)
                    {
                        approach = "KFAllan"; KalmanAllan KalmanAllan = new KalmanAllan(); KalmanAllan.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanAllan.PredictedRms); Data = KalmanAllan.PredictedData;
                    }
                    if (radioButton_KFHardamard.Checked)
                    {
                        approach = "KFHardamard"; KalmanHardamard KalmanHardamard = new KalmanHardamard(); KalmanHardamard.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanHardamard.PredictedRms); Data = KalmanHardamard.PredictedData;
                    }
                    if (radioButton_KFReHardamard.Checked)
                    {
                        approach = "KFReHardamard"; KalmanRecursionHardamard KalmanRecursionHardamard = new KalmanRecursionHardamard(); KalmanRecursionHardamard.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanRecursionHardamard.PredictedRms); Data = KalmanRecursionHardamard.PredictedData;
                    }
                    if (radioButton_KFReAllan.Checked)
                    {
                        approach = "KFReAllan"; KalmanRecursionAllan KalmanRecursionAllan = new KalmanRecursionAllan(); KalmanRecursionAllan.Calculate(OringalClock, CompareClock, intervalSec); list.Add(KalmanRecursionAllan.PredictedRms); Data = KalmanRecursionAllan.PredictedData;
                    }
                    for (int i0 = 0; i0 < Data.RowCount; i0++)
                    {
                        AtomicClock sat = new AtomicClock();
                        sat.Prn       = prn;
                        sat.Time      = StartOfPredicted + i0 * intervalSec;
                        sat.ClockBias = Data[i0, 0];
                        sat.ClockType = ClockType.Satellite;
                        if (!(clkofPredicted.Contains(sat.Prn.ToString())))
                        {
                            clkofPredicted.Add(sat.Prn.ToString(), new List <AtomicClock>());
                        }
                        clkofPredicted[sat.Prn.ToString()].Add(sat);
                    }
                    clkofPredicted.Header.PrnList.Add(prn);
                }
                OutputOfPredictedClock(directory, approach, intervalSec);
            }
            #endregion
            OutputOfSSE(directory, ListOfSSE, approach);

            Geo.Utils.FileUtil.OpenDirectory(directory);
        }
示例#8
0
        private void button_view_Click(object sender, EventArgs e)
        {
            double       cutOff       = namedFloatControl_satCutOff.GetValue();
            bool         isRangeOrTec = checkBox_isRangeOrTec.Checked;
            var          prnsString   = namedStringControl_prn.GetValue();
            var          step         = timeLoopControl1.TimeStepControl.GetValue();
            var          timePeriod   = timeLoopControl1.TimePeriodControl.TimePeriod;
            var          prns         = SatelliteNumber.ParsePRNsBySplliter(prnsString, new char[] { ',', ',', ';' });
            IIonoService ionoService  = null;

            IonoSerivceType type = enumRadioControl_IonoSerivceType.GetCurrent <Gnsser.IonoSerivceType>();

            switch (type)
            {
            case IonoSerivceType.IgsGrid:
                ionoService = GlobalIgsGridIonoService.Instance;
                break;

            case IonoSerivceType.SphericalHarmonics:
                ionoService = GlobalCodeHarmoIonoService.Instance;
                break;

            case IonoSerivceType.GpsKlobuchar:
                ionoService = GlobalKlobucharIonoService.Instance;
                break;

            default:
                break;
            }

            var ephService = GlobalIgsEphemerisService.Instance;
            var siteXyz    = XYZ.Parse(namedStringControl_coord.GetValue());

            double freqValue = Frequence.GpsL1.Value;

            if (!checkBox_freq.Checked)
            {
                freqValue = Frequence.GpsL2.Value;
            }


            ObjectTableStorage table = new ObjectTableStorage();

            for (var time = timePeriod.Start; time < timePeriod.End; time += TimeSpan.FromMinutes(step))
            {
                table.NewRow();
                table.AddItem("Epoch", time);
                foreach (var prn in prns)
                {
                    var eph = ephService.Get(prn, time);
                    if (eph == null)
                    {
                        continue;
                    }
                    var satXyz = eph.XYZ;

                    var polar = CoordTransformer.XyzToGeoPolar(satXyz, siteXyz, AngleUnit.Degree);
                    if (cutOff > polar.Elevation)
                    {
                        continue;
                    }


                    if (isRangeOrTec)
                    {
                        var range = ionoService.GetSlopeDelayRange(time, siteXyz, satXyz, freqValue);

                        table.AddItem(prn, range);
                    }
                    else
                    {
                        var tec = ionoService.GetSlope(time, siteXyz, satXyz);


                        table.AddItem(prn, tec.Value);
                    }
                }
            }


            objectTableControl1.DataBind(table);
        }