49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
|
|
#pragma once
|
||
|
|
/**
|
||
|
|
* @file roller2.h
|
||
|
|
* @brief 同组离群监测
|
||
|
|
* @author your name (you@domain.com)
|
||
|
|
* @version 0.1
|
||
|
|
* @date 2025-01-20
|
||
|
|
*
|
||
|
|
* Copyright: Baosight Co. Ltd.
|
||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
#include <eqpalg/algs/exp_base.h>
|
||
|
|
#include <eqpalg/define/public.h>
|
||
|
|
#include <array>
|
||
|
|
#include <map>
|
||
|
|
|
||
|
|
using std::string;
|
||
|
|
class Roller2 : public ExpBase {
|
||
|
|
public:
|
||
|
|
Roller2(const string& name, const mix_cc::json& rule_json,
|
||
|
|
const string& ruleId, size_t exp_type);
|
||
|
|
|
||
|
|
virtual ~Roller2();
|
||
|
|
|
||
|
|
public:
|
||
|
|
const vector<string> ExpStr = {"pre_exp", "X1", "X2", "X3", "X4",
|
||
|
|
"X5", "X6", "X7", "X8", "X9"};
|
||
|
|
int init() override;
|
||
|
|
virtual AlarmInfo mon_proc() override;
|
||
|
|
std::vector<AlarmInfo> exec_task(mix_cc::time_range_t time_range) override;
|
||
|
|
const array<string, 2> BIG_SMALL = {"过大", "过小"}; ///<检测异常的结果集
|
||
|
|
double limit_over_; ///<百分比阈值
|
||
|
|
private:
|
||
|
|
std::unique_ptr<mix_cc::matheval::Expression> pre_exp_; ///<前提条件
|
||
|
|
map<std::string, std::unique_ptr<mix_cc::matheval::Expression>>
|
||
|
|
var_exp_; ///<监控变量
|
||
|
|
map<std::string, std::string> var_name_; ///<变量名
|
||
|
|
map<std::string, std::string> var_exp_str_;
|
||
|
|
map<std::string, double> var_Xdouble_; ///<监控数据
|
||
|
|
bool pre_exp_flag_; ///<前提条件
|
||
|
|
|
||
|
|
private:
|
||
|
|
int init_X_exp();
|
||
|
|
void print_load_content();
|
||
|
|
|
||
|
|
void refresh_var_result();
|
||
|
|
};
|