Tuning the PID Library

I have tried doing this by just looking at my rotational speed, and if it ever went above X deg/sec, just turn the fins in the oppisite direction and slow the spin down. But this just doesn't seem very elegant.

The limitation with PID is that it models first-order systems. Some systems (most?) just aren't first-order. Or are first-order until there is an outside disturbance (like a gust of wind).

In an ideal world, it would be simple and cheap to create an accurate mathematical model and then design a control strategy around that model. Until we get to an ideal world, it is sometimes necessary to get the gut involved. I have an example that I think is apt...

I worked on a test room for an air conditioning company. The goal was simple: maintain the temperture in the test room within 1 degree Fahrenheit; at ALL times. Under steady-state conditions, a well tuned PID loop did an excellent job. We could keep the temperature within 0.1 degrees! The problem came when the unit under test turned on. For small units, the temperature would rise quickly but stayed within 1 degree. For large units, the temperature would rise by several degrees and cause oscillations. We fiddled and tweaked the parameters to no avail. We even tried using a different set of parameters when the unit was running.

In a moment of desperation, I suggested we bump the output to compensate for the sudden in-rush of heat. I called it "spiking the output". It seemed like a ridiculous idea but we didn't have anything else to try. The idea is simple: turn off the PID loop, adjust the output by some amount, turn on the PID loop. Not only did it work, it work extremely well! For even the largest units, we could maintain 0.1 degree control.

The point is, sometimes you just have to go with what works. :wink: