Skip to content

Commit 23cd9db

Browse files
committed
Tuning default PID parameters
1 parent 7d04087 commit 23cd9db

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pwm-fan.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ LOGISTIC_TEMP_CRITICAL=75
3333
LOGISTIC_a=1
3434
LOGISTIC_b=10
3535
# uncomment and edit PID_THERMAL_IDEAL to set a fixed IDEAL temperature for the PID controller;
36-
# otherwise, the initial temperature after startup is used as reference.
36+
# otherwise, the initial temperature after startup (+2°C) is used as reference.
3737
#PID_THERMAL_IDEAL=45
3838
# https://en.wikipedia.org/wiki/PID_controller#Loop_tuning
39-
PID_Kp=$((DEFAULT_PERIOD/200))
40-
PID_Ki=$((DEFAULT_PERIOD/3000))
41-
PID_Kd=$((DEFAULT_PERIOD/600))
39+
PID_Kp=$((DEFAULT_PERIOD/100))
40+
PID_Ki=$((DEFAULT_PERIOD/500))
41+
PID_Kd=$((DEFAULT_PERIOD/300))
4242
# path to the pwm dir in the sysfs interface
4343
PWMCHIP_ROOT='/sys/class/pwm/'
4444
# path to the thermal dir in the sysfs interface
@@ -283,7 +283,7 @@ function_pid () {
283283
controller_pid () {
284284
# i_error cannot be local to be cumulative since it was first declared.
285285
local p_error d_error model duty_cycle
286-
p_error="$((${TEMPS[-1]}-${PID_THERMAL_IDEAL:-$((THERMAL_INITIAL))}))"
286+
p_error="$((${TEMPS[-1]}-${PID_THERMAL_IDEAL:-$((THERMAL_INITIAL+2))}))"
287287
i_error="$((${i_error:-0}+p_error))"
288288
d_error="$((${TEMPS[-1]}-${TEMPS[-2]}))"
289289
# TODO: Kp, Ki, and Kd could be auto tunned here; currently, they are not declared and PID_ vars are used.

0 commit comments

Comments
 (0)