private double delta; // 仪器常数 //private double oriPointHorCoor; // 定向点横坐标 /// <summary> /// 构造器 /// </summary> public ObserveData(string[] rowText) { //坐标边方位角 coorAzi = AngleTransUtil.DMSToDegree(Convert.ToDouble(rowText[1])); //陀螺边方位角 gyroAzi = AngleTransUtil.DMSToDegree(Convert.ToDouble(rowText[2])); // 定向点横坐标 //OriPointHorCoor = Convert.ToDouble(rowText[3]); }
/// <summary> /// 打开并读取数据文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OpenDataFileToolStripMenuItem_Click(object sender, EventArgs e) { MyOpenFileDialog.InitialDirectory = Application.StartupPath; MyOpenFileDialog.Filter = "txt file(*.txt)|*.txt"; // 文件类型过滤器设置为txt文件 bool estiThroErrData = false; if (MyOpenFileDialog.ShowDialog() == DialogResult.OK) { string[] allText = File.ReadAllLines(MyOpenFileDialog.FileName, Encoding.UTF8); // 读取txt文件中全部的数据 for (int i = 0; i < allText.Length - 1; i++) { string[] rowText = allText[i].Replace(" ", "").Replace(",,", ",").Split(','); // 每一行的数据 if (rowText[0] == "") { estiThroErrData = true; i = i + 1; rowText = allText[i].Replace(" ", "").Replace(",,", ",").Split(','); // 每一行的数据 ml = Convert.ToDouble(rowText[0]); mb = AngleTransUtil.DegreeToRand(Convert.ToDouble(rowText[1]) / 3600); //将mb转成弧度 //ma = DegreeToRand(DMSToDegree(Convert.ToDouble(rowText[2]))); continue; } if (estiThroErrData) { // 贯通数据 bool isDirEdge = Convert.ToInt16(rowText[3]) == 1; int surveyNum = Convert.ToInt16(rowText[4]); TraversePoint startPoint = new TraversePoint(rowText); startPoint.Pointindex = PointNum; rowText = allText[i + 1].Replace(" ", "").Replace(",,", ",").Split(','); // 每一行的数据 TraversePoint endPoint = new TraversePoint(rowText); endPoint.Pointindex = PointNum + 1; TraverseEdge traverEdge = new TraverseEdge(startPoint, endPoint, isDirEdge, surveyNum); traverseEdge.Add(traverEdge); PointNum++; } else { // 陀螺经纬仪观测数据 ObserveData obData = new ObserveData(rowText); // 观测数据 if (rowText[0] == "DM") { //地面 groundData.Add(obData); } if (rowText[0] == "JX") { //井下 downholeData.Add(obData); } } } } isReadData = true; InitState(); // 更新表格数据 InsertObDataIntoTable(); }
/// <summary> /// 陀螺经纬仪定向精度评定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CalDownholeCoorAziToolStripMenuItem_Click(object sender, EventArgs e) { if (isCalma) { return; } //计算仪器常数中误差 mv = 0; //仪器常数中误差清零 double vv = 0; double deltaSum = 0; for (int i = 0; i < groundData.Count; i++) { groundData[i].Delta = groundData[i].CoorAzi - groundData[i].GyroAzi; DataTableGridView.Rows[i].Cells[3].Value = AngleTransUtil.DMSToStr(AngleTransUtil.DegreeToDMS(groundData[i].Delta)); deltaSum = deltaSum + groundData[i].Delta; } double deltaAverage = deltaSum / groundData.Count; //仪器常数平均值 for (int i = 0; i < groundData.Count; i++) { DataTableGridView.Rows[i].Cells[4].Value = Math.Round(-(groundData[i].CoorAzi - groundData[i].GyroAzi - deltaAverage) * 3600, 2) + "″"; vv = vv + (groundData[i].CoorAzi - groundData[i].GyroAzi - deltaAverage) * (groundData[i].CoorAzi - groundData[i].GyroAzi - deltaAverage) * 3600 * 3600; //单位:秒 } mv = Math.Sqrt(vv / (groundData.Count - 1)); //仪器常数一次测定中误差 ma = Math.Sqrt(mv * mv / groundData.Count + mv * mv / 2); //井下一次测定中误差 //计算各个陀螺边的误差 for (int i = 0; i < gyroEdge.Count; i++) { gyroEdge[i].Ma = Math.Sqrt(mv * mv / groundData.Count + mv * mv / gyroEdge[i].SurveyNum); } MessageBox.Show("陀螺经纬仪定向精度评定完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); isCalma = true; OutMaReport(); }
/// <summary> /// 将观测的数据插入到表格中 /// </summary> private void InsertObDataIntoTable() { int dataCount = groundData.Count; for (int i = 0; i < dataCount; i++) { DataTableGridView.Rows.Add(1); DataTableGridView.Rows[i].Cells[0].Value = i + 1; DataTableGridView.Rows[i].Cells[1].Value = AngleTransUtil.DMSToStr(groundData[i].CoorAzi); DataTableGridView.Rows[i].Cells[2].Value = AngleTransUtil.DMSToStr(groundData[i].GyroAzi); } int traverseEdgeCount = traverseEdge.Count; for (int i = 0; i < traverseEdgeCount; i++) { dataGridView1.Rows.Add(1); dataGridView1.Rows[i].Cells[0].Value = i + 1; dataGridView1.Rows[i].Cells[1].Value = traverseEdge[i].StartPoint.PointName; dataGridView1.Rows[i].Cells[2].Value = traverseEdge[i].EndPoint.PointName; dataGridView1.Rows[i].Cells[3].Value = traverseEdge[i].IsGyroDirEdge; dataGridView1.Rows[i].Cells[4].Value = traverseEdge[i].SurveyNum; } }