helm: a proportional-integral-derivative controller implementation
The class of homogenized boundary layer models I'm using in my thesis (developed by Spalart, made compressible by Guarini et al, and most recently extended by Topalian et al) has an adjustable knob called a "slow growth rate" that controls the thickness of the boundary layer. One can manually fiddle with it. One can use RANS simulations and hope that the value obtained produces something similar in a DNS. I aim to apply some basic control theory by bolting a PID controller onto my simulations.
It turns out everybody and their brother intuitively derive the equations governing a basic PID controller. Then they wave their hands a bit about how to solve windup woes, bumpless transition, and deal with incremental/velocity forms. Not that it doesn't work, but they drift away from the continuous equations to do so. Then they cough up O(10) lines of code assuming a constant, discrete sampling rate.
To permit variable sampling and understand where/how the fixes are made, I dug around until I found a nice treatment in Astrom & Murray (Available online), wrote up the variant of their PID derivation that I needed including the discretization, coded up the algorithm, and then put together a small test driver.
Aside from vanilla C99, the implementation has no dependencies. I hope someone else can put it to use.
No comments:
Post a Comment