|
|
@ -24,14 +24,14 @@ using namespace std; |
|
|
|
|
|
|
|
#define PRE_HEAT_TIME (5 * 60)
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::drainingPump_open() { m_zcanHost->pumpctrl_c1004(2, 100, -300, 1, 20); } |
|
|
|
void DisinfectionCtrlService::drainingPump_close() { m_zcanHost->pumpctrl_c1004(2, 100, 0, 1, 20); } |
|
|
|
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(2, 100, 300, 1, 20); } |
|
|
|
void DisinfectionCtrlService::replenishingFluidsPump_close() { m_zcanHost->pumpctrl_c1004(2, 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); } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::sprayLiquidPump_open() { m_zcanHost->pumpctrl_c1004(1, 100, 200, 1, 15); } |
|
|
|
void DisinfectionCtrlService::sprayLiquidPump_close() { m_zcanHost->pumpctrl_c1004(1, 100, 0, 1, 15); } |
|
|
|
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); } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::airCompressor(bool val) { |
|
|
|
if (val) { |
|
|
@ -95,6 +95,14 @@ string DisinfectionCtrlService::createDisinfectionID() { |
|
|
|
void DisinfectionCtrlService::initialize() { |
|
|
|
GET_TO_SERVICE(m_zcanHost); |
|
|
|
GET_TO_SERVICE(m_sensorDataScan); |
|
|
|
|
|
|
|
drainingPump_close(); |
|
|
|
replenishingFluidsPump_close(); |
|
|
|
sprayLiquidPump_close(); |
|
|
|
|
|
|
|
heartingPlate_setPower(false); |
|
|
|
blower_setPower(false); |
|
|
|
airCompressor(false); |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::startDisinfection(int loglevel, float roomVol) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
@ -104,18 +112,19 @@ void DisinfectionCtrlService::startDisinfection(int loglevel, float roomVol) { |
|
|
|
} |
|
|
|
|
|
|
|
m_disinfectionID = createDisinfectionID(); |
|
|
|
m_remaintime = loglevel * 20 * 60; // 计算总的加热时间
|
|
|
|
// 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]() { |
|
|
|
ThisThread thisThread; |
|
|
|
bool preHeartFinishedFlag = false; |
|
|
|
// bool preHeartFinishedFlag = false;
|
|
|
|
|
|
|
|
logger->info("startDisinfection {} {} {}", loglevel, roomVol, m_disinfectionID); |
|
|
|
|
|
|
|
auto starttime = zsteady_clock().now(); |
|
|
|
m_disinfectionWorkState = 1; |
|
|
|
auto starttime = zsteady_clock().now(); |
|
|
|
heartingPlate_setPower(true); |
|
|
|
|
|
|
|
m_preheatFlag = 1; |
|
|
|
while (!thisThread.getExitFlag()) { |
|
|
|
thisThread.sleepForMs(1000); |
|
|
|
if (m_disinfectionWorkState == 2) { |
|
|
@ -129,16 +138,16 @@ void DisinfectionCtrlService::startDisinfection(int loglevel, float roomVol) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
logger->info("disinfection running {} {}s preheatFlag:{}", m_disinfectionID, m_remaintime, preHeartFinishedFlag); |
|
|
|
logger->info("disinfection running {} {}s preheatFlag:{}", m_disinfectionID, m_remaintime, m_preheatFlag); |
|
|
|
|
|
|
|
if (!preHeartFinishedFlag && zsteady_clock().elapsedTimeS(starttime) > PRE_HEAT_TIME) { |
|
|
|
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(); |
|
|
|
preHeartFinishedFlag = true; |
|
|
|
m_preheatFlag = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -166,6 +175,7 @@ void DisinfectionCtrlService::stopDisinfection() { |
|
|
|
m_disinfectionThread->join(); |
|
|
|
m_disinfectionThread = nullptr; |
|
|
|
} |
|
|
|
m_disinfectionWorkState = 0; |
|
|
|
} |
|
|
|
|
|
|
|
int32_t DisinfectionCtrlService::getEstimatedRemainingTimeS() { |
|
|
@ -193,8 +203,8 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
m_disinfectionThread.reset(new Thread("disinfectionThread", [this, stopatg]() { |
|
|
|
ThisThread thisThread; |
|
|
|
replenishingFluidsPump_open(); |
|
|
|
m_replenishingFluidsWorkState = 1; |
|
|
|
while (thisThread.getExitFlag()) { |
|
|
|
logger->info("startReplenishingFluids {}g", stopatg); |
|
|
|
while (!thisThread.getExitFlag()) { |
|
|
|
int32_t nowvolume = m_sensorDataScan->getDisinfectantVolume_g(); |
|
|
|
logger->info("replenishingFluids {}g", nowvolume); |
|
|
|
if (nowvolume > stopatg) { |
|
|
@ -214,7 +224,7 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
})); |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
m_replenishingFluidsWorkState = 1; |
|
|
|
logger->info("startReplenishingFluids "); |
|
|
|
} |
|
|
|
// 停止加液
|
|
|
|