新安江模型VB代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Dim P(25), EI(25), PE(25), A(25), AU(25), FR(25), W(25), WU(25), WL(25), WD(25), E(25), EU(25), EL(25), ED(25), R2(25), R3(25), RS(25), RG(25), RSS(25), RIMP(25), QR(25), QRG(25), QRSS(25), QRSP(25), S(25), UH(3), q(3) As Single

Dim N, m, K, B, C, D, EX, SM, SSM, MP, KG, KSS, KKSS, KGD, KSSD, KKGD, KKG, WM, WWMM, WUM, WLM, WDM, DT, UN, QRSS0, QRG0, F, i, j As Single

Private Sub Command1_Click()

Static ik As Integer

ik = ik + 1

Command1.Caption = "您还需计算" & 7 - ik & " 次"

If ik = 7 Then Command1.Enabled = False

Set xlbook = GetObject(App.Path & "\" & "xaj.xls")

xlbook.application.Visible = True: xlbook.windows(1).Visible = True

Set xlsheet1 = xlbook.worksheets("sheet1")

Set xlsheet2 = xlbook.worksheets("sheet2")

K = xlsheet1.Cells(3, 1)

C = xlsheet1.Cells(3, 2)

B = xlsheet1.Cells(3, 3)

SM = xlsheet1.Cells(3, 5)

WUM = xlsheet1.Cells(3, 6)

WLM = xlsheet1.Cells(3, 7)

WDM = xlsheet1.Cells(3, 8)

EX = xlsheet1.Cells(3, 9)

KG = xlsheet1.Cells(3, 10)

KSS = xlsheet1.Cells(3, 11)

KKG = xlsheet1.Cells(3, 12)

KKSS = xlsheet1.Cells(3, 13)

DT = xlsheet1.Cells(3, 14)

UH(1) = xlsheet1.Cells(3, 15)

UH(2) = xlsheet1.Cells(3, 16)

UH(3) = xlsheet1.Cells(3, 17)

WU(0) = xlsheet1.Cells(3, 18)

WL(0) = xlsheet1.Cells(3, 19)

WD(0) = xlsheet1.Cells(3, 20)

FR(0) = xlsheet1.Cells(3, 21)

S(0) = xlsheet1.Cells(3, 22)

QRSS(0) = xlsheet1.Cells(3, 23)

QRG(0) = xlsheet1.Cells(3, 24)

F = xlsheet1.Cells(3, 25)

MP = 0: RS(0) = 0: W(0) = 150

WM = (WUM + WLM + WDM)

WWMM = WM * (1 + B)

SSM = SM * (1 + EX)

KSSD = (1 - (1 - (KG + KSS)) ^ (DT / 24)) / (1 + KG / KSS)

KGD = KSSD * KG / KSS

KKGD = KKG ^ (DT / 24)

N = 24

For i = 1 To N

P(i) = xlsheet1.Cells(5, i + 1)

EI(i) = xlsheet1.Cells(8, i + 1)

PE(i) = P(i) - K * EI(i)

Next i

For i = 1 To N '计算产流

If PE(i) > 0 Then

A(i) = WWMM * (1 - (1 - W(i - 1) / WM) ^ (1 / (1 + B)))

If PE(i) + A(i) >= WWMM Then

R2(i) = PE(i) - (WM - W(i - 1))

Else

R2(i) = PE(i) - (WM - W(i - 1) - WM * (1 - (PE(i) + A(i)) / WWMM) ^ (1 + B)) End If

If PE(i) > 0 Then

FR(i) = R2(i) / PE(i)

Else

FR(i) = 1 - (1 - S(i - 1) / WM) ^ (B / (1 + B))

End If

AU(i) = SSM * (1 - (1 - S(i - 1) / SM) ^ (1 / (1 + EX)))

If PE(i) + AU(i) < SSM Then

RS(i) = (PE(i) - SM + S(i - 1) + SM * (1 - (PE(i) + AU(i)) / SSM) ^ (1 + EX)) * FR(i) RSS(i) = (SM - SM * (1 - (PE(i) + AU(i)) / SSM) ^ (1 + EX)) * KSSD * FR(i)

RG(i) = (SM - SM * (1 - (PE(i) + AU(i)) / SSM) ^ (1 + EX)) * KGD * FR(i)

S(i) = (SM - SM * (1 - (PE(i) + AU(i)) / SSM) ^ (1 + EX)) * (1 - KSSD - KGD) Else

RS(i) = (PE(i) - SM + S(i - 1)) * FR(i)

RSS(i) = SM * KSSD * FR(i)

RG(i) = SM * KGD * FR(i)

S(i) = SM * (1 - KSSD - KGD)

End If

Else

R2(i) = 0

FR(i) = 1 - (1 - W(i - 1) / WM) ^ (B / (1 + B))

RS(i) = 0

RSS(i) = S(i - 1) * KSSD * FR(i)

RG(i) = S(i - 1) * KGD * FR(i)

S(i) = S(i - 1) * (1 - KSSD - KGD)

End If

RIMP(0) = 0

RIMP(i) = P(i) * MP

相关文档
最新文档