Преглед на файлове

为比武活动所做修改:表盘颜色, 提示泄压,安全阀与人孔盖增加盲测, 去掉低压缓冲罐等

guoqiang преди 9 месеца
родител
ревизия
311caffd68

+ 10 - 0
app/log.txt

@@ -72,3 +72,13 @@ DateTime:2024-09-03 17:37:30 周二 Message:closeAllValve start
 DateTime:2024-09-03 17:37:30 周二 Message:lampState: false
 DateTime:2024-09-03 17:37:30 周二 Message:02 0F 00 00 00 10 02 00 00
 DateTime:2024-09-03 17:37:30 周二 Message:closeAllValve end
+DateTime:2024-10-28 15:33:24 周一 Message:"OpenCOM3 Error"
+DateTime:2024-10-28 15:33:24 周一 Message:打开传感器串口COM3失败
+DateTime:2024-10-28 15:33:24 周一 Message:"OpenCOM4 Error"
+DateTime:2024-10-28 15:33:24 周一 Message:打开控制串口COM4失败
+DateTime:2024-10-28 15:33:24 周一 Message:openPressureTimeMax: 3
+DateTime:2024-10-28 15:33:24 周一 Message:qrc:/BreatheValve.qml:879:21: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
+DateTime:2024-10-28 15:33:24 周一 Message:qrc:/BreatheValve.qml:858:29: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
+DateTime:2024-10-28 15:33:24 周一 Message:BreathValve Carplattext:京
+DateTime:2024-10-28 15:33:24 周一 Message:qrc:/BreatheValve.qml:352:13: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
+DateTime:2024-10-28 15:33:24 周一 Message:BreathValve Carplattext:浙

BIN
app/valve_experiment.exe


+ 126 - 21
src/BreatheValve.qml

