RFC: calculating RPM from PWM for fan monitor
Lei YU
mine260309 at gmail.com
Tue Jan 23 20:37:38 AEDT 2018
phospohr-fan-monitor compares fan speed with target and determine if the fan
is functional:
https://github.com/openbmc/phosphor-fan-presence/blob/master/monitor/fan.cpp#L182-L185
However, for systems using pwm as target, the logic does not work, because the
fan speed is RPM but the target the PWM.
So we probably need to have a conversion from PWM target to fan speed RPM.
On Romulus, the observation is:
| PWM | RPM |
| --- | ---- |
| 64 | 3000 |
| 96 | 3700 |
| 128 | 4300 |
| 160 | 4900 |
| 192 | 5600 |
| 224 | 6300 |
| 255 | 7000 |
And the linear fit becomes [RPM = 20.7147 * PWM + 1660.04][1]
So how do we make fan-monitor to support this?
My proposal is to define the parameters, e.g. slope, intercept in the config
yaml, and add this support in phosphor-fan-monitor.
E.g.
sensors:
- name: fan0
has_target: true
slope: 21
intercept: 1600
If the yaml config does not define slope/intercept, then the default value
is set to 1 and 0 which matches the fan speed target.
My question (and concern) is, the fan RPM can not be queried correctly when
PWM is set to a low value, e.g. 32, and it means the fit function may not be
linear fit.
What do you think?
[1]: http://m.wolframalpha.com/input/?i=linear+fit+%7B64%2C+3000%7D%2C%7B96%2C+3700%7D%2C%7B128%2C+4300%7D%2C%7B160%2C+4900%7D%2C%7B192%2C+5600%7D%2C%7B224%2C6300%7D%2C%7B255%2C7000%7D
More information about the openbmc
mailing list