PID Control
Intro
PID Control is a closed loop control architecture that uses monitoring and feedback to improve control of a process variable - that is something you wish to control. It is more robust than open loop controllers that have a set it and forget it type of mentality, which do not monitor what is happening.
Before learning about PID Control, it is important to know where it fits in with other types of control options. The introduction to PID is on this other page.
See page: Intro to Control Theory and PID Loops
Tips and Guides
- PID control works best if the underlying control mechanism does a decent job first
- That way, the correction constants can be tuned to correct disturbances, and not to control the system for its default behavior.
- This implies that your feed-forward/open loop/bias component should be calculated appropriately, and not rely on the PID portion to perform basic operation. Proper bias is an important element of the controller, and will allow you to focus efforts on tuning for step changes or variability, and not for basic performance. It is unnatural to combine them into the P, I, and D, and it will complicate the tuning process considerably if you do not account for a proper bias.
- Get your bias right before tuning P, I, or D. If the bias is incorrect, you will have a hard time tuning with only P. Figure out a good bias for as many setpoints that you find appropriate. If you have more than one setpoint of interest, and they would work best with different biases, create an equation or lookup table to help provide an appropriate bias for whatever setpoint is used.
- Tune P before I or D. P should generally be the largest input to correct the error, and should be tuned first. If you have to retune P, you will likely need to retune I and then D.
- Tune I before D. I should be used to help with variation and unexpected inputs, that can be corrected over time. If you have to retune I, you will likely need to retune D.
- Consider if windowing would be helpful. Windowing limits the impact of lengthy error accumulation, reducing windup, or effects after the problem has been corrected. However, if the window is too small, it may not guarantee that you ever reach the goal (setpoint).
- D often does not need to be used
- Only use D values if you have issues with oscillation, and are confident that is the best approach after considering:
- Is your I value too high?
- Would windowing the I integration to only recent samples help?
- The Derivative component D is often subject to noise and can be difficult to control
- You can perform noise filtering to get improvements at a cost of slightly delayed response for the D component. Usually the delayed response is insignificant.
- When tuning, be mindful of what is available for corrections:
- Know that you cannot correct with MORE than 100% of max positive output or MORE than of 100% max negative output.
- Negative output is any output that causes the process variable to lessen
- Note that either the max positive or max negative output may be nil (zero)
- For example, when heating to a specific temperature, the best you may want to do when it is already too hot, is to turn off the heating element (not introduce cooling). Similarly, when cooling, you may only want to turn off cooling and not want to introduce heating when it has gotten too cold.
Resources
Links:
- Control Gurus - The P-Only Control Algorithm A decent intro to Proportional Control, and a solid basis for understanding PID Control. Careful - ControlGuru uses Kc instead of Kp, and Kc/Ti instead of Ki. Essentially works the same.
- Control Gurus - Table of Contents Some of the most comprehensive documentation on PID Control on the net. Includes beginner topics and advanced topics.
- Non-linear Processes and Design Level Of Operation (DLO) To tune a non-linear process that responds differently to changes at different levels of output, you need to determine a representative operating point (DLO). Maybe you need more than one because there is too much variation, in which case - you need more than one controller, each based on its own range of operation.
- Wikipedia PID Controller
- Wikipedia Control Theory
- Talon SRX PIDF controller PID Control built into the Talon SRX controllers
To Do:
- Cover use of the PIDF controller built into the Talon SRX controllers by descriptive text here.
- Maybe include advanced treatment (noise filtering, especially for D, cascading controllers?) and possibly info about the mentor PID Controller code when completed.
- Additional topics: tips for tuning, typical places to apply on the robot.
- banding the PID control (I.e) multiple DLOs) to create a stronger response