📄 frm_main.frm
字号:
Index = 4
Left = 240
TabIndex = 4
Top = 2160
Width = 855
End
Begin VB.Label Lbl_Com
Caption = "Label1"
Height = 255
Index = 3
Left = 240
TabIndex = 3
Top = 1800
Width = 855
End
Begin VB.Label Lbl_Com
Caption = "Label1"
Height = 255
Index = 2
Left = 240
TabIndex = 2
Top = 1440
Width = 855
End
Begin VB.Label Lbl_Com
Caption = "Lbl_Com"
Height = 255
Index = 1
Left = 240
TabIndex = 1
Top = 1080
Width = 855
End
Begin VB.Label Lbl_Com
Caption = "Label1"
Height = 255
Index = 0
Left = 2400
TabIndex = 0
Top = 120
Width = 855
End
End
Attribute VB_Name = "Frm_Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const Link_num = 43
'Y = 实际数 * 量程范围 / 模拟量点数+初值
Private S_F As Single '初值MMM
Private S_N As Single '模拟量点数III
Private S_M As Single '量程范围NNN
Private S_Data(Link_num) As Single '显示值
Private cnn As New ADODB.Connection
Private rs As New ADODB.Recordset
Private strcon As String
Private msg As String
Const ComDrv = "\\3.5ar\MBPLUS|plc"
Private Sub Form_Load()
On Error Resume Next
Dim inum As Long
Call ConnectionDB
Call InitDB
For inum = 1 To Link_num
Lbl_Com(inum).LinkTopic = ComDrv
Lbl_Com(inum).LinkTimeout = 80
Lbl_Com(inum).LinkMode = vbLinkAutomatic
DoEvents
Next inum
Call StartClient
'Call TestProcedure
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Unload Me
End
End Sub
Private Sub ConnectionDB()
On Error GoTo Err_ConnectionDB:
If cnn.State = 1 Then cnn.Close
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
cnn.ConnectionString = "Provider=OraOLEDB.Oracle.1;Password=yq;Persist Security Info=True;User ID=yq;Data Source=yqdata"
cnn.CursorLocation = adUseClient
rs.CursorLocation = adUseClient
cnn.Open
Exit Sub
Err_ConnectionDB:
msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox msg, , "Error", Err.HelpFile, Err.HelpContext
Err.Clear
' Exit Sub ' 将控制返回到产生错误的语句。
End
End Sub
Private Sub InitDB()
On Error GoTo Err_InitDB:
If rs.State = 1 Then rs.Close
' strcon = "select * from tab_1ArTower_Com"
strcon = "delete from tab_1ArTower_Com"
rs.Open strcon, cnn, adOpenStatic, adLockOptimistic
strcon = "insert into tab_1ArTower_Com (N_AI704) values (9999)"
rs.Open strcon, cnn, adOpenStatic, adLockOptimistic
Exit Sub
Err_InitDB:
msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox msg, , "Error", Err.HelpFile, Err.HelpContext
Err.Clear
' Exit Sub ' 将控制返回到产生错误的语句。
End
End Sub
'''Private Sub StartClient()
'''On Error Resume Next
'''
''' Timer_INTOUCH.Enabled = False
''' Timer_INTOUCH.Interval = 0
''' S_N = 10000
''''=======================氩提取===========================================
''' S_F = 0
''' With Lbl_Com(1)
''' .LinkTopic = ComDrv
''' .LinkItem = "40630"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 20 '80---100
''' S_Data(1) = Str(Val(Lbl_Com(1).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "40 AI704 粗氩中含氩量 %.VOL.Ar 80-100 " & " " & S_Data(1)
''' With Lbl_Com(2)
''' .LinkTopic = ComDrv
''' .LinkItem = "40629 s"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 5
''' S_Data(2) = Str(Val(Lbl_Com(2).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "39 AIAS703 粗氩塔粗氩中含氧量 %.VOL.O2 0-5 " & " " & S_Data(2)
''' With Lbl_Com(3)
''' .LinkTopic = ComDrv
''' .LinkItem = "40611 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_F = -200
''' S_M = 250
''' S_Data(3) = Str(Val(Lbl_Com(3).Caption) * S_M / S_N + S_F)
'''' S_Data(3) = Int(Val(Lbl_Com(3).Caption) * S_M / S_N + S_F)
'''' S_Data(3) = Fix(Val(Lbl_Com(3).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "1 TI701 粗氩塔回流液空温度 ℃ -200--50 " & " " & S_Data(3)
''' With Lbl_Com(4)
''' .LinkTopic = ComDrv
''' .LinkItem = "40637 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_F = 0
''' S_M = 1000
''' S_Data(4) = Str(Val(Lbl_Com(4).Caption) * S_M / S_N + S_F)
''' 'S_Data(4) = int(Val(Lbl_Com(4).Caption) * S_M / S_N + S_F)
''' 'S_Data(4) = fix(Val(Lbl_Com(4).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "33 LIC701 粗氩冷凝器液空侧液面 mm 0-1000 " & " " & S_Data(4)
''' With Lbl_Com(5)
''' .LinkTopic = ComDrv
''' .LinkItem = "40628"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 20
''' S_Data(5) = Str(Val(Lbl_Com(5).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "38 AI701 粗氩塔氩馏分含氩量 %.VOL.Ar 0-20 " & " " & S_Data(5)
''' With Lbl_Com(6)
''' .LinkTopic = ComDrv
''' .LinkItem = "40609 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 10
''' S_Data(6) = Str(Val(Lbl_Com(6).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "31 PDI701 粗氩塔阻力压力 Kpa 0-10 " & " " & S_Data(6)
''' With Lbl_Com(7)
''' .LinkTopic = ComDrv
''' .LinkItem = "40642"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_F = -200
''' S_M = 250
''' S_Data(7) = Str(Val(Lbl_Com(7).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "3 TI703 液空进塔温度 ℃ -200--50 " & " " & S_Data(7)
''' With Lbl_Com(8)
''' .LinkTopic = ComDrv
''' .LinkItem = "40151"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 100
''' S_F = 0
''' S_Data(8) = Str(Val(Lbl_Com(8).Caption) * S_M / S_N + S_F)
''' 'S_Data(8) = int(Val(Lbl_Com(8).Caption) * S_M / S_N + S_F)
''' 'S_Data(8) = fix(Val(Lbl_Com(8).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "23 PIC701 精氩塔压力 Kpa 0-100 " & " " & S_Data(8)
''' With Lbl_Com(9)
''' .LinkTopic = ComDrv
''' .LinkItem = "40610 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 30
''' S_Data(9) = Str(Val(Lbl_Com(9).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "32 PDIC702 精氩塔阻力压力 Kpa 0-30 " & " " & S_Data(9)
''' With Lbl_Com(10)
''' .LinkTopic = ComDrv
''' .LinkItem = "40638 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 400
''' S_Data(10) = Str(Val(Lbl_Com(10).Caption) * S_M / S_N + S_F)
''' DoEvents
''''!List1.AddItem "36 LIC704 精氩塔工艺氩液面 mm 0-400 " & " " & S_Data(10)
''' With Lbl_Com(11)
''' .LinkTopic = ComDrv
''' .LinkItem = "40640"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 600
''' S_Data(11) = Str(Val(Lbl_Com(11).Caption) * S_M / S_N + S_F)
''' 'S_Data(11) = int(Val(Lbl_Com(11).Caption) * S_M / S_N + S_F)
''' 'S_Data(11) = fix(Val(Lbl_Com(11).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "34 LICAS702 精氩冷凝器液氮侧液面 mm 0-600 " & " " & S_Data(11)
''' With Lbl_Com(12)
''' .LinkTopic = ComDrv
''' .LinkItem = "40639 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 1600
''' S_Data(12) = Str(Val(Lbl_Com(12).Caption) * S_M / S_N + S_F)
''' 'S_Data(12) = int(Val(Lbl_Com(12).Caption) * S_M / S_N + S_F)
''' 'S_Data(12) = fix(Val(Lbl_Com(12).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "35 LIC703 精氩塔纯液氩液面 mm 0-1600 " & " " & S_Data(12)
''' With Lbl_Com(13)
''' .LinkTopic = ComDrv
''' .LinkItem = "40613 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_F = 0
''' S_M = 50
''' S_Data(13) = Str(Val(Lbl_Com(13).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "4 TI751 精氩塔余气放空温度 ℃ 0-50 " & " " & S_Data(13)
''' With Lbl_Com(14)
''' .LinkTopic = ComDrv
''' .LinkItem = "40643 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 25
''' S_Data(14) = Str(Val(Lbl_Com(14).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "19 FI751 精氩塔余气放空流量 M3/H 0-25 " & " " & S_Data(14)
''' With Lbl_Com(15)
''' .LinkTopic = ComDrv
''' .LinkItem = "40612 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_F = -200
''' S_M = 250
''' S_Data(15) = Str(Val(Lbl_Com(15).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "2 TIC702 精氩塔工艺氩进口温度 ℃ -200--50 " & " " & S_Data(15)
''''==================================================================
'''
''''=======================氩干燥===========================================
''' S_F = 0
''' With Lbl_Com(16)
''' .LinkTopic = ComDrv
''' .LinkItem = "40605 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 500
''' S_Data(16) = Str(Val(Lbl_Com(16).Caption) * S_M / S_N + S_F)
''' 'S_Data(16) = int(Val(Lbl_Com(16) .Caption) * S_M / S_N + S_F)
''' 'S_Data(16) = fix(Val(Lbl_Com(16) .Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "27 PIC2106 工艺氩进冷箱前压力 Kpa 0-500 " & " " & S_Data(16)
''' With Lbl_Com(17)
''' .LinkTopic = ComDrv
''' .LinkItem = "40624 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 600
''' S_Data(17) = Str(Val(Lbl_Com(17).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "15 TIS2181 干燥器再生氮气温度 ℃ 0-600 " & " " & S_Data(17)
''' With Lbl_Com(18)
''' .LinkTopic = ComDrv
''' .LinkItem = "40625 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_Data(18) = Str(Val(Lbl_Com(18).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "16 TIAS2182 电加热器加热元件温度 ℃ 0-600 " & " " & S_Data(18)
''' With Lbl_Com(19)
''' .LinkTopic = ComDrv
''' .LinkItem = "40626 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 300
''' S_Data(19) = Str(Val(Lbl_Com(19).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "17 TI2183 干燥器氮气放空温度 ℃ 0-300 " & " " & S_Data(19)
''' With Lbl_Com(20)
''' .LinkTopic = ComDrv
''' .LinkItem = "40633"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 10
''' S_Data(20) = Str(Val(Lbl_Com(20).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "43 AIAS2104 工艺氩中含氧量 ppm. VOL.O2 0-10 " & " " & S_Data(20)
''' With Lbl_Com(21)
''' .LinkTopic = ComDrv
''' .LinkItem = "40632"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 100
''' S_Data(21) = Str(Val(Lbl_Com(21).Caption) * S_M / S_N + S_F)
''' DoEvents
''''List1.AddItem "42 AIA2103 工艺氩水分 ppm. VOL.H2 0-100 " & " " & S_Data(21)
''' With Lbl_Com(22)
''' .LinkTopic = ComDrv
''' .LinkItem = "40621 S"
''' .LinkTimeout = 80
''' .LinkMode = vbLinkAutomatic
''' End With
''' S_M = 50
''' S_Data(22) = Str(Val(Lbl_Com(22).Caption) * S_M / S_N + S_F)
''' DoEvents
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -