openbmc / phosphor-pid-control

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

proposal: MaxError activated PI control #29

Closed huangalang closed 1 year ago

huangalang commented 1 year ago

We’re proposing a new PI controller named “MaxError activated PI control” It includes following features which is not covered in current pid algorithm

The advantage of the algorithm is: 1 tuning p coefficient & I coefficient is sufficient for most of server based systems 2 . special integral clamp can respond to error change to avoid the overshooting situation ( not use the d term because the derivative term is too sensitive to noise..) 3 introducing MaxError , keep fan running at minimal speed when error is far away from the set point (don not need to do pi calculation all the time)

The algorithm is listed as below
EX:
Old_iterm = 0, Pgain = -7, Igain = -0.1     (Pgain = 6~12, Igain = 0.05~0.2 )
MaxError = 13, Umax = 100, Umin = 20, R = 80
e = R - PV
if e <= MaxERROR:
        Iterm = old_Iterm
        Pterm = Pgain*e
        Iterm += Igain*e

        /*clamping by taking Pterm into consideration*/
        if Pterm+Iterm < Umin:
            Iterm = Umin - Pterm
        if Pterm+Iterm > Umax:
            Iterm = Umax - Pterm

         out = Pterm + Iterm
         old_Item = Iterm

else:
        out = Umin
        Iterm = 0 

Simulation test log as bellow

err:11.00 proportionalTerm:-110.00 integralTermTerm:140.00 output:30.00
err:10.00 proportionalTerm:-100.00 integralTermTerm:139.00 output:39.00
err:10.00 proportionalTerm:-100.00 integralTermTerm:138.00 output:38.00
err:9.00 proportionalTerm:-90.00 integralTermTerm:137.10 output:47.10
err:8.00 proportionalTerm:-80.00 integralTermTerm:136.30 output:56.30
err:7.00 proportionalTerm:-70.00 integralTermTerm:135.60 output:65.60
err:5.00 proportionalTerm:-50.00 integralTermTerm:135.10 output:85.10
err:0.00 proportionalTerm:-0.00 integralTermTerm:100.00 output:100.00
=>when the error change is getting bigger , output increase will be going up too.
err:-1.00 proportionalTerm:10.00 integralTermTerm:90.00 output:100.00
err:-1.00 proportionalTerm:10.00 integralTermTerm:90.00 output:100.00
err:-1.00 proportionalTerm:10.00 integralTermTerm:90.00 output:100.00
err:-1.00 proportionalTerm:10.00 integralTermTerm:90.00 output:100.00
err:-1.00 proportionalTerm:10.00 integralTermTerm:90.00 output:100.00
err:-0.50 proportionalTerm:5.00 integralTermTerm:90.05 output:95.05
err:-0.20 proportionalTerm:2.00 integralTermTerm:90.07 output:92.07
err:-0.10 proportionalTerm:1.00 integralTermTerm:90.08 output:91.08
huangalang commented 1 year ago

it will not be applied , so close it