openbmc / phosphor-pid-control

OpenBMC PID-based Thermal Control Daemon
Apache License 2.0
16 stars 21 forks source link

Add support for Derivative (the "D" in PID loop) #22

Closed Krellan closed 1 year ago

Krellan commented 2 years ago

As of now, phosphor-pid-control only provides a PI loop. It's not technically a PID loop. However, thanks to feed-forward support, it gets the job done.

It might be nice to enhance the algorithms, to truly become a PID loop. Add support for including the Derivative in the loop calculations, and add whatever new parameters are necessary to the thermal zone configuration structure.

I'm not sufficiently well-versed in control theory to add such a feature myself. I'm documenting this as a feature request, though, because it regularly comes up in conversation.

Ed Tanous writes, on the Discord:

Why do you think the derivative term important for thermal control? The derivative term is quite important in things like motion control, where the physical model has some amount of "momentum" that needs to be countered, and the loops are tuned for bidirectional stability, but in most server thermals, there isn't really generally any "momentum" that needs to be countered, and in general, most servers are tuned for unstable positive error feedback loops, and stable negative error feedback loops (because overheating is worse than overcooling).

I wouldn't' be against someone having a patch adding a D term, but I suspect it would only serve so that this question doesn't get asked so often, rather than making thermal loops more stable. Implementation wise, it's not trivial to add, because the way our sensor loops work, there isn't a fixed sample rate, given that sensors can go unavailable at times, or have imprecise time between samples. The I term is pretty easy to calculate because it's just (time since last reading) (error) (I coefficient), but D is generally based on the sample rate, measuring the difference between subsequent, well spaced samples, so you'd have to invent in software some way to generate an analog for that.

So, here it is, as a feature request, if anybody who is really good at control theory wants to tackle it.

Krellan commented 1 year ago

Looks like we're getting this soon!

https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/57660

Krellan commented 1 year ago

This feature landed a few months ago. Closing this issue.