193 lines
4.2 KiB
C
Raw Normal View History

2022-07-30 11:50:01 +08:00
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QObject>
#include <QVector>
#include <QMap>
#include <qcolor.h>
#include "qmap.h"
#define SAVE_SPEEDTIME //存储转速时间戳
enum Except{ EXCEP_ZERO,EXCEP_ONE};
extern bool AddFlag;
extern QString DeviceNO;
typedef struct tag_WAVE_DATA{
QString channelId;
QString channelName;
int wavesize;
int SamleRate;
int SamleRateRealTime;
float mean;
QString sensorType;
int channelNo;
int Time;
QString pairChannelID;
QVector<float> waveData;
QVector<double> waveDataRealTime;
QColor linColor;
QVector<double> SpeedProfileSpeed;
QString sensorEngineeringUnit;
QString speedRefChannelId;
double sensorGapVoltage;
double sensorSensitivity;
int iTrigger;
int iKeyCount;
float iTriggerValue;
float iHysteresis;
bool tachAutoTach;
QVector<double> TimeStamp;
QVector<double> RMSValue;
tag_WAVE_DATA(){
channelId = "";
channelName = "";
wavesize = 0;
SamleRate = 0;
mean = 0.0;
sensorType = "";
channelNo = 0;
Time = 0;
pairChannelID = "";
sensorEngineeringUnit = "";
speedRefChannelId = "";
iTrigger = -1;
iKeyCount= 0;
iTriggerValue = 0.0;
iHysteresis = 0.0;
}
} WAVE_DATA;
typedef struct {
QString channelId;
float wavedata;
} WAVE_ALLDATA;
typedef struct {
int Second;
QString channelId;
QVector<float> waveData;
QVector<double> TimeStamp;
} WAVE_CHNDATA;
//实时数据
typedef struct {
int total;
int count;
int type; // 1: 转速通道 0:其他
int number; // 原始数据量
int flag; // 平台标识
char channelId[16];
char SensorEngineeringUnit[32];
float waveData[32768];
} WAVE_CONTAIN;
typedef struct {
QString channelId;
QVector<float> wavedata;
} WAVE_CSVDATA;
typedef struct {
QVector<double> Key;
QVector<double> wavedata; //原始数据
QVector<double> wavedataEnv;//包络数据
QVector<double> wavedata_DC;
QVector<double> TimeStamp;
QColor linColor;
QString channelType;
QString sensorEngineeringUnit;
int SamleRate;
float mean;
double meanRpm;
QString channleName;
int iTrigger;
int iKeyCount;
float iTriggerValue;
float iHysteresis;
bool tachAutoTach;
} WAVE_DISPALYDATA;
typedef struct{
QString channelId;
QString channelType;
QString channelName;
int channelSamleRate;
QString sensorType;
QString pairChannelID;
QString equipmentName;
int TachTriggerPerRev;
QString sensorEngineeringUnit;
QString speedRefChannelId;
bool tachAutoTach;
QVector<double> SpeedProfileSpeed;
QVector<double> RMSValue;
double sensorGapVoltage;
double sensorSensitivity;
int iTrigger;
int iKeyCount;
int iTriggerValue;
int iHysteresis;
}WAVE_INFO;
typedef struct tag_DEVICE_INFO{
QString DeviceMac;
QString DeviceName;
QString DeviceIP;
QString DeviceType;
tag_DEVICE_INFO(){
DeviceMac = "";
DeviceName = "";
DeviceIP = "";
DeviceType = "";
}
}DEVICE_INFO;
typedef struct tag_REPORT_INFO{
QString DeviceMac;
QString DeviceName;
QString DevicemCollectTime;
tag_REPORT_INFO(){
DeviceMac = "";
DeviceName = "";
DevicemCollectTime = "";
}
}REPORT_INFO;
typedef struct {
QVector<double> key;
QVector<double> value;
} KeyPhasor;
typedef struct tag_RotatingSpeed{
int iTrigger;
int iTriggerValue;
int iKeyCount;
int iHysteresis;
tag_RotatingSpeed(){
iTrigger = -1;
iTriggerValue = 0;
iKeyCount = 0;
iHysteresis = 0;
}
}RotatingSpeed ;
class global
{
public:
global();
~global();
void Sleep(int msec);
public:
static quint16 port;
static QString IpAddr_G; //设备IP
static QString MacAddr_G; //设备MAC地址
static QString FilePath_G; //文件路径
static int m_nowChannel; //当前通道
static int Count_G; //dat文件总共秒数
static QVector<double> m_featureData;
static RotatingSpeed rotatingSpeed;
};
#endif // GLOBAL_H