Friday, March 27, 2015

Position-Integral-Derivative Controllers

Proportional-Integral-Derivative controllers are one of the most abundant type of control systems found in the world of engineering. It provides a flexible, (relatively) simple, and dynamic way to adjust outputs to achieve a goal with the optimal behavior.

First, lets define some terms. Kp, Ki, and Kd are the constant values for the proportional, integral, and derivative components respectively. These three will be different for every situation and every PID controller. MV is the measured variable, the characteristic of the system which we can measure on some regular basis. CV is the control variable, which is the characteristic of the system which our controller can directly manipulate. SP is the setpoint, or the value which we want MV to become.

For example, examine an application where we must heat a tank of water by controlling the temperature of new water flowing into the tank. SP is the desired temperature and MV is the current temperature. CV is the temperature of the in-flowing water.

The proportional component is the simplest part of PID. In proportional control, the CV is set proportionally to the error between MV and SP. This corrects the error faster the larger the error is, which can provide a gentle correction curve. However, proportional control is prone to several errors. First, if there is some other force acting on the system (such as heat dissipation in a temperature control system or a heavy load on an elevator), MV will settle at some offset from the desired value, since the proportional correction will be equal to the other input force. Additionally, too low of a Kp may have trouble reaching SP, and too high of a Kp may overshoot or even oscillate around SP.

Integral control fixes some of the problems presented by proportional control. In integral control, a correction factor is applies that is the integral of the error term. In a real system, measurements are non-continuous, so this is approximated by adding up the error terms at some high rate. This resolves situations in proportional control where the MV has flattened out but is not yet at the setpoint, by summing up the error values and correcting for them.

Derivative control is the least common of the three components. The derivative of the error is taken, and then summed with the other components. This allows the controller to dampen itself and avoid overshoot, by decreasing the correction factor if the slope rises too high.

One way to visualize the three components by comparing which part of the process they are interested in. Proportional control only corrects based on the current value, regardless of the behavior before or after. Integral control can correct for a history of errors; if the past behavior is not reaching the setpoint, then the integral term will sum up and push MV to the setpoint. Derivative control looks at the slope of the error and can be used to control the future behavior, avoiding overshoot or other unintended behavior.

However, PID Control is not always flexible enough to control complex systems. PID assumes that the systems is controllable at a relatively high frequency, is symmetric, and behaves in a linear way. For example, a building temperature control system which has only a passive cooling method but active heating puts special restraints on what PID constants are effective.

There are many, many modifications of PID controllers that have been used to solve more complex systems. Some systems may require a "feed-forward" term, sometimes included in the other three as Kf. This is a flat term that is summed together with the other variables, and continuously drives CV. This might be used in an application that requires lifting and holding a weight. If the feed-forward term is set to counteract the force required to lift the weight, the PID controller can act as if the weight is zero.

Other solutions include wrapping a faster PID Controller inside a slower one, forcing some maximum or minimum ramp rate, using multiple PID constant values for different situations, or scaling the setpoint according to some trajectory.

Thursday, March 12, 2015

Real-time control systems are systems where the controlling logic has only two ways of interacting with the system: reading sensor input, and writing to physical outputs. This field includes robotics, telescope control systems, and most applications involving a physical system being driven by a digital controller.
An approximate description of a real time system.
This diagram roughly describes the control systems of a modern real-time system. The user generates a set of input data, either by giving information through input devices such as controllers or a computer, or by inputting a desired state which the controller attempts to reach. The controller compiles together sensor data and user data, and determines a set of output data to be written to motors and actuators.

The most important and complex part in these systems is the Controller; the logic, calculations, PID controls, trajectory calculations, etc. that determine the behavior of your system happen in this controller.My next post will explain a simple overview and how to use PID, feed forward, and trajectories.