You are on page 1of 50

PID Basics With

Pico Controller

Debasish Mukhopadhyay

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Why Closed Loop Control?

Current temperature

Control
Device
Setpoint
¾Temperature
Command
¾ Flow
Position ¾ Speed
to valve ¾ Weight
¾ Level
¾ Pressure
Liquid
Steam ¾PH
Valve
Steam ¾Conductivity
Inlet
Heating
Steam Coil
Return
Temperature
Sensor

Ability to maintain a process variable at a desired state/ value/


setpoint
Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Why Analog Feedback Control?

• Could control using On/Off strategy


• If Actual>Desired Then ‘Off’
• If Desired<Actual Then ‘On’

Æ Open loop control (non-feedback control) can be used in


systems sufficiently well-characterized as to predict what outputs will
necessarily achieve the desired states. For example, the rotational
velocity of an electric motor may be well enough characterized for the
supplied voltage to make feedback unnecessary.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


On-Off Control of Heating System

CONTROLLED
VARIABLE

SET
POINT

OPEN (ON)

FUEL VALVE POSITION

CLOSED (OFF)

TIME

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Why Analog Feedback Control?

Need to fix the actuation of the valve to some intermediate position


between 0% and 100% to attain the desired result…

But how to find that position?

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Temperature Control

Process
Three Types Of Processes
P
1. Self Regulating- Process that reaches a new
The steady-state when it is driven by a steady change
Feedback in input.
Sensor S O Output
Loop 2. Imbalanced or Integrating Process- Liquid level in
a tank

C
3. Open Loop or Unstable process- Exothermic
ReactorÆexponential change
Control

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Tuning Methods

There are Two types of tuning methods used:


•Open Loop
Fast and Simple. Put the PID controller in manual mode. The value of the Control
Variable is stepped by a fixed amount and the performance of the system is observed.
Parameters obtained are K (Process Gain), tp (Process Time Constant), td (Dead Time).
Kp = tp / K* Td , Ti = 5td Td = td / 2

•Close Loop
Instead of changing the output, the setpoint is changed with the PID in Auto mode. The
system behaviors are observed. Some people do this as a fine tuning after doing the Open
Loop tuning. Parameters obtained, KU (Ultimate Gain) & TU (Ultimate Period) are used to
find gain values.

The choice of tuning method depends on the person’s experience and the knowledge of
the process.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Instrumentation and Control Elements Used in
Process Control

• Sensing Element
The components used to measure the process variable. A simple thermocouple is a good example
of a temperature sensor
• Transmitter
Sensors having a sensor and a transmitter both. Flow, Level, Pressure and Temperature
measurement devices are referred to as Transmitters.
• Transducer
Device that has a sensor, some additional circuitry to “polish” the signal (scaling, compensation,
etc), and a transmitter. A pressure transducer can measure pressure, perform some polishing of
the measurement, and transmit a signal on a wire or cable. Transducers are normally mounted
remotely from the conditioning device. An example is a Weight Transmitter connected to remote
Load Cells

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Instrumentation

•Most widely used


•Inexpensive
•Wide ranges of temperatures
“J” or “K” type refers to the metals used for the sensor and influences the
range and accuracy of the sensor.

Thermocouples

“Application – Cost – Accuracy – Durability – Reliability”


Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Instrumentation

Thermistors
Infrared sensors
RTD’s

•Fairly wide Temp. •More accurate than •Expensive


range TC or RTD’s
•Special Applications –High
•More accurate than •Limited Temperature Temp, Moving parts, Non-
Thermocouples range contact surface or large
surfaces

“Application – Cost – Accuracy – Durability – Reliability”


Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Instrumentation

Pressure Transmitter Flow Transmitter


•Absolute
Level Transmitters
•Mass
•Differential •Discrete
•Volumetric
•Hydrostatic •Continuous
Voltage / Current signal •Velocity
•Inferential
Capacitive and Ultrasonic
CFM – Configurable Technology
Flow Meter for high
speed, high resolution
on calculation and
output

“Application – Cost – Accuracy – Durability – Reliability”


Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Framework For Understanding

• The contribution of Ziegler and Nichols tuning methods were developed during
1940s
• We will not be concerned about determining settings within 1% (Accuracy
Ballpark)

• Modern controllers perform the same functions as those built around 1940

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Do We Know?

1. PV – Known as Process Variable. Actual measured value which we are trying to control.
Pressure, Temperature, Flow, % Opening etc.

1. Error / Offset - The difference between (Set Point and Process Variable) where we are and
where we want to be.
Measured as SP ~ PV
3. Δt - Knowledge of ‘when’ the PV was observed

4. Control Variable(CV) – Variable adjusted to correct error

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


PID Æ3 Mode Regulator

• Has the advantages of three components, (P,I, and D)


P Æ Proportional
IÆ Integral
DÆ Derivative

The three put together is called PID

• Most common regulator in the industry

• Very easy to understand the components


• Just like a lead/lag filter Error ÆPID ÆOutput

Simplicity – Versatility- Longevity

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


PID Equations

