⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsanalyzer.cls

📁 FLA-502控制、标定、分析用
💻 CLS
📖 第 1 页 / 共 2 页
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsAnalyzer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

'*************************
'南华分析仪
'*************************
Option Explicit

Dim m_AnalyzerHandle As Long
Dim m_AnalyzerPort As String
Dim m_排气分析仪 As String

Dim m_AnaWarming As Boolean '分析仪在预热
Dim m_Zeroing As Boolean    '分析仪正在清零
Dim m_Leaking As Boolean    '分析仪正在检漏

Dim m_Online As Boolean
Dim m_HC As Single
Dim m_C3H8 As Single

Dim m_CO As Single
Dim m_CO2 As Single
Dim m_NO As Single
Dim m_O2 As Single
Dim m_PEF As Single
Dim m_mPa As Single
Dim m_Lambd As Single
Dim m_RPM As Single
Dim m_Temperature As Single
Dim m_Humidity As Single
Dim m_OilyTemp As Single
Dim m_Flux As Single
Dim m_Status As Byte
Dim m_CS As Byte

Public Property Let HC(iHC As Single)
    m_HC = iHC
End Property
Public Property Get HC() As Single
    HC = m_HC
End Property
Public Property Let C3H8(iC3H8 As Single)
    m_C3H8 = iC3H8
End Property
Public Property Get C3H8() As Single
    C3H8 = m_C3H8
End Property
Public Property Let CO(iCO As Single)
    m_CO = iCO
End Property
Public Property Get CO() As Single
    CO = m_CO
End Property
Public Property Let CO2(iCO2 As Single)
    m_CO2 = iCO2
End Property
Public Property Get CO2() As Single
    CO2 = m_CO2
End Property
Public Property Let NO(iNO As Single)
    m_NO = iNO
End Property
Public Property Get NO() As Single
    NO = m_NO
End Property
Public Property Let O2(iO2 As Single)
    m_O2 = iO2
End Property
Public Property Get O2() As Single
    O2 = m_O2
End Property
Public Property Let PEF(iPEF As Single)
    m_PEF = iPEF
End Property
Public Property Get PEF() As Single
    If m_PEF = 0 Then
        m_PEF = 0.519
    Else
        PEF = m_PEF
    End If
End Property
Public Property Let mPa(imPa As Single)
    m_mPa = imPa
End Property
Public Property Get mPa() As Single
    mPa = m_mPa
End Property
Public Property Let Lambd(iLambd As Single)
    m_Lambd = iLambd
End Property
Public Property Get Lambd() As Single
    Lambd = m_Lambd
End Property
Public Property Let rpm(iRPM As Single)
    m_RPM = iRPM
End Property
Public Property Get rpm() As Single
    rpm = m_RPM
End Property
Public Property Let Temperature(iTemperature As Single)
    m_Temperature = iTemperature
End Property
Public Property Get Temperature() As Single
    Temperature = m_Temperature
End Property
Public Property Let Humidity(iHumidity As Single)
    m_Humidity = iHumidity
End Property
Public Property Get Humidity() As Single
    Humidity = m_Humidity
End Property
Public Property Let OilyTemp(iOilyTemp As Single)
    m_OilyTemp = iOilyTemp
End Property
Public Property Get OilyTemp() As Single
    OilyTemp = m_OilyTemp
End Property
Public Property Let Flux(iFlux As Single)
    m_Flux = iFlux
End Property
Public Property Get Flux() As Single
    Flux = m_Flux
End Property

Public Property Let Online(iOnline As Long)
    m_Online = iOnline
End Property
Public Property Get Online() As Long
    Online = m_Online
End Property

Public Property Get AnalyzerHandle() As Long
    AnalyzerHandle = m_AnalyzerHandle
End Property
Public Property Let AnalyzerHandle(pnAnalyzerHandle As Long)
    m_AnalyzerHandle = pnAnalyzerHandle
End Property

Public Property Get AnalyzerPort() As String
    AnalyzerPort = m_AnalyzerPort
End Property
Public Property Let AnalyzerPort(pStrAnalyzerPort As String)
    m_AnalyzerPort = pStrAnalyzerPort
End Property

Public Property Get AnaWarming() As Boolean
    AnaWarming = m_AnaWarming
End Property
Public Property Let AnaWarming(iAnaWarming As Boolean)
    m_AnaWarming = iAnaWarming
End Property

Public Property Get Zeroing() As Boolean
    Zeroing = m_Zeroing
End Property
Public Property Let Zeroing(iZeroing As Boolean)
    m_Zeroing = iZeroing
End Property

Public Property Get Leaking() As Boolean
    Leaking = m_Leaking
End Property
Public Property Let Leaking(iLeaking As Boolean)
    m_Leaking = iLeaking
End Property



Public Property Get 排气分析仪() As String
    排气分析仪 = m_排气分析仪
End Property
Public Property Let 排气分析仪(p排气分析仪 As String)
    m_排气分析仪 = p排气分析仪
End Property


Private Sub CloseLastHandle(pnHandle As Long)
    Call CloseHandle(pnHandle)
End Sub

