|
@ -22,10 +22,16 @@ using namespace std; |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#define PRE_HEAT_TIME (2)
|
|
|
|
|
|
|
|
|
// #define PRE_HEAT_TIME (2)
|
|
|
|
|
|
#define PRE_HEAT_TIME (5 * 60)
|
|
|
|
|
|
|
|
|
#define DVALUE_COMPUTEPERIOD_TIME_S (15.0)
|
|
|
#define DVALUE_COMPUTEPERIOD_TIME_S (15.0)
|
|
|
#define MAX_VOLUME (5000)
|
|
|
#define MAX_VOLUME (5000)
|
|
|
|
|
|
|
|
|
|
|
|
namespace iflytop { |
|
|
|
|
|
extern bool g_preheat; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
DisinfectionCtrlService::DisinfectionCtrlService() {} |
|
|
DisinfectionCtrlService::DisinfectionCtrlService() {} |
|
|
void DisinfectionCtrlService::initialize() { |
|
|
void DisinfectionCtrlService::initialize() { |
|
|
GET_TO_SERVICE(m_zcanHost); |
|
|
GET_TO_SERVICE(m_zcanHost); |
|
@ -108,7 +114,7 @@ void DisinfectionCtrlService::computeRemainTime(DisinfectionContext& context) { |
|
|
void DisinfectionCtrlService::initContext(DisinfectionContext& context, int loglevel, float roomVol) { |
|
|
void DisinfectionCtrlService::initContext(DisinfectionContext& context, int loglevel, float roomVol) { |
|
|
context.m_disinfectionID = createDisinfectionID(); |
|
|
context.m_disinfectionID = createDisinfectionID(); |
|
|
// m_remaintime = loglevel * 20 * 60; // 计算总的加热时间
|
|
|
// m_remaintime = loglevel * 20 * 60; // 计算总的加热时间
|
|
|
context.m_remaintime = PRE_HEAT_TIME + loglevel * 20 * 60 * (roomVol / 20.0); // 计算总的加热时间
|
|
|
|
|
|
|
|
|
context.m_remaintime = PRE_HEAT_TIME + loglevel * 90 * 60; // 计算总的加热时间
|
|
|
m_disinfectionWorkState = 1; |
|
|
m_disinfectionWorkState = 1; |
|
|
context.m_targetLoglevel = loglevel; |
|
|
context.m_targetLoglevel = loglevel; |
|
|
context.m_nowLoglevel = 0; |
|
|
context.m_nowLoglevel = 0; |
|
@ -132,7 +138,8 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, int logl |
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 1, 0); |
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 1, 0); |
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
context.csvlogger = m_disinfectionLogsManager->createNewLogger(context.m_disinfectionID); |
|
|
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\n"); |
|
|
|
|
|
|
|
|
context.csvlogger->write( |
|
|
|
|
|
"time,h2o21,temp1,humi1,saturation1,h2o22,temp2,humi2,saturation2,h2o23,temp3,humi3,saturation3,dvalue,nowlog,targetlog,remaintime\n"); |
|
|
} |
|
|
} |
|
|
void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
context.m_remaintime = 0; |
|
|
context.m_remaintime = 0; |
|
@ -155,7 +162,7 @@ void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) { |
|
|
void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) { |
|
|
if (context.m_preheatFlag && zsteady_clock().elapsedTimeS(context.m_starttp) > PRE_HEAT_TIME) { |
|
|
|
|
|
|
|
|
if ((context.m_preheatFlag && zsteady_clock().elapsedTimeS(context.m_starttp) > PRE_HEAT_TIME) || !g_preheat) { |
|
|
logger->info("preheat finished {}", context.m_disinfectionID); |
|
|
logger->info("preheat finished {}", context.m_disinfectionID); |
|
|
// blower_setPower(true);
|
|
|
// blower_setPower(true);
|
|
|
m_deviceIoControlService->AirBlower_setState(true); |
|
|
m_deviceIoControlService->AirBlower_setState(true); |
|
@ -241,7 +248,8 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont |
|
|
float nowh2o2 = m_context.h2o2data.max_h2o2; |
|
|
float nowh2o2 = m_context.h2o2data.max_h2o2; |
|
|
float humid = m_context.h2o2data.max_humid; |
|
|
float humid = m_context.h2o2data.max_humid; |
|
|
|
|
|
|
|
|
if (nowSatur > m_context.stoped_satur || nowh2o2 > m_context.stoped_gs || humid > m_context.stoped_satur) { |
|
|
|
|
|
|
|
|
// humid > m_context.stoped_satur
|
|
|
|
|
|
if (nowSatur > m_context.stoped_satur || nowh2o2 > m_context.stoped_gs) { |
|
|
logger->info("stop sprayLiquid"); |
|
|
logger->info("stop sprayLiquid"); |
|
|
|
|
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
|
m_deviceIoControlService->sprayLiquidPump_close(); |
|
@ -255,7 +263,8 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont |
|
|
float nowh2o2 = m_context.h2o2data.max_h2o2; |
|
|
float nowh2o2 = m_context.h2o2data.max_h2o2; |
|
|
float humid = m_context.h2o2data.max_humid; |
|
|
float humid = m_context.h2o2data.max_humid; |
|
|
|
|
|
|
|
|
if (nowSatur < m_context.continued_satur && nowh2o2 < m_context.continued_gs && humid < m_context.continued_satur) { |
|
|
|
|
|
|
|
|
// && humid < m_context.continued_satur
|
|
|
|
|
|
if (nowSatur < m_context.continued_satur && nowh2o2 < m_context.continued_gs) { |
|
|
logger->info("start sprayLiquid"); |
|
|
logger->info("start sprayLiquid"); |
|
|
|
|
|
|
|
|
m_deviceIoControlService->sprayLiquidPump_open(); |
|
|
m_deviceIoControlService->sprayLiquidPump_open(); |
|
|