Private Sub mnuFileCloce_Click()
End
'para1
Private Sub Text1_Change()
Dim K1, K2, K3, K4, K5, K6, K7, K8, K9 As Double
Dim Tc, Pc, T, X, Xx, Xy, Xz, P As Double
K1 = -7.691234564
K2 = -26.08023696
K3 = -168.1706546
K4 = 64.23285504
K5 = -118.9646225
K6 = 4.167117732
K7 = 20.9750676
K8 = 1000000000#
K9 = 6#
Ts = Val(Text1.Text)
Tc = 647.3
Pc = 22120#
T = Ts + 273.15
X = T / Tc
Xx = 1 + K6 * (1 - X) + K7 * (1 - X) ^ 2
Xy = K8 * (1 - X) ^ 2 + K9
Xz = K1 * (1 - X) + K2 * (1 - X) ^ 2 + K3 * (1 - X) ^ 3 + K4 * (1 - X) ^ 4 + K5 * (1 - X) ^ 5
Ps = Pc * Exp(((1 / X) * Xz) / Xx - (1 - X) / Xy)
Text2.Text = Str(Ps)
If Text1.Text = "" Then Text2.Text = ""
If Text4.Text = "" Then Text3.Text = ""
'part 2
Private Sub Text4_Change()
Dim K1, K2, K3, K4, K5, K6, K7, K8, K9 As Double
Dim Tc, Pc, T, Ts, X, Xx, Xy, Xz, Ps, P As Double
Dim A1, A2, A3, A4, A5, A6, PDIF As Double
Dim I As Long
A1 = 46.8922631
A2 = 3.61025379
A3 = -0.181752837
A4 = -0.00657409
A5 = -0.010390705
A6 = -0.00228354
K1 = -7.691234564
K2 = -26.08023696
K3 = -168.1706546
K4 = 64.23285504
K5 = -118.9646225
K6 = 4.167117732
K7 = 20.9750676
K8 = 1000000000
K9 = 6
I = 0
Pc = 22120
Ps = Val(Text4.Text)
P1 = (A1 + (A2 * Ps))
P2 = (A3 * Ps ^ 2)
P3 = (A4 * Ps ^ 3)
P4 = (A5 * Ps ^ 4)
P5 = (A6 * Ps ^ 5)
Ts = P1 + P2 + P3 + P4 + P5
30
T = Ts + 273.15
Tc = 647.3
X = T / Tc
Xx = 1 + K6 * (1 - X) + K7 * (1 - X) ^ 2
Xy = K8 * (1 - X) ^ 2 + K9
Xz = K1 * (1 - X) + K2 * (1 - X) ^ 2 + K3 * (1 - X) ^ 3 + K4 * (1 - X) ^ 4 + K5 * (1 - X) ^ 5
P = Pc * Exp((((1 / X) * Xz) / (Xx)) - ((1 - X) / Xy))
PDIF = Ps * 100# / P
If PDIF > 1.0001 Or PDIF < 0.9999 Then
Ts = Ts * ((PDIF) ^ 0.5)
I = I + 1
Label9.Caption = Str(I)
GoTo 30
End If
Text3.Text = Str(Ts)
If Text4.Text = "" Then Text3.Text = ""
End Sub