资源描述:
《四等水准附和导线、闭合导线平差VB代码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、程序说明:数据录入文件的存储格式为:按每一测站的距离、高差形式存储,平差之前需要输入测站总数,依次点击“平差计算”、“成果分析”、“成果输出“。Dimds()AsSingle,ht()AsSingle,detht()AsSingle,zh()AsSingle'ht测量高差,deth高差改正数,zh点高程DimfhtAsSingle,nAsInteger,frAsSingle,sdsAsSingle'fht高差闭合差,n测站数,fr高差闭差合限差,sds线路总长PrivateSubCommand3_Click()EndEndSubPrivateSubC
2、ommand5_Click()DimiAsIntegern=Val(Text3.Text)Ifn=0ThenMsgBox"请输入测站数"ExitSubEndIfReDimht(n)AsSingle,ds(n)AsSingle,detht(n)AsSingle,zh(n)AsSingleCD.Filter="文本文件(*.txt)
3、*.txt
4、所有文件(*.*)
5、*.*"CD.ShowOpenstrfilename=CD.FileNameOpenstrfilenameForInputAs#1Fori=1TonInput#1,ds(i),ht(i)Ifd
6、s(i)>160ThenMsgBox"第"&i&"测站视距超限"ExitSubEndIfNextiClose#1MsgBox"数据已录入"EndSubPrivateSubCommand6_Click()DimiAsInteger,shtAsSingle,xAsSingleDimaAsSingle,bAsSinglesds=0sht=0Fori=1Tonsds=sds+ds(i)sht=sht+ht(i)NextiIfOption1.ValueThena=Val(Text1.Text)b=Val(Text2.Text)fht=sht-(a-b)Else
7、IfOption2.ValueThena=Val(Text1.Text)fht=shtEndIfEndIfzh(0)=aFori=1Tonx=-fht*ds(i)/sdsdetht(i)=xht(i)=ht(i)+detht(i)zh(i)=zh(i-1)+ht(i)NextiMsgBox"平差计算已完成"EndSubPrivateSubCommand7_Click()DimxAsSinglefr=40*Sqr(sds/1000)x=Abs(fht)Ifx>frThenMsgBox"线路全长高差闭合差超限,但系统已按照平差原理平差,如需保存结果,请点
8、击“成果保存”按钮"ExitSubElseMsgBox"线路全长高差闭合差符合限差要求,如需保存结果,请点击“成果保存”按钮"EndIfEndSubPrivateSubCommand8_Click()DimiAsIntegerCD.Filter="文本文件(*.txt)
9、*.txt
10、所有文件(*.*)
11、*.*"CD.ShowOpenstrfilename=CD.FileNameOpenstrfilenameForOutputAs#2Fori=1TonPrint#2,"第"&i&"测站视线长:"&ds(i)&"m",Print#2,"高差改正数:"&F
12、ormat(detht(i),"0.000")&"m",Print#2,"改后高差:"&Format(ht(i),"0.000")&"m",Print#2,"高程:"&Format(zh(i),"0.000")&"m"NextiPrint#2,"路线全长:"&Format(sds/1000,"0.000")&"km"Print#2,"路线全长高差闭合差:"&Format(fht,"0.000")&"m"Print#2,"限差:"&Format(fr/1000,"0.000")&"m"Print#2,"解算人:×××"Print#2,"时间:"&Dat
13、eClose#2MsgBox"成果已保存"EndSub