|
@@ -3,6 +3,7 @@
|
|
#include "valve.h"
|
|
#include "valve.h"
|
|
#include "ballvalve.h"
|
|
#include "ballvalve.h"
|
|
#include "PressureSensor.h"
|
|
#include "PressureSensor.h"
|
|
|
|
+#include "Calibrationpara.h"
|
|
#include<QDateTime>
|
|
#include<QDateTime>
|
|
#include<QTime>
|
|
#include<QTime>
|
|
#include<QEventLoop>
|
|
#include<QEventLoop>
|
|
@@ -28,6 +29,7 @@ TestService::TestService(QThread *parent)
|
|
{
|
|
{
|
|
|
|
|
|
m_bRunning=false;
|
|
m_bRunning=false;
|
|
|
|
+ m_bRealEnd = true;
|
|
|
|
|
|
for(int i=0; i<MAX_COMPARTMENT_NUM; i++ ){
|
|
for(int i=0; i<MAX_COMPARTMENT_NUM; i++ ){
|
|
m_tank.m_comparts[i].m_id = i;
|
|
m_tank.m_comparts[i].m_id = i;
|
|
@@ -136,6 +138,22 @@ bool TestService::setTankinfo(const QVariantList& list)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+#if 0
|
|
|
|
+ ParaItem pid_para;
|
|
|
|
+ g_CalibrationPara->get_pidPara(volume[i], pid_para);
|
|
|
|
+ qDebug("setTankinfo: pid max_volume:[%d]", pid_para.max_volume);
|
|
|
|
+ qDebug("setTankinfo: pid keep_time:[%d]", pid_para.keep_time);
|
|
|
|
+
|
|
|
|
+ qDebug("setTankinfo: pid outermax:[%f]", pid_para.outermax);
|
|
|
|
+ qDebug("setTankinfo: pid outermin:[%f]", pid_para.outermin);
|
|
|
|
+ qDebug("setTankinfo: pid outerkp:[%f]", pid_para.outerkp);
|
|
|
|
+ qDebug("setTankinfo: pid outerki:[%f]", pid_para.outerki);
|
|
|
|
+ qDebug("setTankinfo: pid outerkd:[%f]", pid_para.outerkd);
|
|
|
|
+
|
|
|
|
+ qDebug("setTankinfo: pid innermax:[%f]", pid_para.innermax);
|
|
|
|
+ qDebug("setTankinfo: pid innermin:[%f]", pid_para.innermin);
|
|
|
|
+ qDebug("setTankinfo: pid innerkp:[%f]", pid_para.innerkp);
|
|
|
|
+#endif
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -159,6 +177,13 @@ bool TestService::tstart(int compartmentid, int direction)
|
|
emit onNotice(str);
|
|
emit onNotice(str);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(false == m_bRealEnd){
|
|
|
|
+ QString str = "当前有任务还未完全结束...";
|
|
|
|
+ emit onNotice(str);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
m_compartmentid = compartmentid-1;
|
|
m_compartmentid = compartmentid-1;
|
|
|
|
|
|
if(0 == direction)
|
|
if(0 == direction)
|
|
@@ -179,7 +204,7 @@ bool TestService::tstart(int compartmentid, int direction)
|
|
{
|
|
{
|
|
case QMessageBox::Ok:
|
|
case QMessageBox::Ok:
|
|
qDebug()<<"Ok";
|
|
qDebug()<<"Ok";
|
|
- m_pTimer_1->start(1*1000); // 1s
|
|
|
|
|
|
+ m_pTimer_1->start(1*500); // 500 ms
|
|
m_bRunning = true;
|
|
m_bRunning = true;
|
|
start();
|
|
start();
|
|
break;
|
|
break;
|
|
@@ -205,6 +230,12 @@ bool TestService::tselfstart(int compartmentid, int direction)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(false == m_bRealEnd){
|
|
|
|
+ QString str = "当前有任务还未完全结束...";
|
|
|
|
+ emit onNotice(str);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
m_compartmentid = compartmentid-1;
|
|
m_compartmentid = compartmentid-1;
|
|
|
|
|
|
if(0 == direction)
|
|
if(0 == direction)
|
|
@@ -402,12 +433,11 @@ QString TestService::read_PressureValue()
|
|
{
|
|
{
|
|
float pressure = 0.0;
|
|
float pressure = 0.0;
|
|
static int timeout_count =0;
|
|
static int timeout_count =0;
|
|
|
|
+
|
|
PressureSensor ps(&m_SerialUi4);
|
|
PressureSensor ps(&m_SerialUi4);
|
|
if(ps.Read(pressure)){
|
|
if(ps.Read(pressure)){
|
|
-
|
|
|
|
push_pressurelist(pressure);
|
|
push_pressurelist(pressure);
|
|
timeout_count=0;
|
|
timeout_count=0;
|
|
-
|
|
|
|
}else{
|
|
}else{
|
|
|
|
|
|
pressure = calculate_averagepressure();
|
|
pressure = calculate_averagepressure();
|
|
@@ -421,8 +451,9 @@ QString TestService::read_PressureValue()
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- int _ipressure = pressure*100;
|
|
|
|
- pressure = _ipressure/100.0;
|
|
|
|
|
|
+ int _ipressure = pressure*1000;
|
|
|
|
+ _ipressure = (_ipressure/PRESSURE_DIVISION_VALUE)*PRESSURE_DIVISION_VALUE;
|
|
|
|
+ pressure = _ipressure/1000.0;
|
|
|
|
|
|
QString pressure_str = QString("%1").arg(pressure, 4,'f',2,QLatin1Char('0'));
|
|
QString pressure_str = QString("%1").arg(pressure, 4,'f',2,QLatin1Char('0'));
|
|
return pressure_str;
|
|
return pressure_str;
|
|
@@ -449,10 +480,9 @@ QJsonObject TestService::ballvalve_status()
|
|
{
|
|
{
|
|
unsigned char status;
|
|
unsigned char status;
|
|
unsigned short value = 0;
|
|
unsigned short value = 0;
|
|
- QJsonObject rootObj;
|
|
|
|
|
|
|
|
|
|
+ QJsonObject rootObj;
|
|
BallValve ball_v(&m_SerialUi4);
|
|
BallValve ball_v(&m_SerialUi4);
|
|
- ball_v.GetSP(status, value);
|
|
|
|
|
|
|
|
if(ball_v.GetSP(status, value)){
|
|
if(ball_v.GetSP(status, value)){
|
|
switch(status){
|
|
switch(status){
|
|
@@ -505,15 +535,10 @@ void TestService::OnTimer1()
|
|
{
|
|
{
|
|
float pressure = 0.00;
|
|
float pressure = 0.00;
|
|
static int timeout_count =0;
|
|
static int timeout_count =0;
|
|
|
|
+ static int times_count = 0;
|
|
PressureSensor ps(&m_SerialUi4);
|
|
PressureSensor ps(&m_SerialUi4);
|
|
if(ps.Read(pressure)){
|
|
if(ps.Read(pressure)){
|
|
|
|
|
|
- //int _ipressure = pressure*100;
|
|
|
|
- //if(_ipressure<100){
|
|
|
|
- // _ipressure=0;
|
|
|
|
- //}
|
|
|
|
- //pressure = _ipressure/100.0;
|
|
|
|
-
|
|
|
|
push_pressurelist(pressure);
|
|
push_pressurelist(pressure);
|
|
timeout_count=0;
|
|
timeout_count=0;
|
|
}else{
|
|
}else{
|
|
@@ -528,38 +553,40 @@ void TestService::OnTimer1()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- int _ipressure = 0;
|
|
|
|
- //if(pressure >= 4.5){
|
|
|
|
- // _ipressure = pressure*10;
|
|
|
|
- // pressure = _ipressure/10.0;
|
|
|
|
- //}else{
|
|
|
|
- _ipressure = pressure*100;
|
|
|
|
- pressure = _ipressure/100.0;
|
|
|
|
- //}
|
|
|
|
|
|
+ times_count++;
|
|
|
|
|
|
- //int _ipressure = pressure*100;
|
|
|
|
- //pressure = _ipressure/100.0;
|
|
|
|
|
|
+ if(0 == times_count%2){
|
|
|
|
|
|
- QString pressure_str = QString("%1").arg(pressure, 4,'f',2,QLatin1Char('0'));
|
|
|
|
|
|
+ int _ipressure = 0;
|
|
|
|
+
|
|
|
|
+ _ipressure = pressure*1000;
|
|
|
|
+ _ipressure = (_ipressure/PRESSURE_DIVISION_VALUE)*PRESSURE_DIVISION_VALUE;
|
|
|
|
+ pressure = _ipressure/1000.0;
|
|
|
|
|
|
- PressureItem item;
|
|
|
|
- //item.m_pressure = pressure_str;
|
|
|
|
- item.m_testDirection = m_direction;
|
|
|
|
- item.m_testStage = m_stage;
|
|
|
|
- item.m_testStep = m_step;
|
|
|
|
|
|
+ QString pressure_str = QString("%1").arg(pressure, 4,'f',2,QLatin1Char('0'));
|
|
|
|
|
|
- QVariantMap map;
|
|
|
|
- map.clear();
|
|
|
|
|
|
+ PressureItem item;
|
|
|
|
+ //item.m_pressure = pressure_str;
|
|
|
|
+ item.m_testDirection = m_direction;
|
|
|
|
+ item.m_testStage = m_stage;
|
|
|
|
+ item.m_testStep = m_step;
|
|
|
|
|
|
- map.insert("pressure", pressure_str);
|
|
|
|
- map.insert("direction", item.m_testDirection);
|
|
|
|
- map.insert("stage", item.m_testStage);
|
|
|
|
- map.insert("step", item.m_testStep);
|
|
|
|
|
|
+ QVariantMap map;
|
|
|
|
+ map.clear();
|
|
|
|
+
|
|
|
|
+ map.insert("pressure", pressure_str);
|
|
|
|
+ map.insert("direction", item.m_testDirection);
|
|
|
|
+ map.insert("stage", item.m_testStage);
|
|
|
|
+ map.insert("step", item.m_testStep);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //QString pressure_str = QString("%1").arg(pressure, 5,'f',3,QLatin1Char('0'));
|
|
|
|
+ //m_tank.m_comparts[m_compartmentid].m_currentpressure= pressure_str.toFloat();
|
|
|
|
+ emit sigPressure(m_compartmentid+1, map);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- //QString pressure_str = QString("%1").arg(pressure, 5,'f',3,QLatin1Char('0'));
|
|
|
|
- //m_tank.m_comparts[m_compartmentid].m_currentpressure= pressure_str.toFloat();
|
|
|
|
- emit sigPressure(m_compartmentid+1, map);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -578,8 +605,9 @@ void TestService::OnTimer2()
|
|
Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSavedata)
|
|
Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSavedata)
|
|
{
|
|
{
|
|
Ret_Value ret_v = Ret_OK;
|
|
Ret_Value ret_v = Ret_OK;
|
|
|
|
+ int interval_time = 500; // ms
|
|
int count = 0;
|
|
int count = 0;
|
|
- int stable_counts = 0;
|
|
|
|
|
|
+ int delay_count = 0;
|
|
int exceed_times =0;
|
|
int exceed_times =0;
|
|
|
|
|
|
QElapsedTimer timer;
|
|
QElapsedTimer timer;
|
|
@@ -590,8 +618,9 @@ Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSav
|
|
double current_speed = 0;
|
|
double current_speed = 0;
|
|
unsigned char bvstatus;
|
|
unsigned char bvstatus;
|
|
unsigned short bvposition;
|
|
unsigned short bvposition;
|
|
- unsigned short bvoffset = 100;
|
|
|
|
- int holding_time = 60;
|
|
|
|
|
|
+ unsigned short bvoffset = 150;
|
|
|
|
+ int keep_times = 60;
|
|
|
|
+ int stable_count = 0; //稳压计数
|
|
|
|
|
|
PressureSensor ps(&m_SerialUi4);
|
|
PressureSensor ps(&m_SerialUi4);
|
|
BallValve bv(&m_SerialUi4);
|
|
BallValve bv(&m_SerialUi4);
|
|
@@ -603,25 +632,17 @@ Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSav
|
|
PID* pPIDinner = NULL;
|
|
PID* pPIDinner = NULL;
|
|
double speed_target = 0.0;
|
|
double speed_target = 0.0;
|
|
|
|
|
|
- //pPIDouter = new PID(1, 0.2, 0, 0.2, 0, 0);
|
|
|
|
|
|
|
|
- if(expect.volume <= 500){
|
|
|
|
- pPIDouter = new PID(0.5, 0.2, 0, 0.2, 0, 0);
|
|
|
|
- pPIDinner = new PID(0.5, 200, 0, 1000, 50, 20, 50, 2);
|
|
|
|
- holding_time = 30;
|
|
|
|
- }else if(expect.volume <= 5000){
|
|
|
|
- pPIDouter = new PID(1, 0.2, 0, 0.2, 0, 0);
|
|
|
|
- pPIDinner = new PID(1, 900, 0, 3000, 50, 30, 60, 10);
|
|
|
|
- holding_time = 60;
|
|
|
|
- }else if(expect.volume <= 10000){
|
|
|
|
- pPIDouter = new PID(1, 0.2, 0, 0.2, 0, 0);
|
|
|
|
- pPIDinner = new PID(1, 900, 0, 4500, 80, 60, 60, 20);
|
|
|
|
- holding_time = 60;
|
|
|
|
- }else{
|
|
|
|
- pPIDouter = new PID(1, 0.2, 0, 0.2, 0, 0);
|
|
|
|
- pPIDinner = new PID(1, 900, 0, 4500, 40, 60, 50, 20);
|
|
|
|
- holding_time = 30;
|
|
|
|
- }
|
|
|
|
|
|
+ ParaItem pid_para;
|
|
|
|
+ g_CalibrationPara->get_pidPara(expect.volume, pid_para);
|
|
|
|
+
|
|
|
|
+ pPIDouter = new PID(0.5, pid_para.outermax, pid_para.outermin, pid_para.outerkp, 0, 0);
|
|
|
|
+ //pPIDouter = new PID(0.5, pid_para.outermax, pid_para.outermin, pid_para.outerkp, pid_para.outerkd, pid_para.outerki);
|
|
|
|
+ pPIDinner = new PID(0.5, pid_para.innermax, pid_para.innermin, pid_para.innerkp, pid_para.innerkd, pid_para.innerki,pid_para.innermaxI, pid_para.innerIstep, pid_para.innerDstep);
|
|
|
|
+
|
|
|
|
+ //将稳压时间转换成计数
|
|
|
|
+ keep_times = pid_para.keep_time *(1000/interval_time);
|
|
|
|
+
|
|
|
|
|
|
prev_pressure = calculate_averagepressure();
|
|
prev_pressure = calculate_averagepressure();
|
|
|
|
|
|
@@ -657,14 +678,12 @@ Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSav
|
|
if((BALLVALVE_STATUS_OPENEND == bvstatus) || (BALLVALVE_STATUS_CLOSEEND == bvstatus) ){
|
|
if((BALLVALVE_STATUS_OPENEND == bvstatus) || (BALLVALVE_STATUS_CLOSEEND == bvstatus) ){
|
|
int ps_offset = bvoffset;
|
|
int ps_offset = bvoffset;
|
|
int cu_position = bvposition;
|
|
int cu_position = bvposition;
|
|
- if(abs(cu_position-ps_offset) < 10){
|
|
|
|
|
|
+ if(abs(cu_position-ps_offset) <= 10){
|
|
bv_ready=true;
|
|
bv_ready=true;
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
bv.SetPosition(bvoffset);
|
|
bv.SetPosition(bvoffset);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
|
|
|
|
@@ -676,7 +695,9 @@ Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSav
|
|
|
|
|
|
if(current_pressure >= expect.target+0.01){
|
|
if(current_pressure >= expect.target+0.01){
|
|
|
|
|
|
- count++;
|
|
|
|
|
|
+ count = 0;
|
|
|
|
+ stable_count++;
|
|
|
|
+
|
|
if(bOpen_intake){
|
|
if(bOpen_intake){
|
|
|
|
|
|
qDebug(" PositivePressure_Add, in_v.Close ");
|
|
qDebug(" PositivePressure_Add, in_v.Close ");
|
|
@@ -688,81 +709,96 @@ Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSav
|
|
//bOpen_intake = false;
|
|
//bOpen_intake = false;
|
|
}
|
|
}
|
|
|
|
|
|
- if(exceed_times <= 1){
|
|
|
|
- stable_counts = 15;
|
|
|
|
- }else if(2 == exceed_times){
|
|
|
|
- stable_counts =10;
|
|
|
|
|
|
+#if 1
|
|
|
|
+
|
|
|
|
+ if(exceed_times <= 2){
|
|
|
|
+ delay_count = 15*(1000/interval_time);
|
|
|
|
+ }else if(3 == exceed_times){
|
|
|
|
+ delay_count =10*(1000/interval_time);
|
|
}else{
|
|
}else{
|
|
- stable_counts =5;
|
|
|
|
|
|
+ delay_count =5*(1000/interval_time);
|
|
}
|
|
}
|
|
|
|
|
|
- //stable_counts = 15;
|
|
|
|
-
|
|
|
|
- //系统自测及容积较小时,球阀最好归零,否则因球阀不太紧漏气, 进气阀与球阀之间的气体会压向系统,导致压力升高
|
|
|
|
- //当容器过大时, 如果压力超出后又降下来或系统存在漏气,需要重新加压,设置 bvoffset,能让重新加压速度快起来。
|
|
|
|
- if(expect.volume < 100){
|
|
|
|
- if(bv.SetPosition(0))
|
|
|
|
- bvposition = 0;
|
|
|
|
- qDebug(" PositivePressure_Add, bv.SetPosition 0");
|
|
|
|
- }else {
|
|
|
|
- if(bvoffset != bvposition){
|
|
|
|
- if(bv.SetPosition(bvoffset))
|
|
|
|
- bvposition = bvoffset;
|
|
|
|
- qDebug(" PositivePressure_Add, bv.SetPosition bvoffset");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
|
|
|
|
|
+ // stable_count 需要从第一次超出目标压力时,开始增加
|
|
|
|
+ if(stable_count > 0) stable_count++;
|
|
|
|
+
|
|
if(current_pressure >= expect.target && current_pressure < expect.target + 0.01){
|
|
if(current_pressure >= expect.target && current_pressure < expect.target + 0.01){
|
|
count++;
|
|
count++;
|
|
|
|
+
|
|
|
|
+ if(((false == bOpen_intake) && count >=10*(1000/interval_time))||((stable_count > keep_times)&&(false == bOpen_intake))){
|
|
|
|
+ count = keep_times+10;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(false == bOpen_intake){
|
|
|
|
+ //在进气阀关闭,压力回落过程中,两种情况触发加压过程退出
|
|
|
|
+ // 1. 压力值连续10秒都没有下降0.01Kpa, 说明压力基本稳定了
|
|
|
|
+ // 2. 计数超出稳压所需计数
|
|
|
|
+
|
|
|
|
+ if((count >=10*(1000/interval_time)) || (stable_count > keep_times) ){
|
|
|
|
+ count = keep_times+10;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 进行阀门密闭性测试,加压过程中。 只要加压到目标压力就退出
|
|
|
|
+ if(m_stage == Test_Stage_ValveTest){
|
|
|
|
+ count = keep_times+10;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
count=0;
|
|
count=0;
|
|
|
|
|
|
- if(stable_counts > 0){
|
|
|
|
- stable_counts--;
|
|
|
|
|
|
+ if(delay_count > 0){
|
|
|
|
+ delay_count--;
|
|
}
|
|
}
|
|
|
|
|
|
- if(false == bOpen_intake && 0 == stable_counts){
|
|
|
|
|
|
+ if(false == bOpen_intake && 0 == delay_count){
|
|
bOpen_intake = in_v.Open();
|
|
bOpen_intake = in_v.Open();
|
|
qDebug(" PositivePressure_Add, in_v.Open 222 ");
|
|
qDebug(" PositivePressure_Add, in_v.Open 222 ");
|
|
pPIDinner->reset();
|
|
pPIDinner->reset();
|
|
|
|
+ if(bv.SetPosition(bvoffset))
|
|
|
|
+ bvposition = bvoffset;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if(NULL != pPIDouter && NULL != pPIDinner && 0 == stable_counts){
|
|
|
|
|
|
+ if(NULL != pPIDouter && NULL != pPIDinner && 0 == delay_count){
|
|
|
|
|
|
- speed_target = pPIDouter->calculate(expect.target+0.01, current_pressure);
|
|
|
|
|
|
+ speed_target = pPIDouter->calculate(expect.target, current_pressure);
|
|
|
|
|
|
- qDebug(" PositivePressure_Add, pPIDinner speed_target:%f, current_speed:%f", speed_target, current_speed);
|
|
|
|
- double inc = pPIDinner->calculate(speed_target, current_speed);
|
|
|
|
|
|
+ qDebug(" PositivePressure_Add, pPIDinner speed_target:%f, current_speed:%f", speed_target, current_speed);
|
|
|
|
+ double inc = pPIDinner->calculate(speed_target, current_speed);
|
|
|
|
|
|
- unsigned short position = bvoffset +inc;
|
|
|
|
|
|
+ unsigned short position = bvoffset +inc;
|
|
|
|
|
|
- //qDebug(" PositivePressure_Add, position : %d", position);
|
|
|
|
- if(bvposition != position){
|
|
|
|
- qDebug(" PositivePressure_Add, position : %d", position);
|
|
|
|
- if(bv.SetPosition(position))
|
|
|
|
- bvposition = position;
|
|
|
|
- }
|
|
|
|
|
|
+ //qDebug(" PositivePressure_Add, position : %d", position);
|
|
|
|
+ if(bvposition != position){
|
|
|
|
+ qDebug(" PositivePressure_Add, position : %d", position);
|
|
|
|
+ if(bv.SetPosition(position))
|
|
|
|
+ bvposition = position;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- }else{
|
|
|
|
|
|
+ }else{
|
|
|
|
|
|
- if(0 == stable_counts){
|
|
|
|
- qDebug(" PositivePressure_Add, NULL = pPIDouter NULL == pPIDinner ");
|
|
|
|
|
|
+ if(0 == delay_count){
|
|
|
|
+ qDebug(" PositivePressure_Add, NULL = pPIDouter NULL == pPIDinner ");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //qDebug(" PositivePressure_Add, NULL = pPIDouter NULL == pPIDinner ");
|
|
}
|
|
}
|
|
|
|
|
|
- //qDebug(" PositivePressure_Add, NULL = pPIDouter NULL == pPIDinner ");
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if(count >= holding_time){ //about 60s
|
|
|
|
|
|
+ if(count >= keep_times){ //about 60s
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -785,7 +821,7 @@ Ret_Value TestService::PositivePressure_Add(const TestExpect& expect, bool bSav
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- QThread::msleep(500);
|
|
|
|
|
|
+ QThread::msleep(interval_time);
|
|
|
|
|
|
int remainingtime = expect.timeout*1000 - timer.elapsed();
|
|
int remainingtime = expect.timeout*1000 - timer.elapsed();
|
|
if(remainingtime <= 0){
|
|
if(remainingtime <= 0){
|
|
@@ -993,6 +1029,7 @@ Ret_Value TestService::Pressure_Relief(const TestExpect& expect)
|
|
Valve vent_v(&m_SerialUi3, VALVE_VENT);
|
|
Valve vent_v(&m_SerialUi3, VALVE_VENT);
|
|
|
|
|
|
float current_pressure;
|
|
float current_pressure;
|
|
|
|
+ float last_pressure = calculate_averagepressure();
|
|
|
|
|
|
QElapsedTimer timer;
|
|
QElapsedTimer timer;
|
|
timer.start();
|
|
timer.start();
|
|
@@ -1000,6 +1037,7 @@ Ret_Value TestService::Pressure_Relief(const TestExpect& expect)
|
|
|
|
|
|
//打开泄压阀
|
|
//打开泄压阀
|
|
bOpen_ventv = vent_v.Open();
|
|
bOpen_ventv = vent_v.Open();
|
|
|
|
+ //last_pressure = calculate_averagepressure();
|
|
|
|
|
|
//等待压力清零
|
|
//等待压力清零
|
|
while(m_bRunning){
|
|
while(m_bRunning){
|
|
@@ -1010,19 +1048,18 @@ Ret_Value TestService::Pressure_Relief(const TestExpect& expect)
|
|
|
|
|
|
current_pressure = calculate_averagepressure();
|
|
current_pressure = calculate_averagepressure();
|
|
|
|
|
|
- if(current_pressure <= 0.02){
|
|
|
|
|
|
+
|
|
|
|
+ if(fabs(current_pressure - last_pressure) <= 0.01){
|
|
qDebug(" Pressure_Relief 111 finished");
|
|
qDebug(" Pressure_Relief 111 finished");
|
|
count++;
|
|
count++;
|
|
}else{
|
|
}else{
|
|
count=0;
|
|
count=0;
|
|
}
|
|
}
|
|
|
|
|
|
- if(count > 10){
|
|
|
|
-
|
|
|
|
|
|
+ if((count > 5) ||(current_pressure < 0.01)){
|
|
//关闭泄压阀
|
|
//关闭泄压阀
|
|
- if(vent_v.Close()){
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ vent_v.Close();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
QThread::msleep(1000);
|
|
QThread::msleep(1000);
|
|
@@ -1079,7 +1116,7 @@ Ret_Value TestService::Pressure_Relief()
|
|
count=0;
|
|
count=0;
|
|
}
|
|
}
|
|
|
|
|
|
- if(count > 5){
|
|
|
|
|
|
+ if(count > 0){
|
|
//关闭泄压阀
|
|
//关闭泄压阀
|
|
vent_v.Close();
|
|
vent_v.Close();
|
|
break;
|
|
break;
|
|
@@ -1088,7 +1125,7 @@ Ret_Value TestService::Pressure_Relief()
|
|
|
|
|
|
QThread::msleep(1000);
|
|
QThread::msleep(1000);
|
|
|
|
|
|
- int remainingtime = 200*1000 - timer.elapsed();
|
|
|
|
|
|
+ int remainingtime = 60*1000 - timer.elapsed();
|
|
if(remainingtime < 0){
|
|
if(remainingtime < 0){
|
|
ret_v = Ret_Timeout;
|
|
ret_v = Ret_Timeout;
|
|
qDebug("timeout, Pressure_Relief Timeout");
|
|
qDebug("timeout, Pressure_Relief Timeout");
|
|
@@ -1110,8 +1147,8 @@ Ret_Value TestService::Pressure_Keep(int keeptime, float& start_value, float& e
|
|
Ret_Value ret_v = Ret_OK;
|
|
Ret_Value ret_v = Ret_OK;
|
|
|
|
|
|
start_value = calculate_averagepressure();
|
|
start_value = calculate_averagepressure();
|
|
- int _ipressure = start_value*10;
|
|
|
|
- start_value = _ipressure/10.0;
|
|
|
|
|
|
+ int _ipressure = start_value*100;
|
|
|
|
+ start_value = _ipressure/100.0;
|
|
|
|
|
|
while((count < keeptime) && m_bRunning){
|
|
while((count < keeptime) && m_bRunning){
|
|
QThread::msleep(1000);
|
|
QThread::msleep(1000);
|
|
@@ -1120,8 +1157,8 @@ Ret_Value TestService::Pressure_Keep(int keeptime, float& start_value, float& e
|
|
|
|
|
|
end_value = calculate_averagepressure();
|
|
end_value = calculate_averagepressure();
|
|
|
|
|
|
- _ipressure = end_value*10;
|
|
|
|
- end_value = _ipressure/10.0;
|
|
|
|
|
|
+ _ipressure = end_value*100;
|
|
|
|
+ end_value = _ipressure/100.0;
|
|
|
|
|
|
|
|
|
|
if(!m_bRunning){
|
|
if(!m_bRunning){
|
|
@@ -1235,14 +1272,16 @@ void TestService::run()
|
|
{
|
|
{
|
|
qDebug("doTest >>>enter ");
|
|
qDebug("doTest >>>enter ");
|
|
QString notice_str;
|
|
QString notice_str;
|
|
- QElapsedTimer q_time;
|
|
|
|
|
|
+ //QElapsedTimer q_time;
|
|
int ret_btn = QMessageBox::NoButton;
|
|
int ret_btn = QMessageBox::NoButton;
|
|
TestExpect texpect;
|
|
TestExpect texpect;
|
|
bool bQuit = false;
|
|
bool bQuit = false;
|
|
|
|
|
|
- q_time.start();
|
|
|
|
|
|
+ //q_time.start();
|
|
Ret_Value ret_v = Ret_OK;
|
|
Ret_Value ret_v = Ret_OK;
|
|
|
|
|
|
|
|
+ m_bRealEnd = false;
|
|
|
|
+
|
|
if(m_compartmentid >= 0){
|
|
if(m_compartmentid >= 0){
|
|
|
|
|
|
if(m_direction == Test_Direction_Positive){
|
|
if(m_direction == Test_Direction_Positive){
|
|
@@ -1404,6 +1443,14 @@ void TestService::run()
|
|
|
|
|
|
ret_v = Pressure_Keep(5*60, start_value, end_value);
|
|
ret_v = Pressure_Keep(5*60, start_value, end_value);
|
|
|
|
|
|
|
|
+ float offset = 0;
|
|
|
|
+ //修正 强制初始压力为 0
|
|
|
|
+ if(start_value != 0.0){
|
|
|
|
+ offset = start_value;
|
|
|
|
+ start_value = 0.0;
|
|
|
|
+ end_value -= offset;
|
|
|
|
+ }
|
|
|
|
+
|
|
m_tank.m_comparts[m_compartmentid].m_result.valvestart_pressure = start_value;
|
|
m_tank.m_comparts[m_compartmentid].m_result.valvestart_pressure = start_value;
|
|
m_tank.m_comparts[m_compartmentid].m_result.valveend_pressure = end_value;
|
|
m_tank.m_comparts[m_compartmentid].m_result.valveend_pressure = end_value;
|
|
|
|
|
|
@@ -1431,8 +1478,6 @@ void TestService::run()
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case Test_Step_reliefPressure:
|
|
case Test_Step_reliefPressure:
|
|
@@ -1445,7 +1490,7 @@ void TestService::run()
|
|
|
|
|
|
texpect.volume = 0;
|
|
texpect.volume = 0;
|
|
texpect.target = 0.0;
|
|
texpect.target = 0.0;
|
|
- texpect.timeout = 120;//m_tank.m_comparts[m_compartmentid].get_adjust_timeout();
|
|
|
|
|
|
+ texpect.timeout = 60;//m_tank.m_comparts[m_compartmentid].get_adjust_timeout();
|
|
ret_v = Pressure_Relief(texpect);
|
|
ret_v = Pressure_Relief(texpect);
|
|
if(Ret_Exit == ret_v){
|
|
if(Ret_Exit == ret_v){
|
|
bQuit = true;
|
|
bQuit = true;
|
|
@@ -1540,8 +1585,8 @@ void TestService::run()
|
|
|
|
|
|
texpect.volume = 0;
|
|
texpect.volume = 0;
|
|
texpect.target = 4.50;
|
|
texpect.target = 4.50;
|
|
- texpect.timeout = 3*60; //5分钟
|
|
|
|
- ret_v = PositivePressure_Add(texpect, true);
|
|
|
|
|
|
+ texpect.timeout = 3*60; //3分钟
|
|
|
|
+ ret_v = PositivePressure_Add(texpect);
|
|
|
|
|
|
if(Ret_Exit == ret_v){
|
|
if(Ret_Exit == ret_v){
|
|
bQuit = true;
|
|
bQuit = true;
|
|
@@ -1692,7 +1737,8 @@ void TestService::run()
|
|
Valve all_v(&m_SerialUi3, ALL_VALVE);
|
|
Valve all_v(&m_SerialUi3, ALL_VALVE);
|
|
all_v.Close();
|
|
all_v.Close();
|
|
|
|
|
|
- dump_comstatistic();
|
|
|
|
|
|
+ //dump_comstatistic();
|
|
|
|
+ m_bRealEnd = true;
|
|
|
|
|
|
|
|
|
|
qDebug("doTest >>>leave ");
|
|
qDebug("doTest >>>leave ");
|