采用简化的hp_base模型,不追求t_out为0时候,hp_base为0

check
Zeng wei (曾威) 2 years ago
parent eabfda897f
commit 8fa7b77213

@ -225,13 +225,16 @@ void PID_Calc() // pid calc
if (abs(pid.out_tem) > 1e-5) {
float t_out = pid.set_tem - pid.out_tem; // 7
float t_in = pid.set_tem - pid.now_tem; // 1.1
float hp_base = -0.003125 * t_out * t_out + 0.1875 * t_out;
// 当t_out为0时hp_base为0
// float hp_base = -0.003125 * t_out * t_out + 0.1875 * t_out;
// 采用简化模型不追求t_out为0时hp_base为0这可以同时提高在t_out较小时候的hp值
float hp_base = 0.075 * t_out + 0.9;
pid.hp = (6 - hp_base) / 2 * t_in + hp_base;
if (pid.hp < 0) {
pid.hp = 0;
}
if (pid.hp > 6) {
pid.hp = 6;
if (pid.hp > 9) {
pid.hp = 9;
}
} else {
if (pid.set_tem - pid.now_tem < 3) {

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save