|
|
|
|
@ -60,7 +60,7 @@ void PID_Init()
|
|
|
|
|
pid.hd_h = 0;
|
|
|
|
|
pid.h_base_h = 0;
|
|
|
|
|
|
|
|
|
|
pid.hp_l = 4.5;
|
|
|
|
|
pid.hp_l = 9;
|
|
|
|
|
pid.hi_l = 0.01;
|
|
|
|
|
pid.hd_l = 0;
|
|
|
|
|
pid.h_base_l = 10;
|
|
|
|
|
@ -209,12 +209,18 @@ void PID_Calc() // pid calc
|
|
|
|
|
// if (pid.set_tem - pid.now_tem < 3) {
|
|
|
|
|
// pid.hp = pid.hp_l * 0.6;
|
|
|
|
|
// }
|
|
|
|
|
if (pid.set_tem - pid.now_tem < 2) {
|
|
|
|
|
pid.hp = pid.hp_l * 0.5;
|
|
|
|
|
}
|
|
|
|
|
if (abs(pid.out_tem) > 1e-5) {
|
|
|
|
|
// hp_l = 3
|
|
|
|
|
pid.hp = -0.02 * pid.hp_l * (pid.out_tem - pid.set_tem) + pid.hp_l;
|
|
|
|
|
// pid.hp = -0.02 * pid.hp_l * (pid.out_tem - pid.set_tem) + pid.hp_l;
|
|
|
|
|
|
|
|
|
|
// increase hp when the delta_tem is large
|
|
|
|
|
float delta_tem = pid.now_tem - pid.set_tem;
|
|
|
|
|
if (delta_tem > - 2) {
|
|
|
|
|
// pid.hp = pid.hp * 0.5;
|
|
|
|
|
pid.hp = -0.09 * delta_tem + pid.hp_l / 2;
|
|
|
|
|
} else {
|
|
|
|
|
pid.hp = (-pid.hp_l / 6 + 0.06) * delta_tem + pid.hp_l / 6 + 0.3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|