59 lines
1.4 KiB
Plaintext
59 lines
1.4 KiB
Plaintext
|
|
/******************************************************************************************************************
|
||
|
|
* Action instruction algorithm
|
||
|
|
*
|
||
|
|
* arg[0] data determination expression
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*
|
||
|
|
* 1.0 2020-12-17 zoufuzhou
|
||
|
|
******************************************************************************************************************/
|
||
|
|
#ifndef _H_ALGORITHM_EXPRESSION_H
|
||
|
|
#define _H_ALGORITHM_EXPRESSION_H
|
||
|
|
|
||
|
|
#include <eqpalg/AlgCommonDefine.h>
|
||
|
|
#include <eqpalg/alg_base.h>
|
||
|
|
#include <eqpalg/stat_tools/SampleTrendAnalysis.h>
|
||
|
|
#include <glob/MathExpression.h>
|
||
|
|
#include <iomanip>
|
||
|
|
#include <iostream>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
class Exp : public AlgBase {
|
||
|
|
public:
|
||
|
|
Exp(const string &name, const Json::Value &rulejson, const string &ruleId);
|
||
|
|
|
||
|
|
virtual ~Exp();
|
||
|
|
|
||
|
|
public:
|
||
|
|
int init() override;
|
||
|
|
virtual Json::Value exec_mon();
|
||
|
|
virtual Json::Value mon_proc();
|
||
|
|
|
||
|
|
protected:
|
||
|
|
int refresh_exp_vars_mem();
|
||
|
|
int refresh_exp_vars_ihd(int row);
|
||
|
|
|
||
|
|
private:
|
||
|
|
int reload_config_data_source();
|
||
|
|
int reload_config_exp_act();
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void print_exp_vars(const string &expstr = "");
|
||
|
|
|
||
|
|
protected:
|
||
|
|
std::unique_ptr<mix_cc::matheval::Expression> exp_act_;
|
||
|
|
std::map<std::string, double> mm_vars;
|
||
|
|
|
||
|
|
int data_source_; // 0:iHyerDB,1:memory
|
||
|
|
// value signal (%)
|
||
|
|
string m_expstr;
|
||
|
|
|
||
|
|
protected:
|
||
|
|
bool act_triggered_;
|
||
|
|
|
||
|
|
protected:
|
||
|
|
// SampleTrendAnalysis *sample_analysis;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|