|
|
|
@ -60,8 +60,8 @@ void PID_Init()
|
|
|
|
pid.hd_h = 0;
|
|
|
|
pid.hd_h = 0;
|
|
|
|
pid.h_base_h = 0;
|
|
|
|
pid.h_base_h = 0;
|
|
|
|
|
|
|
|
|
|
|
|
pid.hp_l = 6;
|
|
|
|
pid.hp_l = 3;
|
|
|
|
pid.hi_l = 0.04;
|
|
|
|
pid.hi_l = 0.01;
|
|
|
|
pid.hd_l = 0;
|
|
|
|
pid.hd_l = 0;
|
|
|
|
pid.h_base_l = 53;
|
|
|
|
pid.h_base_l = 53;
|
|
|
|
|
|
|
|
|
|
|
|
@ -206,14 +206,15 @@ void PID_Calc() // pid calc
|
|
|
|
pid.h_base = pid.h_base_l;
|
|
|
|
pid.h_base = pid.h_base_l;
|
|
|
|
|
|
|
|
|
|
|
|
// if now temp is close to set temp, the heater will be less power
|
|
|
|
// if now temp is close to set temp, the heater will be less power
|
|
|
|
if (pid.set_tem - pid.now_tem < 3) {
|
|
|
|
// if (pid.set_tem - pid.now_tem < 3) {
|
|
|
|
pid.hp = pid.hp_h * 0.6;
|
|
|
|
// pid.hp = pid.hp_l * 0.6;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if (pid.set_tem - pid.now_tem < 1) {
|
|
|
|
if (pid.set_tem - pid.now_tem < 2) {
|
|
|
|
pid.hp = pid.hp_h * 0.3;
|
|
|
|
pid.hp = pid.hp_l * 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (abs(pid.out_tem) > 1e-5) {
|
|
|
|
if (abs(pid.out_tem) > 1e-5) {
|
|
|
|
pid.hp = -0.1 * pid.hp_l * (pid.out_tem - pid.set_tem) + pid.hp_l;
|
|
|
|
// hp_l = 3
|
|
|
|
|
|
|
|
pid.hp = -0.02 * pid.hp_l * (pid.out_tem - pid.set_tem) + pid.hp_l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|