added boxcar averaging functionality #10
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running the original code, I often encountered one fluke temperature value sent the fans spinning like crazy, only to come back down really quickly. The time behaviour of the fan speed adaptation was much faster than the thermal mass of the system could absorb heat, so it appears instantaneous adaptation was too volatile.
Therefore I implemented a simple form of low-pass filtering where we simply average the last n temperature measurements, known as boxcar averaging.
In the settings you can indicate how many temperature measurements are averaged. Together with the interval parameter, you can now express the temporal behaviour of the fan speed adaptation. The reaction speed to a step in temperature is now (interval * Nboxcar) so with the default values, the system now ramps up or down in 5 seconds. I've played with values as large as 30 seconds to really smooth out the fan speed modulation and it worked fine. The value of 5 I consider to be an absolutely safe value together with the default temp curve.