您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 间接平差程序
  所属分类: C++
  开发工具:
  文件大小: 5kb
  下载次数: 0
  上传时间: 2015-11-18
  提 供 者: qq_31******
 详细说明: 按间接平差原理写的代码,绝对有用,真实可靠 Dim strFileName As String Dim nn%, un%, tn%, hn% '已知点个数,未知点个数,总点数,观测值个数 Dim Pname() As String '点名数组 Dim Hknown() As Double '已知高程数组,存放已知点高程和高程近似值 Dim be%(), en%() '观测值的起点和终点编号数组,存储的是点序号 Dim h#(), s#() '高差观测值数组和距离观测值数组 Dim A#(), X#(), P#(), L#() '间接平差的系数阵、解向量、权阵和常数向量 '平差计算 Private Sub mnuAdj_Click() Dim i%, j% ReDim X(1 To un) InAdjust A, P, L, X '调用间接平差的通用过程求解 '计算并显示高程平差结果 txtShow.Text = txtShow.Text & "平差计算结果:" & vbCrLf txtShow.Text = txtShow.Text & "点号 初始高程(m) 高程改正 数(m) 平差后高程(m)" & vbCrLf For i = 1 To un txtShow.Text = txtShow.Text & Pname(nn + i) & " " & Format(Hknown(nn + i), "0.0000") Hknown(nn + i) = Hknown(nn + i) + X(i) txtShow.Text = txtShow.Text & " " & Format(X(i), "0.0000") & " " & Format(Hknown(nn + i), "0.0000") & vbCrLf Next i txtShow.Text = txtShow.Text & vbCrLf '计算并显示单位权中误差--------->>精度评定部分应该也包含在间接平差模块里,一起来调用 ' Dim dblT As Double ' dblT = 0 ' For i = 1 To un ' ' Next i End Sub '列立误差方程:给A、P、L赋值 Private Sub mnuEqu_Click() Dim i%, j% ReDim A(1 To hn, 1 To un), L(1 To hn), P(1 To hn, 1 To hn) '对每个观测值列误差方程 For i = 1 To hn If en(i) > nn Then A(i, en(i) - nn) = 1 '若终点未知,则给终点对应的系数矩阵元素赋值 If be(i) > nn Then A(i, be(i) - nn) = -1 '若起点未知,则给起点对应的系数矩阵元素赋值 L(i) = -(Hknown(en(i)) - Hknown(be(i)) - h(i)) '根据起终点计算常数项 P(i, i) = 1 / s(i) '以距离的倒数为权 Next i '显示误差方程 txtShow.Text = txtShow.Text & " 列立的误差方程:" & vbCrLf For i = 1 To hn For j = 1 To un txtShow.Text = txtShow.Text & A(i, j) & " " Next j txtShow.Text = txtShow.Text & " " & Format(L(i), "0.0000") & vbCrLf Next i txtShow.Text = txtShow.Text & "权矩阵:" & vbCrLf For i = 1 To hn For j = 1 To hn txtShow.Text = txtShow.Text & P(i, j) & " " Next j txtShow.Text = txtShow.Text & vbCrLf Next i End Sub '计算近似高程 Private Sub mnuHeight_Click() Dim i%, j% For i = 1 To un For j = 1 To hn If be(j) = nn + i And en(j) < nn + i Then '找到一个起点相同且终点已知的观测值 Hknown(nn + i) = Hknown(en(j)) - h(j) Exit For End If If en(j) = nn + i And be(j) < nn + i Then '找到一个终点相同且起点已知的观测值 Hknown(nn + i) = Hknown(be(j)) + h(j) Exit For End If Next j Next i '显示近似高程计算结果 txtShow.Text = txtShow.Text & " 近似高程计算结果: " & vbCrLf For i = 1 To un txtShow.Text = txtShow.Text & Pname(i + nn) & ":" & Format(Hknown(i + nn), "0.000") & vbCrLf Next i End Sub '退出程序 Private Sub mnuExit_Click() End End Sub '打开文件 Private Sub mnuOpen_Click() Dim i As Integer '循环变量 Dim strT1 As String, strT2 As String CDg1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*" CDg1.ShowOpen '打开对话框 strFileName = CDg1.FileName '获得选中的文件名和路径 Open strFileName For Input As #1 '打开文件 Input #1, nn, un, hn '读入已知点个数,未知点个数,观测值个数 tn = nn + un ReDim Pname(1 To tn), Hknown(1 To tn) ReDim h(1 To hn), s(1 To hn), be(1 To hn), en(1 To hn) For i = 1 To tn '读入点名 Input #1, Pname(i) Next i For i = 1 To nn '读入已知高程 Input #1, Hknown(i) Next i For i = 1 To hn '读入各观测值 Input #1, strT1, strT2, h(i), s(i) be(i) = Order(strT1): en(i) = Order(strT2) '给起终点数组排序 Next i '显示读入的数据 txtShow.Text = txtShow.Text & "读入的水准网数据:" & vbCrLf txtShow.Text = txtShow.Text & " 已知点" & nn & "个,未知点" & un & "个,观测值" & hn & "个。" & vbCrLf txtShow.Text = txtShow.Text & " 网中涉及的点名有:" For i = 1 To tn txtShow.Text = txtShow.Text & Pname(i) & "," Next i txtShow.Text = txtShow.Text & vbCrLf txtShow.Text = txtShow.Text & " 已知点高程为:" & vbCrLf For i = 1 To nn txtShow.Text = txtShow.Text & Pname(i) & "的高程为:" & Hknown(i) & vbCrLf Next i txtShow.Text = txtShow.Text & " 各观测值分别为:" & vbCrLf txtShow.Text = txtShow.Text & "起点" & " " & "终点" & " " & "高差观测值 " & " 距离观测值" & vbCrLf For i = 1 To hn txtShow.Text = txtShow.Text & Pname(be(i)) & " " & Pname(en(i)) & " " & Format(h(i), "0.000") & " " & Format(s(i), "0.000") & vbCrLf Next i Close #1 '不要忘记关闭文件 End Sub '点名-序号转换函数 Public Function Order(str As String) As Integer Dim i% For i = 1 To tn If str = Pname(i) Then Order = i Exit For End If Next i End Function '保存计算结果 Private Sub mnuSave_Click() CDg1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*" CDg1.ShowSave strFileName = CDg1.FileName Open strFileName For Output As #1 Print #1, txtShow.Text Close #1 End Sub ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 条件平差
 输入关键字,在本站1000多万海量源码库中尽情搜索: