Parcourir la source

泄压时,归零判定条件变更, 连续小于0.2Kpa,5秒左右,便认为已经归零

guoqiang il y a 1 an
Parent
commit
c006324d66
5 fichiers modifiés avec 92 ajouts et 27 suppressions
  1. 6 6
      src/Calibration.qml
  2. 51 8
      src/breatheTest.js
  3. 3 3
      src/modbus.js
  4. 13 7
      src/safeValveTest.js
  5. 19 3
      src/vacuoValveTest.js

+ 6 - 6
src/Calibration.qml

@@ -75,8 +75,8 @@ Item {
                             log.show("低压传感器"+"通讯错误")
                         }
                         else{
-                            gauge_low.value = parseInt(number)
-                            gauge_low.realValue = number
+                            gauge_low.value = obj.pressureNumber //parseInt(obj.pressureNumber)
+                            //gauge_low.realValue = obj.pressureNumber
                         }
                     }else if(comboBox1.currentText === "高压传感器"){
                         obj = ModbusJs.highPressureSensorReadReq(sensorSerial)
@@ -84,8 +84,8 @@ Item {
                             log.show("高压传感器"+"通讯错误")
                         }
                         else{
-                            gauge_high.value = parseInt(number)
-                            gauge_high.realValue = number
+                            gauge_high.value = obj.pressureNumber//parseInt(obj.pressureNumber)
+                            //gauge_high.realValue = obj.pressureNumber
                         }
                     }else if(comboBox1.currentText === "负压传感器"){
                         obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
@@ -93,8 +93,8 @@ Item {
                             log.show("负压传感器"+"通讯错误")
                         }
                         else{
-                            gauge_negative.value = parseInt(number)
-                            gauge_negative.realValue = number
+                            gauge_negative.value = obj.pressureNumber // parseInt(obj.pressureNumber)
+                            //gauge_negative.realValue = obj.pressureNumber
                         }
                     }
 

+ 51 - 8
src/breatheTest.js

@@ -10,6 +10,10 @@ var exit = false
 var capsizeOpenPresure = 10
 var capsizeSetPressure = 32
 