@@ -62,6 +62,7 @@ Item{
             property  var dataArray: []
             signal pressureDisplaySigFun(var pressureNumber)
             signal resultSigFun(var result)
+            signal menuSigFun(var enable)
             property var pointList0:[]
             property var pointList1:[]
             property var pointList2:[]
@@ -134,6 +135,10 @@ Item{
                 pressureDisplayInput(pressureNumber)
             }
 
+            onMenuSigFun:{
+                choosevalve.menuEnable = enable
+            }
+
             onRunningChanged: {
                 BreatheTestJs.running = running
                 if(running === true){
@@ -174,8 +179,16 @@ Item{
                     console.log("自检正常")
                     clearCurveDisplay()
                     groupbox.currentIndex = 0
+                    //播放开始语音
+                    BreatheTestJs.playStart_Voice(controlSerial)
+
                     if(testTypeComboBox.currentText === "正压开启压力和密封试验"){
+                        spy.wait(500)
+                        clearPTData(0)
+                        clearPTData(1)
+                        clearPTData(2)
 
+                        BreatheTestJs.cylinderPressdown(controlSerial, menuSigFun)
                         do{
                             let  tab =  breatheTable.positiveTabview.getTab(groupbox.currentIndex)
                             let tabView = breatheTable.positiveTabview
@@ -192,15 +205,26 @@ Item{
                                                                    openPressureModel,sealPressureModel,
                                                                    pressureDisplaySigFun,resultSigFun,spy,log)
                             if(ret === false){
-                                processWindow.show("测试退出,泄中...")
+                                processWindow.show("测试退出,泄中...")
                                 BreatheTestJs.runningBackup = groupbox.running
                                 BreatheTestJs.positiveTestStop(controlSerial,pressureDisplaySigFun,spy,log)
                             }
-                            spy.wait(1500) //延时 确认全关继电器
+                            spy.wait(500) //延时 确认全关继电器
+
                             groupbox.currentIndex++
                         }while(groupbox.currentIndex <root.count && ret === true)
+
+                        //呼吸阀气缸上升
+                        BreatheTestJs.cylinderRelease(controlSerial, menuSigFun)
+
                     }
                     else if(testTypeComboBox.currentText === "负压开启压力和密封试验"){
+                        spy.wait(500)
+                        clearNTData(0)
+                        clearNTData(1)
+                        clearNTData(2)
+                        BreatheTestJs.cylinderPressdown(controlSerial, menuSigFun)
+
                         do{
                             let tab =  breatheTable.negativeTabview.getTab(groupbox.currentIndex)
                             let tabView = breatheTable.negativeTabview
@@ -212,19 +236,24 @@ Item{
 
                             openPressureModel.clear()
                             sealPressureModel.clear()
+
                             ret =  BreatheTestJs.negativeTestStart(groupbox.currentIndex,tabView,processWindow,controlSerial,sensorSerial,
                                                                    openPressureModel,sealPressureModel,
                                                                    pressureDisplaySigFun,resultSigFun,spy,log)
                             if(ret === false){
-                                processWindow.show("测试退出,泄中...")
+                                processWindow.show("测试退出,泄中...")
                                 BreatheTestJs.runningBackup = groupbox.running
                                 BreatheTestJs.negativeTestStop(controlSerial,pressureDisplaySigFun,spy,log)
                             }
-                            spy.wait(1500) //延时 确认全关继电器
+                            spy.wait(500) //延时 确认全关继电器
+
                             groupbox.currentIndex++
 
                         }while(groupbox.currentIndex <root.count && ret === true)
 
+                        //呼吸阀气缸上升
+                        BreatheTestJs.cylinderRelease(controlSerial, menuSigFun)
+
                     }
                     else if(testTypeComboBox.currentText === "颠覆性密封试验"){
                         console.log("颠覆性密封试验")
@@ -253,14 +282,21 @@ Item{
                         ret =  BreatheTestJs.capsizeTestStart(processWindow,controlSerial,sensorSerial,
                                                               sealPressureModel,pressureDisplaySigFun,resultSigFun,spy,log)
                         if(ret === false){
-                            processWindow.show("测试退出,泄中...")
+                            processWindow.show("测试退出,泄中...")
                             BreatheTestJs.runningBackup = groupbox.running
                             BreatheTestJs.positiveTestStop(controlSerial,pressureDisplaySigFun,spy,log)
                         }
+
                     }
 
+                    //播放结束语音
+                    BreatheTestJs.playStop_Voice(controlSerial)
+
                     testStop()
-                    choosevalve.menuEnable = true
+                    //choosevalve.menuEnable = true
+
+
+
                 }
             }
 
@@ -270,6 +306,55 @@ Item{
                 startStopButton.running = false
             }
 
+            function clearPTData(index){
+
+                let  tab =  breatheTable.positiveTabview.getTab(index)
+                let tabView = breatheTable.positiveTabview
+                let openPressureModel = tab.item.modelData
+
+                tab =  breatheTable.positiveTabview.getTab(index+3)
+                let sealPressureModel = tab.item.modelData
+                openPressureModel.clear()
+                sealPressureModel.clear()
+
+                if(index === 0){
+                    breatheResult.positiveOpenPressure1 = ""
+                    breatheResult.positiveSealPressure1 = ""
+                }else if(index === 1){
+                    breatheResult.positiveOpenPressure2 = ""
+                    breatheResult.positiveSealPressure2 = ""
+                }else {
+                    breatheResult.positiveOpenPressure3 = ""
+                    breatheResult.positiveSealPressure3 = ""
+                }
+
+            }
+
+            function clearNTData(index){
+
+                let tab =  breatheTable.negativeTabview.getTab(index)
+                let tabView = breatheTable.negativeTabview
+                let openPressureModel = tab.item.modelData
+
+                tab =  breatheTable.negativeTabview.getTab(index+3)
+                let sealPressureModel = tab.item.modelData
+
+                openPressureModel.clear()
+                sealPressureModel.clear()
+
+                if(index === 0){
+                    breatheResult.negativeOpenPressure1 = ""
+                    breatheResult.negativeSealPressure1 = ""
+                }else if(index === 1){
+                    breatheResult.negativeOpenPressure2 = ""
+                    breatheResult.negativeSealPressure2 = ""
+                }else {
+                    breatheResult.negativeOpenPressure3 = ""
+                    breatheResult.negativeSealPressure3 = ""
+                }
+
+            }
+
 
 
             function reportPositiveGeneratePicture(  )
@@ -447,13 +532,14 @@ Item{
             function pressureDisplayInput(number){
                 pressureCnt++
                 //console.log("pressureDisplayInput number:%f", number)
-                if(number+2 > curveDisplay.axisyMax ){
-                    curveDisplay.axisyMax = number +2
+                if(number+10 > curveDisplay.axisyMax ){
+                    curveDisplay.axisyMax = number +10
                 }
 
                 if(pressureCnt <= 61){
                     dataArray.push(number)
                     curveDisplay.spline.append(pressureCnt-1,number)
+                    curveDisplay.axisxMax = 60
                 }
                 else{
                     dataArray.push(number)
@@ -509,9 +595,10 @@ Item{
                 spacing: 0
                 Rectangle{
                     id:paraRectagle
-                    property int addHeight :0
+                    property int addHeight :40
                     width: 980
-                    height: 70+addHeight
+                    //height: 70+addHeight
+                    height: 100
                     color: "white"
                     radius: 6
                     Row{
@@ -562,7 +649,7 @@ Item{
                                     }
                                     InputLine{
                                         id:openPressureTimeMaxInputLine
-                                        paraName: "开启时:"
+                                        paraName: "开启时:"
                                         paraLength: 40
                                         text: BreatheTestJs.openPressureTimeMax
                                         validator:RegExpValidator {
@@ -571,7 +658,7 @@ Item{
                                         inputMethodHints: Qt.ImhDigitsOnly
                                         onTextChanged: {
                                             BreatheTestJs.openPressureTimeMax =  Number(text)
-                                            console.log("openPressureTimeMax:",BreatheTestJs.openPressureTimeMax)
+                                            //console.log("openPressureTimeMax:",BreatheTestJs.openPressureTimeMax)
                                             if(Number(text) >180){
                                                 text = 180
                                             }
@@ -638,22 +725,22 @@ Item{
                                             }
                                             switch(currentText){
                                             case "正压开启压力和密封试验":
-                                                BreatheTestJs.openPressureTimeMax = 3
-                                                BreatheTestJs.sealPressureTimemax = 15
+                                                //BreatheTestJs.openPressureTimeMax = 3
+                                                //BreatheTestJs.sealPressureTimemax = 5
                                                 sealPressureTimemaxInputLine.text = BreatheTestJs.sealPressureTimemax
                                                 openPressureTimeMaxInputLine.text = BreatheTestJs.openPressureTimeMax
                                                 openPressureTimeMaxInputLine.enabled = true
                                                 break
                                             case "负压开启压力和密封试验":
-                                                BreatheTestJs.openPressureTimeMax = 3
-                                                BreatheTestJs.sealPressureTimemax = 15
+                                                //BreatheTestJs.openPressureTimeMax = 3
+                                                //BreatheTestJs.sealPressureTimemax = 5
                                                 sealPressureTimemaxInputLine.text = BreatheTestJs.sealPressureTimemax
                                                 openPressureTimeMaxInputLine.text = BreatheTestJs.openPressureTimeMax
                                                 openPressureTimeMaxInputLine.enabled = true
                                                 break
                                             case "颠覆性密封试验":
                                                 openPressureTimeMaxInputLine.enabled = false
-                                                BreatheTestJs.sealPressureTimemax = 15
+                                                //BreatheTestJs.sealPressureTimemax = 5
                                                 sealPressureTimemaxInputLine.text = BreatheTestJs.sealPressureTimemax
                                                 openPressureTimeMaxInputLine.text = BreatheTestJs.openPressureTimeMax
                                                 break
@@ -701,11 +788,28 @@ Item{
 
                                 }
                                 Row{
-                                    visible: paraRectagle.addHeight === 0?false:true
+                                    //visible: paraRectagle.addHeight === 0?false:true
                                     spacing: 10
 
-                                    Text{
-                                        width: 425
+                                    Button{
+                                        text: "气缸上升"
+                                        width: 100
+                                        height: 25
+                                        onClicked: {
+                                            //呼吸阀气缸上升
+                                            BreatheTestJs.cylinderRelease(controlSerial, menuSigFun)
+
+                                        }
+                                    }
+                                    Button{
+                                        text: "气缸下压"
+                                        width: 100
+                                        height: 25
+                                        onClicked: {
+                                            //呼吸阀气缸下压
+                                            BreatheTestJs.cylinderPressdown(controlSerial, menuSigFun)
+
+                                        }
                                     }
 
                                     // InputLine{
@@ -868,7 +972,8 @@ Item{
 
                 Rectangle{
                     width: 980
-                    height: 265 - paraRectagle.addHeight
+                    height: 235
+                    //height: 265 - paraRectagle.addHeight
                     color: "white"
                     radius: 6
 

+ 31 - 24
src/ChooseValve.qml

@@ -32,40 +32,47 @@ MenuBar {
                     choose(text)
                 }
             }
-            MenuItem {
-                text: "罐体"
-                onTriggered: {
-                    choose(text)
-                }
-            }
-            MenuItem {
-                text: "密封自检"
-                onTriggered: {
-                    choose(text)
-                }
-            }
+            // MenuItem {
+            //     text: "罐体"
+            //     onTriggered: {
+            //         choose(text)
+            //     }
+            // }
+            // MenuItem {
+            //     text: "密封自检"
+            //     onTriggered: {
+            //         choose(text)
+            //     }
+            // }
             // MenuItem {
             //     text: "标定模式"
             //     onTriggered: {
             //         choose(text)
             //     }
             // }
-        }
 
-        Menu{
-            id:lamp
-            title:"灯控制"
             MenuItem {
-                text: "开灯"
+                text: "手动模式"
                 onTriggered: {
-                    ModbusJs.lampIoCtrl(controlSerial,true)
-                }
-            }
-            MenuItem {
-                text: "关灯"
-                onTriggered: {
-                    ModbusJs.lampIoCtrl(controlSerial,false)
+                    choose(text)
                 }
             }
         }
+
+        // Menu{
+        //     id:lamp
+        //     title:"灯控制"
+        //     MenuItem {
+        //         text: "开灯"
+        //         onTriggered: {
+        //             ModbusJs.lampIoCtrl(controlSerial,true)
+        //         }
+        //     }
+        //     MenuItem {
+        //         text: "关灯"
+        //         onTriggered: {
+        //             ModbusJs.lampIoCtrl(controlSerial,false)
+        //         }
+        //     }
+        // }
     }

+ 3 - 1
src/Gauge.qml

@@ -57,6 +57,7 @@ CircularGauge {
                     ctx.reset();
                     ctx.beginPath();
                     ctx.strokeStyle = "black"
+                    //ctx.strokeStyle = "green"
                     ctx.lineWidth = outerRadius
                     ctx.arc(outerRadius,
                           outerRadius,
@@ -122,7 +123,8 @@ CircularGauge {
 
             antialiasing: true
             smooth: true
-            color: styleData.value <= gauge.value ? "white" : "darkGray"
+            //color: styleData.value <= gauge.value ? "white" : "darkGray"
+            color: styleData.value <= gauge.value ? "green" : "darkGray"
         }
     }
 }

Файловите разлики са ограничени, защото са твърде много
+ 494 - 457
src/ManualMode.qml


+ 69 - 30
src/PeopleCoverHoleValve.qml

@@ -55,8 +55,11 @@ Item {
             property  bool running:startStopButton.running
             property int  pressureCnt:0
             property  var dataArray: []
+
             signal pressureDisplaySigFun(var pressureNumber)
             signal resultSigFun(var result)
+            signal blindTestpressureSigFun(var pressureNumber)
+
             property var pointList0:[]
             property var pointList1:[]
             property var pointList2:[]
@@ -72,27 +75,37 @@ Item {
                 switch(groupbox.currentIndex){
                 case 0:
                     resultSetPressure1.paraResult  = result.openPressureNumber
-                    resultSealPressure1.paraResult = result.sealPressureNumber
+                    resultSealPressure1.paraResult_1 = result.sealPressureNumber
+                    resultSealPressure1.paraResult_2 = result.sealPressureNumber2
+                    resultSealPressure1.paraResult = result.sealPressureNumber+" / "+result.sealPressureNumber2
                     break;
                 case 1:
                     resultSetPressure2.paraResult  = result.openPressureNumber
-                    resultSealPressure2.paraResult = result.sealPressureNumber
+                    resultSealPressure2.paraResult_1 = result.sealPressureNumber
+                    resultSealPressure2.paraResult_2 = result.sealPressureNumber2
+                    resultSealPressure2.paraResult = result.sealPressureNumber+" / "+result.sealPressureNumber2
                     break;
                 case 2:
                     resultSetPressure3.paraResult  = result.openPressureNumber
-                    resultSealPressure3.paraResult = result.sealPressureNumber
+                    resultSealPressure3.paraResult_1 = result.sealPressureNumber
+                    resultSealPressure3.paraResult_2 = result.sealPressureNumber2
+                    resultSealPressure3.paraResult = result.sealPressureNumber+" / "+result.sealPressureNumber2
                     break;
                 }
 
             }
 
+            onBlindTestpressureSigFun:{
+                blindopenPressure.text = pressureNumber
+            }
+
 
 
             function pressureDisplayInput(number){
                 pressureCnt++
                 //console.log("pressureDisplayInput number:%f", number)
-                if(number+2 > curveDisplay.axisyMax ){
-                    curveDisplay.axisyMax = number +2
+                if(number+10 > curveDisplay.axisyMax ){
+                    curveDisplay.axisyMax = number +10
                 }
 
                 if(pressureCnt <= 61){
@@ -131,6 +144,7 @@ Item {
                 }
             }
 
+            /*
             Timer{
                 id:delayTimer
                 repeat: false
@@ -148,6 +162,7 @@ Item {
                     delayCnt = 0
                 }
             }
+            */
 
             Timer{
                 id:startTimer
@@ -173,6 +188,26 @@ Item {
                     groupbox.dataArray = []
                     groupbox.currentIndex = 0
 
+                    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)
+
                     do{
                         //let tab =  tabview1.getTab(groupbox.currentIndex)
                         //let sealPressureModel = tab.item.modelData
@@ -192,14 +227,16 @@ Item {
                                                                                 openPressureModel,sealPressureModel,
                                                                                 pressureDisplaySigFun,resultSigFun,spy,log)
                         if(ret === false){
-                            processWindow.show("测试退出,泄中...")
+                            processWindow.show("测试退出,泄中...")
                             PeopleCoverHoleValveTestJs.runningBackup = groupbox.running
-                            PeopleCoverHoleValveTestJs.releasePressure(controlSerial,pressureDisplaySigFun,spy,log)
+                            PeopleCoverHoleValveTestJs.testStop(controlSerial,pressureDisplaySigFun,spy,log)
                         }
                         spy.wait(500) //延时 确认全关继电器
                         groupbox.currentIndex++
                     }while(groupbox.currentIndex <root.count && ret === true)
 
+                    //播放结束语音
+                    PeopleCoverHoleValveTestJs.playStop_Voice(controlSerial)
 
                     groupbox.testStop()
                     choosevalve.menuEnable = true
@@ -210,7 +247,6 @@ Item {
                 processWindow.exit()
                 reuslt.visible = true
                 startStopButton.running = false
-                PeopleCoverHoleValveTestJs.resetio()
             }
 
             Connections{
@@ -275,9 +311,12 @@ Item {
                     obj.resultSetPressure2 = resultSetPressure2.paraResult
                     obj.resultSetPressure3 = resultSetPressure3.paraResult
 
-                    obj.resultSealPressure1 = resultSealPressure1.paraResult
-                    obj.resultSealPressure2 = resultSealPressure2.paraResult
-                    obj.resultSealPressure3 = resultSealPressure3.paraResult
+                    obj.resultSealPressure1 = resultSealPressure1.paraResult_1
+                    obj.resultSealPressure2 = resultSealPressure2.paraResult_1
+                    obj.resultSealPressure3 = resultSealPressure3.paraResult_1
+                    obj.resultSealPressure1_add = resultSealPressure1.paraResult_2
+                    obj.resultSealPressure2_add = resultSealPressure2.paraResult_2
+                    obj.resultSealPressure3_add = resultSealPressure3.paraResult_2
                     reportWord.generateWord(savePath,obj)
                 }
             }
@@ -295,8 +334,6 @@ Item {
                 animationExit.running = true
                 startStopButton.running = false
                 stopTimer.start()
-                PeopleCoverHoleValveTestJs.resetio()
-                PeopleCoverHoleValveTestJs.reset_airCylinder()
 
                 PeopleCoverHoleValveTestJs.exit = true
             }
@@ -381,7 +418,7 @@ Item {
 
                                     InputLine{
                                         id:openPressureTimeMaxInputLine
-                                        paraName: "开启时:"
+                                        paraName: "开启时:"
                                         paraLength: 40
                                         text: PeopleCoverHoleValveTestJs.openPressureTimeMax
                                         validator:RegExpValidator {
@@ -478,6 +515,7 @@ Item {
                                 Row{
                                     spacing: 15
 
+                                    /*
                                     Button{
                                         id:upButton
                                         text: "压抓上升"
@@ -518,6 +556,7 @@ Item {
                                             }
                                         }
                                     }
+                                    */
 
                                     InputLine{
                                         id:openPressure_min
@@ -553,21 +592,21 @@ Item {
                                     }
 
 
-                                    // InputLine{
-                                    //     id:max_testtime
-                                    //     paraName: "压力平稳时间(秒):"
-                                    //     paraLength: 40
-                                    //     text: 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{
@@ -691,7 +730,7 @@ Item {
                                         width: reuslt.width
                                         height: reuslt.resultHeight
                                         color: "white"
-                                        paraName: "开启压力"
+                                        paraName: "泄放压力"
                                         paraResult:""
                                         paraUnit:""
                                     }
@@ -890,7 +929,7 @@ Item {
                         serialNumberInputLine.textFocus = false
                         userInputLine.textFocus = false
                         carplateInputLine.textFocus = false
-                        releasePressureTimeMaxInputLine.textFocus = false
+                        //releasePressureTimeMaxInputLine.textFocus = false
                         sealPressureTimemaxInputLine.textFocus = false
 
                     }

+ 2 - 0
src/ResultDisplayText.qml

@@ -4,6 +4,8 @@ Rectangle{
 
     property string     paraName:""
     property string     paraResult:""
+    property string     paraResult_1:""
+    property string     paraResult_2:""
     property string     paraUnit:""
     Row{
         anchors.verticalCenter: parent.verticalCenter

+ 62 - 31
src/SafeValve.qml

@@ -27,12 +27,15 @@ Item {
             loader.sourceComponent  = componet
         }
         loader.item.show()
+
+
     }
 
     function exit(){
         if(loader.sourceComponent  !== null){
             loader.item.exit()
         }
+
     }
 
 
@@ -60,6 +63,7 @@ Item {
 
             signal pressureDisplaySigFun(var pressureNumber)
             signal resultSigFun(var result)
+            signal blindTestpressureSigFun(var pressureNumber)
 
 
             onResultSigFun: {
@@ -84,6 +88,10 @@ Item {
                 pressureDisplayInput(pressureNumber)
             }
 
+            onBlindTestpressureSigFun:{
+                pressureInputline.text = pressureNumber
+            }
+
             onRunningChanged: {
                 SaveValveTestJs.running = running
                 if(running === true){
@@ -94,13 +102,14 @@ Item {
             //这里需要优化
             function pressureDisplayInput(number){
                 pressureCnt++
-                if(number+10 > curveDisplay.axisyMax ){
-                    curveDisplay.axisyMax = number +10
+                if((number)+30 >= curveDisplay.axisyMax ){
+                    curveDisplay.axisyMax = (number+30)
                 }
 
-                if(pressureCnt <= 61){
+                if(pressureCnt <= 60){
                     dataArray.push(number)
                     curveDisplay.spline.append(pressureCnt-1,number)
+                    curveDisplay.axisxMax = 60
                 }
                 else{
                     dataArray.push(number)
@@ -130,16 +139,17 @@ Item {
                     groupbox.dataArray = []
 
                     processWindow.show("检查压力....")
+
                     SaveValveTestJs.runningBackup = groupbox.running
                     var ret = SaveValveTestJs.valvePressureCheckStop(controlSerial,processWindow,pressureDisplaySigFun,spy,log)
                     //下降
                     if(upflag === true && ret === true){
-                        processWindow.text("液压升")
-                        ModbusJs.hydraulicUpIoCtrl(controlSerial,true)
+                        processWindow.text("电缸升")
+                        ModbusJs.electriccylinderUpCtrl(controlSerial,true)
                     }
                     else if(upflag === false && ret === true){
-                        processWindow.text("液压降")
-                        ModbusJs.hydraulicUpIoCtrl(controlSerial,false)
+                        processWindow.text("电缸降")
+                        ModbusJs.electriccylinderDownCtrl(controlSerial,true)
                     }
                     spy.wait(500)
                     test_exit()
@@ -165,7 +175,7 @@ Item {
                     console.log("正在自检....")
                     var ret = ModbusJs.checkModebusDevice(controlSerial,sensorSerial,log)
                     if(ret === false){
-                        log.show("自检错误")
+                        log.show("自检退出")
                         test_exit()
                         choosevalve.menuEnable = true
                         return
@@ -178,7 +188,23 @@ Item {
                     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)
                     do{
 
                         var tab = tabview1.getTab(groupbox.currentIndex)
@@ -194,7 +220,7 @@ Item {
                                                           openPressureModel,sealPressureModel,
                                                           pressureDisplaySigFun,resultSigFun,spy,log)
                         if(ret === false){
-                            processWindow.show("测试退出,泄中...")
+                            processWindow.show("测试退出,泄中...")
                             SaveValveTestJs.runningBackup = groupbox.running
                             SaveValveTestJs.valveStop(controlSerial,pressureDisplaySigFun,spy,log)
                         }
@@ -203,6 +229,9 @@ Item {
 
                     }while(groupbox.currentIndex <root.count && ret === true)
 
+                    //播放检测结束语音
+                    SaveValveTestJs.playStop_Voice(controlSerial)
+
                     test_exit()
                     //选择阀门 开启
                     choosevalve.menuEnable = true
@@ -398,7 +427,7 @@ Item {
 
                                     InputLine{
                                         id:openPressureTimeMaxInputLine
-                                        paraName: "整定时:"
+                                        paraName: "整定时:"
                                         paraLength: 40
                                         text: SaveValveTestJs.openPressureTimeMax
                                         validator:RegExpValidator {
@@ -459,15 +488,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)
                                         }
                                     }
 
@@ -510,44 +539,46 @@ Item {
 
                                 Row{
                                     spacing: 10
-                                    Button{
-                                        text: "液压泵开启"
-                                        width: 100
-                                        height: 25
-                                        onClicked: {
-                                            ModbusJs.hydraulicOpenIoCtrl(controlSerial,true)
-                                        }
-                                    }
-                                    Button{
-                                        text: "液压泵关闭"
-                                        width: 100
-                                        height: 25
-                                        onClicked: {
-                                            ModbusJs.hydraulicOpenIoCtrl(controlSerial,false)
-                                        }
-                                    }
+                                    // Button{
+                                    //     text: "电缸开启"
+                                    //     width: 100
+                                    //     height: 25
+                                    //     onClicked: {
+                                    //         ModbusJs.electriccylinderPowerCtrl(controlSerial,true)
+                                    //     }
+                                    // }
+                                    // Button{
+                                    //     text: "电缸关闭"
+                                    //     width: 100
+                                    //     height: 25
+                                    //     onClicked: {
+                                    //         ModbusJs.electriccylinderPowerCtrl(controlSerial,false)
+                                    //     }
+                                    // }
                                     Button{
                                         id:upButton
-                                        text: "液压爪升"
+                                        text: "压爪压紧"
                                         width: 100
                                         height: 25
                                         onClicked: {
                                             downButton.enabled = false
                                             upButton.enabled = false
                                             hydraulicGrabTimer.upflag = true
+                                            ModbusJs.electriccylinderPowerCtrl(controlSerial,true)
                                             hydraulicGrabTimer.start()
 
                                         }
                                     }
                                     Button{
                                         id:downButton
-                                        text: "液压爪降"
+                                        text: "压爪松开"
                                         width: 100
                                         height: 25
                                         onClicked: {
                                             downButton.enabled = false
                                             upButton.enabled = false
                                             hydraulicGrabTimer.upflag = false
+                                            ModbusJs.electriccylinderPowerCtrl(controlSerial,true)
                                             hydraulicGrabTimer.start()
                                         }
                                     }

+ 4 - 4
src/SealSelfTest.qml

@@ -84,7 +84,7 @@ Item {
                         return
                     }
                     else{
-                        if(testTypeComboBox.currentText === "正压罐密封测试"){
+                        if(testTypeComboBox.currentText === "高压密封测试"){
                             console.log(testTypeComboBox.currentText)
                             sealSelfTestPstep.running =true
                         }
@@ -561,13 +561,13 @@ Item {
                                     height:30
                                     bgColor:"#D2D5D9"
                                     enabled: !groupbox.running
-                                    model: ["正压罐密封测试","负压罐密封测试"]
+                                    model: ["高压密封测试","低压密封测试"]
                                     onCurrentTextChanged: {
-                                        if(currentText === "正压罐密封测试"){
+                                        if(currentText === "高压密封测试"){
                                             sealSelfTestPstep.visible = true
                                             sealSelfTestNstep.visible = false
                                         }
-                                        else if(currentText === "负压罐密封测试"){
+                                        else if(currentText === "低压密封测试"){
                                             sealSelfTestPstep.visible = false
                                             sealSelfTestNstep.visible = true
                                         }

+ 1 - 0
src/UserComboBox.qml

@@ -1,5 +1,6 @@
 import QtQuick 2.12
 import QtQuick.Controls 2.12
+import QtQml 2.12
 
 ComboBox {
     id: control

+ 50 - 4
src/VacuoValve.qml

@@ -116,10 +116,21 @@ Item {
                         return
                     }
                     console.log("自检正常")
+
+                    clearData(0)
+                    clearData(1)
+                    clearData(2)
+
+
+                    //播放开始语音
+                    VacuoValveTestJs.playStart_Voice(controlSerial)
                     curveDisplay.spline.clear()
                     groupbox.pressureCnt =0
                     groupbox.dataArray = []
 
+                    //真空阀气缸下压
+                    ModbusJs.vacuocylinderCtrl(controlSerial, true)
+
                     groupbox.currentIndex = 0
                     do{
 
@@ -132,24 +143,58 @@ Item {
                         openPressureModel.clear()
                         sealPressureModel.clear()
 
+
+
                         ret =  VacuoValveTestJs.testStart(groupbox.currentIndex,tabView,processWindow,controlSerial,sensorSerial,
                                                           openPressureModel,sealPressureModel,
                                                           pressureDisplaySigFun,resultSigFun,spy,log)
                         if(ret === false){
-                            processWindow.show("测试退出,泄中...")
+                            processWindow.show("测试退出,泄中...")
                             VacuoValveTestJs.runningBackup = groupbox.running
                             VacuoValveTestJs.vacuoTestStop(controlSerial,pressureDisplaySigFun,spy,log)
                         }
                         spy.wait(1500) //延时 确认全关继电器
+
+
+
                         groupbox.currentIndex++
                     }while(groupbox.currentIndex <root.count && ret === true)
 
 
+                    //播放结束语音
+                    VacuoValveTestJs.playStop_Voice(controlSerial)
+
+                    //真空阀气缸升起
+                    ModbusJs.vacuocylinderCtrl(controlSerial, false)
+
                     groupbox.testStop()
                     choosevalve.menuEnable = true
+
                 }
             }
 
+            function clearData(index){
+
+                var  tab =  tabview1.getTab(index)
+                var openPressureModel = tab.item.modelData
+                tab =  tabview1.getTab(index+3)
+                var sealPressureModel = tab.item.modelData
+                openPressureModel.clear()
+                sealPressureModel.clear()
+
+                if(index === 0){
+                    resultOpenPressure1.paraResult=""
+                    resultSealPressure1.paraResult=""
+                }else if(index === 1){
+                    resultOpenPressure2.paraResult=""
+                    resultSealPressure2.paraResult=""
+                }else {
+                    resultOpenPressure3.paraResult=""
+                    resultSealPressure3.paraResult=""
+                }
+
+            }
+
             function testStop(){
                 processWindow.exit()
                 reuslt.visible = true
@@ -158,13 +203,14 @@ Item {
 
             function pressureDisplayInput(number){
                 pressureCnt++
-                if(number+5 > curveDisplay.axisyMax ){
-                    curveDisplay.axisyMax = number +5
+                if(number-10 < curveDisplay.axisyMin ){
+                    curveDisplay.axisyMax = number-10
                 }
 
                 if(pressureCnt <= 61){
                     dataArray.push(number)
                     curveDisplay.spline.append(pressureCnt-1,number)
+                    curveDisplay.axisxMax = 60
                 }
                 else{
                     dataArray.push(number)
@@ -349,7 +395,7 @@ Item {
 
                                     InputLine{
                                         id:openPressureTimeMaxInputLine
-                                        paraName: "开启时:"
+                                        paraName: "开启时:"
                                         paraLength: 40
                                         text: VacuoValveTestJs.openPressureTimeMax
                                         validator:RegExpValidator {

Файловите разлики са ограничени, защото са твърде много
+ 443 - 209
src/breatheTest.js


+ 48 - 0
src/generateword.cpp

@@ -478,10 +478,22 @@ void GenerateWord::receiveGenerateWord(QString savePath, QVariant obj)
     QString resultSealPressure2 = map["resultSealPressure2"].toString();
     QString resultSealPressure3 = map["resultSealPressure3"].toString();
 
+    QString resultSealPressure1_add = "";
+    QString resultSealPressure2_add = "";
+    QString resultSealPressure3_add = "";
+
+
+
     QString text;
     //QTextCodec *codec = QTextCodec::codecForName("GBK");
     QTextCodec *codec = QTextCodec::codecForName("UTF-8");
 
+    if(valve == codec->toUnicode("人孔盖")){
+        resultSealPressure1_add = map["resultSealPressure1_add"].toString();
+        resultSealPressure2_add = map["resultSealPressure2_add"].toString();
+        resultSealPressure3_add = map["resultSealPressure3_add"].toString();
+    }
+
     QString text1 = codec->toUnicode("正在生成报告,请耐心等待");
     QString text2 = codec->toUnicode("正在保存中...");
     QString text3 = codec->toUnicode("报告已完成");
@@ -721,6 +733,42 @@ void GenerateWord::receiveGenerateWord(QString savePath, QVariant obj)
         word.setCellText(table, 3, 3, text,true);
         word.setCellText(table, 3, 4, resultSealPressure3.toUtf8(),false);
 
+        word.autoFitBehavior(table,wdAutoFitWindow);
+        word.moveForEnd();
+        word.insertMoveDown();
+        delete table;
+    }else{
+
+        word.setFontSize(7);
+        word.setFontBold(false);
+        table = word.createTableWithColor(3, 5);
+
+        text = codec->toUnicode("第一次泄放压力(kPa)");
+        word.setCellText(table, 1, 1, text,true);
+        word.setCellText(table, 1, 2, resultSetPressure1.toUtf8(),false);
+        text = codec->toUnicode("第一次密封压力(kPa)");
+        word.setCellText(table, 1, 3, text,true);
+        word.setCellText(table, 1, 4, resultSealPressure1.toUtf8(),false);
+        word.setCellText(table, 1, 5, resultSealPressure1_add.toUtf8(),false);
+
+        text = codec->toUnicode("第二次泄放压力(kPa)");
+        word.setCellText(table, 2, 1, text,true);
+        word.setCellText(table, 2, 2, resultSetPressure2.toUtf8(),false);
+        text = codec->toUnicode("第二次密封压力(kPa)");
+        word.setCellText(table, 2, 3, text,true);
+        word.setCellText(table, 2, 4, resultSealPressure2.toUtf8(),false);
+        word.setCellText(table, 2, 5, resultSealPressure2_add.toUtf8(),false);
+
+
+        text = codec->toUnicode("第三次泄放压力(kPa)");
+        word.setCellText(table, 3, 1, text,true);
+        word.setCellText(table, 3, 2, resultSetPressure3.toUtf8(),false);
+        text = codec->toUnicode("第三次密封压力(kPa)");
+
+        word.setCellText(table, 3, 3, text,true);
+        word.setCellText(table, 3, 4, resultSealPressure3.toUtf8(),false);
+        word.setCellText(table, 3, 5, resultSealPressure3_add.toUtf8(),false);
+
         word.autoFitBehavior(table,wdAutoFitWindow);
         word.moveForEnd();
         word.insertMoveDown();

+ 1 - 1
src/img/background.svg

@@ -31,7 +31,7 @@
          offset="0.75487471"
          style="stop-color:#000000;stop-opacity:0.82352941;" />
       <stop
-         style="stop-color:#939393;stop-opacity:1"
+         style="stop-color:#009300;stop-opacity:1"
          offset="1"
          id="stop22069" />
     </linearGradient>

+ 1 - 1
src/img/tickmark.svg

@@ -23,7 +23,7 @@
        inkscape:collect="always"
        id="linearGradient6093">
       <stop
-         style="stop-color:#b3b3b3;stop-opacity:1;"
+         style="stop-color:#00b300;stop-opacity:1;"
          offset="0"
          id="stop6095" />
       <stop

+ 45 - 20
src/main.qml

@@ -32,9 +32,11 @@ ApplicationWindow {
                 peopleCoverHoleValve.exit()
                 tankValve.exit()
                 //calibrationMode.exit()
+                manual_mode.exit()
                 sealSelfTest.exit()
                 safeValve.show()
                 ModbusJs.closeAllValve(controlSerial)
+
             }
             else if(text === "呼吸阀"){
                 safeValve.exit()
@@ -42,6 +44,7 @@ ApplicationWindow {
                 peopleCoverHoleValve.exit()
                 tankValve.exit()
                 //calibrationMode.exit()
+                manual_mode.exit()
                 sealSelfTest.exit()
                 breatheValve.show()
                 ModbusJs.closeAllValve(controlSerial)
@@ -52,6 +55,7 @@ ApplicationWindow {
                 peopleCoverHoleValve.exit()
                 tankValve.exit()
                 //calibrationMode.exit()
+                manual_mode.exit()
                 vacuoValve.show()
                 sealSelfTest.exit()
                 ModbusJs.closeAllValve(controlSerial)
@@ -62,30 +66,33 @@ ApplicationWindow {
                 vacuoValve.exit()
                 tankValve.exit()
                 //calibrationMode.exit()
+                manual_mode.exit()
                 sealSelfTest.exit()
                 peopleCoverHoleValve.show()
                 ModbusJs.closeAllValve(controlSerial)
             }
-            else if(text === "罐体"){
-                safeValve.exit()
-                breatheValve.exit()
-                vacuoValve.exit()
-                peopleCoverHoleValve.exit()
-                //calibrationMode.exit()
-                sealSelfTest.exit()
-                tankValve.show()
-                ModbusJs.closeAllValve(controlSerial)
-            }
-            else if(text === "密封自检"){
-                safeValve.exit()
-                breatheValve.exit()
-                vacuoValve.exit()
-                peopleCoverHoleValve.exit()
-                //calibrationMode.exit()
-                tankValve.exit()
-                sealSelfTest.show()
-                ModbusJs.closeAllValve(controlSerial)
-            }
+            // else if(text === "罐体"){
+            //     safeValve.exit()
+            //     breatheValve.exit()
+            //     vacuoValve.exit()
+            //     peopleCoverHoleValve.exit()
+            //     //calibrationMode.exit()
+            //     manual_mode.exit()
+            //     sealSelfTest.exit()
+            //     tankValve.show()
+            //     ModbusJs.closeAllValve(controlSerial)
+            // }
+            // else if(text === "密封自检"){
+            //     safeValve.exit()
+            //     breatheValve.exit()
+            //     vacuoValve.exit()
+            //     peopleCoverHoleValve.exit()
+            //     //calibrationMode.exit()
+            //     manual_mode.exit()
+            //     tankValve.exit()
+            //     sealSelfTest.show()
+            //     ModbusJs.closeAllValve(controlSerial)
+            // }
 
             // else if(text === "标定模式"){
             //     safeValve.exit()
@@ -95,6 +102,16 @@ ApplicationWindow {
             //     tankValve.exit()
             //     calibrationMode.show()
             // }
+            else if(text === "手动模式"){
+                safeValve.exit()
+                breatheValve.exit()
+                vacuoValve.exit()
+                peopleCoverHoleValve.exit()
+                tankValve.exit()
+               // calibrationMode.exit()
+                sealSelfTest.exit()
+                manual_mode.show()
+            }
 
 
         }
@@ -130,6 +147,12 @@ ApplicationWindow {
     //     anchors.fill: parent
     //     id:calibrationMode
     // }
+
+    ManualMode{
+        id:manual_mode
+        anchors.fill: parent
+    }
+
     Component.onCompleted: {
         breatheValve.show()
     }
@@ -171,6 +194,8 @@ ApplicationWindow {
         onTriggered: {
             console.log("关闭所有阀门")
             ModbusJs.closeAllValve(controlSerial)
+
+            ModbusJs.voiceplayer_Play(controlSerial, ModbusJs.welcome_voice)
         }
     }
 

Файловите разлики са ограничени, защото са твърде много
+ 561 - 548
src/modbus.js


Файловите разлики са ограничени, защото са твърде много
+ 498 - 332
src/peopleCoverHoleValveTest.js


Файловите разлики са ограничени, защото са твърде много
+ 674 - 466
src/safeValveTest.js


+ 5 - 0
src/serialport.cpp

@@ -354,6 +354,10 @@ void SerialPort::receiveWrite(QString sendStr)
     m_serial->write(sendData,cnt);
     m_serial->waitForBytesWritten(200);
 
+    // QByteArray tx_buf;
+    // tx_buf.append(sendData, cnt);
+    // qDebug() << "receiveWrite tx_buf: " << tx_buf.toHex();
+
     QSignalSpy spy(m_serial, SIGNAL(readyRead()));
     bool ret = spy.wait(600);
     if(ret == true){
@@ -361,6 +365,7 @@ void SerialPort::receiveWrite(QString sendStr)
         while (spy.wait(30) == true){
             responseData += m_serial->readAll();
         }
+        //qDebug() << "receiveWrite rxbuf: " << responseData.toHex();
         if(responseData.length() > 2){
             for(int i=0 ;i<responseData.length(); i++){
                 uint8_t value = responseData.at(i);

+ 224 - 89
src/vacuoValveTest.js

@@ -4,9 +4,9 @@
 var running = false
 var runningBackup = false
 //开启压力计时时间
-var openPressureTimeMax = 5
+var openPressureTimeMax = 10
 //密封压力计时时间
-var sealPressureTimemax = 15
+var sealPressureTimemax = 5
 //整定压力
 var setPressure  = -21
 //此参数不用
@@ -14,12 +14,27 @@ var exit = false
 
 var pthreshold_Setzero = 0.5
 var nthreshold_Setzero = -0.5
-var delaycount_Setzero = 3
+var delaycount_Setzero = 5
 
-var readPressureInterval = 10 // ms
+var readPressureInterval = 5 // ms
 var maxPressureStableTime = 20
 var releasePressureTimeOut = 180
 
+
+function sleep(ms) {
+  return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+function playStart_Voice(controlSerial){
+    ModbusJs.voiceplayer_Play(controlSerial, ModbusJs.vacuostart_voice)
+}
+
+function playStop_Voice(controlSerial){
+    ModbusJs.voiceplayer_Play(controlSerial, ModbusJs.teststop_voice)
+}
+
+
+
 //试验异常中止退出 泄压操作
 /*  controlSerial           控制串口对象
  *  pressureDisplaySigFun   压力显示信号函数(回调函数)
@@ -28,44 +43,68 @@ var releasePressureTimeOut = 180
  *  log                     异常显示对象
  */
 function vacuoTestStop(controlSerial,pressureDisplaySigFun,spy,log){
-    //打开真空阀阀测试口阀门  从一开始就打开 逻辑修改
-    ModbusJs.vacuoValveTestIO(controlSerial,true)
-    console.log("打开真空测试口阀门 不然无法检测到压力 压力表在阀门后面")
-    //关闭负压罐进气阀门
-    ModbusJs.negativePressureTankInputCtrl(controlSerial,false)
-    console.log("关闭负压罐进气阀门")
     //关闭 负压泵
     ModbusJs.negativePumpPowerCtrl(controlSerial,false)
     console.log("关闭 负压泵")
-    //打开负压罐头泄气阀门
-    ModbusJs.negativePressureTankOutputCtrl(controlSerial,true)
-    console.log("打开负压罐头泄气阀门")
+
+    //前端压力一起泄掉
+    //打开负压中速进气阀门
+    ModbusJs.npms_IntakeCtrl(controlSerial,true)
+    console.log("打开负压中速进气阀门")
+
+    //打开负压低速进气阀门
+    ModbusJs.npls_IntakeCtrl(controlSerial,true)
+    console.log("打开负压低速进气阀门")
+
+    //打开真空阀测试口
+    ModbusJs.vacuovalve_TestIO(controlSerial,true)
+    console.log("打开真空阀测试口")
+
+    //打开低压高速泄气阀门
+    ModbusJs.lphs_ReleaseCtrl(controlSerial,true)
+    console.log("打开低压高速泄气阀门")
+
+    //打开低压低速泄气阀门
+    ModbusJs.lpls_ReleaseCtrl(controlSerial,true)
+    console.log("打开低压低速泄气阀门")
+
+
     //查看负压传感器值 等待负压罐头压力降到最低值
+    var timeout = 0
     var end_count = 0
     do{
         //重新开始时 停止测试
         if(runningBackup === false && running === true){
             console.log("停止测试")
-            ModbusJs.closeAllValve(controlSerial)
-            return
+            ModbusJs.relay1CloseAll(controlSerial)
+            break
         }
         if(exit === true)
-            return
+            break
 
-        var obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+        var obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
         if(obj.ret === false){
             log.show("负压传感器通讯错误")
-            return false
+            break
         }
         // signal 压力显示函数
         pressureDisplaySigFun(obj.pressureNumber)
+
+        if(obj.pressureNumber > -1.0){
+            //关闭真空阀测试口,微弱压力由气缸上升释放
+            ModbusJs.vacuovalve_TestIO(controlSerial,false)
+            console.log("关闭真空阀测试口")
+        }
+
+        timeout++
         //延时
         spy.wait(900)
+
         if(obj.pressureNumber > nthreshold_Setzero){
             end_count++
         }
-    }while(end_count < delaycount_Setzero )
-    ModbusJs.closeAllValve(controlSerial)
+    }while(end_count < delaycount_Setzero && timeout < releasePressureTimeOut )
+    ModbusJs.relay1CloseAll(controlSerial)
     console.log("关闭 关闭所有阀门")
 }
 
@@ -99,20 +138,33 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     console.log("真空阀测试开始")
 
     //step 1
-    // 关闭所有测试口
-    ModbusJs.turnOffAllTestIO(controlSerial)
-    console.log("关闭所有测试口")
+    ModbusJs.negativePumpPowerCtrl(controlSerial,false)
+    console.log("关闭 负压泵")
+    // 关闭所有气路电磁阀
+    ModbusJs.relay1CloseAll(controlSerial)
+    console.log("关闭所有气路电磁阀")
+
+    //真空阀气缸下压
+    //ModbusJs.vacuocylinderCtrl(controlSerial, true)
+    spy.wait(500)
 
     //step 2
-    ModbusJs.pressureSensorCtrl(controlSerial,"负压")
-    console.log("打开负压传感器阀门")
-    //关闭负压罐进气阀门
-    ModbusJs.negativePressureTankInputCtrl(controlSerial,false)
-    console.log("关闭负压罐进气阀门")
-    processWindow.show("等待压力到0kPa")
-    //打开负压罐头泄气阀门
-    ModbusJs.negativePressureTankOutputCtrl(controlSerial,true)
-    console.log("打开负压罐头泄气阀门")
+    //打开真空阀测试口
+    ModbusJs.vacuovalve_TestIO(controlSerial,true)
+    console.log("打开真空阀测试口")
+
+    //打开低压高速泄气阀门
+    ModbusJs.lphs_ReleaseCtrl(controlSerial,true)
+    console.log("打开低压高速泄气阀门")
+
+    //前端压力一起泄掉
+    //打开负压中速进气阀门
+    ModbusJs.npms_IntakeCtrl(controlSerial,true)
+    console.log("打开负压中速进气阀门")
+
+    //打开负压低速进气阀门
+    ModbusJs.npls_IntakeCtrl(controlSerial,true)
+    console.log("打开负压低速进气阀门")
 
     //查看负压传感器值 等待负压压罐头压力到0kPa
     var timeout = 0
@@ -126,7 +178,7 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
             console.log("停止测试")
             return false
         }
-        var obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+        var obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
         if(obj.ret === false){
             log.show("负压传感器通讯错误")
             return false
@@ -140,34 +192,49 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
             end_count++;
         }
 
-    }while(end_count < delaycount_Setzero && timeout < releasePressureTimeOut)
+    }while(end_count < 2 && timeout < releasePressureTimeOut)
     console.log("压力降压到 0 kPa")
 
     if(timeout === releasePressureTimeOut){
         log.show("释放压力超时")
-        ModbusJs.closeAllValve(controlSerial)
+        ModbusJs.relay1CloseAll(controlSerial)
         console.log("关闭所有阀门")
         return false
     }
 
-    //关闭负压罐泄气阀门
-    ModbusJs.negativePressureTankOutputCtrl(controlSerial,false)
-    console.log("关闭负压罐泄气阀门")
+    //关闭低压高速泄气阀门
+    ModbusJs.lphs_ReleaseCtrl(controlSerial,false)
+    console.log("关闭低压高速泄气阀门")
+
+    //前端压力一起泄掉
+    //关闭负压中速进气阀门
+    ModbusJs.npms_IntakeCtrl(controlSerial,false)
+    console.log("关闭负压中速进气阀门")
+
+    //关闭负压低速进气阀门
+    ModbusJs.npls_IntakeCtrl(controlSerial,false)
+    console.log("关闭负压低速进气阀门")
 
 
     //setp 3
     /*********测试开启压力*************/
+
+    tabView.currentIndex = currentIndex
+
     ModbusJs.negativePumpPowerCtrl(controlSerial,true)
     console.log("打开 负压泵")
 
-    //打开真空阀阀测试口阀门
-    ModbusJs.vacuoValveTestIO(controlSerial,true)
-    console.log("打开真空测试口阀门")
+    //打开真空阀测试口
+    ModbusJs.vacuovalve_TestIO(controlSerial,true)
+    console.log("打开真空测试口")
 
-    //打开负压罐进气阀门
-    ModbusJs.negativePressureTankInputCtrl(controlSerial,true)
-    console.log("打开负压罐进气阀门 粗调")
-    tabView.currentIndex = currentIndex
+    // //打开负压中速进气阀门
+    // ModbusJs.npms_IntakeCtrl(controlSerial,true)
+    // console.log("打开负压中速进气阀门")
+
+    //打开负压中速进气阀门
+    ModbusJs.npms_IntakeCtrl(controlSerial,true)
+    console.log("打开负压中速进气阀门")
 
     processWindow.show("开启压力试验开始")
     console.log("开启压力测试开始")
@@ -175,22 +242,27 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     var delta = 0
     var keepCnt = 0
 
-    obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+    var pre_pressure = 0
+    var pre_pressure2 = 0
+    //var prevTime  = Date.now()
+    var preDelta = 0
+    // var min = 2*setPressure
+    // var max = 0.6*setPressure
+    // var switch_pressure = 0.8*setPressure
+    var npms_close = false
+
+
+    var prevTime  = Date.now()
+    obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
     if(obj.ret === false){
         log.show("负压传感器通讯错误")
         return false
     }
 
-    var pre_pressure = obj.pressureNumber2
-    var prevTime  = Date.now()
-    var preDelta = 0
-    var min = 1.6*setPressure
-    var max = 0.6*setPressure
-    //var setPressure = 100
-
+    pre_pressure = obj.pressureNumber
+    pre_pressure2 = obj.pressureNumber2
     ret = true
-    //StablePressureCount = openPressureTimeMax*1000/readPressureInterval
-    spy.wait(500)
+    var back_flag = false
 
     do{
         //延时
@@ -203,39 +275,70 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
 
         var curTime  = Date.now()
         var deltaTime = curTime - prevTime
-        if(deltaTime > 1000){
+        if(deltaTime >= 980){
             prevTime = curTime
 
-            obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+            obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
             if(obj.ret === false){
                 log.show("负压传感器通讯错误")
                 return false
             }
 
+            //var curTime2  = Date.now()
+            //console.log("读取低压变送器:时长:"+(curTime2-curTime)+" ms");
 
-            //开启压力超出范围了
-            if(obj.pressureNumber < min){
-                //ret = false
 
-                log.show("真空阀无法开启")
-                break
-            }
+            // //开启压力超出范围了
+            // if(obj.pressureNumber < min){
+            //     ret = false
+
+            //     log.show("真空阀无法开启")
+            //     break
+            // }
 
-            delta = pre_pressure - obj.pressureNumber2
-            pre_pressure = obj.pressureNumber2
+            // if((obj.pressureNumber < switch_pressure) && (npms_close === false)){
+            //     //关闭负压中速进气阀门
+            //     var rv = ModbusJs.npms_IntakeCtrl(controlSerial,false)
+            //     console.log("关闭负压中速进气阀门")
+            //     if(rv === true){
+            //         npms_close = true
+            //     }
 
-            if((delta < (preDelta-0.03)) || (delta <= 0.12)){
+            // }
+
+            delta = pre_pressure2 - obj.pressureNumber2
+            //pre_pressure = obj.pressureNumber2
+
+            //if((delta<0.6) && ((delta < (preDelta-0.03)) || (delta <= 0.15))){
+            if(delta < 0.1){
                 keepCnt++
+                if(keepCnt === 1){
+                    openPressureNumber = obj.pressureNumber
+                }
+                if(delta < 0){
+                    back_flag = true
+
+                }
             }else{
-                keepCnt=0
+                if(back_flag === false){
+                    keepCnt = 0
+                }
+
             }
 
+            // console.log("current pressure:"+obj.pressureNumber2+", delta:"+delta)
+            // console.log("releaseCnt:"+ keepCnt +", deltaTime:"+deltaTime)
+
             if(keepCnt >= openPressureTimeMax){
                 //console.log("keepCnt > StablePressureCount")
                 break;
             }
 
             preDelta = delta
+
+            pre_pressure = obj.pressureNumber
+            pre_pressure2 = obj.pressureNumber2
+
             pressureDisplaySigFun(obj.pressureNumber)
             // add  pressure table
             var table={}
@@ -253,31 +356,41 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     table.pressure=obj.pressureNumber
     openPressureModel.append(table)
 
-    openPressureNumber = obj.pressureNumber
+    if(ret === false){
+        openPressureNumber = obj.pressureNumber
+    }
+
+    //openPressureNumber = obj.pressureNumber
     var result={}
-    result.openPressureNumber = obj.pressureNumber
+    result.openPressureNumber = openPressureNumber
     result.sealPressureNumber = ""
     resultSigFun(result)
 
-    console.log("真空阀整定压力:",obj.pressureNumber)
+    console.log("真空阀整定压力:",openPressureNumber)
     console.log("真空阀整定压力测试结束")
 
+    //关闭负压中速进气阀门
+    ModbusJs.npms_IntakeCtrl(controlSerial,false)
+    console.log("关闭负压中速进气阀门")
+
+    // 关闭负压泵
+    ModbusJs.negativePumpPowerCtrl(controlSerial,false)
+    console.log("关闭 负压泵")
+
+    // //关闭负压中速进气阀门
+    // ModbusJs.npms_IntakeCtrl(controlSerial,false)
+    // console.log("关闭负压中速进气阀门")
 
 
     //setp 4
     /*********测试密封压力*************/
+    /*
     console.log("密封压力开始")
     processWindow.show("密封压力试验开始")
-    //关闭负压罐进气阀门
-    ModbusJs.negativePressureTankInputCtrl(controlSerial,false)
-    console.log("关闭负压罐进气阀门")
-    //关闭 负压泵
-    ModbusJs.negativePumpPowerCtrl(controlSerial,false)
-    console.log("关闭 负压泵")
 
     tabView.currentIndex = currentIndex+3
 
-    obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+    obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
     if(obj.ret === false){
         log.show("负压传感器通讯错误")
         return false
@@ -300,10 +413,10 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
         //压力数据通知
         curTime  = Date.now()
         deltaTime = curTime - prevTime
-        if(deltaTime > 1000){
+        if(deltaTime >= 1000){
 
             prevTime = curTime
-            obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+            obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
             if(obj.ret === false){
                 log.show("负压传感器通讯错误")
                 return false
@@ -336,13 +449,31 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
     console.log("密封压力:",obj.pressureNumber)
     console.log("密封压力结束")
 
+    */
+
+
     //setp 5
-    //打开负压罐头泄气阀门
-    ModbusJs.negativePressureTankOutputCtrl(controlSerial,true)
-    console.log("打开负压罐头泄气阀门")
+
+    //打开低压高速泄气阀门
+    ModbusJs.lphs_ReleaseCtrl(controlSerial,true)
+    console.log("打开低压高速泄气阀门")
+
+    //打开低压低速泄气阀门
+    ModbusJs.lpls_ReleaseCtrl(controlSerial,true)
+    console.log("打开低压低速泄气阀门")
+
+    //前端压力一起泄掉
+    //打开负压中速进气阀门
+    ModbusJs.npms_IntakeCtrl(controlSerial,true)
+    console.log("打开负压中速进气阀门")
+
+    //打开负压低速进气阀门
+    ModbusJs.npls_IntakeCtrl(controlSerial,true)
+    console.log("打开负压低速进气阀门")
+
     console.log("等待压力 0kPa")
     //查看负压传感器值 等待负压罐到0kPa
-    processWindow.show("试验结束,泄气中")
+    processWindow.show("试验结束,泄中")
 
     end_count = 0
     timeout = 0
@@ -351,13 +482,21 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
             console.log("停止测试")
             return false
         }
-        obj = ModbusJs.negativePressureSensorReadReq(sensorSerial)
+        obj = ModbusJs.lowPressureSensorReadReq(sensorSerial)
         if(obj.ret === false){
             log.show("负压传感器通讯错误")
             return false
         }
         // signal 压力显示函数
         pressureDisplaySigFun(obj.pressureNumber)
+
+        // if(obj.pressureNumber > -2.0){
+        //     //关闭真空阀测试口,微弱压力由气缸上升释放
+        //     ModbusJs.vacuovalve_TestIO(controlSerial,false)
+        //     console.log("关闭真空阀测试口")
+
+        // }
+
         //延时
         spy.wait(950)
         timeout++
@@ -366,14 +505,10 @@ function testStart(currentIndex,tabView,processWindow,controlSerial,sensorSerial
         }
     }while(end_count < delaycount_Setzero && timeout < 180 )
 
-    //关闭负压罐头泄气阀门
-    ModbusJs.negativePressureTankOutputCtrl(controlSerial,false)
-    console.log("关闭负压罐头泄气阀门")
-
 
     //setp 6
     console.log("压力 0kPa")
-    ModbusJs.closeAllValve(controlSerial)
+    ModbusJs.relay1CloseAll(controlSerial)
     console.log("关闭所有阀门")
     return true
 

+ 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-09-19T09:52:43. -->
+<!-- Written by QtCreator 14.0.0, 2024-11-27T22:49:06. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>