40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
|
|
#pragma once
|
||
|
|
#include <array>
|
||
|
|
#include <eqpalg/alg_base.h>
|
||
|
|
#include <eqpalg/define/public.h>
|
||
|
|
#include <eqpalg/utility/proxy_py.h>
|
||
|
|
#include <map>
|
||
|
|
|
||
|
|
const int MAXLEN = ProxPyMapConfig::dataMaxLen;
|
||
|
|
using std::string;
|
||
|
|
class GlitchDetection : public AlgBase {
|
||
|
|
public:
|
||
|
|
GlitchDetection(const string name, const mix_cc::json &rule_json,
|
||
|
|
const string ruleId);
|
||
|
|
|
||
|
|
virtual ~GlitchDetection();
|
||
|
|
|
||
|
|
public:
|
||
|
|
int init() override;
|
||
|
|
AlarmInfo exec_mon() override;
|
||
|
|
std::vector<AlarmInfo> exec_task(mix_cc::time_range_t time_range) override;
|
||
|
|
void save_rule_norm_data() override;
|
||
|
|
bool get_prr() override;
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::array<double, MAXLEN> data_; ///<被检测的数据
|
||
|
|
int data_index_ = 0; ///<当前数据个数
|
||
|
|
int data_size_ = 0; ///<数据长度
|
||
|
|
double glitch_per_ = 0.1; ///<毛刺比例
|
||
|
|
mix_cc::time_range_t run_time_range_;
|
||
|
|
string exp_str_; ///< 表达式字符串
|
||
|
|
mix_cc::json py_param_; ///< send 2 py params
|
||
|
|
std::string error_content_; ///<报警内容
|
||
|
|
private:
|
||
|
|
/**
|
||
|
|
* @brief 加载表达式
|
||
|
|
* @return int
|
||
|
|
*/
|
||
|
|
int load_exp();
|
||
|
|
};
|