📄 otherequ.vb
字号:
saveRecepDevice()
End If
Case 9 '''发电机
'If tableCRC16(btData)(0) Then
Select Case btData(0)
Case Val(strTransmitAddr)
Select Case btData(1)
Case 3
DieselmotorParse(btData)
saveDieselmotor()
Case 16
bOpenClose = True
End Select
Case 131
CommStatus = 0
bOpenClose = False
End Select
'End If
Case 10 '''N+1切换器
If btData(0) <> 85 Or btData(1) <> 170 Then Exit Sub '''''同步字节
Nand1SwitchParse(btData)
saveNand1()
End Select
CommStatus = 1
'Catch ex As Exception
' MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'End Try
End Sub
'**********************解析柴油发电机的数据************************************
'接收数据格式:地址位(1B)+查询命令码(1B)+数据长度(1B)+3-4位为第一个积存器(2B)+
'5-6位为第二个积存器(2B)+n-n+1位为第n个寄存(2B)(高字节MSB在前,低字节LSB在后)+÷
'CRC效验码(2B,低字节LSB在前,高字节MSB在后)
'错误数据格式:功能码131(1B)+错误类型码(1B,在错误列表中查看相应错误)+CRC校验(2B)
Private Sub DieselmotorParse(ByRef btData() As Byte)
Dieselmotor.dFixVol = btData(3) * 256 + btData(4)
End Sub
'**********************解析防非接收机的数据************************************
'PC读取机器报警记录数据 PC发:0xa5-0x04
'机器回数据:
'每个事件发:0xaa-0x55-事件类型-事件月-事件日-事件时-事件分-事件秒-安全等级-参考信号强度-信号强度-参考信号质量-信号质量
'事件发完:0x5a
'事件类型:
' 1、功击报警切换
' 2、人工应急切换
' 3、PC恢复
' 4、定时自动恢复
' 5、人工恢复
' 6、(备用)
' 7、关电源恢复
'''防非接收机主动上报数据解析,以此判断工作状态
Private Sub RecepParse(ByRef btData() As Byte)
RecepDevice.strAffairTime = Date.Now
Select Case btData(0)
Case 17
RecepDevice.strAffairType = "无信号"
Case 34
RecepDevice.strAffairType = "恢复"
Case 51
RecepDevice.strAffairType = "切换"
End Select
RecepDevice.dSafetyGrade = 0
RecepDevice.dReIntensity = 0
RecepDevice.dIntensity = 0
RecepDevice.dReQuality = 0
RecepDevice.dQuality = 0
End Sub
Private Sub RecepDeviceParse(ByRef btData() As Byte)
Dim i As Integer
'Try
If UBound(btData) > 1 Then
For i = 0 To Int((UBound(btData) + 1) / 14)
RecepDevice.strAffairTime = CStr(Year(Now)) + "-" + CStr(btData(3 + 14 * i)) + "-" + CStr(btData(4 + 14 * i)) + " " + _
CStr(btData(5 + 14 * i)) + ":" + CStr(btData(6 + 14 * i)) + ":" + CStr(btData(7 + 14 * i))
Select Case btData(2 + 14 * i)
Case 1
RecepDevice.strAffairType = "功击报警切换"
Case 2
RecepDevice.strAffairType = "人工应急切换"
Case 3
RecepDevice.strAffairType = "PC恢复"
Case 4
RecepDevice.strAffairType = "定时自动恢复"
Case 5
RecepDevice.strAffairType = "人工恢复 "
Case 6
RecepDevice.strAffairType = "(备用)"
Case 7
RecepDevice.strAffairType = "关电源恢复 "
End Select
RecepDevice.dSafetyGrade = btData(8 + 14 * i)
RecepDevice.dReIntensity = btData(10 + 14 * i)
RecepDevice.dIntensity = btData(11 + 14 * i)
RecepDevice.dReQuality = btData(12 + 14 * i)
RecepDevice.dQuality = btData(13 + 14 * i)
Next
End If
'Catch ex As Exception
' MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK)
'End Try
End Sub
'**********************解析N+1切换器的数据*************************************
Private Sub Nand1SwitchParse(ByRef btData() As Byte)
'''0-主,1-备,2-同轴开关损坏,3-发射机故障
'''55 AA 12 06 11 00 00 00 01 01 00 00 4D 4D 4D 42 4E 4E 4E 4E 0A
'''端口1
Select Case Chr(btData(12))
Case "M"
Nand1Switch.iPort1 = 0
Case "B"
Nand1Switch.iPort1 = 1
Case "E"
Nand1Switch.iPort1 = 2
Case "e"
Nand1Switch.iPort1 = 3
End Select
'''端口2
Select Case Chr(btData(13))
Case "M"
Nand1Switch.iPort2 = 0
Case "B"
Nand1Switch.iPort2 = 1
Case "E"
Nand1Switch.iPort2 = 2
Case "e"
Nand1Switch.iPort2 = 3
End Select
'''端口3
Select Case Chr(btData(14))
Case "M"
Nand1Switch.iPort3 = 0
Case "B"
Nand1Switch.iPort3 = 1
Case "E"
Nand1Switch.iPort3 = 2
Case "e"
Nand1Switch.iPort3 = 3
End Select
'''端口4
Select Case Chr(btData(15))
Case "M"
Nand1Switch.iPort4 = 0
Case "B"
Nand1Switch.iPort4 = 1
Case "E"
Nand1Switch.iPort4 = 2
Case "e"
Nand1Switch.iPort4 = 3
End Select
'''端口5
Select Case Chr(btData(16))
Case "M"
Nand1Switch.iPort5 = 0
Case "B"
Nand1Switch.iPort5 = 1
Case "E"
Nand1Switch.iPort5 = 2
Case "e"
Nand1Switch.iPort5 = 3
End Select
'''端口6
Select Case Chr(btData(17))
Case "M"
Nand1Switch.iPort6 = 0
Case "B"
Nand1Switch.iPort6 = 1
Case "E"
Nand1Switch.iPort6 = 2
Case "e"
Nand1Switch.iPort6 = 3
End Select
'''端口7
Select Case Chr(btData(18))
Case "M"
Nand1Switch.iPort7 = 0
Case "B"
Nand1Switch.iPort7 = 1
Case "E"
Nand1Switch.iPort7 = 2
Case "e"
Nand1Switch.iPort7 = 3
End Select
'''端口8
Select Case Chr(btData(19))
Case "M"
Nand1Switch.iPort8 = 0
Case "B"
Nand1Switch.iPort8 = 1
Case "E"
Nand1Switch.iPort8 = 2
Case "e"
Nand1Switch.iPort8 = 3
End Select
If Chr(btData(12)) = "b" And Chr(btData(13)) = "b" And Chr(btData(14)) = "b" And Chr(btData(15)) = "b" _
And Chr(btData(16)) = "b" And Chr(btData(17)) = "b" And Chr(btData(18)) = "b" And Chr(btData(19)) = "b" Then
Nand1Switch.istate = 1
Else
Nand1Switch.istate = 0
End If
End Sub
'''采集器
'**********************解析环境监控采集器的数据************************************
'1、作为环境采集器
'=+1320@28=+1241@28=+1325@28=+1243@28=+0003@28=+0006@28=+0000@28=+0003@28=@@@@=@@@@=@Hon
'=+1320@28=+1241@28=+1325@28=+1243@28=+0003@28=+0003@28=+0000@28=+0005@28=@@@@=@@@@=@Hom
'=+1320@28=+1241@28=+1327@28=+1243@28=+0005@28=+0003@28=+0002@28=+0003@28=@@@@=@@@@=@H`a
'=+1320@28=+1238@28=+1327@28=+1243@28=+0005@28=+0006@28=+0002@28=+0003@28=@@@@=@@@@=@H`j
'=+1320@28=+1238@28=+1327@28=+1243@28=+0003@28=+0003@28=+0000@28=+0005@28=@@@@=@@@@=@H`e
'2、作为信号源采集器
'=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00
'=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=@@@@=@@@@=@@kg
'=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00
'=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=+0000@00=A@@@=A@@@=@@ki
Public Sub CollectionParse(ByRef strRec As String)
Dim i As Integer
Dim iStart As Integer
CommStatus = 1
Select Case TransmitType
Case 0
For i = 0 To 7
Collection.dAinPort(i) = Val(Mid(strRec, 3 + i * 9, 4)) / 100
Next
iStart = 74
Case 1
iStart = 146
End Select
For i = 0 To 3
Collection.bDinPort(i * 4) = False
Collection.bDinPort(i * 4 + 1) = False
Collection.bDinPort(i * 4 + 2) = False
Collection.bDinPort(i * 4 + 3) = False
Select Case Mid(strRec, iStart + i, 1)
Case "A" '''41
Collection.bDinPort(i * 4) = True
Case "B" '''42
Collection.bDinPort(i * 4 + 1) = True
Case "D" '''44
Collection.bDinPort(i * 4 + 2) = True
Case "H" '''48
Collection.bDinPort(i * 4 + 3) = True
Case "C" '''43
Collection.bDinPort(i * 4) = True
Collection.bDinPort(i * 4 + 1) = True
Case "E" '''45
Collection.bDinPort(i * 4) = True
Collection.bDinPort(i * 4 + 2) = True
Case "F" '''46
Collection.bDinPort(i * 4 + 1) = True
Collection.bDinPort(i * 4 + 2) = True
Case "G" '''47
Collection.bDinPort(i * 4) = True
Collection.bDinPort(i * 4 + 1) = True
Collection.bDinPort(i * 4 + 2) = True
Case "I" '''49
Collection.bDinPort(i * 4) = True
Collection.bDinPort(i * 4 + 3) = True
Case "J" '''4A
Collection.bDinPort(i * 4 + 1) = True
Collection.bDinPort(i * 4 + 3) = True
Case "K" '''4B
Collection.bDinPort(i * 4) = True
Collection.bDinPort(i * 4 + 1) = True
Collection.bDinPort(i * 4 + 3) = True
Case "L" '''4C
Collection.bDinPort(i * 4 + 2) = True
Collection.bDinPort(i * 4 + 3) = True
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -