139 lines
4.4 KiB
C
139 lines
4.4 KiB
C
#ifndef __PARAMS_H__
|
||
#define __PARAMS_H__
|
||
#include "lib.h"
|
||
#include "main.h"
|
||
#include "entity.h"
|
||
|
||
/// 阀门执行机构气罐的大小,影响进气和排气速度
|
||
typedef enum
|
||
{
|
||
Small = 0, // 小
|
||
Medium, // 中
|
||
Large, // 大
|
||
Largest, // 特大
|
||
} eActatorSize;
|
||
|
||
/// 气压通道
|
||
typedef enum
|
||
{
|
||
ADC_Index_PressSource = 0, // 气源压力
|
||
ADC_Index_PressOutA = 1, // 输出压力A
|
||
ADC_Index_PressOutB = 2, // 输出压力B
|
||
ADC_Index_CloseALL = 3, // 全部关闭
|
||
} ePressureIndex;
|
||
|
||
// TODO 磁条规格
|
||
typedef enum
|
||
{
|
||
MAGNET_PARAM_TEST,
|
||
MAGNET_PARAM_100,
|
||
MAGNET_PARAM_MAX,
|
||
} magnet_type_e;
|
||
|
||
// TODO 气压传感规格
|
||
typedef enum
|
||
{
|
||
PRESSURE_PARAM_S,
|
||
PRESSURE_PARAM_A,
|
||
PRESSURE_PARAM_B,
|
||
PRESSURE_PARAM_MAX,
|
||
} pressure_type_e;
|
||
|
||
typedef enum
|
||
{
|
||
POSITIONER_MODEL_GPS1000 = 1000,
|
||
POSITIONER_MODEL_GPS3000 = 3000, // 自制IP+放大器
|
||
POSITIONER_MODEL_GPS5000 = 5000,
|
||
} positioner_model_e; ///< 定位器型号
|
||
|
||
// 定位器工作模式
|
||
#define ON_LINE_MODE 0 ///< 在线模式(根据4~20ma控制阀位),自动模式
|
||
#define OFF_LINE_MODE 1 ///< 离线模式(根据hart指令控制阀位,4~20ma用于供电),手动模式
|
||
#define MANUAL_TEST_MODE 2 ///< 按键测试模式(点按-小步长动作,长按-连续动作)
|
||
#define FORBIDEN_MODE 3 ///< 禁用模式(阀门复位,定位器禁用信号控制功能)
|
||
#define STOP_MODE 4 ///< 停止模式(DCS专用,阀门复位,定位器不工作,只保留串口通讯功能)
|
||
#define WAIT_MODE 5 ///< 待机模式(DCS专用,阀门保持现状,定位器正常工作,不接收外部信号)
|
||
|
||
// 显示方向 0/180
|
||
#define DISP_DIR_0 0
|
||
#define DISP_DIR_180 1
|
||
|
||
// 显示语言
|
||
#define ENGLISH 0
|
||
#define CHINESE 1
|
||
|
||
// 行程类型, 直行程/角行程
|
||
#define TRAVEL_TYPE_STRAIGHT 0 // 直行程
|
||
#define TRAVEL_TYPE_ANGULAR 1 // 角行程
|
||
|
||
// 行程百分比显示方式
|
||
#define TRAVEL_DISPLAY_NORMAL 0 // 正常显示,与阀门开度一致
|
||
#define TRAVEL_DISPLAY_REVERSE 1 // 反向显示,与阀门开度相反
|
||
|
||
// 行程显示单位
|
||
#define TRAVEL_UNIT_PRE 0 // 百分比
|
||
#define TRAVEL_UNIT_MM 1 // 毫米
|
||
#define TRAVEL_UNIT_INCH 2 // 英寸
|
||
#define TRAVEL_UNIT_ANGLE 3 // 角度
|
||
|
||
// 阀门开关触发逻辑
|
||
#define TRIGGER_LOGIC_DISABLE 0 // 禁用
|
||
#define TRIGGER_LOGIC_BELOW 1 // 低于,小于 <
|
||
#define TRIGGER_LOGIC_ABOVE 2 // 高于,大于 >
|
||
|
||
// 压力单位
|
||
#define PRESSURE_UNIT_Kpa 0 //
|
||
#define PRESSURE_UNIT_Mpa 1 //
|
||
#define PRESSURE_UNIT_Psi 2 //
|
||
#define PRESSURE_UNIT_Bar 3 //
|
||
#define PRESSURE_UNIT_Kgf 4 //
|
||
|
||
// 阀门特性
|
||
#define VALVE_CHARACT_LINEAR 0 // 线性
|
||
#define VALVE_CHARACT_EQU50 1 // 等百1:50
|
||
#define VALVE_CHARACT_QOPEN50 2 // 快开1:50
|
||
#define VALVE_CHARACT_EQU25 3 // 等百1:25
|
||
#define VALVE_CHARACT_QOPEN25 4 // 快开1:25
|
||
#define VALVE_CHARACT_EQU33 5 // 等百1:33
|
||
#define VALVE_CHARACT_QOPEN33 6 // 快开1:33
|
||
#define VALVE_CHARACT_SElF 7 // 自定义
|
||
|
||
// 执行机构单/双作用
|
||
#define VALVE_ACTING_SINGLE 0 // 单作用
|
||
#define VALVE_ACTING_DOUBLE 1 // 双作用
|
||
|
||
// 定位器(控制器)正/反作用
|
||
#define CONTROLLER_ACTING_NORMAL 0 // 正作用, I增大 -> 输出气压增大
|
||
#define CONTROLLER_ACTING_REVERSE 1 // 反作用, I增大 -> 输出气压减小
|
||
|
||
// 气开/气关设置(零控信号阀门状态, 0-关闭,其它打开)
|
||
#define ATO 0 // 气开,充气阀门打开,放气阀门关闭
|
||
#define ATC 1 // 气关,充气阀门关闭,放气阀门打开
|
||
|
||
// 报警处理方式
|
||
#define ALARM_HANDLING_CONTINUE 0 // 显示屏/诊断软件内显示,不影响阀门动作
|
||
#define ALARM_HANDLING_PAUSE 1 // 显示屏/诊断软件内显示,阀门故障动作/保持
|
||
|
||
// PID
|
||
#define Adaptive_PID 0 // 自适应PID
|
||
#define Self_PID 1 // 自定义PID
|
||
|
||
// 直行程:0(自定义)、16mm、25mm、40mm、60mm、100mm、130mm、160mm、200mm
|
||
#define StraightTravelRangeTable_Number 9
|
||
// 角行程:0(自定义)、0~60°、0~90°
|
||
#define AngularTravelRangeTable_Number 3
|
||
|
||
/// 磁条规格 [0]:最小值 [1]:最大值
|
||
extern const uint16_t magnet_param_table[MAGNET_PARAM_MAX][2];
|
||
/// 气压传感规格 [0]:最小值 [1]:最大值
|
||
extern const uint16_t pressure_param_table[PRESSURE_PARAM_MAX][2];
|
||
// 阀门流量特性表
|
||
extern const uint16_t valve_characteristics_table[][17];
|
||
|
||
extern void params_init(void);
|
||
extern void params_restart(void);
|
||
extern void hart_attribute_params_restart(void);
|
||
extern void hart_attribute_user_params_restart(void);
|
||
|
||
#endif // __PARAMS_H__
|