52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
/**
|
|
* @file eqpalg/utility/factory_running_state.h
|
|
* @brief 机组运行状态
|
|
* @author Cat (null.null.null@qq.com)
|
|
* @version 0.1
|
|
* @date 2021-09-17
|
|
*
|
|
* Copyright: Baosight Co. Ltd.
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|
*
|
|
*/
|
|
#include <eqpalg/define/public.h>
|
|
#include <eqpalg/gb_item_memory.h>
|
|
#include <zlib/MemVar.h>
|
|
#include <chrono>
|
|
/**
|
|
* @brief 工厂运行状态,根据各个区段的速度判断工厂是否正在生产
|
|
*/
|
|
class FactoryRunningState {
|
|
private:
|
|
std::chrono::system_clock::time_point last_time =
|
|
std::chrono::system_clock::now(); ///<上次停机时刻
|
|
const double main_speed_min_ = 0;
|
|
|
|
const string tagname_main_speed_ =
|
|
string(CMemVar::Const()->UnitNo) + "_" +
|
|
string(CMemVar::Const()->eis_tagname_main_speed);
|
|
|
|
public:
|
|
FactoryRunningState() = default;
|
|
~FactoryRunningState() = default;
|
|
/**
|
|
* @brief 工厂是否在运行
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool is_factory_running();
|
|
|
|
private:
|
|
std::unique_ptr<LOG> logger_ = std::make_unique<LOG>("FactoryRunningState");
|
|
bool last_state_ = false; ///<上次机组状态
|
|
bool now_state_ = false; ///< 当前机组状态
|
|
|
|
protected:
|
|
/**
|
|
* @brief Get the factory running state object
|
|
* @return int
|
|
*/
|
|
int get_factory_running_state();
|
|
};
|