TSI_Config/data_config.h

245 lines
5.1 KiB
C
Raw Normal View History

2025-02-15 11:50:15 +08:00
#ifndef DATA_CONFIG_H
#define DATA_CONFIG_H
#include <QString>
#include <QPushButton>
2025-03-11 16:42:00 +08:00
#include <QLabel>
2025-02-18 10:55:51 +08:00
#include <QList>
2025-02-15 11:50:15 +08:00
2025-03-01 13:40:11 +08:00
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
2025-03-04 16:00:19 +08:00
extern QString g_strServerIp; // 服务端IP
2025-03-29 18:05:12 +08:00
#define SLOT_NUM 15
#define CHANNEL_COUNT 4
typedef enum {
kCardNone = 0,
kCardCpu = 1,
kCardVibSingle = 10,
kCardVibTMRPrimary = 11,
kCardVibTMRBackup = 12,
kCardSpeedSingle = 20,
kCardSpeedTMRPrimary = 21,
kCardSpeedTMRBackup = 22,
kCardKeyphase = 30,
kCardRelaySingle = 31,
kCardRelayTMRPrimary = 32,
kCardRelayTMRBackup = 33,
} CardType;
// 振动板通道类型
typedef enum {
kVibRadial = 0, // 径向位移
kVibAcc = 1, // 加速度
kVibVelocity = 2 // 速度
} VibChannelType;
2025-02-15 11:50:15 +08:00
typedef struct {
int slot;
2025-03-23 14:03:48 +08:00
QString slot_type;
2025-02-15 11:50:15 +08:00
QString chan_display;
QString rack_type;
2025-03-28 14:13:30 +08:00
QPushButton *slot_btn;
QLabel *slot_label;
} SlotConfig;
2025-02-15 11:50:15 +08:00
2025-03-03 21:57:15 +08:00
enum CMTCommand {
kEigenvalueCmd = 1,
kExceptionInfo = 2,
kUpgradeCard = 3,
2025-03-04 16:00:19 +08:00
kGetVersionInfo = 4,
2025-03-05 16:56:07 +08:00
kRelaySetting = 5,
2025-03-13 15:10:35 +08:00
kRelayStatus = 6,
kUpgradeProgress = 7
2025-03-03 21:57:15 +08:00
};
2025-03-23 14:03:48 +08:00
2025-03-29 09:53:29 +08:00
// 振动板采样率
typedef enum {
kVibSR16K = 0, // 16k
kVibSR32K = 1, // 32k
kVibSR64k = 2, // 64k
kVibSR128K = 3, // 128k
} VibSamplingRate;
// 振动板机架类型
typedef enum {
kVibRackSingle = 0, // 单一
kVibRackTMR = 1 // 三冗余
} VibRackType;
2025-02-18 10:55:51 +08:00
2025-03-28 14:13:30 +08:00
typedef struct {
2025-02-18 10:55:51 +08:00
int id;
2025-03-29 18:05:12 +08:00
// QString channel_name;
2025-02-18 10:55:51 +08:00
bool standby;
bool active;
2025-03-29 09:53:29 +08:00
int rack_type; // VibRackType
2025-04-01 15:03:59 +08:00
// char tmr_group[32];
2025-03-29 09:53:29 +08:00
int channel_type; // VibChannelType
2025-04-01 15:03:59 +08:00
int transducer_id;
float scale_factor;
2025-03-29 09:53:29 +08:00
int sampling_rate; // VibSamplingRate
2025-02-18 10:55:51 +08:00
float normal_voltage_low;
float normal_voltage_high;
2025-03-28 14:13:30 +08:00
} SeismicMonitor;
2025-02-25 11:18:20 +08:00
2025-03-29 18:05:12 +08:00
typedef enum {
kFilterTypeLowPass = 0,
kFilterTypeHighPass = 1,
kFilterTypeBandPass = 2,
} FilterType;
2025-03-28 14:13:30 +08:00
typedef struct {
2025-02-25 11:18:20 +08:00
int low;
int high;
bool checked;
} Filter;
2025-04-01 17:52:25 +08:00
//typedef struct {
// Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass
//} AllFilter;
2025-03-29 18:05:12 +08:00
2025-03-28 14:13:30 +08:00
typedef struct {
2025-02-25 11:18:20 +08:00
QString type;
2025-03-28 15:32:39 +08:00
int full_sacle_range;
2025-02-25 11:18:20 +08:00
int bias_voltage;
float clamp_value;
int phase_lag;
bool checked;
2025-03-28 15:32:39 +08:00
float custom;
2025-02-25 11:18:20 +08:00
} Variables;
2025-03-29 18:05:12 +08:00
typedef struct {
2025-04-01 15:03:59 +08:00
int full_scale_range;
2025-03-29 18:05:12 +08:00
float clamp_value;
float custom;
} DirectImpl;
typedef struct {
bool checked;
2025-04-01 15:03:59 +08:00
int full_scale_range;
2025-03-29 18:05:12 +08:00
float clamp_value;
float custom;
int phase_lag;
} XImpl;
typedef struct {
bool checked;
2025-04-01 15:03:59 +08:00
int full_scale_range;
2025-03-29 18:05:12 +08:00
float clamp_value;
float custom;
} RadialImpl;
2025-03-28 14:13:30 +08:00
typedef struct {
2025-02-25 11:18:20 +08:00
int alert;
float danger;
bool active_100ms;
2025-03-29 18:05:12 +08:00
} Delay;
2025-03-28 14:13:30 +08:00
typedef struct {
2025-02-25 11:18:20 +08:00
bool rms_active;
bool integrate_active;
bool alert_latching;
bool danger_latching;
bool timed_ok;
2025-03-28 15:32:39 +08:00
int recorder_output;
2025-02-25 11:18:20 +08:00
bool two_ma_clamp;
2025-03-20 14:38:14 +08:00
float trip_multiply;
2025-02-25 11:18:20 +08:00
QString comparision;
int comparision_percentage;
} Alert_Variables;
2025-03-29 18:05:12 +08:00
typedef struct {
int recorder_output;
bool two_ma_clamp;
float trip_multiply;
2025-04-01 15:03:59 +08:00
int comparision;
int percentage;
2025-03-29 18:05:12 +08:00
} RecorderOut;
2025-03-28 14:13:30 +08:00
typedef struct {
2025-03-21 10:42:24 +08:00
int id;
bool active;
float normal_voltage_low;
float normal_voltage_high;
2025-04-02 14:07:37 +08:00
int speed_peek;
int default_speed;
2025-03-21 10:42:24 +08:00
bool automatic_threshold;
float threshold;
float hysteresis;
int events_per_revolution;
2025-04-02 14:07:37 +08:00
int record_output;
2025-03-21 10:42:24 +08:00
bool two_ma_clamp;
bool alert_latching;
bool overspeed_latching;
bool normal_latching;
2025-04-02 14:07:37 +08:00
} TachometerVariables;
2025-03-21 10:42:24 +08:00
2025-04-02 14:28:53 +08:00
typedef struct {
bool active;
float normal_voltage_low;
float normal_voltage_high;
bool automatic_threshold;
float threshold;
float hysteresis;
int events_per_revolution;
} KeyphaseVariables;
2025-03-28 14:13:30 +08:00
typedef struct {
QString transducer_name;
double scale_factor;
2025-03-28 14:13:30 +08:00
} Transducer;
2025-03-01 13:40:11 +08:00
#pragma pack(1)
typedef struct {
uint8_t head[3]; // 固定值0xAA55AA
uint8_t cmd; // 命令
2025-03-03 21:57:15 +08:00
int len; // 数据长度
2025-03-01 13:40:11 +08:00
uint8_t crc; // 数据 CRC 校验和
char data[0]; // 文件内容
} PackageHead;
2025-03-03 21:57:15 +08:00
2025-03-01 13:40:11 +08:00
typedef struct {
uint8_t card_id; // 0xff是本机其它子卡是115
char data[0];
} UpgradeCardReq;
typedef struct {
uint8_t code; // 0: 上传成功
} UpgradeRsp;
2025-03-03 21:57:15 +08:00
typedef struct {
uint8_t card_id; // 0xff是本机其它子卡是115
} GetVersionReq;
typedef struct {
uint8_t fpga; // fpga版本号
uint8_t sw; // 软件版本号
char fpga_data[9]; // fpga版本日期
} VersionRsp;
2025-03-04 16:00:19 +08:00
typedef struct {
uint8_t card_id; // 0xff是本机其它子卡是115
2025-03-05 16:56:07 +08:00
uint8_t led_id; // ok 灯 0xff,rx/tx 灯 0xf1,板卡测试模式 0xee,板卡状态 0xe1,其他 1 ~ 16
uint8_t led_operate; // 0 OFF,1 ON,2 红色,3 绿色,4 红色1Hz闪烁,5 红色2Hz闪烁,6 绿色闪烁,7 测试状态,8 手动状态,9 工作状态
2025-03-04 16:00:19 +08:00
} RelaySettingReq;
typedef struct {
uint8_t code;
} RelaySettingRsp;
2025-03-05 16:56:07 +08:00
typedef struct {
uint8_t card_id; // 0xff是本机其它子卡是115
} RelayStatusReq;
typedef struct {
uint8_t status; // 7 测试状态,8 手动状态,9 工作状态
} RelayStatusRsp;
2025-03-01 13:40:11 +08:00
#pragma pack()
2025-02-15 11:50:15 +08:00
#endif // DATA_CONFIG_H