|
|
@ -223,8 +223,8 @@ void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& con |
|
|
|
// "{},{},{},{}," //
|
|
|
|
"{},{},{}," //
|
|
|
|
"{},{},{},{}," //
|
|
|
|
"{},{},{},{}," //
|
|
|
|
"{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
// "{}," //
|
|
|
|
"{}\n" //
|
|
|
|
, |
|
|
|
getTime(), //
|
|
|
@ -233,7 +233,7 @@ void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& con |
|
|
|
// sensors[2].h2o2, sensors[2].temp, sensors[2].humid, sensors[2].saturation, //
|
|
|
|
m_context.dvalue, m_context.m_nowLoglevel, (int)m_context.m_targetLoglevel, //
|
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), //
|
|
|
|
// m_deviceIoControlService->getDisinfectantVolume_g(), //
|
|
|
|
m_context.m_remaintime)); |
|
|
|
} |
|
|
|
|
|
|
@ -366,6 +366,7 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont |
|
|
|
void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { |
|
|
|
// logger->info("disinfection running {} {}s preheatFlag:{}", m_context.m_disinfectionID, m_context.m_remaintime, m_context.m_preheatFlag);
|
|
|
|
m_context.m_remaintime--; |
|
|
|
bool forcelog = false; |
|
|
|
if (m_context.m_remaintime < 0) { |
|
|
|
m_context.m_remaintime = 0; |
|
|
|
} |
|
|
@ -392,6 +393,7 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { |
|
|
|
//
|
|
|
|
if (m_context.m_remaintime <= 0) { |
|
|
|
m_context.m_remaintime = 0; |
|
|
|
m_context.m_loglevel = m_context.m_targetLoglevel; |
|
|
|
logger->info("disinfection finished {},but waitting for h2o2 to safe", m_context.m_disinfectionID); |
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
@ -399,6 +401,7 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(false); |
|
|
|
m_context.m_state = kwait_for_h2o2_down; |
|
|
|
forcelog = true; |
|
|
|
} |
|
|
|
|
|
|
|
} else if (m_context.m_state == kwait_for_h2o2_down) { |
|
|
@ -409,13 +412,14 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { |
|
|
|
if (m_context.h2o2data.min_h2o2 < 1) { |
|
|
|
logger->info("h2o2 concentration to safe value"); |
|
|
|
breakflag = true; |
|
|
|
forcelog = true; |
|
|
|
m_context.m_state = kfinished; |
|
|
|
} |
|
|
|
} else { |
|
|
|
ZCHECK(false, "state error"); |
|
|
|
} |
|
|
|
|
|
|
|
if (breakflag || zsteady_clock().elapsedTimeS(m_context.m_lastlogTp) > DVALUE_COMPUTEPERIOD_TIME_S) { |
|
|
|
if (forcelog || zsteady_clock().elapsedTimeS(m_context.m_lastlogTp) > DVALUE_COMPUTEPERIOD_TIME_S) { |
|
|
|
m_context.m_lastlogTp = zsteady_clock().now(); |
|
|
|
dumpDisinfectionLogs(m_context); |
|
|
|
dumpDisinfectionLogsToCSV(m_context); |
|
|
@ -483,7 +487,7 @@ void DisinfectionCtrlService::startDisinfection(int loglevel, // |
|
|
|
//
|
|
|
|
} |
|
|
|
|
|
|
|
int DisinfectionCtrlService::getDisinfectionWorkState() { return m_disinfectionWorkState; } |
|
|
|
int DisinfectionCtrlService::getDisinfectionWorkState() { return m_context.m_state; } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::stopDisinfection() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
@ -491,12 +495,19 @@ void DisinfectionCtrlService::stopDisinfection() { |
|
|
|
m_disinfectionThread->join(); |
|
|
|
m_disinfectionThread = nullptr; |
|
|
|
} |
|
|
|
m_context.m_state = kfinished; |
|
|
|
m_disinfectionWorkState = 0; |
|
|
|
} |
|
|
|
|
|
|
|
int32_t DisinfectionCtrlService::getEstimatedRemainingTimeS() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
if (m_context.m_state == kpreheat) { |
|
|
|
return getPreHeatRaminTimeS(); |
|
|
|
} else if (m_context.m_state == kdisinfection || m_context.m_state == kdisinfection_take_a_break) { |
|
|
|
return m_context.m_remaintime; |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
int32_t DisinfectionCtrlService::getPreHeatRaminTimeS() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|