测量水准程序

在测量学中,水准测量是一种常用的高程测量方法,重复性的计算工作需要通过编程来方便计算。

1.算法原理

在本文合水准路线为例,其中算法原理如下:

H理=H终点 – H起点

Fh= H理  – H测

Fh允=±20√L

Vkm=-Fh/L

按比例分配

2.实现代码


        /// <summary>
        /// 
        /// 进行平差计算
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            //把距离存进来
            try
            {
                double[] ll = new double[d + 1];
                int a = 1;
                double Lz = 0;

                for (int ii = 0; ii < d + 1; ii++)
                {
                    ll[ii] = Convert.ToDouble(dataGridView1.Rows[a].Cells[2].Value);
                    Lz += ll[ii];
                    a++;
                }
                Lz = Math.Round(Lz, 5);
                dataGridView1.Rows[d + 3].Cells[2].Value = Lz;
                //把高差存进来
                double[] hh = new double[d + 1];
                double Hc = 0;

                int b = 1;
                for (int jj = 0; jj < d + 1; jj++)
                {
                    hh[jj] = Convert.ToDouble(dataGridView1.Rows[b].Cells[3].Value);
                    Hc += hh[jj];//所测得的高差之和,就是实际高差
                    b++;
                }
                dataGridView1.Rows[d + 3].Cells[3].Value = Hc;
                //求出高差改正数
                double Hl = Convert.ToDouble(dataGridView1.Rows[d + 2].Cells[6].Value) - Convert.ToDouble(dataGridView1.Rows[0].Cells[6].Value);//理论高差
                double Fh = Hc - Hl;
                double Fy = Math.Round(20 * Math.Sqrt(Lz), 0);
                if (1000*Math.Abs(Fh) > Math.Abs(Fy))
                {
                    MessageBox.Show("闭合差的允许值为:+-" + Math.Abs(Fy).ToString());
                    return;
                }
                double[] Hi = new double[d + 1];
                double[] Vi = new double[d + 1];
                double x_temp = Math.Round(Fh / Lz * 1000, 0);//mm的等级
                double h_temp = 0;
                double v_temp = 0;
                int cc = 1;
                for (int dd = 0; dd < d + 1; dd++)
                {
                    Vi[dd] = ll[dd] * x_temp;
                    Vi[dd] = -Vi[dd];
                    v_temp += Vi[dd];
                    Hi[dd] = hh[dd] + Vi[dd] / 1000;
                    Hi[dd] = Math.Round(Hi[dd], 5);
                    h_temp += Hi[dd];
                    h1 += Hi[dd];
                    h1 = Math.Round(h1, 5);
                    dataGridView1.Rows[cc].Cells[4].Value = Vi[dd];//把高差改正数写到表上
                    dataGridView1.Rows[cc].Cells[5].Value = Hi[dd];//把改正后的高差写到表上
                    dataGridView1.Rows[cc].Cells[6].Value = h1;//把计算后的高程写到表上
                    cc++;
                }
                dataGridView1.Rows[d + 3].Cells[4].Value = v_temp;
                dataGridView1.Rows[d + 3].Cells[5].Value = h_temp;
                richTextBox1.Visible = true;
                richTextBox1.Text = "欢迎使用平差小程序!\n";
                richTextBox1.Text += "理论高差=";
                richTextBox1.Text += h_temp + "\n";
                richTextBox1.Text += "实际高差=";
                richTextBox1.Text +=  Hc+ "\n";
                richTextBox1.Text += "闭合差=";
                richTextBox1.Text += v_temp + "\n";
                richTextBox1.Text += "理论闭合差=";
                richTextBox1.Text += Fy + "\n";

            }
            catch(Exception ex)
            {
                MessageBox.Show("出错:"+ex.Message);
            }
        }

3.实现效果

4.源代码地址

Github: https://github.com/Ahmiao/MeasurementLevel.git


Dim imarks% Private Sub form_load() imark = 1 End Sub Private Sub cmdcancel_Click() Dim i% For i = 1 To imark dis(i) = 0: deth(i) = 0 Next i frmmain.txtshow.Text = "水准计算结果" Unload Me End Sub Private Sub cmdok_Click() dist = Val(txtdist.Text): dh = Val(txtdeth.Text) Call adddata(imark, dist, dh) Public Sub adddata(imark As Integer, dist As Single, dh As Single) dis(imark) = dist: deth(imark) = dh frmmain.txtshow.Text = frmmain.txtshow.Text & "第" & Str(imark) & "站:" & vbCrLf frmmain.txtshow.Text = frmmain.txtshow.Text & " & 距离:" & dis(imark) & " 高差中数:" & deth(imark) & vbCrLf If imark >= nmarks Then frminput.Hide Else txtdist.Text = "": txtdeth.Text "": txtdist.setfoucs End If frminput.Caption = "观数据输入:第" & Trim(Str(imark)) & "站" imark = imark + 1 frminput.Caption = "观数据输入:第" & Trim(Str(imark)) & "站" End Sub Private Sub cmdcheckcalc_Click() Dim totaldeth!, closedeth!, tdist#, i% End Sub Private Sub optannex_Click() txtendpoint.Enabled = optannex.Value End Sub Private Sub optclose_Click() txtendpoint.Enabled = Not optclose.Value End Sub Private Sub optspur_Click() txtendpoint.Enabled = Not optspur.Value End Sub Dim startpoint!, ENDPOINT! Private Sub txtendpoint_LostFocus() If Not IsNumeric(txtendpoint.Text) Then MsgBox "输入的高程含有非数字字符!" txtendpoint.Text = "": txtendpoint.SetFocus Exit Sub End If If Val(txtendpoint.Text) > 5000 Or Val(txtendpoint.Text) < -100 Then MsgBox "输入的高程有误!" txtendtpoint.Text = "": txtendtpoint.SetFocus Exit Sub End If ENDPOINT = Val(txtendtpoint.Text) End Sub
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值