Peter Nachtwey
Member
The link below is to an Excel spreadsheet. I used Excel 2003. Hopefully those with out Excel can at least use the Excel viewer. I decided to use Excel because it is widely available. The spreadsheet below simulates a simple servo system with a PID. The PID gains are initially set to low values. The challenge is to tune this system so that the actual position matches the target position as closely as possible. Doing so reduces the ISE "integrated squared error" which should be used as a means of evaluating whether gain changes are making the system track closer or not.
The PID is a simple one that takes the error and provides a correcting control signal. The PID form that I like and will use for these examples is the incremental form. I like this form for two reasons:
1. It handle saturation well because there is no separate integrator to unwind.
2. Because it is incremental, one can move smoothly between openloop ( manual ) and closed loop ( automatic ) modes.
I reduced the update rate to 10 milliseconds to keep the spread sheets smaller. A later exercise will be to reduce the update period to 1 millisecond to see the difference.
The system could represent a well designed simple servo motor system.
The equation for the system is G/(s*(tau*s+1). I don't expect anyone to know what this means, yet. The point is that it has a time constant tau that has units of seconds and a system gain G which has units of inches per second per volt. ( Sorry about that metric people ) I have converted the system model to a difference equation using z transform tables which I will explain much later.
What I want you to do is to tune the system WITHOUT changing the system gain G and the time constant. The goal should be to get the integrated squared error down below 60. Better yet is to get the ISE below 59. Notice that right now the ISE is above 7000.
I cheated. I can calculate the gains so I know what is possible.
What I want you to notice:
1. Tuning is easy when you have an evaluation routine like the integrated squared error.
2. The output immediately jumps to 10 volts. There is nothing you can do about this. This is the result of the system instantly accelerating instead of ramping smoothly. In real practice this should be avoided. I left this "defect" in to show Norm and Friedrich how a PID should be able to handle staturation.
3. Notice the gains you end up with when you achieve the lowest integrated squared error ( ISE ). What does this say about how the integrator and differentiator should be used.
PID and Servo Simulator.
This is a confidence builder. I will cover other systems with more complicated models that will be more difficult to tune. I will cover many of the different types of systems so there will be many spreadsheets with slightly different characteristics.
Enjoy. Feel free to ask questions. I wonder who will have the lowest ISE.
The PID is a simple one that takes the error and provides a correcting control signal. The PID form that I like and will use for these examples is the incremental form. I like this form for two reasons:
1. It handle saturation well because there is no separate integrator to unwind.
2. Because it is incremental, one can move smoothly between openloop ( manual ) and closed loop ( automatic ) modes.
I reduced the update rate to 10 milliseconds to keep the spread sheets smaller. A later exercise will be to reduce the update period to 1 millisecond to see the difference.
The system could represent a well designed simple servo motor system.
The equation for the system is G/(s*(tau*s+1). I don't expect anyone to know what this means, yet. The point is that it has a time constant tau that has units of seconds and a system gain G which has units of inches per second per volt. ( Sorry about that metric people ) I have converted the system model to a difference equation using z transform tables which I will explain much later.
What I want you to do is to tune the system WITHOUT changing the system gain G and the time constant. The goal should be to get the integrated squared error down below 60. Better yet is to get the ISE below 59. Notice that right now the ISE is above 7000.
I cheated. I can calculate the gains so I know what is possible.
What I want you to notice:
1. Tuning is easy when you have an evaluation routine like the integrated squared error.
2. The output immediately jumps to 10 volts. There is nothing you can do about this. This is the result of the system instantly accelerating instead of ramping smoothly. In real practice this should be avoided. I left this "defect" in to show Norm and Friedrich how a PID should be able to handle staturation.
3. Notice the gains you end up with when you achieve the lowest integrated squared error ( ISE ). What does this say about how the integrator and differentiator should be used.
PID and Servo Simulator.
This is a confidence builder. I will cover other systems with more complicated models that will be more difficult to tune. I will cover many of the different types of systems so there will be many spreadsheets with slightly different characteristics.
Enjoy. Feel free to ask questions. I wonder who will have the lowest ISE.