Has any one here dived deeply into PID controllers? Want a challenge?

Hey there,

Link to my notes on the discrete version: https://www.scribd.com/doc/19070283/Discrete-PI-and-PID-Controller-Design-and-Analysis-for-Digital-Implementation

I’ve worked with PID controllers in the past and done some of the analysis stuff. I want to be able to model a controller in pure code though (no MATLAB Simulink .etc). How can I go about this?

From various bits of PID code around the interwebs, it’s just a case of plugging in the formulae and tweaking the parameters. But I want to work with the discrete version of PID and have (yet) to see anything decent about it in the wild.

If you’re willing to help that would be great, just let me know here… thanks!

Cheers M.

What’s the use case?

e.g. I saw a pid controller throttling ssd writes in order to keep read/write latencies low, implementation was really simple.

Usually the math describing behavior of an algorithm over time is a lot more complex than just the algorithm.

I’ve used PID controllers with an Arduino for making an RC car follow a line using light sensors, and again with a raspberry pi using a webcam.

With PID, and from what I’ve seen most things, the discrete version is much simpler, integrations are just sums, differentiation is just a subtraction etc.

They take the input measurement in a loop, get the P term (the error) by subtracting the setpoint from the input, get the I term by adding the error to the sum of the previous errors, get the D term by subtracting the error from the previous error, and then they add these terms together multiplied by their tuning factors to get the output.

For the Pi I used MiniPID C++ library, and I think I used the builtin Arduino library, they both work in the same way. Here is a python one if you don’t like C++ though :^)