📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Public Const WaterMdbFile = "\data\数据.mdb"
Public k As Single
Public u As Single
Public x As Single
Private y As Single
Public z As Single
Public Function SearchG1(ByVal t As Single, V As Single) As Boolean
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Set db = OpenDatabase(App.Path + WaterMdbFile)
SearchG1 = False
strSQL = "SELECT * FROM water "
strSQL = strSQL & " WHERE t="
strSQL = strSQL & Str(t)
Set rs = db.OpenRecordset(strSQL)
If Not (rs.BOF And rs.EOF) Then
Do While Not rs.EOF
V = rs.Fields(1).value
SearchG1 = True
Exit Do
rs.MoveNext
Loop
End If
rs.Close
db.Close
End Function
Public Function LQd(ByVal C, ByVal H, ByVal O, ByVal S, ByVal W As Single) As Single
Dim A As Single
A = 4.187 * (81 * C + 246 * H - 26 * (O - S) - 6 * W)
LQd = A
End Function
Public Function LL0(ByVal C, ByVal H, ByVal S, ByVal O As Single) As Single
'Static y As Single
y = (8.89 * C + 26.67 * H + 3.33 * S - 3.33 * O) * 0.01
LL0 = y
End Function
Public Function LLY(ByVal C, ByVal H, ByVal S, ByVal W, ByVal N, ByVal O As Single) As Single
'Static z As Single
z = (C / 12 + H / 2 + S / 32 + W / 18 + N / 28) * 0.224 + (0.79 * y)
LLY = z
End Function
Public Function LLn(ByVal C, ByVal H, ByVal S, ByVal O As Single) As Single
'Static x As Single
'Static N As Single
k = Val(Form1.Text4.Text)
'x = L0(CO, H2, CH4, C2H4, H2S, O2)
x = (1 + 0.00124 * Val(Form1.Text3.Text)) * k * y
LLn = x
End Function
Public Function LSY(ByVal C, ByVal H, ByVal O, ByVal N, ByVal S, ByVal W As Single) As Single
'u = L0(CO, H2, CH4, C2H4, H2S, O2)
'u = (N - 1) * u + LY(CO, H2, CH4, C2H4, H2S, CO2, N2, w) + 0.00124 * V * Ln(V, CO, H2, CH4, C2H4, H2S, O2)
u = (C / 12 + S / 32 + H / 2 + W / 18 + N / 28) * 0.224 + (k - 0.21) * y + 0.00124 * Val(Form1.Text3.Text) * x
LSY = u
End Function
Public Function LPCO2(ByVal C As Single) As Single
Dim A As Single
A = 0.224 * C / 12
A = A * 100 / u
LPCO2 = A
End Function
Public Function LPSO2(ByVal S As Single) As Single
Dim A As Single
A = 0.224 * S / 32
A = A * 100 / u
LPSO2 = A
End Function
Public Function LPN2(ByVal N, ByVal C, ByVal H, ByVal S, ByVal O As Single) As Single
Dim A As Single
A = 0.224 * N / 28 + 0.79 * x
A = A * 100 / u
LPN2 = A
End Function
Public Function LPO2(ByVal C, ByVal H, ByVal O, ByVal S As Single) As Single
Dim A As Single
A = 0.21 * (x - y)
A = A * 100 / u
LPO2 = A
End Function
Public Function LPH2O(ByVal C, ByVal H, ByVal O, ByVal S, ByVal W As Single) As Single
Dim A As Single
'a = (H2 + 2 * CH4 + 2 * C2H4 + H2S + w) * 0.01 + 0.00124 * V * SY(V, CO, H2, CH4, C2H4, H2S, O2, N2, w)
A = (H / 2 + W / 18) * 0.224 + 0.00124 * Val(Form1.Text3.Text) * x
A = A * 100 / u
LPH2O = A
End Function
'Public Function LBC2H4(ByVal t As Single)
' Dim C As Single
'C = 1.81514126 + 0.00260694312 * t - 0.000000873543124 * t8t
' LBC2H4 = C
'End Function
'Public Function LBCH4(ByVal t As Single)
' Dim C As Single
' C = 1.52925165 + 0.00131352198 * t - 0.000000153021978 * t * t
' LBCH4 = C
'End Function
'Public Function LBH2S(ByVal t As Single)
' Dim C As Single
'C = 1.50175748 + 0.00039416292 * t - 0.000000039707633 * t * t
' LBH2S = C
'End Function
'Public Function LBH2(ByVal t As Single)
'Dim C As Single
'C = 1.28338694 + 0.0000397565079 * t + 1.05946276E-08 * t * t
'LBH2 = C
'End Function
'Public Function LBCO(ByVal t As Single)
'Dim C As Single
'C = 1.28432057 + 0.000149187027 * t - 0.00000001922558 * t * t
'LBCO = C
'End Function
Public Function LBAir(ByVal t As Single)
Dim C As Single
C = 1.28478578 + 0.000141967442 * t - 1.64954212E-08 * t * t
LBAir = C
End Function
Public Function LBH2O(ByVal t As Single)
Dim C As Single
C = 1.46652143 + 0.000263006685 * t - 1.31144689E-08 * t * t - 0.01
LBH2O = C
End Function
Public Function LBO2(ByVal t As Single)
Dim C As Single
C = 1.30364121 + 0.000207863132 * t - 3.61126374E-08 * t * t
LBO2 = C
End Function
Public Function LBN2(ByVal t As Single)
Dim C As Single
C = 1.2902815 + 0.000107926502 * t - 5.96978022E-09 * t * t
LBN2 = C
End Function
Public Function LBCO2(ByVal t As Single)
Dim C As Single
C = 1.6779859 + 0.000685366197 * t - 0.000000144643162 * t * t - 0.01
LBCO2 = C
End Function
Public Function LC燃(ByVal t As Single)
Dim C As Single
C = 4.187 * (0.416 + 0.0006 * t)
LC燃 = C
End Function
Public Function LQ燃(ByVal t As Single) As Single
Dim C As Single
C = LC燃(t) * t
LQ燃 = C
End Function
Public Function LQ空(ByVal t, ByVal C, ByVal H, ByVal S, ByVal O As Single) As Single
Dim A As Single
'c = BAir(t) * t * Ln(V, CO, H2, CH4, C2H4, H2S, O2)
A = (k * y * LBAir(t) + 0.00124 * Val(Form1.Text3.Text) * k * y * LBH2O(t)) * t
LQ空 = A
End Function
'Public Function C产(ByVal t, ByVal H2, ByVal CH4, ByVal C2H4, ByVal H2S, ByVal H2O, ByVal V, ByVal N2, ByVal CO, ByVal O2, ByVal CO2 As Single)
Public Function LBSO2(ByVal t As Single)
Dim C As Single
C = 1.71745219 + 0.000926912288 * t - 0.000000365996504 * t * t
LBSO2 = C
End Function
Public Function LC产(ByVal t)
Dim C As Single
C = LBCO2(t) * Val(Form1.Label18(0)) + LBSO2(t) * Val(Form1.Label18(1)) + LBH2O(t) * Val(Form1.Label18(2)) + LBN2(t) * Val(Form1.Label18(3)) + LBO2(t) * (Form1.Label18(4))
C = C / 100
LC产 = C
End Function
Public Function Lt理(ByVal C, ByVal H, ByVal O, ByVal S, ByVal W As Single) As Single
Dim A, l, m, st As Single
Dim result As Single
l = Val(Form1.Text5.Text)
m = Val(Form1.Text6.Text)
st = Val(Form1.Text7.Text)
A = LQd(C, H, O, S, W) + LQ空(m, C, H, S, O) + LQ燃(l)
A = A / (z * LC产(st) + (x - y) * LBAir(st))
result = Abs(A - st)
If result < 5 Then
Lt理 = A
Else
Do While result > 5
st = (A + st) / 2
A = LQd(C, H, O, S, W) + LQ空(m, C, H, S, O) + LQ燃(l)
A = A / (z * LC产(st) + (x - y) * LBAir(st))
result = Abs(A - st)
Loop
Lt理 = A
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -