Add kd_tau to oven PID parameters
This commit is contained in:
parent
24651fa74d
commit
99d96fb426
@ -38,7 +38,8 @@ struct pid_controller {
|
||||
volatile float derivate;
|
||||
};
|
||||
|
||||
void pid_init(struct pid_controller *pid, float k_deriv, float k_int, float k_p, float output_sat_min, float output_sat_max, float integral_max, float sample_period);
|
||||
void pid_init(struct pid_controller *pid, float k_deriv, float k_int, float k_p,
|
||||
float output_sat_min, float output_sat_max, float integral_max, float kd_tau, float sample_period);
|
||||
|
||||
void pid_zero(struct pid_controller *pid);
|
||||
|
||||
|
@ -28,6 +28,7 @@ struct oven_pid_settings {
|
||||
float kd;
|
||||
float kp;
|
||||
float ki;
|
||||
float kd_tau;
|
||||
float t_sample;
|
||||
float max_integral;
|
||||
};
|
||||
|
@ -113,7 +113,6 @@ void oven_pid_init(struct pid_controller *controller_to_copy)
|
||||
safety_controller_report_timing(ERR_TIMING_PID);
|
||||
timestamp_last_run = systick_get_global_tick();
|
||||
ssr_safety_en(true);
|
||||
|
||||
}
|
||||
|
||||
void oven_pid_set_target_temperature(float temp)
|
||||
|
@ -21,10 +21,8 @@
|
||||
#include <reflow-controller/pid-controller.h>
|
||||
#include <string.h>
|
||||
|
||||
const float kd_tau = 2.0f;
|
||||
|
||||
void pid_init(struct pid_controller *pid, float k_deriv, float k_int, float k_p, float output_sat_min,
|
||||
float output_sat_max, float integral_max, float sample_period)
|
||||
float output_sat_max, float integral_max, float kd_tau, float sample_period)
|
||||
{
|
||||
if (!pid)
|
||||
return;
|
||||
|
@ -170,6 +170,7 @@ enum settings_load_result sd_card_settings_load_pid_oven_parameters(struct oven_
|
||||
enum config_parser_ret parse_result;
|
||||
struct config_parser_entry entry;
|
||||
bool kp_loaded = false, kd_loaded = false, ki_loaded = false, int_max_loaded = false, t_sample = false;
|
||||
bool kd_tau_loaded = false;
|
||||
|
||||
if (!settings) {
|
||||
ret = SETT_LOAD_ERR;
|
||||
@ -198,13 +199,16 @@ enum settings_load_result sd_card_settings_load_pid_oven_parameters(struct oven_
|
||||
} else if (!strcmp(entry.name, "sample_period")) {
|
||||
t_sample = true;
|
||||
settings->t_sample = entry.value.float_val / 1000.0f;
|
||||
} else if (!strcmp(entry.name, "kd_tau")) {
|
||||
settings->kd_tau = entry.value.float_val;
|
||||
kd_tau_loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
} while (!config_parser_ret_is_abort_condition(parse_result));
|
||||
|
||||
|
||||
if (kp_loaded && kd_loaded && ki_loaded && t_sample && int_max_loaded)
|
||||
if (kp_loaded && kd_loaded && ki_loaded && t_sample && int_max_loaded && kd_tau_loaded)
|
||||
ret = SETT_LOAD_SUCCESS;
|
||||
|
||||
config_parser_close_file(p);
|
||||
|
@ -389,7 +389,7 @@ static void gui_menu_constant_temperature_driver_setup(struct lcd_menu *menu, en
|
||||
menu_lcd_output(menu, 1, "PID parameters");
|
||||
} else {
|
||||
pid_init(&pid_controller, pid_settings.kd, pid_settings.ki, pid_settings.kp, 0, 100,
|
||||
pid_settings.max_integral, pid_settings.t_sample);
|
||||
pid_settings.max_integral, pid_settings.kd_tau, pid_settings.t_sample);
|
||||
oven_pid_init(&pid_controller);
|
||||
menu_entry_enter(menu, gui_menu_constant_temperature_driver, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user