modify:调整变量
This commit is contained in:
parent
96e487b379
commit
3b35db3b48
|
@ -103,7 +103,7 @@
|
|||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>4</nTsel>
|
||||
<nTsel>6</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
|
@ -114,13 +114,13 @@
|
|||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGUARM</Key>
|
||||
<Name>d</Name>
|
||||
<Name>(105=-1,-1,-1,-1,0)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<TargetName>controller-v2</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060061::V5.06 update 1 (build 61)::ARMCC</pCCUsed>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
|
|
Binary file not shown.
|
@ -9,6 +9,7 @@
|
|||
#ifndef __MODE_H__
|
||||
#define __MODE_H__
|
||||
#include "lib.h"
|
||||
#include "mode_def.h"
|
||||
#include "mode_dac.h"
|
||||
#include "mode_pwm.h"
|
||||
#include "mode_pwmp.h"
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef __MODE_DEF_H__
|
||||
#define __MODE_DEF_H__
|
||||
typedef enum
|
||||
{
|
||||
POSITION_CHANGE, // 位置发生变化
|
||||
POSITION_NO_CHANGE, // 位置没变化,但是等待次数没到
|
||||
POSITION_NO_CHANGE_FOREVER, // 位置不再发生变化
|
||||
} valve_position_change_e; // 位置变化
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VALUE_POSITION_MIN, // 位置值最小
|
||||
VALUE_POSITION_MAX, // 位置值最大
|
||||
} mode_pwm_value_position_e; // 位置值
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// 这一部分只用于LCD整定界面
|
||||
LCD_ADJUST_IDEL = 1, // 准备中
|
||||
LCD_ADJUST_POSITION0, // 位置0
|
||||
LCD_ADJUST_POSITION100, // 位置100
|
||||
LCD_ADJUST_TIMER, // 计时
|
||||
LCD_ADJUST_TUNING, // 自整定
|
||||
LCD_ADJUST_SAVE, // 存储变量
|
||||
LCD_ADJUST_STOP, // 停止
|
||||
} lcd_adjust_step_e; // 整定步骤
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LCD_ADJUST_RESULT_OK, ///< 整定成功
|
||||
LCD_ADJUST_RESULT_FAIL, ///< 整定失败
|
||||
LCD_ADJUST_RESULT_ING, ///< 整定中
|
||||
} lcd_adjust_result_e; ///< 整定结果
|
||||
|
||||
#endif // __MODE_DEF_H__
|
|
@ -3,11 +3,6 @@
|
|||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VALUE_POSITION_MIN,
|
||||
VALUE_POSITION_MAX,
|
||||
} mode_pwm_value_position_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -33,25 +33,25 @@ typedef enum
|
|||
/*需要存储的变量*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t tuned_flag; // 是否整定过 1:整定过 0:未整定过
|
||||
uint8_t tuned_state; // 自整定结果
|
||||
uint8_t tuned_flag; // 是否整定过 1:整定过 0:未整定过
|
||||
uint8_t tuned_state; // 自整定结果
|
||||
|
||||
uint16_t bleeding; // 放气值
|
||||
uint16_t inflation; // 充气值
|
||||
uint16_t arr_diff; // 控制区间
|
||||
uint16_t ad_diff; // 磁条区间
|
||||
uint16_t pwmp_min; // 控制最小值
|
||||
uint16_t pwmp_max; // 控制最大值
|
||||
uint16_t trip_0; // 磁条0位置AD
|
||||
uint16_t trip_100; // 词条100位置AD
|
||||
uint16_t trip_min0; // 小回路行程0位置AD
|
||||
uint16_t trip_min100; // 小回路行程100位置AD
|
||||
uint16_t current0; // 电流最小值
|
||||
uint16_t current100; // 电流最大值
|
||||
uint16_t all_open_time;// 全开时间
|
||||
uint16_t all_close_time;// 全关时间
|
||||
uint16_t prov_flag; // 磁条安装的正反:倒装:0 正装:1
|
||||
uint16_t valve_type; // 阀门正反行程:气开:ATO 气关:ATC
|
||||
uint16_t bleeding; // 放气值
|
||||
uint16_t inflation; // 充气值
|
||||
uint16_t arr_diff; // 控制区间
|
||||
uint16_t ad_diff; // 磁条区间
|
||||
uint16_t pwmp_min; // 控制最小值
|
||||
uint16_t pwmp_max; // 控制最大值
|
||||
uint16_t trip_0; // 磁条0位置AD
|
||||
uint16_t trip_100; // 词条100位置AD
|
||||
uint16_t trip_min0; // 小回路行程0位置AD
|
||||
uint16_t trip_min100; // 小回路行程100位置AD
|
||||
uint16_t current0; // 电流最小值
|
||||
uint16_t current100; // 电流最大值
|
||||
uint16_t all_open_time; // 全开时间
|
||||
uint16_t all_close_time; // 全关时间
|
||||
uint16_t prov_flag; // 磁条安装的正反:倒装:0 正装:1
|
||||
uint16_t valve_type; // 阀门正反行程:气开:ATO 气关:ATC
|
||||
float32 kp;
|
||||
float32 ki;
|
||||
float32 kd;
|
||||
|
@ -104,13 +104,6 @@ typedef struct
|
|||
|
||||
/////////////////////////////////////////*共用部分BEGIN*////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POSITION_CHANGE, // 位置发生变化
|
||||
POSITION_NO_CHANGE, // 位置没变化,但是等待次数没到
|
||||
POSITION_NO_CHANGE_FOREVER, // 位置不再发生变化
|
||||
} valve_position_change_hd_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PWMP_HD_ADJUST_IDEL,
|
||||
|
@ -247,8 +240,8 @@ typedef enum
|
|||
/// 操作标志
|
||||
typedef enum
|
||||
{
|
||||
EXECUTE_NONE = 0, ///< 不执行任何操作
|
||||
EXECUTE_DAC = 1, ///< 执行DAC输出
|
||||
EXECUTE_HD_NONE = 0, ///< 不执行任何操作
|
||||
EXECUTE_HD_OUT = 1, ///< 执行输出
|
||||
} execute_hd_e;
|
||||
|
||||
/// 返回内容
|
||||
|
|
|
@ -240,7 +240,7 @@ execute_rsp_hd_t *execute_dac(execute_plan_hd_e plan)
|
|||
case EXECUTE_PLAN_4:
|
||||
return execute_dac_plan4();
|
||||
default:
|
||||
rsp.code = EXECUTE_NONE;
|
||||
rsp.code = EXECUTE_HD_NONE;
|
||||
return &rsp;
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static execute_rsp_hd_t *execute_dac_plan1()
|
|||
out *= (mode_pwmp_hd->pwmp_save->storage.pwmp_max + Control_diff * index_max) - (mode_pwmp_hd->pwmp_save->storage.pwmp_min - Control_diff * index_min); // 映射实际控制器的范围
|
||||
out += mode_pwmp_hd->pwmp_save->storage.pwmp_min - Control_diff * index_min; // 对输出结果进行偏移处理
|
||||
|
||||
rsp.code = EXECUTE_DAC;
|
||||
rsp.code = EXECUTE_HD_OUT;
|
||||
rsp.dac = (uint32_t)out;
|
||||
|
||||
/// 在执行了十次之后若系统认为稳定进入以下程序进行微调
|
||||
|
@ -359,7 +359,7 @@ static void set_step_signal(uint16_t signal_in)
|
|||
}
|
||||
|
||||
/*判断阀门状态:移动、停止、停止但仍在等待*/
|
||||
static valve_position_change_hd_e pwmp_adjust_hd_valve_position_change(uint8_t *state, uint8_t next_state, uint8_t diff_adc_max)
|
||||
static valve_position_change_e pwmp_adjust_hd_valve_position_change(uint8_t *state, uint8_t next_state, uint8_t diff_adc_max)
|
||||
{
|
||||
uint16_t diff_adc = 0;
|
||||
// uint16_t adc = get_actual_travel_adc();
|
||||
|
@ -437,7 +437,7 @@ static void pwmp_adjust_hd_idle(uint8_t *state, mode_pwmp_hd_adjust_state_e next
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
|
||||
switch (s)
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ static void pwmp_adjust_hd_rough_position0(uint8_t *state, mode_pwmp_hd_adjust_s
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
|
||||
current_adc = mode_pwmp_hd_adjust->psb_adc;
|
||||
if (ABS(current_adc - mode_pwmp_hd_adjust->adc_record_1) >= DIFF_ADC_MAX)
|
||||
|
@ -627,7 +627,7 @@ static void pwmp_adjust_hd_accurate_position0(uint8_t *state, mode_pwmp_hd_adjus
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX * 10);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX * 10);
|
||||
|
||||
current_adc = mode_pwmp_hd_adjust->psb_adc;
|
||||
/*执行器发生动作*/
|
||||
|
@ -695,7 +695,7 @@ static void pwmp_adjust_hd_rough_position100(uint8_t *state, mode_pwmp_hd_adjust
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
|
||||
switch (s)
|
||||
{
|
||||
|
@ -738,7 +738,7 @@ static void pwmp_adjust_hd_accurate_position100(uint8_t *state, mode_pwmp_hd_adj
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
|
||||
current_adc = mode_pwmp_hd_adjust->psb_adc;
|
||||
uint16_t adc_diff = ABS(current_adc - mode_pwmp_hd_adjust->adc_record_2);
|
||||
|
@ -875,7 +875,7 @@ static void pwmp_adjust_hd_bleeding(uint8_t *state)
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, mode_pwmp_hd_adjust->adjust_state, DIFF_ADC_MAX);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, mode_pwmp_hd_adjust->adjust_state, DIFF_ADC_MAX);
|
||||
current_adc = mode_pwmp_hd_adjust->psb_adc;
|
||||
switch (s)
|
||||
{
|
||||
|
@ -973,7 +973,7 @@ static void pwmp_adjust_hd_PID_tuning(uint8_t *state, mode_pwmp_hd_adjust_state_
|
|||
}
|
||||
else
|
||||
{
|
||||
valve_position_change_hd_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
valve_position_change_e s = pwmp_adjust_hd_valve_position_change(state, next_state, DIFF_ADC_MAX);
|
||||
s_watch = s;
|
||||
/*获取实时行程*/
|
||||
pid_autotune_hd->data.cur_actual = pid_autotune_hd->data.adjust_tmp_actual;
|
||||
|
@ -1234,7 +1234,7 @@ void mode_pwmp_hd_process(void)
|
|||
else if (loop_current >= 4.5 && loop_current <= 19.5)
|
||||
{
|
||||
execute_res = execute_dac(EXECUTE_PLAN); // PID计算结果经过执行器处理
|
||||
if (execute_res->code == EXECUTE_DAC) // 执行DAC输出
|
||||
if (execute_res->code == EXECUTE_HD_OUT) // 执行DAC输出
|
||||
{
|
||||
pdctrl_out(execute_res->dac);
|
||||
}
|
||||
|
@ -1258,7 +1258,7 @@ void mode_pwmp_hd_process(void)
|
|||
{
|
||||
pdctrl_out(mode_pwmp_hd->output);
|
||||
mode_pwmp_hd->current_adc = get_actual_travel_adc();
|
||||
mode_pwmp_hd->duty_percent = ((float32)mode_pwmp_hd->output / (float32)ADC_OUT_MAX) * 100;
|
||||
mode_pwmp_hd->duty_percent = ((float32)mode_pwmp_hd->output / (float32)OUT_MAX) * 100;
|
||||
mode_pwmp_hd->current_electric = ip2current();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define SELF_VCHART_LEN 17 ///< 自定义阀门特性长度
|
||||
#define VALVE_SERIAL_NUM_LEN 16 ///< 阀门序列号长度
|
||||
#define INST_SERIAL_NUM_LEN 16 ///< 定位器序列号长度
|
||||
#define ADC_OUT_MAX 4095 ///< ADC输出最大值
|
||||
#define OUT_MAX 4095 ///< 输出最大值
|
||||
|
||||
/**
|
||||
* ADC通道定义: 主频4、分频系数16,根据公式 TCONV(转换时间) = (采样时间 + 12.5 个周期)/(主频/ADC分频系数) 计算每个通道单个采集时间
|
||||
|
@ -383,24 +383,6 @@ typedef union
|
|||
} Bits;
|
||||
} driver_icon_enable_u;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// 这一部分只用于LCD整定界面
|
||||
LCD_ADJUST_IDEL = 1, // 准备中
|
||||
LCD_ADJUST_POSITION0, // 位置0
|
||||
LCD_ADJUST_POSITION100, // 位置100
|
||||
LCD_ADJUST_TIMER, // 计时
|
||||
LCD_ADJUST_TUNING, // 自整定
|
||||
LCD_ADJUST_SAVE, // 存储变量
|
||||
LCD_ADJUST_STOP, // 停止
|
||||
} lcd_adjust_step_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LCD_ADJUST_RESULT_OK, ///< 整定成功
|
||||
LCD_ADJUST_RESULT_FAIL, ///< 整定失败
|
||||
LCD_ADJUST_RESULT_ING, ///< 整定中
|
||||
} lcd_adjust_result_e;
|
||||
#pragma pack() // 编译器中提供了#pragma pack(n)来设定变量以n字节对齐方式
|
||||
|
||||
extern volatile float32 calib_param[CALIBPARA_NUM][2]; ///< 校准参数
|
||||
|
|
Reference in New Issue