Hi PID tuners,
This seemed like appropriate place to get some input on a self-tuning control library for Arduino. I've been thrilled with what I've been able to do with Brett's PID library, and I recently took an adaptive control course, so time to share.
What my proposed library might do:
-Perform a recursive least-squares fit of input/output data to a very simple moving-average (linear) model
-Calculate state feedback gains for a deadbeat controller. If you're not familiar with a deadbeat controller, wikipedia has a synopsis. One particular benefit is you get zero steady-state error without having to use an integrator
-Execute the deadbeat control
Here's the input I'd like on implementation details:
-Would people want the system identification & feedback gain calculation separated from generating the control signal?
-What sort of sampling rates are people using with Brett's PID controller?
-Is anyone using control signals that are actually continuous and not on/off? My library will need to keep track of the control actually applied as best as possible, so my first idea is a function you'd call that says "I just turned the control signal to value X". I think I'd want actual on/off info if you're using PWM unless your PWM frequency is much faster than the base sampling frequency.
-Would anyone have a problem reporting system output sampled in tight synchronization with system input?
-In order to initially identify the system, the controller will send a step input to the system until it sees improvement in the parameter estimates. This would be an adjustable percentage of full actuation. Does anyone have strange constraints where this type of input would break things?
-Does anyone have systems they know will never change, and would want to be able to save & recall the model parameters once they're identified (to avoid the above step stimulus every time)?
To get my RLS system ID algorithm to work with temperature control, I find that I need to average a bunch of samples, i.e. maybe 30sec of samples @ 2Hz become one sample point to the RLS algorithm. This is my rice cooker as the test system, and a 3-parameter model works fine.
I'd like to implement the control at a faster sampling rate, so my initial idea is to use a sliding-window average to calculate the control signal after every sample, but only update the model & gains once per bin.
I understand that it's fairly common for the RLS algorithm to run at a much slower rate than the control, but I want to give people flexibility on this. My intuition is that the library might be easiest to use if all these things are handled internally, but the parameters can be set externally. So in the end, you'd simply call one function to ask the library what your next control output should be, and another to tell it what the actual system input/output are.
And finally, current status: My RLS algorithm works with experimental data, and I've run a simulation of a 3-parameter model & deadbeat controller at the reduced sampling rate that works quite well with around 5% noise injected on the input. This is all in Matlab =)