prjbas.bas
来自「电梯检测系统是对电梯性能进行检测的系统。是一个用来学习的程序。」· BAS 代码 · 共 1,871 行 · 第 1/5 页
BAS
1,871 行
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
FireServiceTrip = 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 LEO lamp is lit." & Chr(10) & Chr(13)
'check the LEO
If SignalBitRight(LngVRetAryB, 71, 0) Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The LEO lamp did not be lit,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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!"
FireServiceTrip = 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!"
FireServiceTrip = 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!"
FireServiceTrip = 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!"
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire service failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire sevice trip failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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,fire sevice trip failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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.Fire service trip failed.Exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
FireServiceTrip = False
Exit Function
End If
'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
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!"
FireServiceTrip = False
Exit Function
End If
'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)
FireServiceTrip = 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,fire sevice trip failed.exit test." & Chr(10) & Chr(13)
FireServiceTrip = 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!"
FireServiceTrip = 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 + "Fire Service Trip Complished!" & Chr(10) + Chr(13)
FireServiceTrip = True
Else
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Fire Service Trip failed" & Chr(10) + Chr(13)
FireServiceTrip = False
End If
End Function
Public Function InspectionTrip() As Boolean
Dim cTime
Dim CurSendSucc As Boolean
'FrmFuncTest.ButtonImg(1).Visible = True 'DREC-U frame2(2)
'FrmFuncTest.TitleLabel(13).Visible = True
'FrmFuncTest.ButtonImg(2).Visible = True 'JHC frame2(2)
'FrmFuncTest.TitleLabel(12).Visible = True
'FrmFuncTest.ButtonImg(3).Visible = True 'JRH frame2(0)
'FrmFuncTest.TitleLabel(14).Visible = True
'FrmFuncTest.ButtonImg(4).Visible = True 'DREC-D frame2(2)
'FrmFuncTest.TitleLabel(11).Visible = True
'FrmFuncTest.ButtonImg(9).Visible = True 'DRH-D frame2(0)
'FrmFuncTest.TitleLabel(18).Visible = True
'FrmFuncTest.ButtonImg(10).Visible = True 'JREC frame2(2)
'FrmFuncTest.TitleLabel(15).Visible = True
'FrmFuncTest.ButtonImg(11).Visible = True 'JHMD frame2(0)
'FrmFuncTest.TitleLabel(17).Visible = True
'FrmFuncTest.ButtonImg(12).Visible = True 'DRH-U frame2(0)
'FrmFuncTest.TitleLabel(16).Visible = True
FrmFuncTest.Frame2(0).Visible = True
FrmFuncTest.Frame2(2).Visible = True
' FrmFuncTest.Frame2(1).Visible = True
FrmFuncTest.BackLabel(5).Visible = True
FrmFuncTest.BackLabel(0).Visible = True
' FrmFuncTest.BackLabel(4).Visible = True
InspectionTrip = True
FrmFuncTest.TripLabel.Caption = "Inspection Trip"
'send JREC to test Mode
FrmFuncTest.TestText.Text = "Now turn JREC to the test mode" & Chr(10) + Chr(13)
'send JREC to 1
If JRECTstSta Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "The JREC is in test mode,you do not need to turn." & Chr(10) + Chr(13)
Else
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, JRECAddr, &HFF) Then
ButtonImg(10).Picture = LoadPicture(App.Path & "\button\leftbutton.GIF")
TitleLabel(15).ForeColor = &HC000&
CurSendSucc = True
Exit Do
End If
Loop
If Not CurSendSucc Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Handshake failed! Exit test!" & Chr(10) & Chr(13)
InspectionTrip = False
Exit Function
End If
End If
'send DREC-U
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Press DREC-U,until teh car stop at the top of shaft." & Chr(10) + Chr(13)
'send DREC-U to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DREC_UAddr, &HFF) Then
CurSendSucc = True
ButtonImg(1).Picture = LoadPicture(App.Path & "\button\Lightbuttongreen-on.GIF")
TitleLabel(13).ForeColor = &HC000&
Exit Do
End If
Loop
Do Until CountNum >= MaxCount
If Not (NowMoveFx = "U") Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Car move in a error direction!Exit Test!" & Chr(10) + Chr(13)
InspectionTrip = False
Exit Function
End If
DoEvents
Loop
'send DREC-U to 0
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DREC_UAddr, &H0) Then
CurSendSucc = True
ButtonImg(1).Picture = LoadPicture(App.Path & "\button\Lightbutton-G.gif")
TitleLabel(13).ForeColor = &HC0C0C0
Exit Do
End If
Loop
'send DREC-D
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now press DREC-D" & Chr(10) + Chr(13)
'set DREC-D to 1
CurSendSucc = False
cTime = Timer
Do Until Timer - cTime > 2
If bolWritePlcB_05(iDeviceID, DREC_DAddr, &HFF) Then
CurSendSucc = True
ButtonImg(4).Picture = LoadPicture(App.Path & "\button\Lightbuttonyellow-on.GIF")
TitleLabel(11).ForeColor = &HC000&
Exit Do
End If
Loop
Do Until CountNum <= 0
If Not (NowMoveFx = "D") Then
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Car move in a error direction!Exit Test!" & Chr(10) + Chr(13)
InspectionTrip = False
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?