From a069d3e15194bdac83ab50a6bf14e14999d4bf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zeng=20wei=20=28=E6=9B=BE=E5=A8=81=29?= Date: Mon, 22 Apr 2024 10:05:44 +0800 Subject: [PATCH] Update PID.c --- HARDWARE/PID.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/HARDWARE/PID.c b/HARDWARE/PID.c index 5aca00f..abceeb4 100644 --- a/HARDWARE/PID.c +++ b/HARDWARE/PID.c @@ -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; } }