计算程序及说明.docx
- 文档编号:6465809
- 上传时间:2023-01-06
- 格式:DOCX
- 页数:14
- 大小:17.70KB
计算程序及说明.docx
《计算程序及说明.docx》由会员分享,可在线阅读,更多相关《计算程序及说明.docx(14页珍藏版)》请在冰豆网上搜索。
计算程序及说明
计算程序及说明
1、参数Kc的计算
PrivateSubCommand4_Click()’Kc的计算
DimiAsInteger'天数控制变量
DimP(1To2200)AsSingle'流域的平均降雨量
DimP1(1To2200)AsSingle,P2(1To2200)AsSingle,P3(1To2200)AsSingle,P4(1To2200)AsSingle'流域各地区降雨量
DimE0(1To2200)AsSingle'流域的水面蒸发
DimEp(1To367)AsSingle'流域的蒸发能力
Dime(1To367)AsSingle'流域总的蒸发量
DimEU(1To367)AsSingle,EL(1To366)AsSingle,ED(1To367)AsSingle'三层蒸发模式参数
DimQ(1To2200)AsSingle'流域实测径流
DimR(1To367)AsSingle'流域计算径流
DimRS(1To367)AsSingle,RG(1To367)AsSingle'地表及地下径流
DimPE(1To367)AsSingle
DimW(1To367)AsSingle'流域总的蓄水量
DimWU(1To367)AsSingle,WL(1To367)AsSingle,WD(1To367)AsSingle'上下深层土壤含水量
DimWMMAsSingle'流域蓄水容量最大值
DimsumQ(1To4),sumR(1To4)AsSingle'某一年的总实测径流,总计算径流
Dima(1To367)AsSingle
DimXD(1To4000,1To4),minXDH,JD(1To4000,1To4)AsSingle'相对误差,最小相对误差,绝对误差
Dimqo(1To2200),E0o(1To2200),P1o(1To2200),P2o(1To2200),P3o(1To2200),P4o(1To2200)AsSingle'流域实测逐日径流,蒸发量及四个雨量站实测降雨
Dimk,minkAsSingle'循环控制变量,Kc=k/1000,最小的k
Dimkaishi,tianshu,mAsSingle
DimsumQo,sumRo,sumP,verQAsDouble'总实测径流,总计算径流,总降雨量,平均径流
Consth1=0.3,h2=0.17,h3=0.31,h4=0.22'各雨量站的权重
ConstWm=140,WUM=30,WLM=60,WDM=50,B=0.3,C=0.17,IM=0.002,Fc=22'模型参数
Open"C:
\Users\Administrator\Desktop\水文预报课程设计总\89-90数据新.txt"ForInputAs#1'打开文件
Fori=1To730
Input#1,qo(i),E0o(i),P1o(i),P2o(i),P3o(i),P4o(i)
Nexti
Close#1
minXD1=0.002'第一年相对误差比较值
minXD2=0.002'第二年相对误差比较值
Fork=900To1900'Kc=k/1000
XD(k,1)=0
XD(k,2)=0
Form=1To2
Ifm=1Then'读取89年数据
kaishi=1
tianshu=365
ElseIfm=2Then'读取90年数据
kaishi=366
tianshu=365
EndIf
sumQo=0
sumRo=0
sumP=0
Forj=1Totianshu'使带入循环的各年降雨和蒸发量对应
Q(j)=qo(kaishi+j-1)
E0(j)=E0o(kaishi+j-1)
P1(j)=P1o(kaishi+j-1)
P2(j)=P2o(kaishi+j-1)
P3(j)=P3o(kaishi+j-1)
P4(j)=P4o(kaishi+j-1)
P(j)=h1*P1(j)+h2*P2(j)+h3*P3(j)+h4*P4(j)'流域平均降雨量计算
sumQo=sumQo+Q(j)
sumP=sumP+P(j)
Nextj
verQ=sumQo/tianshu
'流域三层蒸发计算
W
(1)=120
WU
(1)=10
WL
(1)=60
WD
(1)=50
W
(1)=WU
(1)+WL
(1)+WD
(1)
Fori=1Totianshu
Ep(i)=E0(i)*k/1000
IfWU(i)+P(i)>=Ep(i)Then
EU(i)=Ep(i)
EL(i)=0
ED(i)=0
EndIf
IfWU(i)+P(i) IfWL(i)>=C*WLMThen EU(i)=WU(i)+P(i) EL(i)=(Ep(i)-EU(i))*WL(i)/WLM ED(i)=0 ElseIfWL(i) EU(i)=WU(i)+P(i) EL(i)=(Ep(i)-EU(i))*C ED(i)=0 ElseIfWL(i) EU(i)=WU(i)+P(i) EL(i)=WL(i) ED(i)=(Ep(i)-EU(i))*C-EL(i) EndIf EndIf e(i)=EU(i)+EL(i)+ED(i) W(i)=WU(i)+WL(i)+WD(i) '流域产流计算 WMM=Wm*(1+B) a(i)=WMM*(1-(1-(W(i)/Wm))^(1/(1+B))) PE(i)=P(i)-e(i) '产流时 IfPE(i)>0Then IfPE(i)+a(i) R(i)=PE(i)+W(i)-Wm+Wm*(1-(PE(i)+a(i))/WMM)^(B+1) W(i+1)=W(i)+PE(i)-R(i) Else R(i)=PE(i)+W(i)-Wm W(i+1)=Wm EndIf EndIf '不产流时 IfPE(i)<=0Then R(i)=0 W(i+1)=W(i)+PE(i) EndIf sumRo=sumRo+R(i) IfWU(i)+P(i)-EU(i)-R(i)<=WUMThen'求下一时刻地下各层含水量 WU(i+1)=WU(i)+P(i)-EU(i)-R(i) WL(i+1)=WL(i)-EL(i) WD(i+1)=WD(i)-ED(i) ElseIfWU(i)+P(i)-EU(i)-R(i)>WUMThen WU(i+1)=WUM IfWL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)<=WLMThen WL(i+1)=WL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM) WD(i+1)=WD(i)-ED(i) ElseIfWL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)>WLMThen WL(i+1)=WLM IfWD(i)-ED(i)+WL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)-WLM<=WDMThen WD(i+1)=WD(i)-ED(i)+WL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)-WLM Else WD(i+1)=WDM EndIf EndIf EndIf Nexti sumRo=sumRo*653000*(1-IM)/24/3600'将sumRo的单位由(mm)转化为(m3/s) sumRo=sumRo+653000*IM*sumP/24/3600'计算的径流总量等于透水面积上的产流加上不透水面积上的直接产流 JD(k,m)=sumQo-sumRo'求解绝对误差 XD(k,m)=JD(k,m)/sumQo'求解相对误差 sumQ(m)=sumQo sumR(m)=sumRo Nextm IfminXD1>Abs(XD(k,1))Then'判断相对误差是否小于5% minXD1=Abs(XD(k,1)) EndIf IfminXD2>Abs(XD(k,2))Then minXD2=Abs(XD(k,2)) EndIf IfminXD1 minXDH=Abs(XD(k,1)) Else: minXDH=Abs(XD(k,2)) mink=k Text1.Text=Round(sumQ (1),5)'第一年实测径流量Q Text2.Text=Round(sumR (1),5)'第一年计算径流量R Text3.Text=Round(JD(k,1),5)'第一年绝对误差 Text4.Text=Round(XD(k,1),5)'第一年相对误差 Text5.Text=Round(sumQ (2),5)'第二年实测径流量Q Text6.Text=Round(sumR (2),5)'第二年计算径流量 Text7.Text=Round(JD(k,2),5)'第二年绝对误差 Text8.Text=Round(XD(k,2),5)'第二年相对误差 EndIf Nextk Text9.Text=mink/1000'输出最优的KC值 EndSub 2、参数Kc的率定检验 PrivateSubCommand1_Click()’Kc的率定检验 DimP(366)AsSingle,E(366)AsSingle,PE(366)AsSingle'逐日降雨量,蒸发量,P-E DimP1(366)AsSingle,P2(366)AsSingle,P3(366)AsSingle,P4(366)AsSingle'四个雨量站逐日实测降雨量 DimE0(366)AsSingle,Ep(366)AsSingle'逐日蒸发量,蒸发能力 DimEU(366)AsSingle,EL(366)AsSingle,ED(366)AsSingle'上、下、深层蒸发量 DimWU(366)AsSingle,WL(366)AsSingle,WD(366)AsSingle,W(366)AsSingle DimQ(366)AsSingle,R(366)AsSingle,sumRAsDouble,sumQAsSingle'逐日实测径流量Q,逐日计算径流量R,实测总径流,计算总径流 DimiAsInteger,KcAsSingle,WMMAsSingle,a(366)AsSingle ConstWUM=30,WLM=60,WDM=50'模型参数 ConstC=0.17 Constb=0.3 ConstWM=140 ConstFC=22 ConstIM=0.002 Consth1=0.3,h2=0.17,h3=0.31,h4=0.22'各雨量站的权重 Kc=Val(Text1.Text) IfOption1.Value=TrueThen Open"C: \Users\Administrator\Desktop\swyb\89data.txt"ForInputAs#1'打开文件 Fori=1To365 Input#1,Q(i),E0(i),P1(i),P2(i),P3(i),P4(i)'引用89年数据 P(i)=h1*P1(i)+h2*P2(i)+h3*P3(i)+h4*P4(i) sumQ=sumQ+Q(i) sumP=sumP+P(i) Text2.Text=sumQ'实测总径流流量 Nexti Close#1 EndIf IfOption2.Value=TrueThen Open"C: \Users\Administrator\Desktop\swyb\90data.txt"ForInputAs#2'打开文件 Fori=1To365 Input#2,Q(i),E0(i),P1(i),P2(i),P3(i),P4(i)'引用90年数据 P(i)=h1*P1(i)+h2*P2(i)+h3*P3(i)+h4*P4(i) sumQ=sumQ+Q(i) sumP=sumP+P(i) Text2.Text=sumQ'实测总径流流量 Nexti Close#2 EndIf WMM=WM*(1+b) WU (1)=10: WL (1)=40: WD (1)=60 W (1)=WU (1)+WL (1)+WD (1) a (1)=WMM*(1-(1-W (1)/WM)^(1/(1+b))) '三层蒸散发计算 Fori=1To365 Ep(i)=E0(i)*Kc Nexti Fori=1To365 IfWU(i)+P(i)>=Ep(i)Then EU(i)=Ep(i) EL(i)=0 ED(i)=0 Else IfWL(i)>=C*WLMThen EU(i)=WU(i)+P(i) EL(i)=(Ep(i)-EU(i))*WL(i)/WLM ED(i)=0 Else IfWL(i)>=C*(Ep(i)-EU(i))Then EU(i)=WU(i)+P(i) EL(i)=C*(Ep(i)-EU(i)) ED(i)=0 Else EU(i)=WU(i)+P(i) EL(i)=WL(i) ED(i)=C*(Ep(i)-EU(i))-EL(i) EndIf EndIf EndIf E(i)=EU(i)+EL(i)+ED(i) PE(i)=P(i)-E(i) '产流量计算 IfPE(i)>0Then'产流 Ifa(i)+PE(i) R(i)=PE(i)+W(i)-WM+WM*(1-(PE(i)+a(i))/WMM)^(b+1) a(i+1)=PE(i)+a(i) W(i+1)=W(i)+PE(i)-R(i) Else'蓄满 R(i)=PE(i)+W(i)-WM a(i+1)=WMM W(i+1)=WM EndIf Else R(i)=0'不产流 W(i+1)=W(i)+PE(i) a(i+1)=WMM*(1-(1-W(i+1)/WM)^(1/(1+b))) EndIf IfWU(i)+P(i)-EU(i)-R(i)<=WUMThen WU(i+1)=WU(i)+P(i)-EU(i)-R(i) WL(i+1)=WL(i)-EL(i) WD(i+1)=WD(i)-ED(i) Else WU(i+1)=WUM IfWL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)<=WLMThen WL(i+1)=WL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM) WD(i+1)=WD(i)-ED(i) Else WL(i+1)=WLM IfWD(i)-ED(i)+WL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)-WLM<=WDMThen WD(i+1)=WD(i)-ED(i)+WL(i)-EL(i)+(WU(i)+P(i)-EU(i)-R(i)-WUM)-WLM Else WD(i+1)=WDM EndIf EndIf EndIf Nexti Fori=1To365 sumR=sumR+R(i)*653000*(1-IM)/24/3600'透水面积上的R求和并将其单位由(mm)转化为(m3/s) Nexti sumR=sumR+sumP*653000*IM/24/3600'计算的径流总量等于透水面积上的产流加上不透水面积上的直接产流 Text3.Text=sumR'计算总径流流量 Text4.Text=Round((sumR-sumQ),4)'绝对误差 Text5.Text=Round(((sumR-sumQ)/sumQ),4)'相对误差 EndSub 3、洪水径流预报计算 PrivateSubCommand2_Click()’洪水径流预报计算 DimiAsInteger DimP(28),E(28),PE(28),Ep(28)AsSingle'降雨量,蒸发量,P-E,蒸发能力 DimEU(28),EL(28),ED(28)AsSingle'上、下、深层土壤蒸发量 DimWU(29),WL(29),WD(29)AsSingle'上、下、深层土壤含水量 DimW(29)AsSingle,R(28)AsSingle,rpe(28)AsSingle,rg(28)AsSingle,rs(28)AsSingle DimWUMAsInteger,WLMAsInteger,WDMAsInteger'上、下、深层土壤含水容量 DimC,b,FC,WM,WMM,a(29),ep2(28)AsSingle DimP1(28)AsSingle,P2(28)AsSingle,P3(28)AsSingle,P4(28)AsSingle'四个雨量站实测降雨量 DimQg0,CgAsSingle'地下径流初始流量,流量消退系数 DimU(28)AsInteger,KcAsSingle DimQ(28)AsSingle,Qs(28)AsSingle,Qg(28)AsSingle,jAsInteger Consth1=0.3,h2=0.17,h3=0.31,h4=0.22'各雨量站的权重 Kc=Val(Text1.Text) WUM=30: WLM=60: WDM=50: C=0.17: b=0.3: FC=22: WM=140'模型参数赋值 WMM=WM*(1+b) WU (1)=10: WL (1)=60: WD (1)=50 W (1)=WU (1)+WL (1)+WD (1) a (1)=WMM*(1-(1-W (1)/WM)^(1/(1+b))) Qg0=55: Cg=0.976 Open"C: \Users\Administrator\Desktop\水文预报课程设计总\暴雨过程.txt"ForInputAs#1 Fori=1To28 Input#1,ep2(i),P1(i),P2(i),P3(i),P4(i) P(i)=h1*P1(i)+h2*P2(i)+h3*P3(i)+h4*P4(i) Ep(i)=ep2(i)*Kc Nexti Close#1 '三层蒸散发计算 Fori=1To28 IfWU(i)+P(i)>=Ep(i)Then EU(i)=Ep(i): EL(i)=0: ED(i)=0 ElseIfWL(i)>=C*WLMThen EU(i)=WU(i)+P(i) EL(i)=(Ep(i)-EU(i))*WL(i)/WLM ED(i)=0 ElseIfWL(i)>=C*(Ep(i)-EU(i))Then EU(i)=WU(i)+P(i) EL(i)=C*(Ep(i)-
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算 程序 说明
![提示](https://static.bdocx.com/images/bang_tan.gif)