主题:实时错误11 除数为0
Public Sub ZQCS(t As Double, VZQ As Double, p As Double) 'T--温度,VZQ--比容,P--压力
Dim AL(4) As Double
Dim BL(3) As Double
Dim EB(2) As Double
Dim CL(6) As Double
Dim DL(4) As Double
AL(1) = 0.0102811: AL(2) = 0.0299621: AL(3) = 0.0156146: AL(4) = -0.00422464
BL(1) = -0.39707: BL(2) = 0.400302: BL(3) = 1.06
EB(1) = -0.171587: EB(2) = 2.39219
CL(1) = 0.642857: CL(2) = -4.11717: CL(3) = -6.17937: CL(4) = 0.00308976: CL(5) = 0.0822994: CL(6) = 10.0932
DL(1) = 0.0701309: DL(2) = 0.011852: DL(3) = 0.00169937: DL(4) = -1.02
'Dim ZT As Double
ZT = (t + 273.15) / 647.27
Dim ZV As Double
ZV = VZQ / 0.003147
Dim R0 As Double
R0 = 0
Dim IK As Integer
Dim i As Integer
For IK = 1 To 4
i = 5 - IK
R0 = R0 * ZT + AL(i)
Next IK
R0 = Sqr(ZT) * R0
Dim RB As Double
RB = BL(1) + BL(2) / ZV + BL(3) * Exp(EB(1) * (1 / ZV + EB(2)) ^ 2)
Dim RD1 As Double
RD1 = (DL(1) / ZT ^ 10 + DL(2)) / ZV ^ 1.8 * Exp(CL(1) * (1 - 1 / ZV ^ 2.8))
Dim RD3 As Double
RD3 = DL(4) * Exp(CL(2) * ZT ^ 1.5 + CL(3) * ZV ^ 5)
Dim DT As Double
DT = Abs(ZT - 1) + CL(4)
Dim Q0 As Double
Q0 = 2 + CL(5) / DT ^ 0.6
Dim RX As Double
RX = Q0 + 1
If ZT < 1 Then
Dim S0 As Double
S0 = CL(6) / DT ^ 0.6
Else
S0 = 1 / DT
End If
Dim RD2 As Double
RD2 = DL(3) * S0 / ZV ^ Q0 * Exp(Q0 / RX * (1 - 1 / ZV ^ RX))
Dim RD As Double
RD = RD1 + RD2 + RD3
Dim RAMD As Double
RAMD = (R0 + RB + RD + 0.00001 * p) / 1.163
这是个子程序,运行到RB = BL(1) + BL(2) / ZV + BL(3) * Exp(EB(1) * (1 / ZV + EB(2)) ^ 2)
跳出了标题的错误,求教
Dim AL(4) As Double
Dim BL(3) As Double
Dim EB(2) As Double
Dim CL(6) As Double
Dim DL(4) As Double
AL(1) = 0.0102811: AL(2) = 0.0299621: AL(3) = 0.0156146: AL(4) = -0.00422464
BL(1) = -0.39707: BL(2) = 0.400302: BL(3) = 1.06
EB(1) = -0.171587: EB(2) = 2.39219
CL(1) = 0.642857: CL(2) = -4.11717: CL(3) = -6.17937: CL(4) = 0.00308976: CL(5) = 0.0822994: CL(6) = 10.0932
DL(1) = 0.0701309: DL(2) = 0.011852: DL(3) = 0.00169937: DL(4) = -1.02
'Dim ZT As Double
ZT = (t + 273.15) / 647.27
Dim ZV As Double
ZV = VZQ / 0.003147
Dim R0 As Double
R0 = 0
Dim IK As Integer
Dim i As Integer
For IK = 1 To 4
i = 5 - IK
R0 = R0 * ZT + AL(i)
Next IK
R0 = Sqr(ZT) * R0
Dim RB As Double
RB = BL(1) + BL(2) / ZV + BL(3) * Exp(EB(1) * (1 / ZV + EB(2)) ^ 2)
Dim RD1 As Double
RD1 = (DL(1) / ZT ^ 10 + DL(2)) / ZV ^ 1.8 * Exp(CL(1) * (1 - 1 / ZV ^ 2.8))
Dim RD3 As Double
RD3 = DL(4) * Exp(CL(2) * ZT ^ 1.5 + CL(3) * ZV ^ 5)
Dim DT As Double
DT = Abs(ZT - 1) + CL(4)
Dim Q0 As Double
Q0 = 2 + CL(5) / DT ^ 0.6
Dim RX As Double
RX = Q0 + 1
If ZT < 1 Then
Dim S0 As Double
S0 = CL(6) / DT ^ 0.6
Else
S0 = 1 / DT
End If
Dim RD2 As Double
RD2 = DL(3) * S0 / ZV ^ Q0 * Exp(Q0 / RX * (1 - 1 / ZV ^ RX))
Dim RD As Double
RD = RD1 + RD2 + RD3
Dim RAMD As Double
RAMD = (R0 + RB + RD + 0.00001 * p) / 1.163
这是个子程序,运行到RB = BL(1) + BL(2) / ZV + BL(3) * Exp(EB(1) * (1 / ZV + EB(2)) ^ 2)
跳出了标题的错误,求教