prjbas.bas
来自「电梯检测系统是对电梯性能进行检测的系统。是一个用来学习的程序。」· BAS 代码 · 共 1,871 行 · 第 1/5 页
BAS
1,871 行
'' FrmFuncTest.ButtonImg(4).Visible = False
'FrmFuncTest.TitleLabel(11).Visible = False
'FrmFuncTest.ButtonImg(9).Visible = False
'FrmFuncTest.TitleLabel(18).Visible = False
'FrmFuncTest.ButtonImg(10).Visible = False
''FrmFuncTest.TitleLabel(15).Visible = False
'FrmFuncTest.ButtonImg(11).Visible = False
'FrmFuncTest.TitleLabel(17).Visible = False
' FrmFuncTest.ButtonImg(12).Visible = False
' FrmFuncTest.TitleLabel(16).Visible = False
FrmFuncTest.Frame2(0).Visible = False
FrmFuncTest.Frame2(2).Visible = False
FrmFuncTest.BackLabel(0).Visible = False
FrmFuncTest.BackLabel(5).Visible = False
EarthquakeControl = True
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now begin fire service trip." & Chr(10) & Chr(13)
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Switching on the JBF." & Chr(10) & Chr(13)
'set JBF to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, JBFAddr, &HFF) Then
CurSendSucc = True
FrmFuncTest.toggle(9).Picture = LoadPicture(App.Path & "\button\switchon.gif")
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
TempFloor = CurFloor
'0.5 second later,wait the signal work
cTime = Timer
Do Until Timer - cTime > 0.5
DoEvents
Loop
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Check whether the LEB lamp is lit." & Chr(10) & Chr(13)
'check the LEB
If SignalBitRight(LngVRetAryB, 72, 0) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LEB lamp did not be lit,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'check the lamp which mark whether the call be seviced
'LC-1
If SignalBitRight(LngVRetAryB, 73, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-1 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-2
If SignalBitRight(LngVRetAryB, 74, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-2 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-3
If SignalBitRight(LngVRetAryB, 75, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-3 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-U1
If SignalBitRight(LngVRetAryB, 76, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-U1 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-U2
If SignalBitRight(LngVRetAryB, 77, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-U2 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-D2
If SignalBitRight(LngVRetAryB, 78, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-D2 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-D3
If SignalBitRight(LngVRetAryB, 79, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-D3 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'send two signal
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now Send out at least two car call and landing call to check whether these calls will be cancelled." & Chr(10) & Chr(13)
'set DC-3 to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DC_3Addr, &HFF) Then
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DC_3Addr, &H0) Then
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
'set DC-D2 to 0
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DC_D2Addr, &HFF) Then
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DC_D2Addr, &H0) Then
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
'check the lamp which mark whether the call be seviced
'LC-3
If SignalBitRight(LngVRetAryB, 75, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-3 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'LC-D2
If SignalBitRight(LngVRetAryB, 78, 1) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LC-D2 was not cancelled,Earthquake Control failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'wait the car stop
Do Until NowMoveFx = "S"
DoEvents
Loop
'check whether stop at the nearest floor
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Check whether stop at the nearest floor and keep the door opening 15-20 senconds then the door closed, at the same time the light will be switch off and 'leave car' light is lit. Then the car blocked." & Chr(10) & Chr(13)
If Not (TempFloor = CurFloor) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The car did not stop at the nearest floor,Earthquake Control trip failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'wait KET-O=1
Do Until SignalBitRight(LngVRetAryB, 1, 1)
DoEvents
Loop
'check whether keep opening 15-20 seconds
cTime = Timer
Do Until SignalBitRight(LngVRetAryB, 68, 1)
DoEvents
Loop
If Timer >= cTime + 15 And Timer <= cTime + 20 Then
Else
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The car did not keep opening 15-20 seconds,Earthquake Control trip failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'wait KET-S=1
Do Until SignalBitRight(LngVRetAryB, 2, 1)
DoEvents
Loop
'check LC=0 (light)
If SignalBitRight(LngVRetAryB, 81, 0) Then 'LC
Else
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Light did not switch off.Earthquake Control trip failed.Exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'send DT-O signal
'set DT-O to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DT_O, &HFF) Then
CurSendSucc = True
Exit Do
End If
Loop
'set DT-O to 0
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DT_O, &H0) Then
CurSendSucc = True
Exit Do
End If
Loop
'in ten seconds, the car door must be open
cTime = Timer
CurSendSucc = False
Do Until Timer - cTime > 10
If SignalBitRight(LngVRetAryB, 1, 1) Then
CurSendSucc = True
Exit Do
End If
DoEvents
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "in ten seconds, the car door did not be open." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'check whether keep opening 15-20 seconds
CurSendSucc = False
cTime = Timer
Do Until Timer > cTime + 20
If SignalBitRight(LngVRetAryB, 68, 1) Then
CurSendSucc = True
Exit Do
End If
DoEvents
Loop
If CurSendSucc Then
Else
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The car did not closed 15-20 seconds later,Earthquake Control trip failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now reset the P mode signal. waiting 30 seconds, the system sends out a landing call.Make sure this landing had been served correctly." & Chr(10) & Chr(13)
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "reset the P mode , then press Yes button." & Chr(10) & Chr(13)
YesCmdClick = False
Do Until YesCmdClick
DoEvents
Loop
If Not FuncTestPass Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "You cancel current test,Earthquake Control trip failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'30 seconds later
cTime = Timer
Do Until Timer - cTime > 30
DoEvents
Loop
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now send a landing call(DC-2)" & Chr(10) & Chr(13)
'set DC-2 to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DC_2Addr, &HFF) Then
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
'set DC-2 to 0
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DC_2Addr, &H0) Then
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
Do Until NowMoveFx = "S"
DoEvents
Loop
If CurFloor <> 2 Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The car did not stop at correct floor,Earthquake Control trip failed.exit test." & Chr(10) & Chr(13)
EarthquakeControl = False
Exit Sub
End If
'set JBF to 0
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, JBFAddr, &H0) Then
CurSendSucc = True
FrmFuncTest.toggle(9).Picture = LoadPicture(App.Path & "\button\switchoff.gif")
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
EarthquakeControl = False
Exit Function
End If
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "If all are right, click Yes commandbutton,Or click No commandbutton." & Chr(10) & Chr(13)
Do Until YesCmdClick
DoEvents
Loop
If FuncTestPass Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Earthquake Control Trip Complished!" & Chr(10) + Chr(13)
EarthquakeControl = True
Else
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Earthquake Control Trip failed" & Chr(10) + Chr(13)
EarthquakeControl = False
End If
End Function
Public Function FireServiceTrip() As Boolean
Dim cTime
Dim CurSendSucc As Boolean
'FrmFuncTest.ButtonImg(1).Visible = False
'FrmFuncTest.TitleLabel(13).Visible = False
'FrmFuncTest.ButtonImg(2).Visible = False
'FrmFuncTest.TitleLabel(12).Visible = False
'FrmFuncTest.ButtonImg(3).Visible = False
'FrmFuncTest.TitleLabel(14).Visible = False
'FrmFuncTest.ButtonImg(4).Visible = False
'FrmFuncTest.TitleLabel(11).Visible = False
'FrmFuncTest.ButtonImg(9).Visible = False
'FrmFuncTest.TitleLabel(18).Visible = False
'FrmFuncTest.ButtonImg(10).Visible = False
'FrmFuncTest.TitleLabel(15).Visible = False
'FrmFuncTest.ButtonImg(11).Visible = False
'FrmFuncTest.TitleLabel(17).Visible = False
'FrmFuncTest.ButtonImg(12).Visible = False
'FrmFuncTest.TitleLabel(16).Visible = False
FrmFuncTest.Frame2(0).Visible = False
FrmFuncTest.Frame2(2).Visible = False
FrmFuncTest.BackLabel(0).Visible = False
FrmFuncTest.BackLabel(5).Visible = False
FireServiceTrip = True
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now begin fire service trip." & Chr(10) & Chr(13)
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Switching on the JBF." & Chr(10) & Chr(13)
'set JBF to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, JBFAddr, &HFF) Then
CurSendSucc = True
FrmFuncTest.toggle(9).Picture = LoadPicture(App.Path & "\button\switchon.gif")
Exit Do
End If
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?