Selaa lähdekoodia

部分检测逻辑恢复到比武之前

guoqiang 8 kuukautta sitten
vanhempi
commit
36549b4909

+ 15 - 30
src/PeopleCoverHoleValve.qml

@@ -96,7 +96,7 @@ Item {
             }
 
             onBlindTestpressureSigFun:{
-                blindopenPressure.text = pressureNumber
+                //blindopenPressure.text = pressureNumber
             }
 
 
@@ -190,21 +190,6 @@ Item {
 
                     reuslt.visible = false
 
-                    //盲测
-                    ret =  PeopleCoverHoleValveTestJs.valveStartBlindTest(groupbox.currentIndex,processWindow,controlSerial,sensorSerial,
-                                                      pressureDisplaySigFun,resultSigFun,blindTestpressureSigFun,spy,log)
-                    if(ret === false){
-                        log.show("盲测结束")
-                        PeopleCoverHoleValveTestJs.runningBackup = groupbox.running
-                        PeopleCoverHoleValveTestJs.testStop(controlSerial,pressureDisplaySigFun,spy,log)
-
-                        groupbox.testStop()
-                        choosevalve.menuEnable = true
-                        reuslt.visible = true
-                        return
-                    }
-
-
                     //播放开始语音
                     PeopleCoverHoleValveTestJs.playStart_Voice(controlSerial)
 
@@ -592,21 +577,21 @@ Item {
                                     }
 
 
-                                    InputLine{
-                                        id:blindopenPressure
-                                        paraName: "盲测压力(kPa):"
-                                        paraLength: 40
-                                        text: "0"  //PeopleCoverHoleValveTestJs.maxPressureStableTime
-                                        validator:RegExpValidator {
-                                            regExp: /[0-9]*/
-                                        }
-                                        inputMethodHints: Qt.ImhDigitsOnly
-                                        // onTextChanged: {
-                                        //     PeopleCoverHoleValveTestJs.maxPressureStableTime = Number(text)
-                                        //     console.log("maxPressureStableTime:",PeopleCoverHoleValveTestJs.maxPressureStableTime)
+                                    // InputLine{
+                                    //     id:blindopenPressure
+                                    //     paraName: "盲测压力(kPa):"
+                                    //     paraLength: 40
+                                    //     text: "0"  //PeopleCoverHoleValveTestJs.maxPressureStableTime
+                                    //     validator:RegExpValidator {
+                                    //         regExp: /[0-9]*/
+                                    //     }
+                                    //     inputMethodHints: Qt.ImhDigitsOnly
+                                    //     // onTextChanged: {
+                                    //     //     PeopleCoverHoleValveTestJs.maxPressureStableTime = Number(text)
+                                    //     //     console.log("maxPressureStableTime:",PeopleCoverHoleValveTestJs.maxPressureStableTime)
 
-                                        // }
-                                     }
+                                    //     // }
+                                    //  }
 
 
                                     // Button{

+ 3 - 18
src/SafeValve.qml

@@ -187,21 +187,6 @@ Item {
                     curveDisplay.spline.clear()
                     groupbox.pressureCnt =0
                     groupbox.dataArray = []
-
-                    //盲测
-                    ret =  SaveValveTestJs.valveStartBlindTest(groupbox.currentIndex,processWindow,controlSerial,sensorSerial,
-                                                      pressureDisplaySigFun,resultSigFun,blindTestpressureSigFun,spy,log)
-                    if(ret === false){
-                        log.show("盲测结束")
-                        SaveValveTestJs.runningBackup = groupbox.running
-                        SaveValveTestJs.valveStop(controlSerial,pressureDisplaySigFun,spy,log)
-
-                        test_exit()
-                        choosevalve.menuEnable = true
-                        return
-                    }
-
-
                     groupbox.currentIndex = 0
                     //播放开始检测语音
                     SaveValveTestJs.playStart_Voice(controlSerial)
@@ -488,15 +473,15 @@ Item {
 
                                     InputLine{
                                         id:pressureInputline
-                                        paraName: "盲测开启(kPa):"
+                                        paraName: "整定压力(kPa):"
                                         paraLength: 77
                                         validator:RegExpValidator {
                                             regExp: /[0-9]*/
                                         }
-                                        text: "" //SaveValveTestJs.setPressure
+                                        text: SaveValveTestJs.setPressure
                                         inputMethodHints: Qt.ImhDigitsOnly
                                         onTextChanged: {
-                                            //SaveValveTestJs.setPressure = Number(text)
+                                            SaveValveTestJs.setPressure = Number(text)
                                         }
                                     }
 

+ 14 - 10
src/breatheTest.js

@@ -4,7 +4,7 @@
 var running = false
 var runningBackup = false
 var openPressureTimeMax = 10
-var sealPressureTimemax = 5
+var sealPressureTimemax = 15
 var exit = false
 
 var Pressure_open = 12
@@ -167,8 +167,9 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
 
     //自检
     runningBackup = running
-    var openPressureNumber
-    var sealPressureNumber
+
+    var openPressureNumber = 0
+    var sealPressureNumber = 0
 
     var ret = true
 
@@ -305,8 +306,11 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
                 keepCnt++
                 if(keepCnt == 1){
                     openPressureNumber = obj.pressureNumber
+                     console.log("openPressureNumber:",openPressureNumber)
                 }
-                if(delta < 0){
+
+
+                if((delta < 0)&&(obj.pressureNumber > 3.0)){
                     back_flag = true
                 }
             }else{
@@ -361,16 +365,16 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     result.sealPressureNumber = ""
     resultSigFun(result)
 
-    console.log("呼吸阀正压开启压力:",obj.pressureNumber)
+    console.log("呼吸阀正压开启压力:",openPressureNumber)
     console.log("呼吸阀正压开启压力测试结束")
 
     //关闭低压低速进气阀门
     ModbusJs.lpls_IntakeCtrl(controlSerial,false)
     console.log("关闭低压低速进气阀门")
 
-    /*
+
     //step 3.1 泄压到0.8倍开启压力
-    console.log("泄压到0.8开启压力左右")
+    console.log("泄压到0.8开启压力左右")
     processWindow.show("泄压到0.8倍开启压力")
 
     ModbusJs.lpls_ReleaseCtrl(controlSerial,true)
@@ -501,7 +505,7 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     resultSigFun(result)
     console.log("密封压力:",obj.pressureNumber)
     console.log("密封压力结束")
-    */
+
 
     //setp 5
     //打开低压快速泄气阀门
@@ -737,6 +741,7 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
                 keepCnt++
                 if(keepCnt === 1){
                     openPressureNumber = obj.pressureNumber
+                    console.log("openPressureNumber:",openPressureNumber)
                 }
 
                 if(delta < 0){
@@ -798,7 +803,7 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
 
     console.log("开启压力测试结束")
 
-    /*
+
     //step 3.1 泄压到0.8倍开启压力
     console.log("泄压到0.8位开启压力左右")
     processWindow.show("泄压到0.8位开启压力")
@@ -905,7 +910,6 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     result.sealPressureNumber = sealPressureNumber
     resultSigFun(result)
     console.log("密封压力结束")
-    */
 
     //setp 5
     //打开低压高速泄气阀门

+ 2 - 3
src/peopleCoverHoleValveTest.js

@@ -357,7 +357,7 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     console.log("打开人孔盖低速进气阀门")
 
     var open_intake = true
-    var switch_pressure = estimate_Pressure - 10
+    var switch_pressure = 0.8*openPressureMin
 
     processWindow.show("开启压力试验开始")
 
@@ -465,7 +465,7 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
 
 
 
-/*
+
     //setp 4 开始密封实验
     // 压力开始下降
     var keepCnt = 0
@@ -723,7 +723,6 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     resultSigFun(result)
     console.log("密封压力:",obj.pressureNumber)
 
-*/
     //setp 5
     //泄压
 

+ 38 - 129
src/safeValveTest.js

@@ -6,7 +6,7 @@ var runningBackup = false
 //开启压力测试计时时间
 var openPressureTimeMax = 10
 //密封压力测试计时时间
-var sealPressureTimemax = 5
+var sealPressureTimemax = 60
 //安全阀默认整定压力
 var setPressure = 0
 
@@ -385,103 +385,7 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
 
     spy.wait(500)
 
-    //盲测压力
-
-    // //打开安全阀测试口
-    // ModbusJs.safeValve_TestIO(controlSerial,true)
-    // console.log("打开安全阀测试口")
-
-
-    // processWindow.show("开始盲测压力")
-    var prevTime  = Date.now()
-    var keepCnt = 0
-    var delta = 0
-    var preDelta = 0
-
-    /*
-    ModbusJs.hphs_IntakeCtrl(controlSerial,true)
-    console.log("打开高压高速进气阀门")
-    //打开高压中速进气阀门
-    ModbusJs.hpms_IntakeCtrl(controlSerial,true)
-    console.log("打开高压中速进气阀门")
 
-    var obj = ModbusJs.highPressureSensorReadReq(sensorSerial)
-    if(obj.ret === false){
-        log.show("高压传感器通讯错误")
-        return false
-    }
-
-    var pre_pressure = obj.pressureNumber
-    var pre_pressure2 = obj.pressureNumber2
-
-    ret = true
-
-    do{
-        //延时
-        spy.wait(delayInterval)
-
-        if(running === false){
-            console.log("安全阀整定压力--停止测试")
-            ModbusJs.relay1CloseAll(controlSerial)
-            console.log("关闭所有气路阀门")
-            return false
-        }
-
-
-        var curTime  = Date.now()
-        var deltaTime = curTime - prevTime
-
-
-
-        if(deltaTime >= 980){
-
-            obj = ModbusJs.highPressureSensorReadReq(sensorSerial)
-            if(obj.ret === false){
-                log.show("高压传感器通讯错误")
-                ModbusJs.relay1CloseAll(controlSerial)
-                console.log("关闭所有气路阀门")
-                return false
-            }
-
-            delta = obj.pressureNumber2 - pre_pressure2
-
-            if((obj.pressureNumber2 - pre_pressure2) < 0.5){
-                keepCnt++
-                if(keepCnt ==1){
-                    estimate_Pressure = obj.pressureNumber
-                    setPressure = estimate_Pressure
-                }
-            }else{
-                keepCnt=0
-            }
-
-            if(keepCnt >= 6){
-                //console.log("keepCnt > StablePressureCount")
-                break;
-            }
-
-            prevTime = curTime
-
-            pre_pressure = obj.pressureNumber
-            pre_pressure2 = obj.pressureNumber2
-
-            pressureDisplaySigFun(obj.pressureNumber)
-            // add  pressure table
-            // var table={}
-            // table.pressure=obj.pressureNumber
-            // //开启压力模型赋值
-            // openPressureModel.append(table)
-        }
-
-    }while(1)
-
-    ModbusJs.hphs_IntakeCtrl(controlSerial,false)
-    console.log("关闭高压高速进气阀门")
-    //关闭高压中速进气阀门
-    ModbusJs.hpms_IntakeCtrl(controlSerial,false)
-    console.log("关闭高压中速进气阀门")
-
-    */
 
     //step 2
     //压力清零
@@ -559,20 +463,27 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
     //切换当前tab页面
     tabView.currentIndex = currentIndex
 
-    delta = 0
-    keepCnt = 0
-    prevTime  = Date.now()
-    preDelta = 0
-    var min = 0.8*estimate_Pressure
-    var max = 1.2*estimate_Pressure
+    var prevTime  = Date.now()
+    var keepCnt = 0
+    var delta = 0
+    var preDelta = 0
+
+    // delta = 0
+    // keepCnt = 0
+    // prevTime  = Date.now()
+    // preDelta = 0
+
+
+    var min = 0.8*setPressure
+    var max = 1.2*setPressure
 
     //var setPressure = 100
     var highspeed_open = false
     var middlespeed_open = false
-    var switch_pressure = estimate_Pressure-35
-    var last_pressure = 0.1*estimate_Pressure
+    var switch_pressure = setPressure-30
+    var last_pressure = 0.1*setPressure
 
-     if(estimate_Pressure >= 100){
+     if(setPressure >= 100){
         //打开高压高速进气阀门
         ModbusJs.hphs_IntakeCtrl(controlSerial,true)
         console.log("打开高压高速进气阀门")
@@ -583,17 +494,17 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
         console.log("打开高压中速进气阀门")
          middlespeed_open = true
 
-     }else if(estimate_Pressure >= 40){
+     }else if(setPressure >= 40){
          //打开高压中速进气阀门
         ModbusJs.hpms_IntakeCtrl(controlSerial,true)
         console.log("打开高压中速进气阀门")
         middlespeed_open = true
 
-        min = 0.5*estimate_Pressure
-        max = 1.5*estimate_Pressure
+        min = 0.5*setPressure
+        max = 1.5*setPressure
     }else{
-        min = 0.2*estimate_Pressure
-        max = 2*estimate_Pressure
+        min = 0.2*setPressure
+        max = 2*setPressure
     }
 
     obj = ModbusJs.highPressureSensorReadReq(sensorSerial)
@@ -633,14 +544,14 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
                 return false
             }
 
-            // //开启压力超出范围了
-            // if(obj.pressureNumber > max){
-            //     log.show("安全阀无法开启")
-            //     ret = false
-            //     ModbusJs.relay1CloseAll(controlSerial)
-            //     console.log("关闭所有气路阀门")
-            //     return false
-            // }
+            //开启压力超出范围了
+            if(obj.pressureNumber > max){
+                log.show("安全阀无法开启")
+                ret = false
+                ModbusJs.relay1CloseAll(controlSerial)
+                console.log("关闭所有气路阀门")
+                return false
+            }
 
 
             if(obj.pressureNumber > switch_pressure){
@@ -744,17 +655,14 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
     ModbusJs.hpls_IntakeCtrl(controlSerial,false)
     console.log("关闭高压低速进气阀门")
 
-    // if(setPressure_real < 30){
-    //     console.log("整定压力过小")
-    //     log.show("整定压力过小")
-    //     return false
-    // }
-
-    /*
-    //step 3.1 泄压到60%*setPressure_real
+    if(setPressure_real < 30){
+        console.log("整定压力过小")
+        log.show("整定压力过小")
+        return false
+    }
 
-    console.log("泄压到60%*setPressure_real")
 
+    //step 3.1 泄压到60%*setPressure_real
     var addPressure_target = 0
 
     if(setPressure_real > 300.0){
@@ -768,6 +676,8 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
         addPressure_target = 10
     }
 
+    console.log("泄压到 addPressure_target ")
+
     processWindow.show("泄放压力到:"+(addPressure_target-5)+"kPa")
 
     //打开高压低速泄气阀门
@@ -968,7 +878,6 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
     console.log("密封压力:",obj.pressureNumber)
     console.log("密封压力结束")
 
-    */
 
     //setp 5
     //打开正压罐头泄气阀门

+ 2 - 1
src/serialport.cpp

@@ -376,7 +376,8 @@ void SerialPort::receiveWrite(QString sendStr)
 
             if(crc_h !=0 || crc_l !=0  ){
                 mData.clear();
-                qDebug()<<"modbus crc error";
+                //qDebug()<<"modbus crc error";
+                qDebug() << "modbus crc error rxbuf: " << responseData.toHex();
                 emit sendCrcError();
             }
         }

+ 2 - 4
src/vacuoValveTest.js

@@ -6,7 +6,7 @@ var runningBackup = false
 //开启压力计时时间
 var openPressureTimeMax = 10
 //密封压力计时时间
-var sealPressureTimemax = 5
+var sealPressureTimemax = 15
 //整定压力
 var setPressure  = -21
 //此参数不用
@@ -384,7 +384,7 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
 
     //setp 4
     /*********测试密封压力*************/
-    /*
+
     console.log("密封压力开始")
     processWindow.show("密封压力试验开始")
 
@@ -449,8 +449,6 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     console.log("密封压力:",obj.pressureNumber)
     console.log("密封压力结束")
 
-    */
-
 
     //setp 5
 

+ 1 - 1
src/valve_experiment.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 14.0.0, 2024-11-29T11:02:50. -->
+<!-- Written by QtCreator 14.0.0, 2024-12-17T20:24:17. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>