Beispiel #1
0
        public static GnsserXyzCoord Average(List <GnsserXyzCoord> coords)
        {
            var            last  = coords[coords.Count - 1];
            GnsserXyzCoord coord = new GnsserXyzCoord()
            {
                FileName      = last.FileName,
                CaculateTime  = DateTime.Now,
                ReceivingTime = last.ReceivingTime,
                SiteName      = last.SiteName,
                Info          = "Count=" + coords.Count
            };
            ObjectTableStorage table = new ObjectTableStorage();

            foreach (var item in coords)
            {
                table.NewRow();
                table.AddItem("X", item.EstX);
                table.AddItem("Y", item.EstY);
                table.AddItem("Z", item.EstZ);
                table.EndRow();
            }
            var resultDic = table.GetAveragesWithStdDev();
            XYZ xyz       = new XYZ(resultDic["X"][0], resultDic["Y"][0], resultDic["Z"][0]);
            XYZ rms       = new XYZ(resultDic["X"][1], resultDic["Y"][1], resultDic["Z"][1]);

            coord.EstXyz = xyz;
            coord.RmsXyz = rms;

            return(coord);
        }
Beispiel #2
0
        /// <summary>
        /// 多路径效应因子
        /// </summary>
        private Dictionary <FrequenceType, double> GetMultipathFactors()
        {
            ObjectTableStorage table = BuildObjectTable();
            var aveRms = table.GetAveragesWithStdDev();

            var table2     = BuildObjectTable2();
            var OutputPath = Path.Combine(Setting.GnsserConfig.TempDirectory, FileName + "_Mp.xls");
            var writer     = new ObjectTableWriter(OutputPath);

            writer.Write(table2);

            Dictionary <FrequenceType, double> data = new Dictionary <FrequenceType, double>();

            foreach (var val in aveRms)
            {
                var type = Geo.Utils.EnumUtil.Parse <FrequenceType>(val.Key);
                data.Add(type, val.Value[1]);
            }

            return(data);
        }
