Beruflich Dokumente
Kultur Dokumente
PID control
The PID controller has been in
use for over a century in various
forms. It has enjoyed popularity
as a purely mechanical device,
Figure 2
as a pneumatic device, and as an
electronic device. The digital PID
controller using a microprocessor is being driven only from plant throughout this article, and carriage on a printer, or a throttle
has recently come into its own feedback. The plant feedback is show the effects of apply- mechanism in an automobile
in industry. As you will see, it is a subtracted from the command ing the various controllers to cruise control system, or almost
straightforward task to embed a signal to generate an error. This them: any other moderately precise po-
PID controller into your code. error signal drives the propor- • A motor driving a gear train sition controller. Figure 2 shows
PID stands for “proportional, tional and integral elements. • A precision positioning sys- a diagram of such a system. The
integral, derivative.” These three The resulting signals are added tem motor is driven by a voltage that
terms describe the basic ele- together and used to drive the • A thermal system is commanded by software. The
ments of a PID controller. Each of plant. I haven’t described what motor output is geared down to
these elements performs a differ- these elements do yet-we’ll get Each of these systems has dif- drive the actual mechanism. The
ent task and has a different effect to that later. I’ve included an al- ferent characteristics and each position of this final drive is mea-
on the functioning of a system. ternate placement for the propor- one requires a different control sured by the potentiometer.
In a typical PID controller these tional element (dotted lines)-this strategy to get the best perfor- A DC motor driven by a volt-
elements are driven by a combi- can be a better location for the mance. age wants to go at a constant
nation of the system command proportional element, depending speed that is proportional to the
and the feedback signal from the on how you want the system to Motor and gear applied voltage. Usually the mo-
object that is being controlled respond to commands. The first example plant is a mo- tor armature has some resistance
(usually referred to as the “plant”). tor driving a gear train, with the that limits its ability to accelerate,
Their outputs are added together Sample plants output position of the gear train so the motor will have some de-
to form the system output. In order to discuss this subject being monitored by a potenti- lay between the change in input
Figure 1 shows a block dia- with any sense of reality we ometer or some other position voltage and the resulting change
gram of a basic PID controller. In need some example systems. reading device. You might see in speed. The gear train takes
this case the derivative element I’ll use three example plants this kind of mechanism driving a the movement of the motor and
typedef struct
{
double dState; // Last position input
double iState; // Integrator state
double iMax, iMin;