Update PID.c

check
Zeng wei (曾威) 2 years ago
parent a9c5531b1e
commit a069d3e151

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

Loading…
Cancel
Save