📄 frmair.frm
字号:
Height = 255
Left = 4170
TabIndex = 13
Top = 1650
Width = 735
End
Begin VB.Label Label6
Caption = "Pa.s"
Height = 255
Left = 4215
TabIndex = 12
Top = 1080
Width = 615
End
Begin VB.Label Label7
Caption = "(Kg/m3)"
Height = 375
Left = 1800
TabIndex = 11
Top = 1065
Width = 615
End
Begin VB.Label Label8
Caption = "(J/kg.K)"
Height = 255
Left = 1710
TabIndex = 10
Top = 1680
Width = 735
End
Begin VB.Label Label14
Caption = "M:"
Height = 375
Left = 2640
TabIndex = 9
Top = 435
Width = 255
End
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 315
Left = 1560
TabIndex = 1
Top = 3600
Width = 700
End
Begin VB.CommandButton Command3
Caption = "输出"
Height = 315
Left = 3000
TabIndex = 0
Top = 3600
Width = 700
End
End
Attribute VB_Name = "Air"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim I As Integer
Dim J As Integer
Dim flag As Boolean
Dim flag1 As Boolean
Dim flag2 As Boolean
Private Sub Command1_Click()
Dim flag As Single
Dim hum_a As Single 'hum_a
Dim hum_r As Single
Dim Rm As Single
Rm = 8315.488
Call init
Cp = Cpi(7) '读入空气的定压比热
Wm_m = Wmi(7) '读入空气的分子量
R_m = Rm / Wmi(7) '计算空气的气体常数
If Text7(0).Text = "" And Text7(1).Text = "" And Text7(2).Text = "" And Text7(3).Text = "" Then '程序初始化
p = MDIForm1.txtInletPressure.Text
Text7(0).Text = p
Text7(1).Text = p * 10 ^ (-6) '压力单位由Pa转化为Mpa
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由Pa转化为公斤力
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(0).Text <> "" Then '如果输入压力单位为Pa
p = Val(Text7(0).Text)
Text7(1).Text = p * 10 ^ (-6) '压力单位由Pa转化为Mpa
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由Pa转化为公斤力
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(1).Text <> "" Then '如果输入压力单位为Mpa
p = Val(Text1(4).Text) * 10 ^ 6
Text7(0).Text = p
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由Pa转化为公斤力
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(2).Text <> "" Then '如果输入压力为公斤力
p = Val(Text7(2).Text) * 98000
Text7(0).Text = p
Text7(1).Text = p * 10 ^ -6 '压力单位由Pa转化为MPa
Text12.Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(3).Text <> "" Then '如果输入压力为巴
p = Val(Text7(3).Text) * 100000
Text7(0).Text = p
Text7(1).Text = p * 10 ^ -6 '压力单位由巴转化为MPa
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由巴转化为公斤力
End If
If Text8(0).Text = "" And Text8(1).Text = "" Then
Text8(0).Text = Val(MDIForm1.txtInletTemp.Text)
T = Val(Text8(0).Text)
Text8(1).Text = Val(Text8(0).Text) - 273.15
ElseIf Text8(0).Text <> "" Then
T = Val(Text8(0).Text)
Text8(1).Text = Val(Text8(0).Text) - 273.15
ElseIf Text8(1).Text <> "" Then
T = Val(Text8(1).Text) + 273.15
Text8(0).Text = Val(Text8(1).Text) + 273.15
End If
u = viscous(T) '插值产生动力粘度系数,认为仅于温度有关
If Option1.Value = True And Option2.Value = False Then
hum_r = Val(Text1(0).Text)
If hum_r = 0 Then
Cp = Cp * 1000
hum_a = 0
dens = p / (R_m * T) ' 按照理想气体计算空气的密度
k = Ak(7) '读入空气的绝热指数
Text2(1).Text = Cp '输出定压比热
Text2(0).Text = k '输出绝热指数
Text2(2).Text = R_m '输出气体常数
Text2(3).Text = dens '输出密度
Text2(4).Text = Val(Left(Str(u), 6)) & "*10^-6" '输出动力粘度系数
Text3.Text = Wm_m '输出气体分子量
Text1(1).Visible = True
Text1(1).Text = hum_a
Else
Cp = Cp * 1000
RdRw = 18.016 / Wm_m
ps = pressure(T, pa, ta) '插值产生对应于温度T的饱和水蒸气压力
If p - ps * hum_r * 0.01 < 100 Then
MsgBox "气体接近液化,请重新输入气体温度,湿度和压力", vbCritical, "警告"
Else
hum_a = RdRw * hum_r * 0.01 * ps / (p - ps * hum_r * 0.01)
End If
Text1(1).Visible = True
Text1(1).Text = hum_a * 1000
End If
ElseIf Option1.Value = False And Option2.Value = True Then
ps = pressure(T, pa, ta)
Cp = Cp * 1000
RdRw = 18.016 / Wm_m
hum_a = Val(Text1(1).Text)
hum_r = hum_a * 0.1 * p / ((hum_a * 0.001 + RdRw) * ps)
Text1(0).Visible = True
Text1(0).Text = hum_r
End If
Rm_h = (R_m + hum_a * 0.4616) / (1 + 0.001 * hum_a) '空气和水蒸气混合后的气体常数
Sk = Cp / (Cp - Rm_h) '空气和水蒸气混合后的绝热指数
dens = p / (Rm_h * T)
R_m = Rm_h
k = Sk
Text2(1).Text = Cp '输出定压比热
Text2(0).Text = k '输出绝热指数
Text2(2).Text = R_m '输出气体常数
Text2(3).Text = dens '输出密度
Text2(4).Text = Val(Left(Str(u), 6)) & "*10^-6" '输出动力粘度系数
Text3.Text = Wm_m
End Sub
Private Sub Command2_Click()
Text7(0).Text = ""
Text7(1).Text = ""
Text7(2).Text = ""
Text7(3).Text = ""
Text2(0).Text = ""
Text2(1).Text = ""
Text2(2).Text = ""
Text2(3).Text = ""
Text2(4).Text = ""
Text3.Text = ""
Text8(0).Text = ""
Text8(1).Text = ""
End Sub
Private Sub Command4_Click()
Dim flag As Single
Dim hum_a As Single 'hum_a
Dim hum_r As Single
Dim Rm As Single
Rm = 8315.488
Call init
Cp = Cpi(7) '读入空气的定压比热
Wm_m = Wmi(7) '读入空气的分子量
R_m = Rm / Wmi(7) '计算空气的气体常数
If Text7(0).Text = "" And Text7(1).Text = "" And Text7(2).Text = "" And Text7(3).Text = "" Then '程序初始化
p = 101325
Text7(0).Text = p
Text7(1).Text = p * 10 ^ (-6) '压力单位由Pa转化为Mpa
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由Pa转化为公斤力
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(0).Text <> "" Then '如果输入压力单位为Pa
p = Val(Text7(0).Text)
Text7(1).Text = p * 10 ^ (-6) '压力单位由Pa转化为Mpa
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由Pa转化为公斤力
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(1).Text <> "" Then '如果输入压力单位为Mpa
p = Val(Text7(1).Text) * 10 ^ 6
Text7(0).Text = p
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由Pa转化为公斤力
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(2).Text <> "" Then '如果输入压力为公斤力
p = Val(Text7(2).Text) * 98000
Text7(0).Text = p
Text7(1).Text = p * 10 ^ -6 '压力单位由Pa转化为MPa
Text7(3).Text = p / 100000 '压力单位由Pa转化为巴
ElseIf Text7(3).Text <> "" Then '如果输入压力为巴
p = Val(Text7(3).Text) * 100000
Text7(0).Text = p
Text7(1).Text = p * 10 ^ -6 '压力单位由巴转化为MPa
Text7(2).Text = (p * 10 ^ -4) / 9.8 '压力单位由巴转化为公斤力
End If
If Text8(0).Text = "" And Text8(1).Text = "" Then
T = 293.15
Text8(0).Text = T
Text8(1).Text = Val(Text8(0).Text) - 273.15
ElseIf Text8(0).Text <> "" Then
T = Val(Text8(0).Text)
Text8(1).Text = Val(Text8(0).Text) - 273.15
ElseIf Text8(1) <> "" Then
T = Val(Text8(1).Text) + 273.15
Text8(0).Text = Val(Text8(1).Text) + 273.15
End If
If Text1(0).Text = "" And Text1(1).Text = "" Then
MsgBox "请输入空气的湿度值", vbCritical, "警告"
End If
End Sub
Private Sub Form_Load()
ta = Array(-16, -14, -12, -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 104.81, 109.32, 113.32, 116.93, 120.23, 127.43, 133.54, 138.88, 143.62, 147.92, 151.85, 158.84, 164.96, 170.42, 175.36, 179.88)
pa = Array(175.5, 207, 243, 287, 334, 389.5, 452, 525, 610, 704, 812, 931, 1070, 1226, 1312, 1400, 1500, 1600, 1705, 1825, 1930, 2070, 2196, 2334, 2490, 2650, 2815, 2990, 3180, 3365, 3560, 3732, 4000, 4240, 4490, 4760, 5030, 5330, 5620, 5950, 6285, 6630, 7010, 7380, 7800, 8200, 8650, 9120, 9600, 10100, 10600, 11190, 11770, 12180, 15300, 19900, 25000, 31200, 38550, 47400, 57850, 70500, 84500, 101325, 120000, 140000, 160000, 180000, 200000, 25000, 300000, 350000, 400000, 450000, 500000, 600000, 700000, 800000, 900000, 1000000)
Text1(1) = ""
Text7(0) = ""
Text8(0) = ""
Text2(0) = ""
Text2(1) = ""
Text2(2) = ""
Text2(3) = ""
Text2(4) = ""
Option1.Value = True
flag = True
End Sub
Private Sub Option1_Click()
Option1.Value = True
Option2.Value = False
Text1(1).Enabled = False
Text1(0).Enabled = True
Text1(0).Text = 0
Text1(1).Text = ""
End Sub
Private Sub Option2_Click()
Option1.Value = False
Option2.Value = True
Text1(1).Enabled = True
Text1(0).Enabled = False
Text1(1).Text = ""
Text1(0).Text = ""
End Sub
Private Sub Text7_Change(Index As Integer)
If flag1 = True Then
For I = 0 To 3
Text7(I) = ""
Next I
End If
flag1 = False
End Sub
Private Sub Text7_LostFocus(Index As Integer)
flag1 = False
End Sub
Private Sub Text8_Change(Index As Integer)
If flag2 = True Then
For I = 0 To 1
Text8(I) = ""
Next I
End If
flag2 = False
End Sub
Private Sub Text7_GotFocus(Index As Integer)
If Text7(0).Text = "" And Text7(1).Text = "" And Text7(2).Text = "" And Text7(3).Text = "" Then
flag1 = False
Else
flag1 = True
End If
End Sub
Private Sub Text8_GotFocus(Index As Integer)
If Text8(0).Text = "" And Text8(1).Text = "" Then
flag2 = False
Else
flag2 = True
End If
End Sub
Private Sub Text8_LostFocus(Index As Integer)
flag2 = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -