eis/inc/eqpalg/AlgCommonDefine.h

143 lines
2.5 KiB
C++

#ifndef _H_ALGORITHM_COMMON_DEFINE_H
#define _H_ALGORITHM_COMMON_DEFINE_H
//#include <Ice/BuiltinSequences.h>
#include <zlib/MemTable.hpp>
//
#include <T_LOV_FDAAITEM.h>
#include <zlib/zoneDef.h>
#include <json/json.h>
#include <string>
#include <vector>
const int ALARM_INTERVAL = 120; //s
const int BACK_TIME = 1;
const int SAMPLE_CNT = 50; //ms
const int SAMPLE_TIME_MIN = 60*1000; //ms
const double EPS = 1e-6;
const int DEFAULT_CERCLE_TIME = 500;
const int FEED_BACK_OUTTIME = 600000; //10min
const int SAMPLE_COUNT = 1000; //
//using namespace log4cplus;
struct ADDR {
short mode;
short event;
short addr;
short addrbit;
};
struct ITEM {
short event;
float valueold;
float value;
char chinese[100];
};
class AD_MODE {
public:
static const short NORMAL = 0;
static const short UNKNOW = 1;
static const short BINARY = 2;
};
class DATA_STAT {
public:
static const short HISTORY = 0;
static const short ACTUAL = 1;
};
class DATA_SOURCE {
public:
static const short IHDB = 0;
static const short MEMORY = 1;
static const short DB2 = 2;
};
class JUDGE_MODE {
public:
static const short DIFFERENCE = 0;
static const short PRCENTAGE = 1;
static const short NORMAL = 2;
static const short TREND_FIT = 3;
};
namespace MSG_LEVEL{
const string INFO = "INFO";
const string WARN = "WARN";
const string ERROR= "ERROR";
};
struct FEED_BACK {
short addr_action;
short addr_feedback;
long long start;
};
struct ConfidenceInterval
{
double up;
double low;
double avg;
double std_dev;
double probability;
inline string tostring() const{
return "up:"+to_string(up)+" low:"+to_string(low)+" avg:"+to_string(avg)+" std_dev:"+to_string(std_dev)+" probability:"+to_string(probability);
}
};
struct AbsDifference
{
double max;
double min;
double avg;
inline string tostring() const{
return "max:"+to_string(max)+" min:"+to_string(min)+" avg:"+to_string(avg);
}
};
struct SampleData
{
ConfidenceInterval normal_cfdi;
AbsDifference abs_diff;
vector<double> vtrend;
};
struct SampleState
{
bool havesample;
bool islearned;
int archive;
int judgemode;
double probability;
time_t lastsave;
};
struct SampleLearn
{
vector<double> vstat; // one
vector<double> vtrend; // curve
AbsDifference abs_diff;
};
struct SampleProperty
{
std::string tag_name;
SampleState state;
SampleData data;
SampleLearn learn;
};
#endif