You are on page 1of 22

PID controller

A proportional-integral-derivative controller (PID controller) is a control loop feedback mechanism (controller) widely used in industrial control systems. A PID controller calculates an error value as the difference between a measured process variable and a desired setpoint. The controller attempts to minimize the error by adjusting the process through use of a manipulated variable.

The PID controller algorithm involves three separate constant parameters, and is accordingly sometimes called three-term control: the proportional, the integral and derivative values, denoted P, I, and D. Simply put, these values can be interpreted in terms of time: P depends on the present error, I on the accumulation of past errors, and D is a prediction of future errors, based on current rate of change. The weighted sum of these three actions is used to adjust the process via a control element such as the position of a control valve or a damper.

Some applications may require using only one or two actions to provide the appropriate system control. This is achieved by setting the other parameters to zero. A PID controller will be called a PI, PD, P or I controller in the absence of the respective control actions. PI controllers are fairly common, since derivative action is sensitive to measurement noise.

PID controller A proportional-integral-derivative controller (PID controller) is a control loop feedback mechanism (controller) widely used

Defining u(t) as the controller output or control input to plant, the final form of the PID algorithm is:

Defining u(t) as the controller output or control input to plant, the final form of the

Where
: Proportional gain, a tuning parameter
: Integral gain, a tuning parameter
: Derivative gain, a tuning parameter

  • : Error SP=Setpoint value PV= Plant value

Defining u(t) as the controller output or control input to plant, the final form of the
  • : Time or instantaneous time (the present)

  • : Variable of integration; takes on values from time 0 to the present

.
.

Proportional term

Defining u(t) as the controller output or control input to plant, the final form of the

The proportional term produces an output value that is proportional to the current error value. The proportional response can be adjusted by multiplying the error by a constant Kp, called the proportional gain constant.

The proportional term is given by:

The proportional term produces an output value that is proportional to the current error value. Theintegral in a PID controller is the sum of the instantaneous error over time and gives the accumulated offset that should have been corrected previously. The accumulated error is then multiplied by the integral gain ( ) and added to the controller output. The integral term is given by: The integral term accelerates the movement of the process towards setpoint and eliminates the residual steady-state error that occurs with a pure proportional controller . Derivative term The job of derivative control is to react to changes in the system. A constant error will be dealt with by proportional and integral control The derivative of the process error is calculated by determining the slope of the error over time and multiplying this rate of change by the derivative gain Kd. The magnitude of the contribution of the derivative term to the overall control action is termed the derivative gain, Kd. " id="pdf-obj-2-6" src="pdf-obj-2-6.jpg">

A high proportional gain results in a large change in the output for a given change in the error & can cause unstable system. A small gain results in a small output response to a large input error, and less sensitive controller. Tuning theory and industrial practice indicate that the proportional term should contribute the bulk of the output change.

Integral term

The contribution from the integral term is proportional to both the magnitude of the error and the duration of the error. The integral in a PID controller is the sum of the instantaneous error over time and gives the accumulated offset that should have been corrected previously. The accumulated error is then multiplied by the

The proportional term produces an output value that is proportional to the current error value. Theintegral in a PID controller is the sum of the instantaneous error over time and gives the accumulated offset that should have been corrected previously. The accumulated error is then multiplied by the integral gain ( ) and added to the controller output. The integral term is given by: The integral term accelerates the movement of the process towards setpoint and eliminates the residual steady-state error that occurs with a pure proportional controller . Derivative term The job of derivative control is to react to changes in the system. A constant error will be dealt with by proportional and integral control The derivative of the process error is calculated by determining the slope of the error over time and multiplying this rate of change by the derivative gain Kd. The magnitude of the contribution of the derivative term to the overall control action is termed the derivative gain, Kd. " id="pdf-obj-2-16" src="pdf-obj-2-16.jpg">

integral gain ( ) and added to the controller output.

The integral term is given by:

The proportional term produces an output value that is proportional to the current error value. Theintegral in a PID controller is the sum of the instantaneous error over time and gives the accumulated offset that should have been corrected previously. The accumulated error is then multiplied by the integral gain ( ) and added to the controller output. The integral term is given by: The integral term accelerates the movement of the process towards setpoint and eliminates the residual steady-state error that occurs with a pure proportional controller . Derivative term The job of derivative control is to react to changes in the system. A constant error will be dealt with by proportional and integral control The derivative of the process error is calculated by determining the slope of the error over time and multiplying this rate of change by the derivative gain Kd. The magnitude of the contribution of the derivative term to the overall control action is termed the derivative gain, Kd. " id="pdf-obj-2-22" src="pdf-obj-2-22.jpg">

