📄 cdt.h
字号:
#include "typedef.h"
#include "nucleus.h"
#include "generic.h"
#include "system.h"
#include "inforec.h"
#include "dev_mng.h"
#include "uart.h"
#include "cdtcode.h"
/* 设备标识及通讯端口 */
static WORD m_dev_id =SYS_IED_NIL;
static WORD m_dev_port=UART_PORT_A;
/* 轮询任务1 接受任务 */
static NU_TASK m_232_task;
static BYTE m_232_stack[0x2000];
static VOID task_232(UNSIGNED argc, VOID *argv);
/* 轮询任务2 遥测、全遥信处理任务*/
/*static NU_TASK m_232x_task;
static BYTE m_232x_stack[0x2000];
static VOID task_232x(UNSIGNED argc, VOID *argv);*/
/* 轮询任务3 事件处理任务*/
/*static NU_TASK m_232event_task;
static BYTE m_232event_stack[0x2000];
static VOID task_232event(unsigned argc, VOID *argv);*/
/* 轮询任务4 变位遥信处理任务*/
/*static NU_TASK m_232di_task;
static BYTE m_232di_stack[0x2000];
static VOID task_232di(UNSIGNED argc, VOID *argv);*/
/* 内部数据 */
static T_DI m_di; /* 当前遥信状态 */
static T_MEASURE m_ms; /* 当前遥测状态 */
static WORD yc_temp[250];
static WORD set_temp[250];
static int time_num=0;
/* 通讯资源 */
static BYTE m_tx_buf[UART_PACKET_SIZE];
static BYTE m_rx_buf[UART_PACKET_SIZE];
static NU_SEMAPHORE m_com_lock;
/* 锁定通讯资源 */
#define DEV_LOCK_COM() NU_Obtain_Semaphore(&m_com_lock, NU_SUSPEND)
/* 开放通讯资源 */
#define DEV_UNLOCK_COM() NU_Release_Semaphore(&m_com_lock)
/* 接收中断回调函数,用以判断数据帧的结束。*/
BOOL cdt_get_setting(T_IED *p_ied, T_SET *p_set);
BOOL LD_service(T_IED *p_ied, T_MESSAGE *p_msg);
BOOL c103_get_List(T_IED *p_ied, T_LIST* p_list);
WORD C103_Get_Code(T_IED* p_ied, T_LIST* p_list, WORD code);
BOOL pro_open_ied(const T_IED *p_ied);
BOOL cdt_remote_control(T_IED *p_ied, WORD ctrl_no);
BOOL cdt_check_control(T_IED *p_ied, WORD ctrl_no);
BOOL cdt_set_clock(T_IED *p_ied, const T_DATE *p_date);
void get_change_di(const BYTE *body_di, WORD wSize);
void EVENT_Interpret (const BYTE *Frame);
void DI_Interpret (const BYTE *pFrame);
typedef struct tagT_C103_CODE_TABLE
{
WORD dev_type; /* 设备类型 */
T_EVENT_ENTRY *p_event; /* 事件码表 */
WORD w_even; /* 事件个数 */
T_SET_ENTRY *p_setting; /* 定值码表 */
WORD w_setting; /* 定值个数 */
}T_C103_CODE_TABLE;
#define LD_311 1 //10KV线路
#define LD_331 2 //电容器
#define LD_315 3 //母联
#define LD_313 4 //35KV出线
#define LD_301 5 //管理机
static T_IED g_ied_list[]=
{
//data[0]是设备地址,data[1]是定值组号,data[5]是硬压板个数
{1,LD_service,LD_301,0,{0,0},0},
{2,LD_service,LD_331,0,{1,0},0},
{3,LD_service,LD_315,0,{2,0},0},
{4,LD_service,LD_311,0,{3,0},0},
{5,LD_service,LD_311,0,{4,0},0},
{6,LD_service,LD_311,0,{5,0},0},
{7,LD_service,LD_311,0,{6,0},0},
{8,LD_service,LD_311,0,{7,0},0},
{9,LD_service,LD_311,0,{8,0},0},
{10,LD_service,LD_311,0,{9,0},0},
{11,LD_service,LD_311,0,{10,0},0},
{12,LD_service,LD_311,0,{11,0},0},
{13,LD_service,LD_311,0,{12,0},0},
{14,LD_service,LD_311,0,{13,0},0},
{15,LD_service,LD_311,0,{14,0},0},
{16,LD_service,LD_311,0,{15,0},0},
{17,LD_service,LD_311,0,{16,0},0},
{18,LD_service,LD_311,0,{17,0},0},
{19,LD_service,LD_311,0,{18,0},0},
{20,LD_service,LD_311,0,{19,0},0},
{21,LD_service,LD_311,0,{20,0},0},
{22,LD_service,LD_311,0,{21,0},0},
{23,LD_service,LD_311,0,{22,0},0},
{24,LD_service,LD_311,0,{23,0},0},
{25,LD_service,LD_311,0,{24,0},0},
{26,LD_service,LD_311,0,{25,0},0},
{27,LD_service,LD_311,0,{26,0},0},
{28,LD_service,LD_311,0,{27,0},0},
{29,LD_service,LD_313,0,{28,0},0},
{30,LD_service,LD_313,0,{29,0},0},
{31,LD_service,LD_313,0,{30,0},0},
{32,LD_service,LD_313,0,{31,0},0},
{33,LD_service,LD_313,0,{32,0},0},
};
#define DeviceNumber sizeof(g_ied_list)/sizeof(T_IED)//设备数目
static T_C103_CODE_TABLE g_c103_code[]=
{
{LD_311, LD_311_event_table, LD_311_evSize, LD_311_set_table, LD_311_setSize},
{LD_331, LD_331_event_table, LD_331_evSize, LD_331_set_table, LD_331_setSize},
{LD_315, LD_315_event_table, LD_315_evSize, LD_315_set_table, LD_315_setSize},
{LD_313, LD_313_event_table, LD_313_evSize, LD_313_set_table, LD_313_setSize},
{LD_301, LD_301_event_table, LD_301_evSize, LD_301_set_table, LD_301_setSize},
};
#define g_c103_code_size sizeof(g_c103_code)/sizeof(T_C103_CODE_TABLE)
//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -