PID Control Demonstration

Those of you who are interested in feedback control may have come across the infamous PID controller. To many engineers the PID control is the answer to all their problems. What is it for? PID controllers are a sophisticated way to stabilize a system that is under continual threat of disturbance. The simplest example is the cruise control in a car. Most of us probably set the cruise control and forget about it. What’s happening behind the scenes is however much more interesting. As we go up a hill we notice the engine revving up to maintain the set cruise speed and when we go down a hill the engine slows down. The simplest feedback mechanism is where the controller compares the speed of the car with the set cruise speed and adjusts the engine accordingly. The secret to a good controller such as this, is what it does with the error it finds between the actually speed of the car and the desired speed. The simplest solution is to adjust the speed of the engine directly in proportion to the difference, this is called proportional control and is most familiar to engineers. The problem with proportional control is two fold:

1. Too much proportional control and the response overshoots, perhaps so much so that it goes into uncontrolled oscillations, not a good thing in a car.

2. You usually have to set the cruise control slightly higher than the speed you actually want because a proportional controller finds it difficult to actually match the set speed unless the proportional control is strong enough (See problem 1!)

Both these problems can be solved by combining proportional control (The P in PID) with two others, integral (The I in PID) and derivative control (The D in PID). Derivative control is perhaps the easiest to understand. What derivative control does is measure how fast the error between desired and actually engine speed changes. If the difference is changing too fast than we want to slow down the response to avoid overshooting. Derivative control will therefore help get rid of the instability (Too much derivative control can however also result in instability).

The second problem is where the speed of the car doesn’t actually settle to the desired speed. This is fixed by using integral control. This is where the error is continually added up to form a net error and it is the net error than is then used to control the speed of the engine. So long as there is even a little bit of error (ie Desired speed 50 mph, actual speed 49 mph), the net error will increase and drive the car speed to the desired speed until the actual error is zero. Integral is particularly useful if there is a continual disturbance at work, for example a headwind.

To demonstrate these capabilities, I have written a small PID control demonstration tool (for windows only I am afraid) that simulates each of the three elements in a PID controller. The screen shot below shows the application. A user can control the strength of the different controlling elements or remove them all together. To test the response a user can apply a step change to the desired car speed and see how the system responsds. The simulation is continuous so it is easy to see the effects.

Partly support by the NSF
This entry was posted in General Science Interest, Systems Theory. Bookmark the permalink.

2 Responses to PID Control Demonstration

  1. hsauro says:

    Only for Windows I’m afraid at the moment.

  2. Rahul Ponde says:

    Hi,
    I tried opening your file on a macbook and its not working? Is this only for windows?
    Thanks

Leave a Reply

Your email address will not be published.