The integral term accelerates the movement of the process towards setpoint and eliminates the residual steady-state error that occurs with a pure proportional controller.

Derivative term

The job of derivative control is to react to changes in the system. A constant error

will be dealt with by proportional and integral control

The derivative of the process error is calculated by determining the slope of the error over time and multiplying this rate of change by the derivative gain Kd. The magnitude of the contribution of the derivative term to the overall control action is termed the derivative gain, Kd.

The derivative term is given by:

The derivative term is given by: Derivative action predicts system behavior and thus improves settling timediverges, with or without oscillation, and is limited only by saturation. Instability is caused by excess gain. Generally, stabilization of response is required and the process must not oscillate for any combination of process conditions and set-points, though sometimes marginal stability (bounded oscillation) is acceptable or desired. Tuning method: Method Advantages Disadvantages Requires Manual No math required; online. experienced tuning personnel Process upset, some Ziegler – Proven method; online. Nichols trial-and-error, very aggressive tuning. Consistent tuning; online or offline - can Software employ computer-automated control system Some cost or tools design (CAutoD) techniques; may include valve and sensor analysis; allows simulation before training involved downloading; can support non-steady-state " id="pdf-obj-3-4" src="pdf-obj-3-4.jpg">

Derivative action predicts system behavior and thus improves settling time and stability of the system. Derivative action is seldom used in practice.

Stability

If the PID controller parameters (the gains of the proportional, integral and derivative terms) are chosen incorrectly, the controlled process input can be unstable, i.e., its output diverges, with or without oscillation, and is limited only

by saturation. Instability is caused by excess gain.

Generally, stabilization of response is required and the process must not oscillate for any combination of process conditions and set-points, though sometimes marginal stability (bounded oscillation) is acceptable or desired.

Tuning method:

 

Method

Advantages

Disadvantages

   

Requires

Manual

No math required; online.

experienced

tuning

personnel

 
   
   

Process upset, some

Ziegler

Proven method; online.

Nichols

trial-and-error, very aggressive tuning.

 
   
 

Consistent tuning; online or offline - can

 

Software

employ computer-automated control system

Some cost or

tools

design (CAutoD) techniques; may include valve and sensor analysis; allows simulation before

training involved

 

downloading; can support non-steady-state

 
     
 

(NSS) tuning.

 
   

Some math; offline;

CohenCoon

Good process models.

only good for first- order processes.

   
     

Manual tuning:

If the system must remain online, one tuning method is to first set and values to
If
the
system
must
remain
online,
one
tuning
method
is
to first
set
and
values
to
zero.
Increase
the
until
the
output
of
the loop
oscillates, then the should be set to approximately half of that value for a
"quarter amplitude decay" type response. Then increase until any offset is
corrected in sufficient time for the process. However, too much will cause
instability. Finally, increase , if required, until the loop is acceptably quick to
reach its reference after a load disturbance. However, too much will cause
excessive response and overshoot. A fast PID loop tuning usually overshoots
slightly to reach the setpoint more quickly; however, some systems cannot accept
overshoot, in which case an over-damped closed-loop system is required, which
will require a setting significantly less than half that of the setting that was causing oscillation.
will require a
setting significantly less than half that of the
setting that was
causing oscillation.
Effects of increasing a parameter independently
Steady-state
Overshoot Settling time
Stability
Parameter
Rise time
error
Small
Decrease
Increase
Decrease
Degrade
change
Decrease
Increase
Increase
Eliminate
Degrade
 

Minor

   

No effect in

Improve

 
Decrease Decrease

Decrease

Decrease

 

change

theory

if

change theory if small

small

       

ZieglerNichols method Another heuristic or experience-based tuning method is formally known as

Minor No effect in Improve Decrease Decrease change theory if small Ziegler – Nichols method AnotherZiegler Nichols method, introduced by John G. Ziegler and Nathaniel B. Nichols in the 1940s. As in the method above, the and gains are first set to zero. The proportional gain is increased until it reaches the ultimate gain, , at which the output of the loop starts to oscillate. and the oscillation period are used to set the gains as shown: Ziegler – Nichols method Control Type P - - PI - PID These gains apply to the ideal, parallel form of the PID controller. When applied to the standard PID form, the integral and derivative time parameters and are only dependent on the oscillation period . " id="pdf-obj-5-58" src="pdf-obj-5-58.jpg">
Minor No effect in Improve Decrease Decrease change theory if small Ziegler – Nichols method AnotherZiegler Nichols method, introduced by John G. Ziegler and Nathaniel B. Nichols in the 1940s. As in the method above, the and gains are first set to zero. The proportional gain is increased until it reaches the ultimate gain, , at which the output of the loop starts to oscillate. and the oscillation period are used to set the gains as shown: Ziegler – Nichols method Control Type P - - PI - PID These gains apply to the ideal, parallel form of the PID controller. When applied to the standard PID form, the integral and derivative time parameters and are only dependent on the oscillation period . " id="pdf-obj-5-60" src="pdf-obj-5-60.jpg">

Nichols in the 1940s. As in the method above, the and gains are first set to

zero. The proportional gain is increased until it reaches the ultimate gain,

zero. The proportional gain is increased until it reaches the ultimate gain, , at

, at

which the output

of

the

loop

starts

to

oscillate.

which the output of the loop starts to oscillate. and the oscillation

and

the

oscillation

period

Minor No effect in Improve Decrease Decrease change theory if small Ziegler – Nichols method AnotherZiegler Nichols method, introduced by John G. Ziegler and Nathaniel B. Nichols in the 1940s. As in the method above, the and gains are first set to zero. The proportional gain is increased until it reaches the ultimate gain, , at which the output of the loop starts to oscillate. and the oscillation period are used to set the gains as shown: Ziegler – Nichols method Control Type P - - PI - PID These gains apply to the ideal, parallel form of the PID controller. When applied to the standard PID form, the integral and derivative time parameters and are only dependent on the oscillation period . " id="pdf-obj-5-108" src="pdf-obj-5-108.jpg">

are used to set the gains as shown:

ZieglerNichols method

 

Control Type

Control Type
Control Type
Control Type

P

P - -

-

-

PI

PI -
PI -

-

PID

PID
PID
PID
       

These gains apply to the ideal, parallel form of the PID controller. When applied

to

the

standard

PID

form,

the

integral

and

derivative

time

parameters

parameters and are only dependent on the oscillation period .

and

are only dependent on the oscillation period

are only dependent on the oscillation period

.
.
PID tuning software Most modern industrial facilities no longer tune loops using the manual calculation methods

PID tuning software

Most modern industrial facilities no longer tune loops using the manual

calculation methods shown above. Instead, PID tuning and loop optimization

software are used to ensure consistent results. These software packages will

gather the data, develop process models, and suggest optimal tuning. Some

software packages can even develop tuning by gathering data from reference

changes.

Now we consider the following unity feedback system:

PID tuning software Most modern industrial facilities no longer tune loops using the manual calculation methods

The output of a PID controller, equal to the control input to the plant, in the time-

domain is as follows:

The output of a PID controller, equal to the control input to the plant, in the

1)

The error signal ( ) will be sent to the PID controller, and the controller computes

The output of a PID controller, equal to the control input to the plant, in the

both the derivative and the integral of this error signal.

The control signal ( ) is sent to the plant, and the new output ( ) is obtained. The

The output of a PID controller, equal to the control input to the plant, in the
The output of a PID controller, equal to the control input to the plant, in the

new output ( ) is then fed back and compared to the reference to find the new

The output of a PID controller, equal to the control input to the plant, in the

error signal ( ). The controller takes this new error signal and computes its

The output of a PID controller, equal to the control input to the plant, in the

derivative and its integral again, ad infinitum.

The transfer function of a PID controller is found by taking the Laplace transform

of Eq. (1).

= Proportional gain = Integral gain
= Proportional gain
= Integral gain

= Derivative gain

2)

We can define a PID controller in MATLAB using the transfer function directly, for

example:

Kp = 1;

Ki = 1;

Kd = 1;

s = tf('s');

  • C = Kp + Ki/s + Kd*s

  • C =

s^2 + s + 1

-----------

s Continuous-time transfer function of controller.

The Characteristics of P, I, and D Controllers

The Characteristics of P, I, and D Controllers A proportional controller ( ) will have the

A proportional controller ( ) will have the effect of reducing the rise time and

will reduce but never eliminate the steady-state error. An integral control ( ) will

The Characteristics of P, I, and D Controllers A proportional controller ( ) will have the

have the effect of eliminating the steady-state error for a constant or step input,

but it may make the transient response slower. A derivative control ( ) will have

The Characteristics of P, I, and D Controllers A proportional controller ( ) will have the

the effect of increasing the stability of the system, reducing the overshoot, and

improving the transient response.

The Characteristics of P, I, and D Controllers A proportional controller ( ) will have the

The effects of each of controller parameters , and on a closed-loop system

The Characteristics of P, I, and D Controllers A proportional controller ( ) will have the

are summarized in the table below.

CL RESPONSE RISE TIME OVERSHOOT SETTLING TIME S-S ERROR Kp Decrease Increase Small Change Decrease Ki
CL RESPONSE
RISE TIME
OVERSHOOT
SETTLING TIME
S-S ERROR
Kp
Decrease
Increase
Small Change
Decrease
Ki
Decrease
Increase
Increase
Eliminate
Kd
Small Change
Decrease
Decrease
No Change

Note that these correlations may not be exactly accurate, because

, ,
,
,

and

The Characteristics of P, I, and D Controllers A proportional controller ( ) will have the

are dependent on each other. In fact, changing one of these variables can

change the effect of the other two. For this reason, the table should only be used

as a reference when you are determining the values for

,
,

and

.
.

Steps for Designing a PID Controller

When you are designing a PID controller for a given system, follow the steps

shown below to obtain a desired response.

  • 1. Obtain an open-loop response and determine what needs to be improved

  • 2. Add a proportional control to improve the rise time

  • 3. Add a derivative control to improve the overshoot

  • 4. Add an integral control to eliminate the steady-state error

  • 5. Adjust each of Kp, Ki, and Kd until you obtain a desired overall response.

example, if a PI controller gives a good enough response, then you don't need to implement a derivative controller on the system. Keep the controller as simple as possible.

Example Problem

example, if a PI controller gives a good enough response, then you don't need to implement

The modeling equation of this system is

example, if a PI controller gives a good enough response, then you don't need to implement

Taking the Laplace transform of the modeling equation, we get

example, if a PI controller gives a good enough response, then you don't need to implement

The transfer function between the displacement

example, if a PI controller gives a good enough response, then you don't need to implement

and the input

example, if a PI controller gives a good enough response, then you don't need to implement

then

becomes

example, if a PI controller gives a good enough response, then you don't need to implement

Let M = 1 kg b = 10 N s/m

k = 20 N/m F = 1 N Plug these values into the above transfer function

k = 20 N/m F = 1 N Plug these values into the above transfer function

The goal of this problem is to show you how each of obtain Fast rise time Minimum overshoot No steady-state error

,
,

and

k = 20 N/m F = 1 N Plug these values into the above transfer function

contributes to

Open-Loop Step Response

Let's first view the open-loop step response. Create a new m-file and run the

following code:

s = tf('s'); P = 1/(s^2 + 10*s + 20); step(P)

k = 20 N/m F = 1 N Plug these values into the above transfer function

The DC gain of the plant transfer function is 1/20, so 0.05 is the final value of the

output to an unit step input. This corresponds to the steady-state error of 0.95,

quite large indeed. Furthermore, the rise time is about one second, and the

settling time is about 1.5 seconds. Let's design a controller that will reduce the

rise time, reduce the settling time, and eliminate the steady-state error.

In the figure, steady state error can be seen at allowable tolerance Proportional Control From the

In the figure, steady state error can be seen at allowable tolerance

Proportional Control

From the table shown above, we see that the proportional controller (Kp) reduces

the rise time, increases the overshoot, and reduces the steady-state error.

The closed-loop transfer function of the above system with a proportional

controller is:

In the figure, steady state error can be seen at allowable tolerance Proportional Control From the

Let the proportional gain (

In the figure, steady state error can be seen at allowable tolerance Proportional Control From the

) equal 300 and change the m-file to the following:

Kp = 300;

C

= pid(Kp)

T = feedback(C*P,1) t = 0:0.01:2; step(T,t)

C

= Kp = 300

P-only controller. T =

300

----------------

s^2 + 10 s + 320

Continuous-time transfer function.

The above plot shows that the proportional controller reduced both the rise time and the steady-state

The above plot shows that the proportional controller reduced both the rise time

and the steady-state error, increased the overshoot, and decreased the settling

time by small amount.

Proportional-Derivative Control

Now, let's take a look at a PD control. From the table shown above, we see that

the derivative controller (Kd) reduces both the overshoot and the settling time.

The closed-loop transfer function of the given system with a PD controller is:

The above plot shows that the proportional controller reduced both the rise time and the steady-state

Let

Let equal 300 as before and let equal 10. Enter the following commands

equal 300 as

before and let

Let equal 300 as before and let equal 10. Enter the following commands

equal 10. Enter the following commands

into an m-file and run it in the MATLAB command window.

Kp = 300; Kd = 10;

 

C

= pid(Kp,0,Kd)

 

T = feedback(C*P,1) t = 0:0.01:2;

step(T,t)

 

C

= Kp + Kd * s with Kp = 300, Kd = 10 Continuous-time PD controller in parallel form.

 

T =

10 s + 300

----------------

s^2 + 20 s + 320

Continuous-time transfer function.

T = 10 s + 300 ---------------- s^2 + 20 s + 320 Continuous-time transfer function

This plot shows that the derivative controller reduced both the overshoot and the settling time, and had a small effect on the rise time and the steady-state error.

Proportional-Integral Control

Before going into a PID control, let's take a look at a PI control. From the table, we see that an integral controller (Ki) decreases the rise time, increases both the overshoot and the settling time, and eliminates the steady-state error. For the given system, the closed-loop transfer function with a PI control is:

X(s)/F(s) = (K p +K i /s)/ (s 2 +10s+20+K p +K i /s)

T = 10 s + 300 ---------------- s^2 + 20 s + 320 Continuous-time transfer function

Let's reduce the

T = 10 s + 300 ---------------- s^2 + 20 s + 320 Continuous-time transfer function

to 30, and let

T = 10 s + 300 ---------------- s^2 + 20 s + 320 Continuous-time transfer function

equal 70. Create an new m-file and enter the

following commands. Kp = 30; Ki = 70; C = pid(Kp,Ki) T = feedback(C*P,1)

t = 0:0.01:2; step(T,t) C =

1

Kp + Ki * --- s with Kp = 30, Ki = 70 Continuous-time PI controller in parallel form T =

30 s + 70

------------------------

s^3 + 10 s^2 + 50 s + 70 Continuous-time transfer function.

t = 0:0.01:2; step(T,t) C = 1 Kp + Ki * --- s with Kp =

Run this m-file in the MATLAB command window, and you should get the following plot. We have reduced the proportional gain (Kp) because the integral controller also reduces the rise time and increases the overshoot as the proportional controller does (double effect). The above response shows that the integral controller eliminated the steady-state error.

Proportional-Integral-Derivative Control

After several trial and error runs, the gains = 350, = 300, and = 50 provided

After several trial and error runs, the gains

After several trial and error runs, the gains = 350, = 300, and = 50 provided

= 350,

After several trial and error runs, the gains = 350, = 300, and = 50 provided

= 300, and

After several trial and error runs, the gains = 350, = 300, and = 50 provided

= 50

provided the desired response. To confirm, enter the following commands to an m-file and run it in the command window. You should get the following step response. Kp = 350; Ki = 300; Kd = 50;

  • C = pid(Kp,Ki,Kd)

T = feedback(C*P,1); t = 0:0.01:2; step(T,t)

  • C =

1

Kp + Ki * --- + Kd * s s with Kp = 350, Ki = 300, Kd = 50 Continuous-time PID controller in parallel form.

After several trial and error runs, the gains = 350, = 300, and = 50 provided

Now, we have obtained a closed-loop system with no overshoot, fast rise time, and no steady-state error.

Electronic Controllers:

Now, we have obtained a closed-loop system with no overshoot, fast rise time, and no steady-state
Home Assignment

Home Assignment

Home Assignment
Home Assignment