Beispiel #3
0
        private void Read()
        {
            string pathA = fileOpenControlA.FilePath;

            if (!File.Exists(pathA))
            {
                FormUtil.ShowFileNotExistBox(pathA);
                return;
            }
            string pathB = this.fileOpenControlB.FilePath;

            if (!File.Exists(pathB))
            {
                FormUtil.ShowFileNotExistBox(pathB);
                return;
            }
            bool isBaseLine = checkBox_isBaseline.Checked;

            if (!isBaseLine)//坐标的比较
            {
                this.CoordsA = NamedXyzParser.GetCoords(pathA);
                this.CoordsB = NamedXyzParser.GetCoords(pathB);
                //此用于地图显示
                this.ShowCoordsA = this.CoordsA;
                this.ShowCoordsB = this.CoordsB;

                ObjectTableStorage tableA = BuildObjectTable(CoordsA);
                ObjectTableStorage tableB = BuildObjectTable(CoordsB);
                objectTableControl_tableA.DataBind(tableA);
                objectTableControl_tableB.DataBind(tableB);

                this.Compared = NamedXyz.Compare(CoordsA, CoordsB, NameLength.Enabled, NameLength.Value);

                CompareResults = new List <NamedXyzEnu>();
                var nameLen = NameLength;
                foreach (var localXyz in Compared)
                {
                    // var name = GetCuttedName(localXyz.Name, nameLen);

                    var staXyz = CoordsA.Find(m => String.Equals(GetCuttedName(m.Name, nameLen), GetCuttedName(localXyz.Name, nameLen), StringComparison.CurrentCultureIgnoreCase));
                    if (staXyz == null)
                    {
                        continue;
                    }
                    var item = NamedXyzEnu.Get(localXyz.Name, localXyz.Value, new XYZ(staXyz.X, staXyz.Y, staXyz.Z));
                    CompareResults.Add(item);
                }
            }
            else//基线选择与输出
            {
                try
                {
                    var path = pathA;
                    ObjectTableStorage tableA = ParseLineTable(pathA);
                    ObjectTableStorage tableB = ParseLineTable(pathB);
                    if (tableA == null || tableB == null)
                    {
                        Geo.Utils.FormUtil.ShowWarningMessageBox("不支持的基线格式!");
                        return;
                    }
                    this.CoordsA = PareToNamedXyz(tableA);
                    this.CoordsB = PareToNamedXyz(tableB);

                    objectTableControl_tableA.DataBind(tableA);
                    objectTableControl_tableB.DataBind(tableB);

                    var netA = MultiPeriodBaseLineNet.Parse(tableA);
                    var netB = MultiPeriodBaseLineNet.Parse(tableB);

                    //此用于地图显示
                    this.ShowCoordsA = netA.GetSiteCoords();
                    this.ShowCoordsB = netB.GetSiteCoords();

                    var compared = MultiPeriodBaseLineNet.Compare(netA, netB);
                    CompareResults = new List <NamedXyzEnu>();
                    foreach (var item in compared)
                    {
                        CompareResults.AddRange(item.Value);
                    }
                }
                catch (Exception ex)
                {
                    Geo.Utils.FormUtil.ShowErrorMessageBox(ex.Message + ",发生了错误\r\n注意:文件内只能有一条同名基线!"); return;
                }
            }
            ObjectTableStorage table = BuildObjectTable(CompareResults);

            //转换为毫米单位
            if (IsInUnitMm)
            {
                table.UpdateAllBy(1000, NumeralOperationType.乘);
            }
            ;
            this.objectTableControl_result.DataBind(table);


            //更进一步,计算偏差RMS
            var           residualRms = table.GetResidualRmse();
            var           meanError   = table.GetAbsMean();
            var           vector      = table.GetAveragesWithStdDev();
            StringBuilder sb          = new StringBuilder();

            sb.AppendLine("参数\t平均误差\t互差中误差\t系统偏差\t系统差中误差");
            var format = "G4";

            foreach (var item in vector)
            {
                sb.AppendLine(item.Key + "\t" + meanError[item.Key][0].ToString(format) + "\t" + residualRms[item.Key][0].ToString(format) + "\t" + item.Value[0].ToString(format) + "\t" + item.Value[1].ToString(format));
            }
            var info = sb.ToString();

            MessageBox.Show(info);
            log.Info(info);

            ObjectTableStorage summeryTable = new ObjectTableStorage("结果汇总");

            summeryTable.NewRow();
            summeryTable.AddItem("Name", "MeanError");
            foreach (var item in meanError)
            {
                summeryTable.AddItem(item.Key, item.Value[0].ToString(format));
            }
            summeryTable.NewRow();
            summeryTable.AddItem("Name", "MutualDevRms");
            foreach (var item in residualRms)
            {
                summeryTable.AddItem(item.Key, item.Value[0].ToString(format));
            }
            summeryTable.NewRow();
            summeryTable.AddItem("Name", "AveOrSysDev");
            foreach (var item in vector)
            {
                summeryTable.AddItem(item.Key, item.Value[0].ToString(format));
            }
            summeryTable.NewRow();
            summeryTable.AddItem("Name", "AveDevRms");
            foreach (var item in vector)
            {
                summeryTable.AddItem(item.Key, item.Value[1].ToString(format));
            }
            summeryTable.EndRow();


            objectTableControl_ave.DataBind(summeryTable);
        }
        private void Read()
        {
            string pathA = this.textBox_PathA.Text;

            if (!File.Exists(pathA))
            {
                FormUtil.ShowFileNotExistBox(pathA);
                return;
            }
            string pathB = this.textBox_PathB.Text;

            List <NamedXyzAndTime> coordsA = NamedXyzParser.GetCoordsAndTime(pathA);

            this.bindingSourceA.DataSource = coordsA;

            List <NamedXyzAndTime>    coordsResult        = new List <NamedXyzAndTime>();
            List <NamedXyzEnuAndTime> namedXyzEnusAndTime = new List <NamedXyzEnuAndTime>();

            TableTextManager = new ObjectTableManager();
            TableTextManager.OutputDirectory = Path.GetDirectoryName(pathA);                                                                       // "D:\\Temp\\errorSSR\\";
            var paramTable = TableTextManager.GetOrCreate("CoordinationErrorOfTimeSeries" + Time.UtcNow.DateTime.ToString("yyyy-MM-dd_HH_mm_ss")); //.ToString("yyyy-MM-dd_HH_mm_ss"));

            foreach (var item in coordsA)
            {
                string dayOfWeek         = item.dayOfWeek;
                string pathB0            = Path.GetFileNameWithoutExtension(pathB);
                string dayOfWeekfileName = null;
                if (pathB0.Substring(0, 3).ToLower() == "gfz" || pathB0.Substring(0, 3).ToLower() == "cod")
                {
                    dayOfWeekfileName = pathB0.Substring(3, 5);
                }
                else
                {
                    dayOfWeekfileName = pathB0.Substring(6, 5);
                }
                string path = pathB.Replace(dayOfWeekfileName, dayOfWeek);
                if (!File.Exists(path))
                {
                    //FormUtil.ShowFileNotExistBox(path);
                    continue;
                }
                List <NamedXyz> coordsB = NamedXyzParser.GetCoords(path);
                var             staXyz  = coordsB.Find(m => String.Equals(m.Name, item.Name, StringComparison.CurrentCultureIgnoreCase));
                if (staXyz != null)
                {
                    NamedXyzAndTime NamedXyzAndTime = new NamedXyzAndTime();
                    NamedXyzAndTime.Name      = item.Name;
                    NamedXyzAndTime.dayOfWeek = item.dayOfWeek;
                    NamedXyzAndTime.Value     = item.Value - staXyz.Value;
                    var enu = NamedXyzEnuAndTime.Get(item.Name, dayOfWeek, NamedXyzAndTime.Value, new XYZ(staXyz.X, staXyz.Y, staXyz.Z));
                    namedXyzEnusAndTime.Add(enu);
                    paramTable.NewRow();
                    paramTable.AddItem("Day", item.dayOfWeek);
                    paramTable.AddItem("Name", item.Name);
                    paramTable.AddItem("dX", enu.X);
                    paramTable.AddItem("dY", enu.Y);
                    paramTable.AddItem("dZ", enu.Z);
                    paramTable.AddItem("dE", enu.E);
                    paramTable.AddItem("dN", enu.N);
                    paramTable.AddItem("dU", enu.U);
                    paramTable.AddItem("length", Math.Sqrt(enu.X * enu.X + enu.Y * enu.Y + enu.Z * enu.Z));
                    paramTable.EndRow();
                }
            }

            TableTextManager.WriteAllToFileAndCloseStream();
            if (coordsResult == null)
            {
                return;
            }


            this.bindingSourceC.DataSource = namedXyzEnusAndTime;

            //更进一步,计算偏差RMS
            var table2 = Geo.Utils.DataGridViewUtil.GetDataTable(this.dataGridView1);

            ObjectTableStorage table = new ObjectTableStorage(table2);

            var           vector = table.GetAveragesWithStdDev();
            StringBuilder sb     = new StringBuilder();

            sb.AppendLine("参数\t 平均数\t 均方差");
            foreach (var item in vector)
            {
                sb.AppendLine(item.Key + "\t" + item.Value[0] + "\t" + item.Value[1]);
            }
            var info = sb.ToString();

            MessageBox.Show(info);
            log.Info(info);

            ObjectTableStorage summeryTable = new ObjectTableStorage();

            summeryTable.NewRow();
            summeryTable.AddItem("Name", "Ave");
            foreach (var item in vector)
            {
                summeryTable.AddItem(item.Key, item.Value[0]);
            }
            summeryTable.NewRow();
            summeryTable.AddItem("Name", "Rms");
            foreach (var item in vector)
            {
                summeryTable.AddItem(item.Key, item.Value[1]);
            }
            summeryTable.EndRow();
            Geo.Utils.FileUtil.OpenDirectory(TableTextManager.OutputDirectory);
            this.dataGridView_summery.DataSource = summeryTable.GetDataTable("结果汇总");
        }