Independent
CV = Kp.E% + ΣKi.Δt.E% + Kd (d/dt) E% + S-S Bias. Mostly Bias is ignored.

Dependent
CV = Kp [E% + Σ(1/Ti)Δt.E% + Td(d/dt)E%] + S-S-Bias
Dependent type is a easier operation

There is no “standard” equation or correct PID algorithm. Just stick to one


and go with it.

The Ki and Kd parameters relate only to dynamics of the process, and the Kp
(proportional gain) relates to the gain of the process.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


PICO Control Action Parameters

SP - PV (default)
Calculate the Error as Set Point - Process Variable
‘Reverse Acting Loop’

PV - SP
Calculate the Error as Process Variable – Set Point
‘Direct Acting Loop’

PICO GFX supports Reverse Acting control

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Controllers and Control Strategies

Disturbances
Controller Output

Final
Algorithm Control
Set Point Σ (Control Law) Element
Process

Process
Measurement

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Direct Acting Controller

Controller
Set Point Error / CONTROLLER Output
Σ
Offset

Measurement / Process Variable

Controller Output Increases


when

PV increases

A typical example of a direct-acting system is controlling flow of


cooling water - if the temperature increases, the flow must be
increased to maintain the desired temperature

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Reverse Acting Controller

Controller
Set Point Error / CONTROLLER Output
Σ
Offset

Measurement / Process Variable

Increase in PV
Causes
Decrease in Controller Output

A typical example of a reverse-acting system is controlling flow of steam for


heating - if the temperature increases, the flow must be decreased to maintain
the desired temperature

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Does Proportional Do?

Controller output moves in proportion to the error between


Setpoint and Process Variable

• Direct, Linear, Relationship Between the Input and Output

• Determines how fast the regulator reacts to errors

• This action is for dynamics

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Does Proportional Do?

Proportional mode causes an instantaneous response in the controller


output to changes in the error

KC E (where Kc= controller gain, E = error);

Want Proportional Gain as high as possible

Responsible for Disturbance Rejection

System Delays Limit Proportional Gain

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Proportional Control

Let the control output be proportional to the difference between ‘Desired’ and ‘Actual’
Output = Kp x Error (Bias is ignored)
Output / Error = Kp (Laplace Transform or Transfer Function)
Kp is dimensionless

When Controller has no automatic reset


Gain =1.0 (integral action), it will usually have a
manual reset (integral) adjustment which
Controller output

Gain =2.0
allows some manual compensation for the
offset or error. Manual reset in a
Gain = 0.5
50 proportional – only controller changes the
fixed relationship between error and
controller output.
Error as % of scale

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Proportional Control

Error

0 t

Output
Kp = 2.0

Kp = 1.0
Kp = 0.5
0% t

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Proportional Control

• Will never maintain the desired operating point


• Increasing the multiplier Kp will get you closer to the
desired level but will also create instability
• Any loop will cycle (become unstable) if the gain in
increased far enough

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Proportional Control

SP oF 80

Offset
OFFSET

Temperature Record of Process With Proportional Control for Two Bottling Machines
Output

Desired
SP oF
80
0

Temperature Record of Process With Proportional Control for One Bottling Machine
Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Limitation Of Proportional Function

P only is not capable of eliminating offset by itself. P only can be used


if you utilize the BIAS term in the control equation. BIAS can remove
the gap between PV & SP. Having large proportional gains can lead
to system instability for a P only controller

Alternates to proportional control are proportional-integral (PI) control


and proportional - integral - derivative control (PID).PID control is
commonly used to implement closed-loop control.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Does Integral Function Do?

• Adds or subtracts to the control output when the process value shows a
sustained deviation from setpoint

• Initially manual reset

• Integral action causes the controller output to change at a rate


proportional to the error. The longer the integral time the slower it
changes. Ki = KP / Ti = KP / Big = Small.

• Integral Time or Reset Time is defined as Minutes per Repeat. The


Integral Time is the time to repeat the change that was due to the
proportional action only.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Integral Contribution

I = In-1 + (Ki x Δt x Error)

Note that the result is accumulated and used again


the next time around
Output = Ki x Sum(Error)

Ki units are in inverse time

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Integral Contribution

Find the area under a curve by rectangular


approximations

Error

0 t
Δt

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Integral Control

PV

SP

Output

100%

0% t

As long as the error is constant the output will continue to accumulate.


How fast it accumulates, depends on the multiplier

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Does Integral Do?

• Eliminates Process Offset (droop)


• Maintains Output at Setpoint
• Is always used with Proportional Control PI or PID, rarely I alone

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Proportional Plus Integral

• These two components together are good enough

• Effects of each are ‘interactive’

• Majority of all the loops are “PI” loops

• Proportional function handles the changes in setpoints and the disturbances


whereas Integral function handles the "steady-state” system changes

• Note that Integral needs “time” over which it accumulates. If the Proportional gain
is increased it will effect the overall that the Integral has to react because P is
making error smaller on average therefore increasing the amount of time it takes to
accumulate the same amount of I.

• Change one and it affects the other….balancing act !


Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Proportional Plus Integral

Error

0 t

Output

‘I’
100%

‘P’

0% t