Public Function 分析仪通讯端口检测() As Boolean
    AnalyzerHandle = Val(cls注册表.GetKeyValue(HKEY_CURRENT_USER, "DS", "AnalyzerHandle"))
    AnalyzerPort = cls注册表.GetKeyValue(HKEY_CURRENT_USER, "DS", "AnalyzerPort")
        CloseLastHandle (AnalyzerHandle)
        AnalyzerHandle = ComObject.串口初始化(AnalyzerPort)
        If AnalyzerHandle > 0 Then
            分析仪通讯端口检测 = True
            Call cls注册表.UpdateKey(HKEY_CURRENT_USER, "DS", "AnalyzerHandle", Format(AnalyzerHandle))
        Else
            分析仪通讯端口检测 = False
        End If
End Function

Public Sub LoadDataCmd(Optional iSendTime As Long = 5)
    Dim KK As Long
    KK = 0
    AnaWarming = False
    Leaking = False
    Zeroing = False
    Do
        KK = KK + 1
        If KK > iSendTime Then commFailed = True: Exit Do
        If SendCommand(1) = OP_SUCCESSED Then
            Select Case 排气分析仪
            Case "NHA-503"
                If getCommBytes(AnalyzerHandle, 18) = OP_SUCCESSED Then
                    commFailed = False
                Else
                    commFailed = True
                End If
            Case "FLA-502"
                If getCommBytes(AnalyzerHandle, 20) = OP_SUCCESSED Then
                    commFailed = False
                    Select Case returnBytes(17)
                    Case 2
                        AnaWarming = True
                    Case 4
                        Leaking = True
                    Case 5
                        Zeroing = True
                    End Select
                Else
                    commFailed = True
                End If
            Case "FLA-512"
                If getCommBytes(AnalyzerHandle, 21) = OP_SUCCESSED Then
                    commFailed = False
                    Select Case returnBytes(17)
                    Case 2
                        AnaWarming = True
                    Case 4
                        Leaking = True
                    Case 5
                        Zeroing = True
                    End Select
                Else
                    commFailed = True
                End If

            End Select
        Else
            If KK >= iSendTime - 1 Then Call 分析仪通讯端口检测
            commFailed = True
        End If
    Loop While commFailed
    If commFailed Then
        ReDim returnBytes(1 To 20)
        For KK = 1 To 20
            returnBytes(KK) = 0
        Next
    Else
        Select Case Analyzer.排气分析仪
        Case "NHA-503", "FLA-502"
            m_HC = GetTrueValue(returnBytes(1), returnBytes(2))  'HC 1X10-6
            m_CO = GetTrueValue(returnBytes(3), returnBytes(4)) / 100  'CO %
            m_CO2 = GetTrueValue(returnBytes(5), returnBytes(6)) / 100 'CO2 %
            m_O2 = GetTrueValue(returnBytes(7), returnBytes(8)) / 100 'O2 %
            m_NO = GetTrueValue(returnBytes(9), returnBytes(10)) 'NO 1X10-6
            m_RPM = GetTrueValue(returnBytes(11), returnBytes(12)) '转速 rpm
            m_OilyTemp = GetTrueValue(returnBytes(13), returnBytes(14)) / 10 '油温
            m_Flux = GetTrueValue(returnBytes(15), returnBytes(16)) '流量
            m_Status = returnBytes(17) '状态
            m_CS = returnBytes(18) 'SUM
        Case "FLA-512"
            If returnBytes(20) = 0 Then
                m_HC = GetTrueValue(returnBytes(1), returnBytes(2))  'HC 1X10-6
                m_CO = GetTrueValue(returnBytes(3), returnBytes(4)) / 100  'CO %
                m_CO2 = GetTrueValue(returnBytes(5), returnBytes(6)) / 100 'CO2 %
                m_O2 = GetTrueValue(returnBytes(7), returnBytes(8)) / 100 'O2 %
                m_NO = GetTrueValue(returnBytes(9), returnBytes(10)) 'NO 1X10-6
                m_RPM = GetTrueValue(returnBytes(11), returnBytes(12)) '转速 rpm
                m_OilyTemp = GetTrueValue(returnBytes(13), returnBytes(14)) / 10 '油温
                m_Flux = GetTrueValue(returnBytes(15), returnBytes(16)) / 100 '流量
                m_Status = returnBytes(17) '状态
                m_CS = returnBytes(18) 'SUM
            Else
                m_HC = GetTrueValue(returnBytes(1), returnBytes(2))  'HC 1X10-6
                m_CO = GetTrueValue(returnBytes(3), returnBytes(4))   'CO %
                m_CO2 = GetTrueValue(returnBytes(5), returnBytes(6)) 'CO2 %
                m_O2 = GetTrueValue(returnBytes(7), returnBytes(8))  'O2 %
                m_NO = GetTrueValue(returnBytes(9), returnBytes(10)) 'NO 1X10-6
                m_RPM = GetTrueValue(returnBytes(11), returnBytes(12)) '转速 rpm
                m_OilyTemp = GetTrueValue(returnBytes(13), returnBytes(14))  '油温

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -