You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
6.9 KiB
C

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef __PD_HF_H__
#define __PD_HF_H__
#ifdef CFG_DEV_TYPE_LAND_PD
/* Includes ------------------------------------------------------------------*/
#include "pd_dau.h"
#define HF_DATA_LEN (1300)
/*趋势上送数据报文头c语言定义*/
enum HF_TREND_TYPE
{
HF_TREND_TYPE_PRPD = 0, // 累计PRPD
HF_TREND_TYPE_ORIG, // 原始波形
HF_TREND_TYPE_PRPS, // 后10秒PRPS
HF_TREND_TYPE_STAT, // 统计数据
HF_TREND_TYPE_MAX,
};
/* 点位数据 */
typedef struct
{
uint16_t index; // 点位
int16_t data; // 数据
} hf_data_point_t;
/* 一般应答 */
typedef struct
{
uint8_t result; // 应答结果. 0:失败 1:成功
uint8_t slot; // slot id
uint8_t reserved[2]; // 保留
} hf_ack_t;
typedef struct
{
uint8_t slot; // 槽位号
uint8_t type_m; // 主设备号
uint8_t type_s; // 次设备号
uint8_t reserved1[1]; // 保留
uint32_t dev_id; // 设备ID
char hostname[FILE_NAME_LEN]; // 设备名 128byte
uint32_t factory_date; // 出厂日期.
uint32_t deployment_date; // 部署日期.
uint8_t app_version[32]; // 软件版本
uint8_t app_compile_time[32]; // 软件编译时间
uint8_t hardware_version[32]; // 硬件版本
uint8_t FPGA_version[32]; // fpga版本
uint32_t ip; // 本机 IP.
uint32_t mask; // 本机 MASK.
uint32_t gw; // 本机网关
uint8_t mac[6]; // MAC地址.
uint16_t server_port; // 服务器端口号.
uint32_t server_ipv4; // 服务器 IP.
uint8_t port[8];
uint8_t port_type[8];
} hf_dev_info_t;
/* 心跳报文. */
typedef struct
{
float freq; // 实测同步源工频频率.
uint8_t dau_state[4]; // 采集模块的状态.
uint8_t out_sync; // 外接调频同步 1: 有效 0: 无效.
uint8_t pt_sync; // PT同步 1: 有效 0: 无效.
uint8_t in_sync; // 内同步 1: 有效 0: 无效.
uint8_t reserved1; // 预留 字节对齐.
uint8_t port_link_alarm[PD_PORT_SUM]; // 通道传感器连接状态 断线告警.
uint8_t dau_port_num[4]; // 采集板端口数量.
} hf_heartbeat_t;
/* 实时图谱关注 */
typedef struct
{
uint8_t vport; // 通道编号 1 ~ 8
uint8_t is_concern; // 关注 1: 关注 0: 取消关注
uint8_t filter; // 滤波器类型
uint8_t denoise_correlation; // 关联降噪 1: 关联噪声去噪
uint8_t denoise_type; // 0-无配置 1-自动 2-手动降噪
uint8_t reserved[1];
uint16_t denoise_manual; // 手动降噪等级
} hf_prps_get_t;
/* 趋势头 */
typedef struct
{
uint16_t index; // 包索引
uint16_t sum; // 总包数
uint8_t type; // 数据类型 0prpd 1:原始波形 210秒prps 3:统计数据
uint8_t vport; // 通道号
uint8_t boosterpack; // 是否补包 0否 1
uint8_t reserved[1]; // 保留
uint32_t identifier; // 数据编号
uint32_t utc; // 同步时间
uint32_t len; // 当前包长度
} hf_trend_head_t;
/* 趋势应答 */
typedef struct
{
uint32_t index;
uint8_t result;
uint8_t boosterpack; // 是否补包 0:否 1:是
uint8_t reserve[2];
} hf_trend_ack_t;
/* 趋势统计 */
typedef struct
{
uint16_t data_cnt; // 数据计数
int16_t max; // 通道的最大值
uint16_t reserved; // 保留
uint16_t avg; // 通道的平均值
uint32_t cnt; // 通道的计数值
uint32_t phase; // 放电相位
uint32_t noise; // 趋势数据中的底噪值: 单位 dBm
uint32_t event_cnt; // 趋势数据中的的事件数量记录
} hf_trend_stat;
/* 趋势统计结构体 */
typedef struct
{
uint32_t index; // 数据编号: 0 - (2^32-1) 循环.
uint32_t utc; // UTC 时标.
hf_trend_stat port[PD_DAU_PORT_SUM]; // 通道 0 - 15 的计算及测量数据.
} hf_trend_col_t;
/* 趋势 PRPD 结构体 */
typedef struct
{
uint16_t data[PD_PHASE_NUM][PD_VAULE_NUM];
} hf_trend_prpd_port_t;
/* 趋势 PRPD 结构体 */
typedef struct
{
pd_trend_prpd_port_t port[PD_DAU_PORT_SUM];
} hf_trend_prpd_t;
/* 趋势 PRPS 结构体 */
typedef struct
{
uint32_t point_cnt; // 数据累计点数.
hf_data_point_t point[PD_TREND_POINT_MAX];
} hf_trend_prps_port_t;
/* 趋势 PRPS 结构体 */
typedef struct
{
hf_trend_prps_port_t port[PD_DAU_PORT_SUM];
} hf_trend_prps_t;
/* 高频趋势数据 */
typedef struct
{
hf_trend_col_t col;
hf_trend_prpd_t prpd;
hf_trend_prps_t prps;
} hf_trend_t;
/* 事件头 */
typedef struct
{
uint16_t index; // 包索引
uint16_t sum; // 总包数
uint8_t vport; // 通道号
uint8_t boosterpack; // 是否补包 0否 1
int16_t max; // 通道的最大值.
uint32_t power_fre; // 工频周期.
uint8_t type; // 事件类型.
uint8_t reserved[3]; // 保留
uint32_t identifier; // 数据编号: 0 - (2^32-1) 循环.
uint32_t utc; // UTC 时标.
uint32_t cnt; // 通道每秒脉冲计数值.
uint16_t avg_o; // 通道原始信号 (降噪前) 的平均值.
uint16_t avg; // 脉冲平均值.
uint32_t point_cnt; // 数据累计点数
uint32_t len; // 当前包长度
} hf_event_head_t;
/* 事件应答 */
typedef struct
{
uint32_t index;
uint8_t result;
uint8_t boosterpack; // 是否补包 0: 否 1: 是
uint8_t reserve[2];
} hf_event_ack_t;
/* 高频事件数据 */
typedef struct
{
hf_event_head_t head;
hf_data_point_t point[PD_EVENT_POINT_MAX];
} hf_event_t;
/* 高频私有数据 */
typedef struct
{
hf_heartbeat_t run_status;
hf_event_t event;
hf_trend_t trend;
} hf_data_t;
extern int32_t hf_recv_process(uint8_t slot, char *pkt, uint16_t len);
extern int32_t hf_send_process(uint8_t slot, uint8_t type, void *data);
extern void* hf_data_malloc(void);
#endif
#endif