fixed broken logic introduced in e29a05f

Sorry people, when I rearranged the logic in e29a05f for:

$desired_temp1 < $weighted_temp < $desired_temp2

I ORed instead of ANDed, but didn't test it until I just pushed out my
ansible config to that host right now, several months later!
This commit is contained in:
Tim Connors 2025-01-22 18:03:38 +11:00
parent 2314f44268
commit e6ee99874a
2 changed files with 14 additions and 7 deletions

View file

@ -144,20 +144,24 @@ sub set_fans_servo {
# which we multiply later to be ranged roughly # which we multiply later to be ranged roughly
# between 0-100% of # between 0-100% of
# ($static_speed_low - $static_speed_high) # ($static_speed_low - $static_speed_high)
if ($weighted_temp > $base_temp and if (($weighted_temp > $base_temp) and
$weighted_temp < $desired_temp1) { ($weighted_temp < $desired_temp1)) {
# slope m = (y2-y1)/(x2-x1) # slope m = (y2-y1)/(x2-x1)
# y - y1 = (x-x1)(y2-y1)/(x2-x1) # y - y1 = (x-x1)(y2-y1)/(x2-x1)
# y1 = 0 ; x1 = base_temp ; y2 = demand1 ; x2 = desired_temp1 # y1 = 0 ; x1 = base_temp ; y2 = demand1 ; x2 = desired_temp1
# x = weighted_temp # x = weighted_temp
$demand = 0 + ($weighted_temp - $base_temp ) * ($demand1 - 0 )/($desired_temp1 - $base_temp ); $demand = 0 + ($weighted_temp - $base_temp ) * ($demand1 - 0 )/($desired_temp1 - $base_temp );
} elsif (($weighted_temp >= $desired_temp1) or ($weighted_temp < $desired_temp2)) { } elsif (($weighted_temp >= $desired_temp1) and
($weighted_temp < $desired_temp2)) {
# y1 = demand1 ; x1 = desired_temp1 ; y2 = demand2 ; x2 = desired_temp2 # y1 = demand1 ; x1 = desired_temp1 ; y2 = demand2 ; x2 = desired_temp2
$demand = $demand1 + ($weighted_temp - $desired_temp1) * ($demand2 - $demand1)/($desired_temp2 - $desired_temp1); $demand = $demand1 + ($weighted_temp - $desired_temp1) * ($demand2 - $demand1)/($desired_temp2 - $desired_temp1);
} elsif ($weighted_temp >= $desired_temp2) { } elsif ($weighted_temp >= $desired_temp2) {
# y1 = demand2 ; x1 = desired_temp2 ; y2 = demand3 ; x2 = desired_temp3 # y1 = demand2 ; x1 = desired_temp2 ; y2 = demand3 ; x2 = desired_temp3
# demand will increase above $demand3 for temps above $desired_temp3, linearly, until we cap it below # demand will increase above $demand3 for temps above $desired_temp3, linearly, until we cap it below
$demand = $demand2 + ($weighted_temp - $desired_temp2) * ($demand3 - $demand2)/($desired_temp3 - $desired_temp2); $demand = $demand2 + ($weighted_temp - $desired_temp2) * ($demand3 - $demand2)/($desired_temp3 - $desired_temp2);
} else {
# the only possibility left is $weighted_temp < $base_temp
# which we've already decided is demand=0
} }
printf "demand(%0.2f)", $demand if $print_stats; printf "demand(%0.2f)", $demand if $print_stats;
$demand = int($static_speed_low + $demand/100*($static_speed_high-$static_speed_low)); $demand = int($static_speed_low + $demand/100*($static_speed_high-$static_speed_low));

View file

@ -93,7 +93,10 @@ Jan 03 02:59:23 pve1 fan-speed-control.pl[3648151]: --> disable dynamic fan cont
> sensors > sensors
> sudo hddtemp /dev/sd? > sudo hddtemp /dev/sd?
``` ```
Whatever. Note that hddtemps and inlet (ambient air *intake*, which measures your room temperature) temperature are polled less frequently than coretemps, given they don't change as rapidly and are more expensive to read. Whatever. Note that hddtemps and inlet (ambient air *intake*, which
measures your room temperature) temperature are polled less frequently
than coretemps, given they don't change as rapidly and are more expensive
to read.
This script monitors the ambient air temperature (you will likely This script monitors the ambient air temperature (you will likely
need to modify the $ipmi_inlet_sensorname variable to find the correct need to modify the $ipmi_inlet_sensorname variable to find the correct