|
|
@ -57,6 +57,7 @@ void DisinfectionCtrlService::initialize() { |
|
|
|
GET_TO_SERVICE(m_disinfectionLogsManager); |
|
|
|
GET_TO_SERVICE(m_disinfectionPrinterService); |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->drainingPump_close(); |
|
|
|
m_deviceIoControlService->replenishingFluidsPump_close(); |
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
@ -64,6 +65,11 @@ void DisinfectionCtrlService::initialize() { |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(false); |
|
|
|
m_deviceIoControlService->airBlower_setState(false); |
|
|
|
m_deviceIoControlService->airCompressor_setState(false); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
m_context.beforeDisinfectantVolume_g = 0; |
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_dvalueComputer.initialize(); |
|
|
|
} |
|
|
|
|
|
|
@ -283,7 +289,14 @@ void DisinfectionCtrlService::pushDisinfectionPrinterTask(DisinfectionContext& c |
|
|
|
task->targetLog = context.cfg_targetLoglevel; |
|
|
|
task->actualLog = context.state_now_loglevel; |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
task->disinfectantVolume = dio->getDisinfectantVolume_g(); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
task->disinfectantVolume = 0; |
|
|
|
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_disinfectionPrinterService->pushPrintTask(task); |
|
|
|
} |
|
|
|
|
|
|
@ -411,8 +424,14 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, |
|
|
|
m_context.max_humid = 0; |
|
|
|
m_context.max_saturation = 0; |
|
|
|
m_context.stateSnapshotList.clear(); |
|
|
|
m_context.afterDisinfectantVolume_g = 0; |
|
|
|
m_context.afterDisinfectantVolume_g = 0; |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_context.beforeDisinfectantVolume_g = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
m_context.beforeDisinfectantVolume_g = 0; |
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->warningLightCtrl(0, 0, 1, 0); |
|
|
@ -422,8 +441,13 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, |
|
|
|
m_deviceIoControlService->warningLightCtrl(1, 1, 0, 0); |
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
|
m_deviceIoControlService->airBlower_setState(true); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
context.csvlogger = createCSVLogger(context.m_disinfectionID); |
|
|
|
|
|
|
|
m_context.firstLog = true; |
|
|
@ -433,6 +457,7 @@ void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
|
context.state_remaintime = 0; |
|
|
|
logger->info("stop disinfection {}", context.m_disinfectionID); |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
// sprayLiquidPump_close();
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
@ -447,6 +472,9 @@ void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
|
m_disinfectionWorkState = 3; |
|
|
|
|
|
|
|
m_deviceIoControlService->warningLightCtrl(0, 1, 0, 0); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) { |
|
|
@ -454,17 +482,38 @@ void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) |
|
|
|
|
|
|
|
// logger->info("preheat {}", context.m_disinfectionID);
|
|
|
|
if ((context.m_state == kstate_preheat && hasstarttime > m_context.pre_heat_time_s)) { |
|
|
|
/**
|
|
|
|
* @brief |
|
|
|
* 预热结束 |
|
|
|
*/ |
|
|
|
logger->info("preheat finished {}", context.m_disinfectionID); |
|
|
|
m_deviceIoControlService->airBlower_setState(true); |
|
|
|
logger->info("preheat finished {}", context.m_disinfectionID); |
|
|
|
|
|
|
|
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
|
|
|
|
m_deviceIoControlService->airCompressor_channelSelect(1); |
|
|
|
m_deviceIoControlService->airCompressor_setValve1(1); |
|
|
|
m_deviceIoControlService->airCompressor_setValve2(1); |
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->airBlower_setState(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
m_deviceIoControlService->DBDB__sprayAirCompressorPowerCtrl(1); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->DBDB__heaterCtrl(1); |
|
|
|
usleep(100 * 1000); |
|
|
|
m_deviceIoControlService->DBDB__heaterCtrlSafeValve(1); |
|
|
|
usleep(100 * 1000); |
|
|
|
m_deviceIoControlService->DBDB__miniPwmBlowerCtrl(1); |
|
|
|
usleep(100 * 1000); |
|
|
|
m_deviceIoControlService->DBDB__extValveCtrl(IF_DeviceIoContrlService::kExtValveChannel_disinfectionChannel); |
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
context.m_state = kstate_disinfection; |
|
|
|
} else { |
|
|
|
logger->info("{}: preheat {}", context.m_disinfectionID, m_context.pre_heat_time_s - hasstarttime); |
|
|
@ -492,7 +541,12 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont |
|
|
|
float humid = m_context.max_humid; |
|
|
|
|
|
|
|
if (m_context.injection_pump_speed_changed) { |
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_context.injection_pump_speed_changed = false; |
|
|
|
} |
|
|
|
|
|
|
@ -500,9 +554,13 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont |
|
|
|
if (nowSatur > m_context.stoped_satur || nowh2o2 > m_context.stoped_gs || humid > m_context.stoped_humi) { |
|
|
|
logger->info("stop sprayLiquid"); |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(false); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// m_context.sprayLiquidFlag = false;
|
|
|
|
m_context.state_is_disinfection_take_break = true; |
|
|
@ -516,9 +574,14 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont |
|
|
|
if (nowSatur < m_context.continued_satur && nowh2o2 < m_context.continued_gs && humid < context.continued_humi) { |
|
|
|
logger->info("start sprayLiquid"); |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(true); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_context.state_is_disinfection_take_break = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -549,11 +612,17 @@ void DisinfectionCtrlService::processState_Disinfection(DisinfectionContext& con |
|
|
|
m_context.state_remaintime = 0; |
|
|
|
m_context.state_now_loglevel = m_context.cfg_targetLoglevel + 0.01; |
|
|
|
logger->info("disinfection finished {},but waitting for h2o2 to safe", m_context.m_disinfectionID); |
|
|
|
|
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(false); |
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(false); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_context.m_state = kstate_degradation; |
|
|
|
} |
|
|
|
} |
|
|
@ -606,9 +675,16 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { |
|
|
|
/**
|
|
|
|
* @brief 消毒结束 |
|
|
|
*/ |
|
|
|
breakflag = true; |
|
|
|
m_context.complete_tp = zsystem_clock().now(); |
|
|
|
breakflag = true; |
|
|
|
m_context.complete_tp = zsystem_clock().now(); |
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
m_context.afterDisinfectantVolume_g = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
|
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
|
|
|
|
m_context.afterDisinfectantVolume_g = 0; |
|
|
|
#else
|
|
|
|
m_context.afterDisinfectantVolume_g = 0; |
|
|
|
#endif
|
|
|
|
|
|
|
|
if (m_context.m_state != kstate_finished) { |
|
|
|
m_context.m_state = kstate_finished; |
|
|
|
} |
|
|
@ -719,6 +795,7 @@ int32_t DisinfectionCtrlService::getPreHeatRaminTimeS() { |
|
|
|
|
|
|
|
string DisinfectionCtrlService::getDisinfectionID() { return m_context.m_disinfectionID; } |
|
|
|
bool DisinfectionCtrlService::isPreheatState() { return m_context.m_state == kstate_preheat; } |
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* // 加液 *
|
|
|
@ -845,6 +922,7 @@ void DisinfectionCtrlService::stopDraining() { |
|
|
|
m_deviceIoControlService->drainingPump_close(); |
|
|
|
} |
|
|
|
int DisinfectionCtrlService::getDrainingWorkState() { return m_drainingWorkState; } |
|
|
|
#endif
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::updateH2O2SensorData(DisinfectionContext& context) { |
|
|
|
auto& cx = context; |
|
|
|