Proportional and Integral contribute to the output when the error is


constant

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Does Integral Do?

• Integral Action determines S.S. operations

• At S.S. Integral Sum is the PID Output

• Integral Gain determines how fast to react to S.S. operating


point changes

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Proportional – Integral Outputs

At SetPoint, Integral output


Proportional Output is needed to maintain SP
100%

O
u
t
p
u
t

0%
T0 TIME T1

Integral Output Contribution


Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Derivative Control

• In systems where significant delays exist proportional


action produces oscillations…Sluggish systems!

• To offset this effect the rate of change of the system


error was added to allow the controller to ‘pull back’ the
control output based on rate that system changes.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


When to Use Derivative Control

• D is largely unnecessary for fast loops (such as flows


and pressures) due to their naturally quick response
times.

• D control is very useful for slow loops and an absolute


must for integrating process such as levels and
insulated temperature loops

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What Does Derivative Do?

• Senses the rate of change of the input signal and causes output to
increase or decrease anticipating possible overshoot or undershoot

• Anticipatory type of control by widening the proportional band and


opposing changes in the PV
• Brakes or Gas as needed

• Only functions when error signal is changing

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Derivative Contribution

D = K d x (Error(now) - Error(before)) / Δt

A linear slope approximation between two


points. Defined as ’rise’ over ‘run’. Where ‘rise’ is
difference in current and previous errors and
‘run’ is difference in time when the errors were
noted.

Kd units are in time

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Derivative Control

Error

0 t

Output
‘P’
100%

‘D’

0% t

A continuously changing error is required to generate


a fixed amount of Derivative…idealistic but not
practical !
Copyright © 2005 Rockwell Automation, Inc. All rights reserved.
Derivative Contribution

Error E
E
E E
ΔError

Out
Out Out Out
Decel
Accel Decel Accel
0 t
Δt

‘D’ Always Opposes Change in ‘PV’


D = d/dt [Error] for Derivative (Error)
D = - d/dt [PV] for Derivative (PV)

Derivative allows Proportional Gain to be larger


The higher the Dead-Time, the more the ‘D’
K d = KP * T d
Can always do without ‘D’ with a smaller ‘P’ ?

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Derivative Contribution

• Limits overshoot through anticipation


• Must be used with proportional control
– PID or PD never ID or D
• May not be necessary in many applications with P & I control
action

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


What P, I, and D Do together?

Proportional and Derivative actions respond to


setpoint changes and dynamic system
disturbances

Integral action responds to changes in steady


state operating point

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


PID Controls

Output Temperature

Integral
Proportional Derivative

Time Æ

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Preparation

• Have some idea of what you are trying to accomplish

• How fast or how far the process is going to respond to the controller output. Restoring stability
with confidence is important

• How much change will you allow In the process and in the controller output ?

• Who is going to adjust controller settings ? How knowledgeable the person is to avoid
confusion or crisis?

• Who is going to switch between Auto and Manual modes and change the setpoint ?

• Knowledge of the safety interlocks and other process related safeties are very important

• Time during and after tuning are important. Process behavioral changes must be closely
monitored and altered accordingly if required.

• Recording of existing settings and controller outputs are important. Especially, when you have
to return to these existing settings. Trending of the parameters should be monitored for
efficient process controls.

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Mantras for Process Control

QUARTER WAVE DECAY RATIO A B


B 1
Overshoot ratio
A 4
Quarter decay ratio is usually good compromise between ‘Fast response’ and ‘Stability’

MINIMIZE OVERSHOOT
Critically Damped

Preferred for some applications. However, cannot eliminate deviation as fast as controller
with quarter -decay

MINIMIZE DEVIATION FROM SET POINT

If the controller is tuned to give a quick response to a load upset (one quarter- decay ratio), it may be too
oscillatory when there is a setpoint change

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Common PID Myths

• If I go faster, I’ll control better


– Controlling faster
– Resolution effects make control worse
• If I have higher resolution input I can control tighter
– Majority of sensors are less accurate

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Closed Loop Ziegler-Nichols tuning method

A controller is tuned with no Integral and Derivative. The Controller gain KC (P


only) is increased while the setpoint is stepped to find the gain at which the
controller begins to oscillate. That gain (ultimate gain=KU) and the period (ultimate
period = TU ) of the oscillation are noted.

Ki= Kp / Ti Kd = Kp * Td

Ki and Kd are calculated from the period. In other words, if the dynamics of the
process changes, using the standard algorithm (Kp affects all terms), Ki and Kd
are changed. If the gain of the process changes, only Kp is changed.
K p = [ CV / PV] * Tp / Td = 1/K * Tp / Td
Where, Tp= Process time constant; Td = Dead Time; K= Process Gain

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Common PID Myths

• If I go faster, I’ll control better


– Controlling faster than wastes BW
– Resolution effects make control worse
• If I have higher resolution input I can control tighter
– Majority of sensors are less accurate

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.


Real Life Applications

Cement Plant
Pre - Calcination Tower, Kiln and Kiln Feed

Copyright © 2005 Rockwell Automation, Inc. All rights reserved.

You might also like