KostyaEsmukov/afancontrol

Smoother fan control

Closed this issue · 6 comments

Hello,

I own a Ryzen 5 3600X with schedutil CPU governor, but CPU temperature does spikes like every 5-7 seconds at idle.
This is a bit annoying because it generates random noise at idle.

Here is a diagram with 250 values:
afancontrol

Archive with SVG digram and CSV file: values.tar.gz
afancontrol configuration file: afancontrol.txt

Smoother fan control is welcome to correct this problem: I think afancontrol could use the mean of last umpteenth values instead of the current value.

Yep, I've seen this kind of behaviour on Ryzen 3900X as well. These chips can change their temperatures quite rapidly.

And I totally agree that having a way to define smoothing filters would be very useful. I think they should probably be put on the temperature sensors side rather than on the PWM fans side.

Another problem I have witnessed is that some temperature sensors (notably SSD/HDD) might report inadequately large individual measurements (i.e. over 100℃). A moving mean filter would be affected by these erroneous spikes, but a moving median would not. I even had a local branch with a rough implementation of that, but unfortunately I never got to actually complete it.

Eventually I would love to have these filters implemented, but for the moment I don't have time to do that myself. Let me know if you would like to work on that yourself, so I could share what I have in that branch which could be a starting point.

You are right, median will be more adequate than mean.

Eventually I would love to have these filters implemented, but for the moment I don't have time to do that myself. Let me know if you would like to work on that yourself, so I could share what I have in that branch which could be a starting point.

I cannot guarantee that I will have free time to work on this, but if you don't mind, share your work in progress on a separate branch and I will take a look.

ATM, I set the CPU governor to powersave for low power tasks as a workaround.

I have just pushed that branch: https://github.com/KostyaEsmukov/afancontrol/tree/f/filters

IIRC it worked fine, but I just trashed the faulty HDD/SSD device instead of finishing that branch. :)

I have just released afancontrol==2.2.0 which contains an initial support for filters: b06324c.

Example configuration:

[filter: moving_quantile_80]
type = moving_quantile
quantile = 0.8
window_size = 10

[temp:cpu]
...
filter = moving_quantile_80

quantile = 0.8 would make it prefer higher temperatures (i.e. it would always take the 80-th percentile temperature in the window of last 10 observations). If the goal is to make fans more quiet at the cost of slower reaction, then a lower quantile can be used, such as quantile = 0.3.

This graph shows how the aforementioned moving_quantile_80 filter affects the temperature measurements on Ryzen 3900X:

Screenshot 2020-09-29 at 01 52 12

(Sorry for the late response)

Wow, awesome, that is better now. Thank you very much!