|
|
@ -22,54 +22,26 @@ using namespace std; |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
#define PRE_HEAT_TIME (5 * 60)
|
|
|
|
#define PRE_HEAT_TIME (2)
|
|
|
|
#define DVALUE_COMPUTEPERIOD_TIME_S (60.0)
|
|
|
|
#define MAX_VOLUME (5000)
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::drainingPump_open() { m_zcanHost->pumpctrl_c1004(1, 100, -300, 1, 20); } |
|
|
|
void DisinfectionCtrlService::drainingPump_close() { m_zcanHost->pumpctrl_c1004(1, 100, 0, 1, 20); } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::replenishingFluidsPump_open() { m_zcanHost->pumpctrl_c1004(1, 100, 300, 1, 20); } |
|
|
|
void DisinfectionCtrlService::replenishingFluidsPump_close() { m_zcanHost->pumpctrl_c1004(1, 100, 0, 1, 20); } |
|
|
|
DisinfectionCtrlService::DisinfectionCtrlService() {} |
|
|
|
void DisinfectionCtrlService::initialize() { |
|
|
|
GET_TO_SERVICE(m_zcanHost); |
|
|
|
GET_TO_SERVICE(m_deviceIoControlService); |
|
|
|
GET_TO_SERVICE(m_dbService); |
|
|
|
GET_TO_SERVICE(m_disinfectionLogsManager); |
|
|
|
|
|
|
|
void DisinfectionCtrlService::sprayLiquidPump_open() { m_zcanHost->pumpctrl_c1004(2, 100, 200, 1, 15); } |
|
|
|
void DisinfectionCtrlService::sprayLiquidPump_close() { m_zcanHost->pumpctrl_c1004(2, 100, 0, 1, 15); } |
|
|
|
m_deviceIoControlService->drainingPump_close(); |
|
|
|
m_deviceIoControlService->replenishingFluidsPump_close(); |
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
|
|
|
|
void DisinfectionCtrlService::airCompressor(bool val) { |
|
|
|
if (val) { |
|
|
|
m_zcanHost->writeio(0, 1); |
|
|
|
usleep(500 * 100); |
|
|
|
m_zcanHost->writeio(1, 1); |
|
|
|
} else { |
|
|
|
m_zcanHost->writeio(1, 0); |
|
|
|
usleep(500 * 100); |
|
|
|
m_zcanHost->writeio(0, 0); |
|
|
|
} |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(false); |
|
|
|
m_deviceIoControlService->AirBlower_setState(false); |
|
|
|
m_deviceIoControlService->airCompressor_setState(false); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::blower_setPower(bool val) { |
|
|
|
if (val) { |
|
|
|
m_zcanHost->writeio(2, 1); |
|
|
|
usleep(500 * 100); |
|
|
|
m_zcanHost->writeio(3, 1); |
|
|
|
} else { |
|
|
|
m_zcanHost->writeio(3, 0); |
|
|
|
usleep(500 * 100); |
|
|
|
m_zcanHost->writeio(2, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::heartingPlate_setPower(bool val) { |
|
|
|
if (val) { |
|
|
|
m_zcanHost->writeio(4, 1); |
|
|
|
usleep(500 * 100); |
|
|
|
m_zcanHost->writeio(5, 1); |
|
|
|
} else { |
|
|
|
m_zcanHost->writeio(5, 0); |
|
|
|
usleep(500 * 100); |
|
|
|
m_zcanHost->writeio(4, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
DisinfectionCtrlService::DisinfectionCtrlService() {} |
|
|
|
|
|
|
|
string DisinfectionCtrlService::createDisinfectionID() { |
|
|
|
struct tm tm = {0}; |
|
|
|
|
|
|
@ -91,86 +63,242 @@ string DisinfectionCtrlService::createDisinfectionID() { |
|
|
|
tm.tm_hour, //
|
|
|
|
tm.tm_min, tm.tm_sec); |
|
|
|
} |
|
|
|
float DisinfectionCtrlService::getDisinfectionDValue(float ppm) { |
|
|
|
/**
|
|
|
|
* @brief |
|
|
|
* |
|
|
|
* D值的计算公式是根据美国竞品的数据记录计算得来的 |
|
|
|
* |
|
|
|
* 浓度小于150时,y=-0.5269X+97.868 |
|
|
|
* 浓度大于150时,y=-0.1405X+40.369 |
|
|
|
*/ |
|
|
|
|
|
|
|
float dvalue = 0; |
|
|
|
|
|
|
|
if (ppm < 150) { |
|
|
|
dvalue = -0.5269 * ppm + 97.868; |
|
|
|
} else if (ppm >= 150 || ppm < 300) { |
|
|
|
dvalue = -0.1405 * ppm + 40.369; |
|
|
|
} |
|
|
|
if (dvalue < 2) { |
|
|
|
dvalue = 2; |
|
|
|
} |
|
|
|
return dvalue; |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::initialize() { |
|
|
|
GET_TO_SERVICE(m_zcanHost); |
|
|
|
GET_TO_SERVICE(m_sensorDataScan); |
|
|
|
void DisinfectionCtrlService::computeRemainTime(DisinfectionContext& context) { |
|
|
|
/**
|
|
|
|
* @brief 计算Dvalue |
|
|
|
*/ |
|
|
|
float dvalue = getDisinfectionDValue(context.h2o2data.min_h2o2); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 计算 m_nowLoglevel |
|
|
|
*/ |
|
|
|
context.m_nowLoglevel += DVALUE_COMPUTEPERIOD_TIME_S / (dvalue * 60); |
|
|
|
if (context.m_targetLoglevel >= context.m_nowLoglevel) { |
|
|
|
context.m_remaintime = (context.m_targetLoglevel - context.m_nowLoglevel) * (dvalue * 60); |
|
|
|
} else { |
|
|
|
context.m_remaintime = 0; |
|
|
|
} |
|
|
|
logger->info("computeRemainTime minh2o2 {} dvalue {}", context.h2o2data.min_h2o2, dvalue); |
|
|
|
} |
|
|
|
|
|
|
|
drainingPump_close(); |
|
|
|
replenishingFluidsPump_close(); |
|
|
|
sprayLiquidPump_close(); |
|
|
|
void DisinfectionCtrlService::initContext(DisinfectionContext& context, int loglevel, float roomVol) { |
|
|
|
context.m_disinfectionID = createDisinfectionID(); |
|
|
|
// m_remaintime = loglevel * 20 * 60; // 计算总的加热时间
|
|
|
|
context.m_remaintime = PRE_HEAT_TIME + loglevel * 20 * 60 * (roomVol / 20.0); // 计算总的加热时间
|
|
|
|
m_disinfectionWorkState = 1; |
|
|
|
context.m_targetLoglevel = loglevel; |
|
|
|
context.m_nowLoglevel = 0; |
|
|
|
context.m_loglevel = loglevel; |
|
|
|
context.m_roomvol = roomVol; |
|
|
|
|
|
|
|
context.stoped_gs = m_dbService->getSettingVal("stoped_gs"); |
|
|
|
context.continued_gs = m_dbService->getSettingVal("continued_gs"); |
|
|
|
context.stoped_satur = m_dbService->getSettingVal("stoped_satur"); |
|
|
|
context.continued_satur = m_dbService->getSettingVal("continued_satur"); |
|
|
|
|
|
|
|
m_context.m_starttp = zsteady_clock().now(); |
|
|
|
logger->info("startDisinfection {} {} {}", m_context.m_loglevel, m_context.m_roomvol, m_context.m_disinfectionID); |
|
|
|
logger->info(" stoped_gs {}", context.stoped_gs); |
|
|
|
logger->info(" continued_gs {}", context.continued_gs); |
|
|
|
logger->info(" stoped_satur {}", context.stoped_satur); |
|
|
|
logger->info(" continued_satur {}", context.continued_satur); |
|
|
|
logger->info(""); |
|
|
|
|
|
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 1, 0); |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
|
context.csvlogger = m_disinfectionLogsManager->createNewLogger(context.m_disinfectionID); |
|
|
|
context.csvlogger->write("time,h2o21,temp1,humi1,saturation1,h2o22,temp2,humi2,saturation2,h2o23,temp3,humi3,saturation3,dvalue,nowlog,targetlog,remaintime"); |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
|
context.m_remaintime = 0; |
|
|
|
logger->info("stop disinfection {}", context.m_disinfectionID); |
|
|
|
|
|
|
|
// sprayLiquidPump_close();
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
|
// airCompressor(false);
|
|
|
|
m_deviceIoControlService->airCompressor_setState(false); |
|
|
|
usleep(1000 * 1000); |
|
|
|
// blower_setPower(false);
|
|
|
|
m_deviceIoControlService->AirBlower_setState(false); |
|
|
|
usleep(1000 * 1000); |
|
|
|
// heartingPlate_setPower(false);
|
|
|
|
m_deviceIoControlService->heartingPlate_setPower(false); |
|
|
|
m_disinfectionWorkState = 3; |
|
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 0, 0); |
|
|
|
context.csvlogger = nullptr; |
|
|
|
} |
|
|
|
|
|
|
|
heartingPlate_setPower(false); |
|
|
|
blower_setPower(false); |
|
|
|
airCompressor(false); |
|
|
|
void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) { |
|
|
|
if (context.m_preheatFlag && zsteady_clock().elapsedTimeS(context.m_starttp) > PRE_HEAT_TIME) { |
|
|
|
logger->info("preheat finished {}", context.m_disinfectionID); |
|
|
|
// blower_setPower(true);
|
|
|
|
m_deviceIoControlService->AirBlower_setState(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|
// airCompressor(true);
|
|
|
|
m_deviceIoControlService->airCompressor_setState(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|
// sprayLiquidPump_open();
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_open(); |
|
|
|
context.m_preheatFlag = false; |
|
|
|
context.sprayLiquidFlag = true; |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::dumpDisinfectionLogs(DisinfectionContext& context) { |
|
|
|
logger->info("T:{},h2o21:{},t1:{},humi:{},s1:{},h2o22:{},t2:{},humi2:{},s2:{},h2o23:{},t3:{},humi3:{},s3:{},dvalue:{},nowlog:{},targetlog:{},remaintime:{}", |
|
|
|
zsteady_clock().elapsedTimeS(m_context.m_starttp), //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].h2o2, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].temp, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].humid, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].saturation, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].h2o2, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].temp, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].humid, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].saturation, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].h2o2, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].temp, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].humid, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].saturation, //
|
|
|
|
m_context.dvalue, //
|
|
|
|
m_context.m_nowLoglevel, //
|
|
|
|
m_context.m_targetLoglevel, //
|
|
|
|
m_context.m_remaintime //
|
|
|
|
); |
|
|
|
|
|
|
|
context.csvlogger->write(fmt::format("{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}", |
|
|
|
zsteady_clock().elapsedTimeS(m_context.m_starttp), //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].h2o2, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].temp, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].humid, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[0].saturation, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].h2o2, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].temp, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].humid, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[1].saturation, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].h2o2, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].temp, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].humid, //
|
|
|
|
m_context.h2o2data.h2o2sensor_data[2].saturation, //
|
|
|
|
m_context.dvalue, //
|
|
|
|
m_context.m_nowLoglevel, //
|
|
|
|
m_context.m_targetLoglevel, //
|
|
|
|
m_context.m_remaintime //
|
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& context) { |
|
|
|
/**
|
|
|
|
* @brief 读取传感器数值 |
|
|
|
*/ |
|
|
|
m_deviceIoControlService->getAllSensorData(m_context.h2o2data); |
|
|
|
|
|
|
|
if (zsteady_clock().elapsedTimeS(m_context.m_lastComputeDvalueTp) > DVALUE_COMPUTEPERIOD_TIME_S) { |
|
|
|
m_context.m_lastComputeDvalueTp = zsteady_clock().now(); |
|
|
|
/**
|
|
|
|
* @brief 周期性计算剩余时间 |
|
|
|
*/ |
|
|
|
computeRemainTime(m_context); |
|
|
|
} |
|
|
|
|
|
|
|
dumpDisinfectionLogs(m_context); |
|
|
|
/**
|
|
|
|
* @brief 根据湿度启停喷雾 |
|
|
|
*/ |
|
|
|
if (m_context.sprayLiquidFlag) { |
|
|
|
/**
|
|
|
|
* @brief 检查当前 |
|
|
|
*/ |
|
|
|
float nowSatur = m_context.h2o2data.max_saturation; |
|
|
|
float nowh2o2 = m_context.h2o2data.max_h2o2; |
|
|
|
float humid = m_context.h2o2data.max_humid; |
|
|
|
|
|
|
|
if (nowSatur > m_context.stoped_satur || nowh2o2 > m_context.stoped_gs || humid > m_context.stoped_satur) { |
|
|
|
logger->info("stop sprayLiquid"); |
|
|
|
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(false); |
|
|
|
|
|
|
|
m_context.sprayLiquidFlag = false; |
|
|
|
} |
|
|
|
} else { |
|
|
|
float nowSatur = m_context.h2o2data.max_saturation; |
|
|
|
float nowh2o2 = m_context.h2o2data.max_h2o2; |
|
|
|
float humid = m_context.h2o2data.max_humid; |
|
|
|
|
|
|
|
if (nowSatur < m_context.continued_satur && nowh2o2 < m_context.continued_gs && humid < m_context.continued_satur) { |
|
|
|
logger->info("start sprayLiquid"); |
|
|
|
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_open(); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(true); |
|
|
|
|
|
|
|
m_context.sprayLiquidFlag = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::startDisinfection(int loglevel, float roomVol) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @TODO |
|
|
|
* 检查当前环境湿度,湿度过大,不允许消毒 |
|
|
|
*/ |
|
|
|
|
|
|
|
if (m_disinfectionThread) { |
|
|
|
stopDisinfection(); |
|
|
|
} |
|
|
|
initContext(m_context, loglevel, roomVol); |
|
|
|
|
|
|
|
m_disinfectionID = createDisinfectionID(); |
|
|
|
// m_remaintime = loglevel * 20 * 60; // 计算总的加热时间
|
|
|
|
m_remaintime = PRE_HEAT_TIME + loglevel * 20 * 60 * (roomVol / 20.0); // 计算总的加热时间
|
|
|
|
m_disinfectionWorkState = 1; |
|
|
|
|
|
|
|
m_disinfectionThread.reset(new Thread("m_disinfectionThread", [this, roomVol, loglevel]() { |
|
|
|
m_disinfectionThread.reset(new Thread("m_disinfectionThread", [this]() { |
|
|
|
ThisThread thisThread; |
|
|
|
// bool preHeartFinishedFlag = false;
|
|
|
|
|
|
|
|
logger->info("startDisinfection {} {} {}", loglevel, roomVol, m_disinfectionID); |
|
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 1, 1, 1, 0); |
|
|
|
|
|
|
|
auto starttime = zsteady_clock().now(); |
|
|
|
heartingPlate_setPower(true); |
|
|
|
m_preheatFlag = 1; |
|
|
|
while (!thisThread.getExitFlag()) { |
|
|
|
thisThread.sleepForMs(1000); |
|
|
|
if (m_disinfectionWorkState == 2) { |
|
|
|
logger->info("disinfection paused {} {}", m_disinfectionID, m_remaintime); |
|
|
|
continue; |
|
|
|
} |
|
|
|
logger->info("disinfection running {} {}s preheatFlag:{}", m_context.m_disinfectionID, m_context.m_remaintime, m_context.m_preheatFlag); |
|
|
|
|
|
|
|
m_remaintime--; |
|
|
|
if (m_remaintime == 0) { |
|
|
|
logger->info("disinfection finished {}", m_disinfectionID); |
|
|
|
break; |
|
|
|
if (m_context.m_preheatFlag) { |
|
|
|
processPreheatState(m_context); |
|
|
|
} else { |
|
|
|
processDisinfectionState(m_context); |
|
|
|
} |
|
|
|
|
|
|
|
logger->info("disinfection running {} {}s preheatFlag:{}", m_disinfectionID, m_remaintime, m_preheatFlag); |
|
|
|
|
|
|
|
if (m_preheatFlag && zsteady_clock().elapsedTimeS(starttime) > PRE_HEAT_TIME) { |
|
|
|
logger->info("preheat finished {}", m_disinfectionID); |
|
|
|
blower_setPower(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|
airCompressor(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|
sprayLiquidPump_open(); |
|
|
|
m_preheatFlag = false; |
|
|
|
m_context.m_remaintime--; |
|
|
|
if (m_context.m_remaintime == 0) { |
|
|
|
logger->info("disinfection finished {}", m_context.m_disinfectionID); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_remaintime = 0; |
|
|
|
logger->info("stop disinfection {}", m_disinfectionID); |
|
|
|
|
|
|
|
sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
|
airCompressor(false); |
|
|
|
usleep(1000 * 1000); |
|
|
|
blower_setPower(false); |
|
|
|
usleep(1000 * 1000); |
|
|
|
heartingPlate_setPower(false); |
|
|
|
m_disinfectionWorkState = 3; |
|
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 0, 0); |
|
|
|
finishDisinfection(m_context); |
|
|
|
})); |
|
|
|
//
|
|
|
|
} |
|
|
|
|
|
|
|
int DisinfectionCtrlService::getDisinfectionWorkState() { return m_disinfectionWorkState; } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::pauseDisinfection() { m_disinfectionWorkState = 2; } |
|
|
|
void DisinfectionCtrlService::continueDisinfection() { m_disinfectionWorkState = 1; } |
|
|
|
void DisinfectionCtrlService::stopDisinfection() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
if (m_disinfectionThread) { |
|
|
@ -182,21 +310,31 @@ void DisinfectionCtrlService::stopDisinfection() { |
|
|
|
|
|
|
|
int32_t DisinfectionCtrlService::getEstimatedRemainingTimeS() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
return m_remaintime; |
|
|
|
return m_context.m_remaintime; |
|
|
|
} |
|
|
|
string DisinfectionCtrlService::getDisinfectionID() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
return m_disinfectionID; |
|
|
|
return m_context.m_disinfectionID; |
|
|
|
} |
|
|
|
|
|
|
|
// 加液
|
|
|
|
int DisinfectionCtrlService::getReplenishingFluidsWorkState() { return m_replenishingFluidsWorkState; } |
|
|
|
int DisinfectionCtrlService::getDrainingWorkState() { return m_drainingWorkState; } |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* // 加液 *
|
|
|
|
*******************************************************************************/ |
|
|
|
/**
|
|
|
|
* @brief 开始加液 |
|
|
|
* |
|
|
|
* @param stopatg |
|
|
|
*/ |
|
|
|
void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
if (m_disinfectionThread) { |
|
|
|
m_disinfectionThread->join(); |
|
|
|
m_disinfectionThread = nullptr; |
|
|
|
} |
|
|
|
int32_t nowvolume = m_sensorDataScan->getDisinfectantVolume_g(); |
|
|
|
int32_t nowvolume = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
|
if (nowvolume > stopatg) { |
|
|
|
logger->warn("start Replenishing fail, nowvolume {} > stopatg {}", nowvolume, stopatg); |
|
|
|
return; |
|
|
@ -204,16 +342,16 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
|
|
|
|
m_disinfectionThread.reset(new Thread("disinfectionThread", [this, stopatg]() { |
|
|
|
ThisThread thisThread; |
|
|
|
replenishingFluidsPump_open(); |
|
|
|
m_deviceIoControlService->replenishingFluidsPump_open(); |
|
|
|
logger->info("startReplenishingFluids {}g", stopatg); |
|
|
|
while (!thisThread.getExitFlag()) { |
|
|
|
int32_t nowvolume = m_sensorDataScan->getDisinfectantVolume_g(); |
|
|
|
int32_t nowvolume = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
|
logger->info("replenishingFluids {}g", nowvolume); |
|
|
|
if (nowvolume > stopatg) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if (nowvolume > 5000) { |
|
|
|
if (nowvolume > MAX_VOLUME) { |
|
|
|
logger->warn("replenishingFluids reach full level {}g", nowvolume); |
|
|
|
break; |
|
|
|
} |
|
|
@ -221,7 +359,8 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
thisThread.sleepForMs(1000); |
|
|
|
} |
|
|
|
logger->info("stopReplenishingFluids"); |
|
|
|
replenishingFluidsPump_close(); |
|
|
|
// replenishingFluidsPump_close();
|
|
|
|
m_deviceIoControlService->replenishingFluidsPump_close(); |
|
|
|
m_replenishingFluidsWorkState = 0; |
|
|
|
})); |
|
|
|
|
|
|
@ -229,7 +368,10 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
m_replenishingFluidsWorkState = 1; |
|
|
|
logger->info("startReplenishingFluids "); |
|
|
|
} |
|
|
|
// 停止加液
|
|
|
|
/**
|
|
|
|
* @brief 停止加液 |
|
|
|
* |
|
|
|
*/ |
|
|
|
void DisinfectionCtrlService::stopReplenishingFluids() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
if (m_disinfectionThread) { |
|
|
@ -238,10 +380,17 @@ void DisinfectionCtrlService::stopReplenishingFluids() { |
|
|
|
} |
|
|
|
|
|
|
|
logger->info("stopReplenishingFluids"); |
|
|
|
replenishingFluidsPump_close(); |
|
|
|
// replenishingFluidsPump_close();
|
|
|
|
m_deviceIoControlService->replenishingFluidsPump_close(); |
|
|
|
m_replenishingFluidsWorkState = 0; |
|
|
|
} |
|
|
|
// 开始排液
|
|
|
|
/*******************************************************************************
|
|
|
|
* 排液 * |
|
|
|
*******************************************************************************/ |
|
|
|
/**
|
|
|
|
* @brief 开始排液 |
|
|
|
* |
|
|
|
*/ |
|
|
|
void DisinfectionCtrlService::startDraining() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
if (m_disinfectionThread) { |
|
|
@ -250,10 +399,13 @@ void DisinfectionCtrlService::startDraining() { |
|
|
|
} |
|
|
|
|
|
|
|
logger->info("startDraining"); |
|
|
|
drainingPump_open(); |
|
|
|
// drainingPump_open();
|
|
|
|
m_deviceIoControlService->drainingPump_open(); |
|
|
|
m_drainingWorkState = 1; |
|
|
|
} |
|
|
|
// 停止排液体
|
|
|
|
/**
|
|
|
|
* @brief 停止排液体 |
|
|
|
*/ |
|
|
|
void DisinfectionCtrlService::stopDraining() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
if (m_disinfectionThread) { |
|
|
@ -262,7 +414,6 @@ void DisinfectionCtrlService::stopDraining() { |
|
|
|
} |
|
|
|
logger->info("stopDraining"); |
|
|
|
m_drainingWorkState = 0; |
|
|
|
drainingPump_close(); |
|
|
|
// drainingPump_close();
|
|
|
|
m_deviceIoControlService->drainingPump_close(); |
|
|
|
} |
|
|
|
int DisinfectionCtrlService::getReplenishingFluidsWorkState() { return m_replenishingFluidsWorkState; } |
|
|
|
int DisinfectionCtrlService::getDrainingWorkState() { return m_drainingWorkState; } |