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

📄 clsanalyzer.cls

📁 FLA-502控制、标定、分析用
💻 CLS
📖 第 1 页 / 共 2 页
字号:
                m_Flux = GetTrueValue(returnBytes(15), returnBytes(16)) '流量
                m_Status = returnBytes(17) '状态
                m_CS = returnBytes(18) 'SUM
            End If
            m_Status = returnBytes(17) '状态
    '        m_CS = returnBytes(21) 'SUM
        End Select
   '     m_Lambd=
        m_C3H8 = m_HC / PEF
       
    End If
    
End Sub

Public Sub LoadSubDataCmd(Optional iSendTime As Long = 5)
    Dim KK As Long
    KK = 0
    Do
        KK = KK + 1
        If KK > iSendTime Then commFailed = True: Exit Do
        If SendCommand(2) = OP_SUCCESSED Then
            If getCommBytes(AnalyzerHandle, 7) = OP_SUCCESSED Then
                commFailed = False
            Else
                commFailed = True
            End If
        Else
            If KK >= iSendTime - 1 Then Call 分析仪通讯端口检测
            commFailed = True
        End If
    Loop While commFailed
    If commFailed Then
        ReDim returnBytes(1 To 7)
        For KK = 1 To 7
            returnBytes(KK) = 0
        Next
    Else
        m_Temperature = GetTrueValue(returnBytes(1), returnBytes(2)) / 10 '环境温度
        m_mPa = GetTrueValue(returnBytes(3), returnBytes(4)) / 10 '大气压力
        m_Humidity = GetTrueValue(returnBytes(5), returnBytes(6)) / 10 '相对湿度
    End If
End Sub
Public Sub TakePEF(Optional iSendTime As Long = 5)
    Dim KK As Long
    KK = 0
    Do
        KK = KK + 1
        If KK > iSendTime Then commFailed = True: Exit Do
        If SendCommByte(AnalyzerHandle, &H13&) = OP_SUCCESSED Then
            Call Delay01(2)
            If getCommBytes(AnalyzerHandle, 2) = OP_FAILED Then
                Call Delay01(2)
                If getCommBytes(AnalyzerHandle, 2) = OP_FAILED Then
                    commFailed = True
                Else
                    commFailed = False
                End If
            Else
                commFailed = False
            End If
        Else
            If KK >= iSendTime - 1 Then
                Call 分析仪通讯端口检测
            End If
        End If
    Loop While commFailed
    If commFailed Then
        m_PEF = 0.519
    Else
        m_PEF = GetTrueValue(returnBytes(1), returnBytes(2)) / 1000
    End If
End Sub

Public Function WriteCheck() As Long '写入检查气--11
    Dim KK As Long
    Dim intSum As Long
    Dim outputArr(1 To 10) As Byte
    
    outputArr(2) = C3H8 \ 256
    outputArr(3) = C3H8 And 255
    
    outputArr(4) = (100 * CO) \ 256
    outputArr(5) = (100 * CO) And 255
    
    outputArr(6) = (100 * CO2) \ 256
    outputArr(7) = (100 * CO2) And 255
     
    outputArr(8) = NO \ 256
    outputArr(9) = NO And 255
    
    intSum = 0
    For KK = 2 To 9
       intSum = intSum + outputArr(KK)
    Next
    intSum = intSum Mod 256
    outputArr(10) = intSum
    
    outputArr(1) = &H11&
    If SendCommBytes(AnalyzerHandle, outputArr(), 10) = OP_SUCCESSED Then
        Call Delay01(2)
        Call getCommByte(AnalyzerHandle)
        If returnBytes(1) = 6 Then
            WriteCheck = OP_SUCCESSED
        Else
            WriteCheck = OP_FAILED
        End If
    Else
        WriteCheck = OP_FAILED
    End If
End Function


Public Function WriteCal() As Long '写入标定气--09
    Dim KK As Long
    Dim outputArr(1 To 12) As Byte
    Dim intSum As Long
    
    outputArr(2) = C3H8 \ 256
    outputArr(3) = C3H8 And 255
    
    outputArr(4) = (100 * CO) \ 256
    outputArr(5) = (100 * CO) And 255
    
    outputArr(6) = (100 * CO2) \ 256
    outputArr(7) = (100 * CO2) And 255
     
    outputArr(8) = (100 * O2) \ 256
    outputArr(9) = (100 * O2) And 255
    
    outputArr(10) = NO \ 256
    outputArr(11) = NO And 255
    
    intSum = 0
    For KK = 2 To 11
       intSum = intSum + outputArr(KK)
    Next
    intSum = intSum Mod 256
    
    outputArr(12) = intSum
    
    outputArr(1) = &H9&
    If SendCommBytes(AnalyzerHandle, outputArr(), 12) = OP_SUCCESSED Then
        Call Delay01(2)
        If getCommBytes(AnalyzerHandle, 2) = OP_SUCCESSED Then
            If returnBytes(1) = 6 And returnBytes(2) = 0 Then
                WriteCal = OP_SUCCESSED
            Else
                WriteCal = OP_FAILED
            End If
        Else
                WriteCal = OP_FAILED
        End If
    Else
        WriteCal = OP_FAILED
    End If
