65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
|
|
/******************************************************************************************************************
|
||
|
|
* Action instruction algorithm
|
||
|
|
*
|
||
|
|
* arg[0] data determination expression
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*
|
||
|
|
* 1.0 2020-12-17 zoufuzhou
|
||
|
|
******************************************************************************************************************/
|
||
|
|
#pragma once
|
||
|
|
/**
|
||
|
|
* @file exp_cpc.h
|
||
|
|
* @brief CPC跑偏检测的类
|
||
|
|
* @author Cat (null.null.null@qq.com)
|
||
|
|
* @version 0.1
|
||
|
|
* @date 2021-09-13
|
||
|
|
*
|
||
|
|
* Copyright: Baosight Co. Ltd.
|
||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
#include <eqpalg/algs/exp.h>
|
||
|
|
#include <glob/MathExpression.h>
|
||
|
|
#include <zlib/MemTrk.h>
|
||
|
|
#include <zlib/coilDef.h>
|
||
|
|
#include <iomanip>
|
||
|
|
#include <iostream>
|
||
|
|
#include <memory>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
struct StringCpcPdo {
|
||
|
|
float offset[2];
|
||
|
|
string endId;
|
||
|
|
string endId_saved;
|
||
|
|
};
|
||
|
|
/**
|
||
|
|
* @brief 表达式-CPC算法
|
||
|
|
*/
|
||
|
|
class ExpCpc : public Exp {
|
||
|
|
public:
|
||
|
|
ExpCpc(const string name, const mix_cc::json& rule_json, const string ruleId);
|
||
|
|
|
||
|
|
virtual ~ExpCpc();
|
||
|
|
|
||
|
|
public:
|
||
|
|
int init() override;
|
||
|
|
AlarmInfo mon_proc() override;
|
||
|
|
|
||
|
|
private:
|
||
|
|
int proc_cpc(const double& act_triggered_);
|
||
|
|
|
||
|
|
private:
|
||
|
|
// GbItemsMemSingleInstance mem_items_;
|
||
|
|
|
||
|
|
std::unique_ptr<CMemTrk> mem_trk_;
|
||
|
|
string m_entId;
|
||
|
|
int m_startpos;
|
||
|
|
int m_endpos;
|
||
|
|
int m_zone;
|
||
|
|
StringCpcPdo m_cpc;
|
||
|
|
std::map<string, double> tags_value_ = {{"tag1", 0}, {"tag2", 0}};
|
||
|
|
std::map<string, double> max_deviation_ = {{"tag1", 0},
|
||
|
|
{"tag2", 0}}; ///< 最大跑偏量
|
||
|
|
};
|