+var pthreshold_Setzero = 0.2
+var nthreshold_Setzero = -0.2
+var delaycount_Setzero = 6
+
 function positiveTestStop(controlSerial,pressureDisplaySigFun,spy,log){
 
     ModbusJs.pressureSensorCtrl(controlSerial,"高压")
@@ -22,6 +26,7 @@ function positiveTestStop(controlSerial,pressureDisplaySigFun,spy,log){
     console.log("打开正压罐头泄气阀门")
     //查看高压传感器值 等待正压罐头压力降到最低值
     var timeout = 0
+    var end_count = 0
     do{
         //重新开始时 停止测试
         if(runningBackup === false && running === true){
@@ -43,8 +48,14 @@ function positiveTestStop(controlSerial,pressureDisplaySigFun,spy,log){
         //延时
         spy.wait(900)
         timeout++
+        if(obj.pressureNumber <= pthreshold_Setzero){
+            end_count++;
+            //console.log("111: pressure:"+ obj.pressureNumber +", pthreshold_setzero:"+pthreshold_Setzero)
+        }else{
+            //console.log("222: pressure:"+ obj.pressureNumber +", pthreshold_setzero:"+pthreshold_Setzero)
+        }
 
-    }while(obj.pressureNumber > 0.1 && timeout < 180)
+    }while(end_count < delaycount_Setzero && timeout < 180)
     ModbusJs.closeAllValve(controlSerial)
     console.log("关闭 关闭所有阀门")
 }
@@ -65,6 +76,7 @@ function negativeTestStop(controlSerial,pressureDisplaySigFun,spy,log){
     console.log("打开负压罐头泄气阀门")
     //查看负压传感器值 等待负压罐头压力降到最低值
     var timeout = 0
+    var end_count =0
     do{
         //重新开始时 停止测试
         if(runningBackup === false && running === true){
@@ -86,7 +98,11 @@ function negativeTestStop(controlSerial,pressureDisplaySigFun,spy,log){
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber < -0.1 && timeout < 180)
+
+        if(obj.pressureNumber >= nthreshold_Setzero){
+            end_count++;
+        }
+    }while(end_count < delaycount_Setzero && timeout < 180)
     ModbusJs.closeAllValve(controlSerial)
     console.log("关闭 关闭所有阀门")
 }
@@ -123,6 +139,7 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     ModbusJs.positivePressureTankOutputCtrl(controlSerial,true)
     console.log("打开正压罐头泄气阀门")
     var timeout = 0
+    var end_count = 0
     do{
         if(running === false){
             console.log("停止测试")
@@ -138,7 +155,11 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber > 0.1 && timeout < 180)
+        if(obj.pressureNumber <= pthreshold_Setzero){
+            end_count++;
+        }
+
+    }while(end_count < delaycount_Setzero && timeout < 180)
     if(timeout === 180){
         log.show("泄压超时")
         ModbusJs.closeAllValve(controlSerial)
@@ -300,6 +321,7 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     //查看低压传感器值 等待正压罐头压力降到最低值
     processWindow.show("试验结束,泄气中")
     timeout = 0
+    end_count = 0
     do{
         if(running === false){
             console.log("停止测试")
@@ -316,7 +338,10 @@ function positiveTestStart(currentIndex,tabView,processWindow,controlSerial,sens
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber > 0.1 && timeout < 180)
+        if(obj.pressureNumber <= pthreshold_Setzero){
+            end_count++;
+        }
+    }while(end_count < delaycount_Setzero && timeout < 180)
 
     //关闭正压罐头泄气阀门
 
@@ -365,6 +390,7 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     //setp 2
     //查看负压传感器值 等待负压压罐头压力至0kPa
     var timeout = 0
+    var end_count=0
     do{
         if(running === false){
             console.log("停止测试")
@@ -382,7 +408,11 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber < 0 && timeout < 180)
+        if(obj.pressureNumber >= nthreshold_Setzero){
+            end_count++;
+        }
+
+    }while(end_count < delaycount_Setzero && timeout < 180)
     if(timeout === 180){
         log.show("泄压超时")
         ModbusJs.closeAllValve(controlSerial)
@@ -523,6 +553,7 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
     //查看负压传感器值 等待负压罐到0kPa
     processWindow.show("试验结束,泄气中")
     timeout = 0
+    end_count = 0
     do{
         if(running === false){
             console.log("停止测试")
@@ -539,7 +570,10 @@ function negativeTestStart(currentIndex,tabView,processWindow,controlSerial,sens
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber < 0  && timeout<180)
+        if(obj.pressureNumber >= nthreshold_Setzero){
+            end_count++;
+        }
+    }while(end_count < delaycount_Setzero  && timeout<180)
     //关闭负压罐头泄气阀门
 
     //setp 6
@@ -573,6 +607,7 @@ function capsizeTestStart(processWindow,controlSerial,sensorSerial,
     ModbusJs.positivePressureTankOutputCtrl(controlSerial,true)
     console.log("打开正压罐头泄气阀门")
     var timeout = 0
+    var end_count=0
     do{
         if(running === false){
             console.log("停止测试")
@@ -588,7 +623,10 @@ function capsizeTestStart(processWindow,controlSerial,sensorSerial,
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber > 0.1 && timeout < 180)
+        if(obj.pressureNumber <= pthreshold_Setzero){
+            end_count++;
+        }
+    }while(end_count < delaycount_Setzero && timeout < 180)
     console.log("压力降压到 0 kPa")
     if(timeout === 180){
         log.show("泄压超时")
@@ -708,6 +746,7 @@ function capsizeTestStart(processWindow,controlSerial,sensorSerial,
     console.log("等待压力 0kPa")
     //查看高压传感器值 等待正压罐头压力降到最低值
     timeout =0
+    end_count = 0
     do{
         if(running === false){
             console.log("停止测试")
@@ -723,7 +762,11 @@ function capsizeTestStart(processWindow,controlSerial,sensorSerial,
         //延时
         spy.wait(900)
         timeout++
-    }while(obj.pressureNumber > 0.1  && timeout < 180)
+        if(obj.pressureNumber <= pthreshold_Setzero){
+            end_count++;
+        }
+
+    }while(end_count < delaycount_Setzero  && timeout < 180)
 
     //setp 6
     console.log("压力 0kPa")

+ 3 - 3
src/modbus.js

@@ -519,7 +519,7 @@ function highPressureSetZeroReq(serial){
         data = serial.serialWriteReponse(command)
 
     if(data.length > 0){
-        if( data[1]===0x06 && data[2]=== 0x06){
+        if( data[1]===0x06){
             ret =  true;
         }
     }
@@ -571,7 +571,7 @@ function lowPressureSetZeroReq(serial){
         data = serial.serialWriteReponse(command)
 
     if(data.length > 0){
-        if( data[1]===0x06 && data[2]=== 0x06){
+        if( data[1]===0x06){
             ret =  true;
         }
     }
@@ -622,7 +622,7 @@ function negativePressureSetZeroReq(serial){
         data = serial.serialWriteReponse(command)
 
     if(data.length > 0){
-        if( data[1]===0x06 && data[2]=== 0x06){
+        if( data[1]===0x06){
             ret =  true;
         }
     }

+ 13 - 7
src/safeValveTest.js

@@ -12,6 +12,11 @@ var setPressure = 100
 //次参数不用
 var exit = false
 
+var pthreshold_Setzero = 0.2
+var nthreshold_Setzero = -0.2
+var delaycount_Setzero = 5
+
+
 //罐体压力检查 用于液压升降时 压力检查
 function valvePressureCheckStop(controlSerial,processWindow,pressureDisplaySigFun,spy,log)
 {
@@ -41,18 +46,19 @@ function valvePressureCheckStop(controlSerial,processWindow,pressureDisplaySigFu
         // signal 压力显示函数
         pressureDisplaySigFun(obj.pressureNumber)
 
-        if(obj.pressureNumber > 0.1 && loseFlag === true ){
+        if(obj.pressureNumber > pthreshold_Setzero && loseFlag === true ){
             loseFlag = false
             ModbusJs.positivePressureTankOutputCtrl(controlSerial,true)
             console.log("打开正压罐头泄气阀门")
             processWindow.text("检查压力,泄气中")
         }
-        else if(obj.pressureNumber > 0.1){
+        else if(obj.pressureNumber > pthreshold_Setzero){
             //延时
             spy.wait(900)
         }
 
-    }while(obj.pressureNumber > 0.1 )
+
+    }while(obj.pressureNumber > pthreshold_Setzero )
     // ModbusJs.closeAllValve(controlSerial)
 
     ModbusJs.positivePressureTankOutputCtrl(controlSerial,false)
@@ -99,13 +105,13 @@ function valveStop(controlSerial,pressureDisplaySigFun,spy,log){
         pressureDisplaySigFun(obj.pressureNumber)
         //延时
         spy.wait(900)
-        if(obj.pressureNumber > 0.1 && loseFlag === true ){
+        if(obj.pressureNumber > pthreshold_Setzero && loseFlag === true ){
             loseFlag = false
             ModbusJs.positivePressureTankOutputCtrl(controlSerial,true)
             console.log("打开正压罐头泄气阀门")
         }
 
-    }while(obj.pressureNumber > 0.1 )
+    }while(obj.pressureNumber > pthreshold_Setzero )
     // ModbusJs.closeAllValve(controlSerial)
     ModbusJs.closeSingalValve(controlSerial)
     console.log("关闭 关闭所有阀门")
@@ -165,7 +171,7 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
         pressureDisplaySigFun(obj.pressureNumber)
         //延时
         spy.wait(900)
-    }while(obj.pressureNumber > 0.1 )
+    }while(obj.pressureNumber > pthreshold_Setzero )
     console.log("压力降压到 0 kPa")
 
     obj = ModbusJs.testFixedPressure(controlSerial,setPressure+30)
@@ -373,7 +379,7 @@ function valveStart(currentIndex,tabView,processWindow,controlSerial,sensorSeria
         pressureDisplaySigFun(obj.pressureNumber)
         //延时
         spy.wait(900)
-    }while(obj.pressureNumber > 0.1 )
+    }while(obj.pressureNumber > pthreshold_Setzero )
     //关闭正压罐头泄气阀门
 
     console.log("压力 0kPa")

+ 19 - 3
src/vacuoValveTest.js

@@ -12,6 +12,10 @@ var outsidePressure  = -21
 //此参数不用
 var exit = false
 
+var pthreshold_Setzero = 0.2
+var nthreshold_Setzero = -0.2
+var delaycount_Setzero = 6
+
 //试验异常中止退出 泄压操作
 /*  controlSerial           控制串口对象
  *  pressureDisplaySigFun   压力显示信号函数(回调函数)
@@ -33,6 +37,7 @@ function vacuoTestStop(controlSerial,pressureDisplaySigFun,spy,log){
     ModbusJs.negativePressureTankOutputCtrl(controlSerial,true)
     console.log("打开负压罐头泄气阀门")
     //查看负压传感器值 等待负压罐头压力降到最低值
+    var end_count = 0
     do{
         //重新开始时 停止测试
         if(runningBackup === false && running === true){
@@ -52,7 +57,10 @@ function vacuoTestStop(controlSerial,pressureDisplaySigFun,spy,log){
         pressureDisplaySigFun(obj.pressureNumber)
         //延时
         spy.wait(900)
-    }while(obj.pressureNumber < -0.1 )
+        if(obj.pressureNumber > nthreshold_Setzero){
+            end_count++
+        }
+    }while(end_count < delaycount_Setzero )
     ModbusJs.closeAllValve(controlSerial)
     console.log("关闭 关闭所有阀门")
 }
@@ -100,6 +108,7 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     //setp 2
     //查看负压传感器值 等待负压压罐头压力到0kPa
     var checkPressure = true
+    var end_count = 0
     do{
         if(running === false){
             console.log("停止测试")
@@ -115,7 +124,10 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
         pressureDisplaySigFun(obj.pressureNumber)
         //延时
         spy.wait(900)
-    }while(obj.pressureNumber < 0)
+        if(obj.pressureNumber > nthreshold_Setzero){
+            end_count++
+        }
+    }while(end_count < delaycount_Setzero)
     console.log("压力到 0 kPa")
 
     //setp 3
@@ -264,6 +276,7 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     console.log("等待压力 0kPa")
     //查看负压传感器值 等待负压罐到0kPa
     processWindow.show("试验结束,泄气中")
+    end_count = 0
     do{
         if(running === false){
             console.log("停止测试")
@@ -278,7 +291,10 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
         pressureDisplaySigFun(obj.pressureNumber)
         //延时
         spy.wait(900)
-    }while(obj.pressureNumber < -0.1  )
+        if(obj.pressureNumber > nthreshold_Setzero){
+            end_count++
+        }
+    }while(end_count < delaycount_Setzero )
     //关闭负压罐头泄气阀门
 
     //setp 6