📄 otherequ.vb
字号:
'**********************其他设备公共类**************************
'***********修改时间:2007年8月12日
'***********编写人:鲍辉
'***********针对与广西联正达合作的机房远控系统
'***********包括设备类型:N+1切换器1台(康特)、信号源切换器12台(成都泰立)、防非信号接收机3台(成都泰立)、
'***********KS-L采集器4台(北京昆仑海岸)、柴油发电机(SW)1台
Imports System.Math
'Imports System.String
Imports Microsoft.VisualBasic.Strings
Imports TransmitTV.Transmitter
Imports TransmitTV.LoadData
Public Class OtherEqu
Dim i As Integer
Public iTransmitID As Integer '''设备编号
Public strTransmitName As String '''设备名称
Public iTraType As Integer '''设备厂家类型 6-采集器,7-信号源切换器,8-防非接收机,9-发电机,10-N+1切换器
Public strTransmitModel As String '''设备型号
Public strTransmitAddr As String '''设备地址 RS232编码地址
Public iTransmitType As Integer '''默认值为0
Public strTransmitPower As String '''默认值为空
Public iMainExciter As Integer '''默认值为0
Public iStandbyExciter As Integer '''默认值为0
Public iAmpCount As Integer '''默认值为0
Public iPort As Integer '''对应串口号
Public strPortPara As String '''串口通讯参数
Public iCommType As Integer '''通讯方式 1-232,2-485,3-TCP/IP
Public iState As Integer '''0-正常,1-报警,2-停用
Public bOpenClose As Boolean
Public bFirst As Boolean '''定义是否第一次保存记录
Public Nand1Switch As Nand1SwitchUnit '''定义N+1切换器
Public SignalSwitch As SignalSwitchEqu '''定义信号源切换器
Public RecepDevice As RecepDeviceEqu '''定义防非接收机
Public Collection As CollectionEqu '''定义采集器
Public Dieselmotor As DieselmotorEqu '''定义柴油发电机
Public iLastSaveTime As Long '''定义上次数据保存的时间
Public iCommStatus As Integer '''通讯状态
Public iId As Int64
Public iTempflag As Integer
Public a1, b1, a2, b2 As Integer
Public Sub New()
iTransmitID = 0
strTransmitName = ""
iTraType = 0
strTransmitModel = ""
strTransmitAddr = ""
iTransmitType = 0
strTransmitPower = ""
iMainExciter = 0
iStandbyExciter = 0
iAmpCount = 0
iPort = 0
strPortPara = ""
iCommType = 0
iTempflag = 0
iState = 0
iId = 0
bOpenClose = False
bFirst = True
iCommStatus = 0
Nand1Switch = New Nand1SwitchUnit
SignalSwitch = New SignalSwitchEqu
RecepDevice = New RecepDeviceEqu
Collection = New CollectionEqu
Dieselmotor = New DieselmotorEqu
ReDim Collection.dAinPort(7)
ReDim Collection.bDinPort(15)
End Sub
Public Property Id() As Integer
Get
Return iId
End Get
Set(ByVal Value As Integer)
iId = Value
End Set
End Property
Public Property TransmitID() As Integer
Get
Return iTransmitID
End Get
Set(ByVal Value As Integer)
iTransmitID = Value
End Set
End Property
Public Property TransmitName() As String
Get
Return strTransmitName
End Get
Set(ByVal Value As String)
strTransmitName = Value
End Set
End Property
Public Property TraType() As Integer
Get
Return iTraType
End Get
Set(ByVal Value As Integer)
iTraType = Value
End Set
End Property
Public Property First() As Boolean
Get
Return bFirst
End Get
Set(ByVal value As Boolean)
bFirst = value
End Set
End Property
Public Property TransmitModel() As String
Get
Return strTransmitModel
End Get
Set(ByVal Value As String)
strTransmitModel = Value
End Set
End Property
Public Property TransmitAddr() As String
Get
Return strTransmitAddr
End Get
Set(ByVal Value As String)
strTransmitAddr = Value
End Set
End Property
Public Property TransmitType() As Integer
Get
Return iTransmitType
End Get
Set(ByVal Value As Integer)
iTransmitType = Value
End Set
End Property
Public Property TransmitPower() As String
Get
Return strTransmitPower
End Get
Set(ByVal Value As String)
strTransmitPower = Value
End Set
End Property
Public Property MainExciter() As Integer
Get
Return iMainExciter
End Get
Set(ByVal Value As Integer)
iMainExciter = Value
End Set
End Property
Public Property StandbyExciter() As Integer
Get
Return iStandbyExciter
End Get
Set(ByVal Value As Integer)
iStandbyExciter = Value
End Set
End Property
Public Property AmpCount() As Integer
Get
Return iAmpCount
End Get
Set(ByVal Value As Integer)
iAmpCount = Value
End Set
End Property
Public Property Port() As Integer
Get
Return iPort
End Get
Set(ByVal Value As Integer)
iPort = Value
End Set
End Property
Public Property PortPara() As String
Get
Return strPortPara
End Get
Set(ByVal Value As String)
strPortPara = Value
End Set
End Property
Public Property CommType() As Integer
Get
Return iCommType
End Get
Set(ByVal Value As Integer)
iCommType = Value
End Set
End Property
Public Property State() As Integer
Get
Return iState
End Get
Set(ByVal Value As Integer)
iState = Value
End Set
End Property
Public Property OpenClose() As Boolean
Get
Return bOpenClose
End Get
Set(ByVal value As Boolean)
bOpenClose = value
End Set
End Property
Public Property Tempflag() As Integer
Get
Return iTempflag
End Get
Set(ByVal Value As Integer)
iTempflag = Value
End Set
End Property
Public Property CommStatus() As Integer
Get
Return iCommStatus
End Get
Set(ByVal Value As Integer)
iCommStatus = Value
End Set
End Property
Public Sub parse(ByRef btData() As Byte, ByVal bytesRec As Integer) '''''''''数据解包
Dim tempData() As Byte
'Try
'''''''按字节对应解析 btData-应答数据数组,bytesRec-返回数据长度
If First = True Then ''''第一次
First = False
iTempflag = 0
iLastSaveTime = Environment.TickCount
Else
If Environment.TickCount - iLastSaveTime > dataSaveCycle * 1000 Then ''''原则上每间隔一小时保存一次
iTempflag = 0
iLastSaveTime = Environment.TickCount
Else
iTempflag = 1
iLastSaveTime = Environment.TickCount
End If
End If
Select Case iTraType '''设备类型(6-采集器,7-信号源切换器,8-防非接收机,9-发电机,10-N+1切换器)
Case 6 '''采集器
'''由于采集器是按ASCII码发送,接收数据为字符串,所以不在此过程中处理
Case 7 '''信号源切换器
'''信号源切换器的开关量采集数据全部由采集器完成
'''他的切换控制命令没有返回数据
Case 8 '''防非接收机
If btData(0) <> 90 Then Exit Sub '''''同步字节
If UBound(btData) > 0 Then
Select Case btData(0)
Case 17, 34, 51
RecepParse(btData)
Case 90
CommStatus = 1
Exit Sub
Case Else
RecepDeviceParse(btData)
End Select
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -