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.
|
|
//
// 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, // 结束
kstate_dehumidification_before_disinfection = 6, // 消毒前除湿
kstate_dehumidification_after_disinfection = 7, // 消毒后除湿
} 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;
float dloglevel; };
class DisinfectionPrinterTask { public: string disinfection_id; string usr;
vector<shared_ptr<StateSnapshot>> stateSnapshotList; // 状态快照I
int disinfectantUsage; // 消毒剂使用量
zsystem_tp start_tp; zsystem_tp complete_tp;
int targetLog; int actualLog;
int disinfectantVolume; // g
};
class DisinfectionContext { public: string m_disinfectionID; disinfection_state_t m_state = kstate_idle; zsteady_tp start_steady_tp; zsystem_tp start_tp; zsystem_tp complete_tp;
/**
* @brief 消毒中配置 */ int pre_heat_time_s = 0; // 预热时间
int stoped_gs = 0; // 停止H2O2浓度
int continued_gs = 0; // 继续H2O2浓度
int stoped_satur = 0; // 停止饱和度
int continued_satur = 0; // 继续饱和度
int stoped_humi = 0; // 停止湿度
int continued_humi = 0; // 继续湿度
int injection_pump_speed; bool injection_pump_speed_changed = false;
float cfg_targetLoglevel = 0;
/**
* @brief 运行状态 */ zsteady_tp state_last_compute_dvalue_tp; // 上次计算dvalue时间
zsteady_tp state_lastlog_tp; // 上次日志时间
int state_remaintime = 0; float state_now_loglevel = 0; float state_dvalue = 0; bool state_is_disinfection_take_break; // 消毒工作中是否暂停工作
/*******************************************************************************
* 传感器信息 * *******************************************************************************/
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;
/*******************************************************************************
* 日志与统计 * *******************************************************************************/ shared_ptr<DisinfectionLogger> csvlogger; // 日志记录器
vector<shared_ptr<StateSnapshot>> stateSnapshotList; // 状态快照I
int beforeDisinfectantVolume_g; // 消毒前消毒剂量
int afterDisinfectantVolume_g; // 消毒后消毒剂量
bool firstLog; };
} // namespace iflytop
|