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:
parent
2314f44268
commit
e6ee99874a
2 changed files with 14 additions and 7 deletions
|
|
@ -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));
|
||||||
|
|
|
||||||
11
readme.md
11
readme.md
|
|
@ -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
|
||||||
|
|
@ -108,7 +111,7 @@ quickly towards full speed much beyond that. It also has an ambient
|
||||||
air temperature threshold of 32degrees where it gives up and delegates
|
air temperature threshold of 32degrees where it gives up and delegates
|
||||||
control back to the firmware. The ambient temperature reading doesn't
|
control back to the firmware. The ambient temperature reading doesn't
|
||||||
normally affect how hard your fans have to spin, and is only used to
|
normally affect how hard your fans have to spin, and is only used to
|
||||||
fallback to iDRAC mode so that your machine doesn't explode if eg., you've
|
fallback to iDRAC mode so that your machine doesn't explode if eg., you've
|
||||||
had an air-conditioning failure. Don't run your bedroom IT closet at 32
|
had an air-conditioning failure. Don't run your bedroom IT closet at 32
|
||||||
degrees yeah?
|
degrees yeah?
|
||||||
|
|
||||||
|
|
@ -129,7 +132,7 @@ Historical notes and stuff it's partially relying on behind the scenes, and if y
|
||||||
|
|
||||||
1. Enable IPMI in iDrac
|
1. Enable IPMI in iDrac
|
||||||
2. Install ipmitool on linux, win or mac os
|
2. Install ipmitool on linux, win or mac os
|
||||||
3. Run the following command to issue IPMI commands:
|
3. Run the following command to issue IPMI commands:
|
||||||
`ipmitool -I lanplus -H <iDracip> -U root -P <rootpw> <command>`
|
`ipmitool -I lanplus -H <iDracip> -U root -P <rootpw> <command>`
|
||||||
|
|
||||||
(we don't use lanplus though)
|
(we don't use lanplus though)
|
||||||
|
|
@ -175,4 +178,4 @@ TLDR; I take _NO_ responsibility if you mess up anything.
|
||||||
|
|
||||||
*****
|
*****
|
||||||
|
|
||||||
All of this was inspired by [this Reddit post](https://www.reddit.com/r/homelab/comments/72qust/r510_noise/dnkofsv/) by /u/whitekidney
|
All of this was inspired by [this Reddit post](https://www.reddit.com/r/homelab/comments/72qust/r510_noise/dnkofsv/) by /u/whitekidney
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue