You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.1 KiB
129 lines
3.1 KiB
//
|
|
// Created by zwsd
|
|
//
|
|
|
|
#pragma once
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <list>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "configs/project_setting.hpp"
|
|
#include "iflytop/core/components/timeutils.hpp"
|
|
/**
|
|
* @brief
|
|
*
|
|
* service: DisinfectionCtrlService
|
|
*
|
|
* 监听事件:
|
|
* 依赖状态:
|
|
* 依赖服务:
|
|
* 作用:
|
|
*
|
|
*/
|
|
|
|
namespace iflytop {
|
|
using namespace std;
|
|
using namespace core;
|
|
|
|
class DisinfectionLogger;
|
|
|
|
typedef enum {
|
|
kstate_idle = 0, // 空闲
|
|
kstate_preheat = 1, // 预热
|
|
kstate_disinfection = 2, // 消毒中-工作
|
|
kstate_degradation = 4, // 降解中
|
|
kstate_finished = 5, // 结束
|
|
} disinfection_state_t;
|
|
|
|
class StateSnapshot {
|
|
public:
|
|
disinfection_state_t state;
|
|
zsystem_tp time;
|
|
|
|
int32_t h2o2[MAX_H2O2_SENSOR_NUM]; // ppm
|
|
int32_t humid[MAX_H2O2_SENSOR_NUM]; // %RH
|
|
int32_t temp[MAX_H2O2_SENSOR_NUM]; // °C
|
|
int32_t saturation[MAX_H2O2_SENSOR_NUM]; // %RS
|
|
|
|
int min_h2o2;
|
|
int max_h2o2;
|
|
int max_humid;
|
|
int max_saturation;
|
|
};
|
|
|
|
class DisinfectionPrinterTask {
|
|
public:
|
|
list<shared_ptr<StateSnapshot>> stateSnapshotList; // 状态快照I
|
|
|
|
int disinfectantUsage; // 消毒剂使用量
|
|
|
|
zsystem_tp start_tp;
|
|
zsystem_tp complete_tp;
|
|
|
|
bool stoped_by_usr = false;
|
|
};
|
|
|
|
class DisinfectionContext {
|
|
public:
|
|
string m_disinfectionID;
|
|
disinfection_state_t m_state = kstate_idle;
|
|
|
|
zsteady_tp m_lastComputeDvalueTp;
|
|
zsteady_tp m_lastlogTp;
|
|
zsteady_tp disinfection_start_steady_tp;
|
|
|
|
int m_remaintime = 0;
|
|
float m_targetLoglevel = 0;
|
|
float m_nowLoglevel = 0;
|
|
float dvalue = 0;
|
|
|
|
int injection_pump_speed;
|
|
bool injection_pump_speed_changed = false;
|
|
|
|
int pre_heat_time_s = 0;
|
|
int stoped_gs = 0;
|
|
int continued_gs = 0;
|
|
int stoped_satur = 0;
|
|
int continued_satur = 0;
|
|
int stoped_humi = 0;
|
|
int continued_humi = 0;
|
|
|
|
shared_ptr<DisinfectionLogger> csvlogger;
|
|
|
|
bool isDisinfectionTakeBreak; // 消毒工作中是否暂停工作
|
|
/*******************************************************************************
|
|
* 传感器信息 *
|
|
*******************************************************************************/
|
|
|
|
int32_t h2o2[MAX_H2O2_SENSOR_NUM]; // ppm
|
|
int32_t humid[MAX_H2O2_SENSOR_NUM]; // %RH
|
|
int32_t temp[MAX_H2O2_SENSOR_NUM]; // °C
|
|
int32_t saturation[MAX_H2O2_SENSOR_NUM]; // %RS
|
|
|
|
int min_h2o2;
|
|
int max_h2o2;
|
|
int max_humid;
|
|
int max_saturation;
|
|
|
|
/*******************************************************************************
|
|
* 消毒统计信息 *
|
|
*******************************************************************************/
|
|
list<shared_ptr<StateSnapshot>> stateSnapshotList; // 状态快照I
|
|
|
|
int beforeDisinfectantVolume_g; // 消毒前消毒剂量
|
|
int afterDisinfectantVolume_g; // 消毒后消毒剂量
|
|
|
|
zsystem_tp disinfection_start_tp;
|
|
zsystem_tp disinfection_complete_tp;
|
|
|
|
bool stoped_by_usr = false;
|
|
};
|
|
|
|
} // namespace iflytop
|