Quote:
|
developed "version 2" based on Kevin's code.
|
Are you willing to post it?
The actual PID algorithm is not very complex, just the tuning process.
I found this on the Wikipedia for
PID Controller:
Quote:
There are several methods for tuning a PID loop. The choice of method will depend largely on whether or not the loop can be taken "offline" for tuning, and the response speed of the system. If the system can be taken offline, the best tuning method often involves subjecting the system to a step change in input, measuring the output as a function of time, and using this response to determine the control parameters.
If the system must remain online, one tuning method is to first set the I and D values to zero. Increase the P until the output of the loop oscillates. Then increase I until oscillation stops. Finally, increase D until the loop is acceptably quick to reach its reference. A fast PID loop tuning usually overshoots slightly to reach the setpoint more quickly; however, some systems cannot accept overshoot.
Code:
Effects of increasing parameters
Parameter Rise Time Overshoot Settling Time S.S. Error
P Decrease Increase Small Change Decrease
I Decrease Increase Increase Eliminate
D Small Chang Decrease Decrease Small Change
Another tuning method is formally known as the "Ziegler-Nichols method". It starts in the same way as the method described before: first set the I and D gains to zero and then increase the P gain until the output of the loop starts to oscillate. Write down the critical gain (Kc) and the oscillation period of the output (Pc). Then adjust the P, I and D controls as the table shows:
Code:
Ziegler-Nichols method
Control P Tr Td
P 0.5 * Kc - -
PI 0.45 * Kc Pc / 1.2 -
PID 0.6 * Kc Pc / 2 Pc/8
|
Everyone wish everyone else luck, (God knows at least I need it)
Robinson