End Function
    
Public Function AutoCheck() As Long '检查--12
    Call SendCommand(&H12&)
    Select Case returnBytes(1)
    Case 5
        Call Delay01(1)
        If getCommBytes(Analyzer.AnalyzerHandle, 13) = OP_SUCCESSED Then
            m_HC = GetTrueValue(returnBytes(1), returnBytes(2))
            m_CO = GetTrueValue(returnBytes(3), returnBytes(4)) / 100
            m_CO2 = GetTrueValue(returnBytes(5), returnBytes(6)) / 100
            m_O2 = GetTrueValue(returnBytes(7), returnBytes(8)) / 100
            m_NO = GetTrueValue(returnBytes(9), returnBytes(10))
            m_PEF = GetTrueValue(returnBytes(11), returnBytes(12)) / 1000
            
            m_C3H8 = m_HC * PEF
            AutoCheck = OP_DOING
        End If
    Case 0
        AutoCheck = OP_SUCCESSED
    Case 1
        AutoCheck = OP_FAILED
    End Select
End Function

Public Function AutoCal() As Long '标定--10
    Call SendCommand(&H10&)
    Select Case returnBytes(1)
    Case 5
        Call Delay01(1)
        If getCommBytes(Analyzer.AnalyzerHandle, 13) = OP_SUCCESSED Then
            m_HC = GetTrueValue(returnBytes(1), returnBytes(2))
            m_CO = GetTrueValue(returnBytes(3), returnBytes(4)) / 100
            m_CO2 = GetTrueValue(returnBytes(5), returnBytes(6)) / 100
            m_O2 = GetTrueValue(returnBytes(7), returnBytes(8)) / 100
            m_NO = GetTrueValue(returnBytes(9), returnBytes(10))
            m_PEF = GetTrueValue(returnBytes(11), returnBytes(12)) / 1000
            m_C3H8 = m_HC / m_PEF
            AutoCal = OP_DOING
        End If
    Case 0
        AutoCal = OP_SUCCESSED
    Case 1
        AutoCal = OP_FAILED
    End Select
End Function

Public Function ConditionCal(iCmd As vb操作命令, iValue As Single) As Long   '环境--温度27,油温29,湿度30,压力31
    Dim outputArr(1 To 3) As Byte
    Dim KK As Long
    outputArr(1) = iCmd
    outputArr(2) = 10 * iValue \ 256
    outputArr(3) = 10 * iValue And 255

    If SendCommBytes(AnalyzerHandle, outputArr(), 3) = OP_SUCCESSED Then
        KK = 0
        Do
            If KK > 5 Then ConditionCal = OP_DOING: commFailed = True: Exit Do
            KK = KK + 1
            Call Delay01(2)
            If getCommByte(AnalyzerHandle) = OP_SUCCESSED Then
                If returnBytes(1) = 6 Then
                    If getCommByte(AnalyzerHandle) = OP_SUCCESSED Then
                        Select Case returnBytes(1)
                        Case 0
                            ConditionCal = OP_SUCCESSED
                        Case 1
                            ConditionCal = OP_FAILED
                        End Select
                        commFailed = False
                    Else
                        commFailed = True
                    End If
                Else
                    commFailed = True
                End If
            Else
                ConditionCal = OP_FAILED
                commFailed = True
            End If
        Loop While commFailed
    Else
        ConditionCal = OP_DOING
    End If
End Function



Public Sub getStatus()
    Select Case 排气分析仪
    Case "NHA-503"
        DoEvents
        If SendCommand(comamdByte) = OP_SUCCESSED Then
            If returnBytes(1) = 2 Then
                AnaWarming = True
                Leaking = True
            Else
                AnaWarming = False
                Leaking = False
            End If
            If comamdByte = 8 And returnBytes(1) = 5 Then
                Zeroing = True
            Else
                Zeroing = False
            End If
            commFailed = False
        Else
            commFailed = True
        End If
    Case "FLA-502"
        LoadDataCmd
    End Select
End Sub
Public Function StatusEcho() As String
    If AnaWarming Then
        StatusEcho = "分析仪正在预热"
    End If
    If Leaking Then
        If AnaWarming Then
            StatusEcho = "分析仪正在预热或正在检漏!"
        Else
            StatusEcho = "分析仪正在检漏!"
        End If
        Exit Function
    End If
    If Zeroing Then
        StatusEcho = "分析仪正在清零!"
        Exit Function
    End If
    If commFailed Then
        StatusEcho = "请检查:1:分析仪没有开.2:分析仪正在测量,按面板上的[K]键来停止测量 3.分析仪需要清零或检漏,按面板上的[K]键.4.通讯线路有没有接好."
        Exit Function
    End If
    StatusEcho = ""
End Function


⌨️ 快捷键说明

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