标签:round 9.png idv tar exce ram ++ IV img
在测量学中,水准测量是一种常用的高程测量方法,重复性的计算工作需要通过编程来方便计算。
在本文合水准路线为例,其中算法原理如下:
H理=H终点 – H起点
Fh= H理 – H测
Fh允=±20√L
Vkm=-Fh/L
按比例分配
1 /// <summary> 2 /// 3 /// 进行平差计算 4 /// </summary> 5 /// <param name="sender"></param> 6 /// <param name="e"></param> 7 private void button4_Click(object sender, EventArgs e) 8 { 9 //把距离存进来 10 try 11 { 12 double[] ll = new double[d + 1]; 13 int a = 1; 14 double Lz = 0; 15 16 for (int ii = 0; ii < d + 1; ii++) 17 { 18 ll[ii] = Convert.ToDouble(dataGridView1.Rows[a].Cells[2].Value); 19 Lz += ll[ii]; 20 a++; 21 } 22 Lz = Math.Round(Lz, 5); 23 dataGridView1.Rows[d + 3].Cells[2].Value = Lz; 24 //把高差存进来 25 double[] hh = new double[d + 1]; 26 double Hc = 0; 27 28 int b = 1; 29 for (int jj = 0; jj < d + 1; jj++) 30 { 31 hh[jj] = Convert.ToDouble(dataGridView1.Rows[b].Cells[3].Value); 32 Hc += hh[jj];//所测得的高差之和,就是实际高差 33 b++; 34 } 35 dataGridView1.Rows[d + 3].Cells[3].Value = Hc; 36 //求出高差改正数 37 double Hl = Convert.ToDouble(dataGridView1.Rows[d + 2].Cells[6].Value) - Convert.ToDouble(dataGridView1.Rows[0].Cells[6].Value);//理论高差 38 double Fh = Hc - Hl; 39 double Fy = Math.Round(20 * Math.Sqrt(Lz), 0); 40 if (1000*Math.Abs(Fh) > Math.Abs(Fy)) 41 { 42 MessageBox.Show("闭合差的允许值为:+-" + Math.Abs(Fy).ToString()); 43 return; 44 } 45 double[] Hi = new double[d + 1]; 46 double[] Vi = new double[d + 1]; 47 double x_temp = Math.Round(Fh / Lz * 1000, 0);//mm的等级 48 double h_temp = 0; 49 double v_temp = 0; 50 int cc = 1; 51 for (int dd = 0; dd < d + 1; dd++) 52 { 53 Vi[dd] = ll[dd] * x_temp; 54 Vi[dd] = -Vi[dd]; 55 v_temp += Vi[dd]; 56 Hi[dd] = hh[dd] + Vi[dd] / 1000; 57 Hi[dd] = Math.Round(Hi[dd], 5); 58 h_temp += Hi[dd]; 59 h1 += Hi[dd]; 60 h1 = Math.Round(h1, 5); 61 dataGridView1.Rows[cc].Cells[4].Value = Vi[dd];//把高差改正数写到表上 62 dataGridView1.Rows[cc].Cells[5].Value = Hi[dd];//把改正后的高差写到表上 63 dataGridView1.Rows[cc].Cells[6].Value = h1;//把计算后的高程写到表上 64 cc++; 65 } 66 dataGridView1.Rows[d + 3].Cells[4].Value = v_temp; 67 dataGridView1.Rows[d + 3].Cells[5].Value = h_temp; 68 richTextBox1.Visible = true; 69 richTextBox1.Text = "欢迎使用平差小程序!\n"; 70 richTextBox1.Text += "理论高差="; 71 richTextBox1.Text += h_temp + "\n"; 72 richTextBox1.Text += "实际高差="; 73 richTextBox1.Text += Hc+ "\n"; 74 richTextBox1.Text += "闭合差="; 75 richTextBox1.Text += v_temp + "\n"; 76 richTextBox1.Text += "理论闭合差="; 77 richTextBox1.Text += Fy + "\n"; 78 79 } 80 catch(Exception ex) 81 { 82 MessageBox.Show("出错:"+ex.Message); 83 } 84 }
Github: https://github.com/Ahmiao/MeasurementLevel.git
标签:round 9.png idv tar exce ram ++ IV img
原文地址:https://www.cnblogs.com/ahmiaolxie/p/9165247.html