|
|
@ -127,14 +127,16 @@ void DisinfectionCtrlService::computeRemainTime(DisinfectionContext& context) { |
|
|
|
|
|
|
|
shared_ptr<DisinfectionLogger> DisinfectionCtrlService::createCSVLogger(string log_file_name) { |
|
|
|
shared_ptr<DisinfectionLogger> _logger = m_disinfectionLogsManager->createNewLogger(log_file_name); |
|
|
|
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION)
|
|
|
|
|
|
|
|
_logger->write( |
|
|
|
fmt::format("{}," |
|
|
|
"{},{},{},{}," |
|
|
|
"{},{},{},{}," |
|
|
|
"{},{},{},{}," |
|
|
|
"{},{},{}," |
|
|
|
"{},{},{},{}," |
|
|
|
"{},{}" |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} , {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {}" |
|
|
|
"\n", |
|
|
|
ZIconv::noChange("时间"), //
|
|
|
|
ZIconv::noChange("仓内-气化过氧化氢浓度"), ZIconv::noChange("仓内-温度"), ZIconv::noChange("仓内-相对湿度"), ZIconv::noChange("仓内-相对饱和度"), //
|
|
|
@ -143,6 +145,23 @@ shared_ptr<DisinfectionLogger> DisinfectionCtrlService::createCSVLogger(string l |
|
|
|
ZIconv::noChange("D值"), ZIconv::noChange("当前LOG"), ZIconv::noChange("目标LOG"), //
|
|
|
|
ZIconv::noChange("加热器电源"), ZIconv::noChange("风机电源"), ZIconv::noChange("空压机电源"), ZIconv::noChange("喷液泵(g/min)"), //
|
|
|
|
ZIconv::noChange("消毒剩余剂量(g)"), ZIconv::noChange("剩余时间(s)"))); |
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
|
|
|
|
|
|
|
|
_logger->write( |
|
|
|
fmt::format(" {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} , {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} " |
|
|
|
"\n", |
|
|
|
ZIconv::noChange("时间"), //
|
|
|
|
ZIconv::noChange("仓内-气化过氧化氢浓度"), ZIconv::noChange("仓内-温度"), ZIconv::noChange("仓内-相对湿度"), ZIconv::noChange("仓内-相对饱和度"), //
|
|
|
|
ZIconv::noChange("D值"), ZIconv::noChange("当前LOG"), ZIconv::noChange("目标LOG"), //
|
|
|
|
ZIconv::noChange("加热器电源"), ZIconv::noChange("风机电源"), ZIconv::noChange("空压机电源"), ZIconv::noChange("喷液泵(g/min)"), //
|
|
|
|
ZIconv::noChange("消毒剩余剂量(g)"), ZIconv::noChange("剩余时间(s)"))); |
|
|
|
#endif
|
|
|
|
return _logger; |
|
|
|
} |
|
|
|
|
|
|
@ -198,6 +217,55 @@ void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& con |
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), formattimeS(remaintime))); |
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
|
|
|
|
|
|
|
|
static_assert(MAX_H2O2_SENSOR_NUM == 1, "MAX_H2O2_SENSOR_NUM must be 1"); |
|
|
|
|
|
|
|
auto& cx = context; |
|
|
|
string h2o2str[MAX_H2O2_SENSOR_NUM]; |
|
|
|
string tempstr[MAX_H2O2_SENSOR_NUM]; |
|
|
|
string humidstr[MAX_H2O2_SENSOR_NUM]; |
|
|
|
string satstr[MAX_H2O2_SENSOR_NUM]; |
|
|
|
|
|
|
|
for (int i = 0; i < MAX_H2O2_SENSOR_NUM; i++) { |
|
|
|
h2o2str[i] = fmt::format("{}", cx.h2o2[i]); |
|
|
|
tempstr[i] = fmt::format("{}", cx.temp[i]); |
|
|
|
humidstr[i] = fmt::format("{}", cx.humid[i]); |
|
|
|
satstr[i] = fmt::format("{}", cx.saturation[i]); |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < MAX_H2O2_SENSOR_NUM; i++) { |
|
|
|
if (cx.h2o2[i] < 0) h2o2str[i] = "N/A"; |
|
|
|
if (cx.temp[i] < 0) tempstr[i] = "N/A"; |
|
|
|
if (cx.humid[i] < 0) humidstr[i] = "N/A"; |
|
|
|
if (cx.saturation[i] < 0) satstr[i] = "N/A"; |
|
|
|
} |
|
|
|
|
|
|
|
auto ds = m_deviceIoControlService; |
|
|
|
float dvalue = 0; |
|
|
|
if (m_context.state_dvalue <= 0) { |
|
|
|
dvalue = 0; |
|
|
|
} else { |
|
|
|
dvalue = m_context.state_dvalue; |
|
|
|
} |
|
|
|
|
|
|
|
int remaintime = getEstimatedRemainingTimeS(); |
|
|
|
|
|
|
|
context.csvlogger->write( |
|
|
|
fmt::format(" {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} , {} ," |
|
|
|
" {} , {} , {} , {} ," |
|
|
|
" {} , {} " |
|
|
|
"\n", |
|
|
|
getTime(), //
|
|
|
|
h2o2str[0], tempstr[0], humidstr[0], satstr[0], //
|
|
|
|
(int32_t)dvalue, (int32_t)m_context.state_now_loglevel, (int32_t)m_context.cfg_targetLoglevel, //
|
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), formattimeS(remaintime))); |
|
|
|
|
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::pushDisinfectionPrinterTask(DisinfectionContext& context) { //
|
|
|
@ -252,6 +320,33 @@ void DisinfectionCtrlService::log(DisinfectionContext& context) { |
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), formattimeS(remaintime))); |
|
|
|
#endif
|
|
|
|
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
|
|
|
|
auto& cx = context; |
|
|
|
auto ds = m_deviceIoControlService; |
|
|
|
float dvalue = 0; |
|
|
|
if (m_context.state_dvalue <= 0) { |
|
|
|
dvalue = 0; |
|
|
|
} else { |
|
|
|
dvalue = m_context.state_dvalue; |
|
|
|
} |
|
|
|
|
|
|
|
int remaintime = getEstimatedRemainingTimeS(); |
|
|
|
|
|
|
|
logger->info( |
|
|
|
fmt::format("{}," |
|
|
|
"s0({},{},{},{})," |
|
|
|
"min_h2o2:{},max_h2o2:{},max_hum:{},max_sa:{}," |
|
|
|
"dv:{},log:{},tlog:{}," |
|
|
|
"h:{},airB:{},airC:{},pump:{}," |
|
|
|
"g:{},remainS:{}" |
|
|
|
"\n", |
|
|
|
getTime(), //
|
|
|
|
cx.h2o2[0], cx.temp[0], cx.humid[0], cx.saturation[0], //
|
|
|
|
m_context.min_h2o2, m_context.max_h2o2, m_context.max_humid, m_context.max_saturation, //
|
|
|
|
(int32_t)dvalue, m_context.state_now_loglevel, (int32_t)m_context.cfg_targetLoglevel, //
|
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), formattimeS(remaintime))); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
@ -321,6 +416,7 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, |
|
|
|
|
|
|
|
m_deviceIoControlService->warningLightCtrl(0, 0, 1, 0); |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
|
m_deviceIoControlService->airBlower_setState(true); |
|
|
|
context.csvlogger = createCSVLogger(context.m_disinfectionID); |
|
|
|
|
|
|
|
m_context.firstLog = true; |
|
|
@ -353,6 +449,11 @@ void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) |
|
|
|
if ((context.m_state == kstate_preheat && hasstarttime > m_context.pre_heat_time_s)) { |
|
|
|
logger->info("preheat finished {}", context.m_disinfectionID); |
|
|
|
m_deviceIoControlService->airBlower_setState(true); |
|
|
|
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
|
|
|
|
m_deviceIoControlService->airCompressor_channelSelect(1); |
|
|
|
m_deviceIoControlService->airCompressor_setValve1(1); |
|
|
|
m_deviceIoControlService->airCompressor_setValve2(1); |
|
|
|
#endif
|
|
|
|
usleep(1000 * 1000); |
|
|
|
m_deviceIoControlService->airCompressor_setState(true); |
|
|
|
usleep(1000 * 1000); |
|
|
|