Automation Engineering
Automation Engineering
Automation Engineering
Version 4.0.en
Foreword
This book will examine the foundations of automation engineering in a world increasingly
focused on the development and implementation of automation. It will provide the reader with an
understanding of the key principles and components of automation engineering and how these
principles can then be combined and implemented in a real industrial system to provide safe,
economically viable, and efficient systems. Application will focus on a wide range of different
systems including chemical, electrical, and mechanical systems.
At the end of each chapter, questions testing the reader’s understanding of the material
presented as well as providing places for extension and deeper understanding of the topics at hand
are given.
In order to clearly differentiate between regular text and computer-related symbols, the font
“Courier New” is used for all computer-related symbols.
This book is meant to be used as the course material for an introductory, bachelor’s-level
course in automation engineering. It is possible to present different permutations and combinations
of the material depending on what topics are of interest to the particular students.
Computer files and related material can be downloaded from the book website (please
insert the appropriate book website once the book has been published).
The authors would like to thank Ying Deng and M.P. for their help in preparing some of
the material used in this book.
i
Table of Contents
Foreword i
Chapter 1 : Introduction to Automation Engineering 16
Section 1.1 : The History of Automation Engineering 16
Section 1.2 : The Key Concepts in Automation Engineering 20
Section 1.3 : Automation-Engineering Framework 23
Section 1.4 : The Automation-Engineering Pyramid 24
Section 1.5 : Chapter Problems 26
Section 1.5.1 : Basic Concepts 26
Section 1.5.2 : Short Exercises 27
Chapter 2 : Instrumentation and Signals 28
Section 2.1 : Types of Signals 28
Section 2.2 : Sensors 31
Section 2.2.1 : Pressure Sensor 33
Section 2.2.2 : Liquid-Level Sensors 34
Section 2.2.3 : Flow Sensors 35
Section 2.2.4 : Temperature Sensors 37
Section 2.2.5 : Concentration, Density, Moisture, and Other Physical Property Sensors 38
Section 2.3 : Actuators 38
Section 2.3.1 : Valves 39
Section 2.3.2 : Pumps 44
Section 2.3.3 : Variable Current Devices 46
Section 2.4 : Programmable Logic Computer (PLCs) 47
Section 2.5 : Communication Devices 51
Section 2.6 : Chapter Problems 52
Section 2.6.1 : Basic Concepts 53
Section 2.6.2 : Short Questions 54
Chapter 3 : Mathematical Representation of a Process 56
Section 3.1 : Laplace and Z-Transforms 56
ii
Section 3.1.1 : Laplace Transform 56
Section 3.1.2 : Z-Transform 61
Section 3.2 : Time- and Frequency-Based Models 64
Section 3.2.1 : Time- and Frequency-Domain Representations 65
Section 3.2.2 : Converting Between Representations 67
Section 3.2.3 : Discrete-Domain Models 70
Section 3.2.4 : Converting Between Discrete and Continuous Models 72
Section 3.2.5 : Impulse Response Model 73
Section 3.2.6 : Compact State-Space Representation 74
Section 3.3 : Process Analysis 75
Section 3.3.1 : Frequency-Domain Analysis 79
Section 3.3.2 : Stability 82
Section 3.3.3 : Controllability and Observability 93
Section 3.3.4 : Analysis of Special Transfer Functions 95
Section 3.4 : Event-Based Representations 116
Section 3.5 : Chapter Problems 126
Section 3.5.1 : Basic Concepts 126
Section 3.5.2 : Short Questions 128
Section 3.5.3 : Computational Exercises 132
Chapter 4 : Schematic Representation of a Process 133
Section 4.1 : Block Diagrams 133
Section 4.2 : Process Flow Diagrams 136
Section 4.3 : Piping and Instrumentation Diagrams (P&ID) 137
Section 4.3.1 : P&ID Component Symbols According to the DIN EN 62424 138
Section 4.3.2 : Connections and Piping in P&IDs 140
Section 4.3.3 : Labels in P&IDs 141
Section 4.4 : Electric and Logic Circuit Diagrams 145
Section 4.5 : Chapter Problems 147
Section 4.5.1 : Basic Concepts 147
Section 4.5.2 : Short Questions 147
Section 4.5.3 : Computational Exercises 153
iii
Chapter 5 : Control and Automation Strategies 154
Section 5.1 : Open- and Closed-Loop Control 155
Section 5.1.1 : Open-Loop Control 155
Section 5.1.2 : Closed-Loop Control 156
Section 5.2 : Feedforward Control 179
Section 5.3 : Discrete-Event Control 182
Section 5.4 : Supervisory Control 183
Section 5.4.1 : Cascade Control 184
Section 5.4.2 : Model Predictive Control 185
Section 5.5 : Advanced Control Strategies 191
Section 5.5.1 : Smith Predictor 191
Section 5.5.2 : Deadbanding and Gain Scheduling 191
Section 5.5.3 : Squared Control 192
Section 5.5.4 : Ratio Control 192
Section 5.5.5 : Input-Position Control 194
Section 5.5.6 : Nonlinear Characterisation 195
Section 5.5.7 : Bumpless Transfer 195
Section 5.6 : Chapter Problems 195
Section 5.6.1 : Basic Concepts 195
Section 5.6.2 : Short Questions 197
Chapter 6 : Boolean Algebra 200
Section 6.1 : Boolean Operators 200
Section 6.2 : Boolean Axioms and Theorems 201
Section 6.3 : Boolean Functions 202
Section 6.3.1 : Sum-of-Products Form and Minterms 203
Section 6.3.2 : Product-of-Sums Form and Maxterms 205
Section 6.3.3 : Don’t-Care Values 207
Section 6.3.4 : Duality 208
Section 6.4 : Minimising a Boolean Function 208
Section 6.4.1 : Karnaugh Map 209
Section 6.5 : Chapter Problems 214
iv
Section 6.5.1 : Basic Concepts 214
Section 6.5.2 : Short Questions 215
Chapter 7 : PLC Programming 217
Section 7.1 : The Common IEC-Standard Hierarchy 217
Section 7.2 : Types of Variables 219
Section 7.3 : Variables, Data Types, and Other Common Elements 220
Section 7.3.1 : Simple Elements 221
Section 7.3.2 : Variables 230
Section 7.3.3 : Data Types 230
Section 7.4 : Ladder Logic (LL) 234
Section 7.4.1 : Components of Ladder Logic 234
Section 7.4.2 : Functions and Ladder Logic 237
Section 7.4.3 : Examples of Using Ladder Logic 238
Section 7.4.4 : Comments 240
Section 7.5 : Instruction List (IL) 240
Section 7.5.1 : Universal Accumulator 241
Section 7.5.2 : Operators 242
Section 7.5.3 : Functions in Instruction List 243
Section 7.5.4 : Calling Function Blocks in Instruction List 244
Section 7.5.5 : Examples 245
Section 7.5.6 : Comments 246
Section 7.6 : Function-Block Language (FB) 247
Section 7.6.1 : Blocks used in the Function-Block Language 247
Section 7.6.2 : Feedback Variable 249
Section 7.6.3 : Example 249
Section 7.6.4 : Comments 250
Section 7.7 : Structured Text (ST) 250
Section 7.7.1 : Commands in Structured Text 250
Section 7.7.2 : Operators in Structured Text 252
Section 7.7.3 : Calling Function Blocks in Structured Text 253
Section 7.7.4 : Example 253
v
Section 7.7.5 : Comments 255
Section 7.8 : Sequential-Function-Chart Language (SFC) 256
Section 7.8.1 : Steps and Transitions 256
Section 7.8.2 : Action Blocks 258
Section 7.8.3 : Sequential Function Charts 259
Section 7.8.4 : Example 261
Section 7.8.5 : Validity of a Sequential Function Chart 264
Section 7.9 : Chapter Problems 267
Section 7.9.1 : Basic Concepts 267
Section 7.9.2 : Short Questions 268
Section 7.9.3 : Computational Exercises 272
Chapter 8 : Safety in the Automation Industry 273
Section 8.1 : Safety of the Physical System 273
Section 8.1.1 : Quantifying Risk and the Safety Integrity Level 275
Section 8.2 : Safety Regulations 277
Section 8.3 : Digital Safety 278
Section 8.4 : Chapter Problems 279
Section 8.4.1 : Basic Concepts 279
Section 8.4.2 : Short Questions 280
Bibliography 282
Appendix I : Partial Fractioning 283
vi
List of Figures
Figure 1: Automation engineering in the time of the ancient Greeks: (left) Æolipile (steam engine)
and (right) Automated temple door opening device 18
Figure 2: Watt governor (a: fly ball, b: arms, c: spindle, d: sleeve, e: ball crank lever, and f: throttle)
18
Figure 3: A system in automation engineering 21
Figure 4: General structure of an automated system 23
Figure 5: A description of the components of the automation-engineering pyramid 25
Figure 6: A timing diagram for two binary signals A and B 29
Figure 7: Continuous and discrete signals 30
Figure 8: Analogue-to-digital conversion 30
Figure 9: Typical Calibration Curve 32
Figure 10: Measurement set-up for pressure sensors: (a) Measuring differential pressure and (b)
Measuring absolute pressure (a: flexible membrane, Pa: ambient pressure, Pm: to-be-
measured pressure, and Pf: fixed pressure) 33
Figure 11: High-pressure transducer-based pressure sensor (a: measuring diaphragm, b: strain
gauge, c: reference hole to the atmosphere, d: true gauge diaphragm, and e: area for the
resistor for temperature correction and internal electronic amplifiers) 34
Figure 12: Level measurement and control using a float (a: trip lever, b: refill tube, c: float, d:
overflow tube, e: ballcock, f: lift chain, and g: flush valve) 35
Figure 13: Venturi tube (a: datum, b: U-tube manometer, c: manometer fluid, d: inlet, e: outlet, f:
main pipe, g: converging cone; h: throat, i: diverging cone, D1: diameter of the main pipe,
D2: diameter of the throat, Z1: reference height 1, Z2: reference height 2, and h: height
difference in the manometer) 36
Figure 14: Thermocouple (a: metal 1, b: metal 2, c: measurement point, d: reference location, T1:
to-be-measured temperature, T2: reference temperature, and V: voltmeter) 37
Figure 15: Pneumatically Actuated Control Valve (air-to-close) (a: supply air connection, b:
mechanical stop, c: diaphragm, d: upper chamber, d: lower chamber, f: spring, g: housing,
h: local position indicator, i: stem, j: flow direction, and k: transducer) 40
Figure 16: Inherent valve characteristics 43
vii
Figure 17: Phase plot for the typical behaviour of a valve with stiction (after (Shoukat Choudhury,
Thornhill, & Shah, 2005)). The arrows show the direction in which the values were
changed. 43
Figure 18: Centrifugal Pump (a: inflow, b: impeller, c: shaft, and d: outflow) 44
Figure 19: Positive-Displacement Pump (a: inflow, b: packing, c: piston rod, d: stuffing-box
bushing, e: liner, f: piston, g: working fluid, h: valve, and i: outflow) 45
Figure 20: Typical pump characteristic curve for a centrifugal pump 46
Figure 21: Layout of a PLC 48
Figure 22: Pre-emptive and nonpre-emptive tasks 51
Figure 23: Determining the Settling Time 76
Figure 24: Bode Plot: The Argument-Ratio and Phase-Angle Plots 81
Figure 25: A Nyquist Plot (for the same process as given by Bode plot in Figure 24) 82
Figure 26: Bode Plot for Closed-Loop Stability Analysis 92
Figure 27: Closed-loop stability using the Bode plot 93
Figure 28: Closed-loop stability using the Nyquist plot 93
Figure 29: Response of the Integrator 1 / s to a Unit-Step Input 96
Figure 30: Bode Plot for an Integrator 97
Figure 31: Bode Plot for a Lead Term (top row) K > 0, (bottom row) K < 0, (left) τL > 0, and (right)
τL < 0 99
Figure 32: Step Response of a Stable, First-Order System to a Step Response 101
Figure 33: Bode Plot for a First-Order System (top row) K > 0, (bottom row) K < 0, (left) τp > 0,
and (right) τp < 0 102
Figure 34: Second-Order Underdamped Process 104
Figure 35: Step Response of a Critically Damped System (ζ = 1, τp = 10, and K = 1) 105
Figure 36: Step Response of an Overdamped System (ζ = 2, τp = 5, and K = 1) 106
Figure 37: Bode Plots for τp = 5, (top) ζ = 0.5, (middle) ζ = 1, (bottom) ζ = 2; (left) K = 1 and
(right) K = −1 109
Figure 38: Step Response of a Second-Order System with Inverse Response (τL = −25, ζ = 5/√7,
τp = 10√7 and K = 1) 110
Figure 39: Bode Plots for (left) τL = −5, (right) τL = 5, and (top) ζ = 0.5 and (bottom) ζ = 2 110
viii
Figure 40: Sketch of the Transfer Function Step Responses: (left) first transfer function, (middle)
second transfer function, and (right) third transfer function. 112
Figure 41: Graphical Representation of an Automaton 118
Figure 42: Automaton for the example 118
Figure 43: Automaton 120
Figure 44: The Trimmed Automaton 121
Figure 45: G1 122
Figure 46: G2 123
Figure 47: The product of G1 and G2 123
Figure 48: The parallel composition of G1 and G2 125
Figure 49: Timed Automaton 125
Figure 50: Automata for Questions 40 and 41 131
Figure 51: Automata for Question 42 132
Figure 52: The basic block diagram 133
Figure 53: Summation block: (top) full form and (bottom) short-hand equivalent 134
Figure 54: Block diagram algebra: In order to relate U and Y, the transfer functions between the
two points need to be multiplied, thus, Y = G3G2G1U. 134
Figure 55: Generic closed-loop, feedback control system 135
Figure 56: Process Flow Diagram for Alkylate Splitter 136
Figure 57: P&ID for a Gas Chilling and Separation Plant According to Canadian Design Standards
(Note the engineering stamp in the bottom middle box.) 137
Figure 58: Fields in a P&ID Label 142
Figure 59: Connections: a) recommend form for contact; b) commonly encountered form for
contact; and c) no contact 147
Figure 60: Block Diagrams for Question 11 148
Figure 61: Sketch of Process Flow Diagram for Question 13 150
Figure 62: P&IDs for Question 14 150
Figure 63: P&ID for Question 15 151
Figure 64: P&ID for Question 16 152
Figure 65: Maple Syrup P&ID for Question 17 153
Figure 66: Open-Loop Control 155
ix
Figure 67: Open-Loop Control for the Temperature in the House 156
Figure 68: Closed-Loop Control 157
Figure 69: Closed-Loop Control of the House Temperature 158
Figure 70: State-feedback control 159
Figure 71: Effect of Changing Kc for a P-Controller 163
Figure 72: Integral Wind-Up 165
Figure 73: Effect of Changing τI for a I-Controller. The solid, black line is the setpoint. 166
Figure 74: Jitter with a Derivative Term 168
Figure 75: Derivative Kick 168
Figure 76: Effect of Changing τD for a D-Controller 169
Figure 77: Controller Tuning Workflow 172
Figure 78: Closed-Loop Performance of the PI Controller 176
Figure 79: Measures of Servo Control Performance 178
Figure 80: Block Diagram for Feedforward Control 179
Figure 81: Effect of Feedforward Control on a Process 182
Figure 82: Block Diagram for Cascade Control 185
Figure 83: Block Diagram for Smith Predictor Control 191
Figure 84: Ratio Control with Trim Feedback Control 193
Figure 85: Input-Position Control 194
Figure 86: Karnaugh map for the function F = B′ 209
Figure 87: Karnaugh map for the function F = Σm(0, 3, 5) 210
Figure 88: Karnaugh map for the function F = A′BD + B′C′D′ + C 210
Figure 89: Karnaugh map for the function F = ΠM(2, 5, 7, 9, 13, 15, 16, 17, 18,
20, 24, 25, 27) 210
Figure 90: Prime implicant and implicant 212
Figure 91: Karnaugh map for Example 40 212
Figure 92: Procedure for minimising a Karnaugh map 213
Figure 93: Karnaugh map for Question 27 216
Figure 94: Visual representation of a configuration 219
Figure 95: Pre-emptive and nonpre-emptive tasks 219
Figure 96: (top) AND and (bottom) OR in ladder logic 237
x
Figure 97: Calling a function in ladder logic 237
Figure 98: Ladder Logic for Example 41 238
Figure 99: Ladder Logic for Example 42 240
Figure 100: Diagram using the Function-Block Language 249
Figure 101: Feedback in the Function-Block Language 249
Figure 102: The Function Q in the Function-Block Language 250
Figure 103: Tank System for the Structured-Text Example 254
Figure 104: Steps in Sequential Function Charts: (left) general step and (right) initial step 256
Figure 105: Transitions Conditions in Different PLC Languages 257
Figure 106: Components of an Action Block: a: Qualifier; b: Action Name; c: Indicator Variable;
d: Process Description 258
Figure 107: Alternative Paths in Sequential Function Charts 260
Figure 108: Usual Decision Order for Alternative Paths in Sequential Function Charts 260
Figure 109: User-Defined Decision Order for Alternative Paths in Sequential Function Charts 260
Figure 110: Parallel Paths in Sequential Function Charts 261
Figure 111: Schematic of the Reactor 262
Figure 112: Sequential Function Chart 263
Figure 113: Sequential Function Chart for Checking Its Validity 265
Figure 114: First Reduction 266
Figure 115: Second Reduction 266
Figure 116: Third Reduction 266
Figure 117: Fourth and Final Reduction 267
Figure 118: Validity of Sequential Function Charts 269
Figure 119: Stirring Process 269
Figure 120: Washing Machine 270
Figure 121: Ladder Logic 272
Figure 122: Relationship between the parameters and the safety integrity levels 277
Figure 123: P&ID for a Compressor Unit 281
xi
List of Tables
Table 1: Thermocouple Types 37
Table 2: Data for creating the valve characterisation curve for Question 34) 54
Table 3: Sensor Calibration Data for Question 35) 55
Table 4: Table of Common Laplace Transforms 57
Table 5: Useful Inverse Laplace Table 58
Table 6: Table of Common z-Transforms (Ts is the sampling time) 62
Table 7: Useful Inverse Z-Transform Table (A and D can be complex) 63
Table 8: Padé Approximations for the Exponential Function, ez 78
Table 9: Summary of the Stability Conditions for Different Representations and Time Domains
83
Table 10: Routh Stability Analysis Table 86
Table 11: Routh Array 87
Table 12: Table for the Jury Stability Analysis 88
Table 13: Table for Jury stability 90
Table 14: Basic Information About an Integrator 96
Table 15: Basic Information About a Lead Term 98
Table 16: Basic Information About a First-Order System 101
Table 17: Basic Information About a Secord-Order System 108
Table 18: Graphical Representation of the Different Types of Functions (The ringing cases can
only occur in the discrete domain.) 113
Table 19: Component Symbols for P&IDs According to the DIN EN 62424 138
Table 20: Connections Types for P&IDs 140
Table 21: Location Symbols 141
Table 22: Type Symbols 141
Table 23: PCE Categories 142
Table 24: PCE Processing Categories 143
Table 25: Common Symbols in Circuit Diagrams 145
Table 26: PI controller constants for first-order-plus-deadtime models 175
Table 27: PID controller constants for first-order-plus-deadtime models 175
xii
Table 28: PID controller constants for a second-order-plus-deadtime models 175
Table 29: Boolean operators, where a, b ∊ 𝔹𝔹 200
Table 30: Truth table for the Boolean Operators (left) AND and (right) OR 203
Table 31: Delimiters in the IEC IEC 61131-3 standard 221
Table 32: All Keywords in the IEC standard 224
Table 33: Special Strings 228
Table 34: The elementary data types in the IEC 61131-3 Standard. The initial letters in the data
types represent: D = double, L = long, S= short, and U = unsigned. 231
Table 35: Components of Ladder Logic 234
Table 36: Changes in the Current Result for Different Operator Groups 241
Table 37: Operators in Instruction List 242
Table 38: Two Possibilities for Calling the Function LIMIT(MN, IN, MX) 243
Table 39: Three Methods for Calling the Function Block ZEIT1(IN, PT) with output variables
Q and ET. 244
Table 40: Blocks used in the function-block language 247
Table 41: Commands in Structured Text 251
Table 42: Operators and their Priority in Structured Text 252
Table 43: Qualifiers in Sequential Function Charts 258
Table 44: I/O for the Washing Machine 271
Table 45: Truth Table I 272
Table 46: Truth Table II 272
List of Examples
Example 1 : Laplace Transform 59
Example 2 : Inverse Laplace Transform 60
Example 3 : Z-Transform 63
Example 4 : Inverse z-Transform 63
Example 5 : Numeric Example of Obtaining a Transfer Function 67
Example 6 : General Univariate Case 68
Example 7 : Multivariate Example 68
xiii
Example 8 : Converting a Transfer Function into its Controllable Canonical Realisation 70
Example 9 : Extracting Information from a Transfer Function 79
Example 10 : Determining the Stability of a Transfer Function 83
Example 11 : Determining the Stability of a State-Space Model 84
Example 12 : Example of Routh Stability Analysis 86
Example 13 : Example of Jury Stability Analysis 89
Example 14 : Sketching the Expected Time-Domain Response 111
Example 15 : Origin of Ringing in Discrete-Time Systems 114
Example 16 : Automaton for a Process 118
Example 17 : Blocking in an Automaton 120
Example 18 : Trimming an Automaton 121
Example 19 : Product of Two Automata 122
Example 20 : Parallel Composition of Two Automata 124
Example 21 : Complex Block Diagrams 135
Example 22 : P&ID Tags 144
Example 23 : Heating the House: Part I: Open-Loop Control 156
Example 24 : Temperature Control: Closed-Loop Case 157
Example 25 : Investigation of the Proportional Term on Stability and Performance 163
Example 26 : Investigation of the Integral Term on Stability and Performance 165
Example 27 : Investigation of the Derivative Term on Stability and Performance 168
Example 28 : Designing a PI Controller 176
Example 29 : Designing a Feedforward Controller 181
Example 30 : Design of a Model Predictive Controller 187
Example 31 : Truth Table 203
Example 32 : Sum-of-Products Form 203
Example 33 : Converting into the Sum-of-Products Form 204
Example 34 : Compact Sum-of-Products Form 204
Example 35 : Product-of-Sums Form 205
Example 36 : Converting into the Product-of-Sums Form 206
Example 37 : Compact Product-of-Sums Form 206
Example 38 : Don’t Cares 207
xiv
Example 39 : Dual of a Function 208
Example 40 : Karnaugh map 212
Example 41 : Ladder Logic for a Boolean Function 238
Example 42 : Ladder Logic for a Recipe 238
Example 43 : Example of the Computation of the Current Result 245
Example 44 : Writing the Instruction List Programme 246
Example 45 : Creating the Diagram using the Function-Block Language 249
Example 46 : Structured Text 253
Example 47 : Creating a Sequential Function Chart 261
Example 48 : Determining the Validity of a Network 265
Example 49 : Partial Fractioning 284
xv
Chapter 1: Introduction to Automation
Engineering
Automation engineering is an important component of modern industrial systems that
focuses on the development, analysis, optimisation, and implementation of complex systems to
provide safe, economically viable, and efficient processes. Automation engineering seeks to
eliminate as much as possible human intervention into the process. However, it should be noted
that this does not mean that humans are not required to monitor and assist with the running of the
process; it simply implies that the mundane, often repetitive, tasks are delegated to computer
systems that are better suited for performing such work.
In order to understand automation engineering, it is important to briefly review its long
history, its main principles, and its foundations.
1
This word is ultimately derived from the Greek word αὐτός, meaning self, and an unattested root, which comes from
the proto-Indo-European word *méntis ~ mn̥téis, meaning thought (which in turn gave us such words as mind in
English)
16
in AD 1656 by Christiaan Huygens. Later, a primitive steam engine, called an æolipile, was
developed by Hero of Alexandria (gr: Ἥρων ὁ Ἀλεξανδρεύς, c. AD 10 to 70). Examples of these
devices are shown in Figure 1. As well, objects that assisted in the computation of heavenly bodies
(essentially the first computers) were also developed. The most famous is the Antikythera
mechanism, a type of astronomical clock based on a gear-driven apparatus. This tradition of
developing mechanical automated objects was continued long into the Middle Ages both in Europe
and in the Middle East, with such work as the Book of Ingenious Devices (ar: ( ﻛﺘﺎب اﻟﺤﯿﻞKitab al-
Hiyal) or pe: ( ﻛﺘﺎب ﺗﺮﻓﻨﺪھﺎKetab tarfandha)) by the brothers Banu Musa published in A.D. 850,
which describe various automata, including primitive control methods, automatic fountains,
mechanical music machines, and water dispensers. Similarly, in the court rooms around the world,
various automata in the shape of singing animals were being developed and maintained. Famous
examples can be found in the (now destroyed) palaces of the Khanbaliq of the Chinese Yuan
dynasty and the court of Robert II, Count of Artois.
The interest in the development of automata continued into the Renaissance with the
development of life-size automata, such as The Flute Player by the French engineer Jacques de
Vaucanson (1709 – 1782) in 1737.
With the rediscovery of steam engines, the ability to develop large and complex automated
system become a reality sparking the first Industrial Revolution (1760 to 1840). One of the first
such examples was the Jacquard loom that could be programmed to automatically weave different
designs using punch cards. The development of advanced systems required methods of controlling
them, so that explosions and damage were minimised. The first dedicated device for controlling a
steam engine, called the Watt governor, was developed by James Watt (1736 – 1819). The Watt
governor, shown in Figure 2, regulates the amount of fuel entering the system so that the speed of
the engine remains in a desired range. The development of the first Watt governor was followed
by a rash of patents trying to improve various aspects, including one by William Siemens
(1823 – 1883). It was not until 1868, when James Clerk Maxwell (1831 – 1879) provided a
mathematical description of the governor in his aptly named paper On Governors that a rigorous
mathematical foundation for the development of methods for controlling a process was available.
As the systems became more complex in the succeeding decades and centuries, there came an
ever-increasing need for understanding these intricate systems in order that they be properly run
so as to avoid unsafe operating conditions.
17
Figure 1: Automation engineering in the time of the ancient Greeks: (left) Æolipile (steam engine) and (right) Automated temple
door opening device
Figure 2: Watt governor (a: fly ball, b: arms, c: spindle, d: sleeve, e: ball crank lever, and f: throttle)
18
The demand for automation continued with the onset of the second Industrial Revolution
(1870 – 1915), which focused on the development of efficient manufacturing methods (production
lines, Taylorism, and similar ideas) coupled with the development of electricity and the first
electrical devices.
By the 1950s, a new industrial revolution, often called the third Industrial Revolution or
the Digital Revolution, had started. This revolution focused on the implementation and use of
complex electrical circuits that can be used to quickly and efficiently perform complex processes.
With the development of these circuits, it became easy and cost-effective to implement automation
in a wide range of different fields. From the perspective of automation engineering, the key event
was the development of programmable logic controller (PLCs) that could be used to implement
advanced control methods in an industrial setting. The first PLCs were developed by Bedford
Associates from Bedford, Massachusetts, USA based on a white paper written by the engineer
Edward R. Clark in 1968 for General Motors (GM). One of the key people working on this project
was Richard E. “Dick” Morley (1932 – 2017), who is often considered the father of the PLC. Other
important work was performed by Odo Josef Struger (1931 − 1998) of Allen-Bradley in the period
1958 – 1960. At the same time, there was an explosion of interest in a theoretical perspective on
automation engineering, especially in the areas of control and process optimisation. This research
by such people as Andrei Kolmagorov (ru: Андре́й Никола́евич Колмого́ров, 1903 − 1987),
Rudolf Kálmán (hu: Kálmán Rudolf Emil, 1930 − 2016), Richard E. Bellman (1920 – 1984) and
others lead to a strong foundation for the subsequent development and implementation of advanced
control methods in industry.
Within the context of the third Industrial Revolution, the concept of robots was also
considered. The word robot itself was first used by the Czech author Karel Čapek (1890 – 1938)
in his 1920 drama R.U.R. (cz: Rossumovi Univerzální Roboti or en: Rossum’s Universal Robots)
as a word for artificial humanoid servants that provided cheap labour. Karel credited his brother
painter Josef Čapek (1887 – 1945) with inventing this word. The word robot stems from the Czech
root robota, that means serfdom, which ultimately comes from the proto-Indo-European word,
*h₃erbʰ−, that means “to change or evolve status” from which the English word arbitrate is also
derived.
More recently, with the growth of interconnectedness and the development of smart
technologies, some have proposed that a new industrial revolution is dawning. This revolution has
19
been called the fourth Industrial Revolution, or Industry 4.0, which focuses on the development of
self-functioning, interconnected systems in an increasingly globalised world. Its main drivers are
ever increasing automation and digitalisation of the industrial plant combined with globalisation
and customisation of the supply chains.
2
In this textbook, the two words will not be distinguished. Some authors consider the process to be the overall way
something is done, while a system represents the actual physical realisation of the process. Since in many cases, these
words are used interchangeably, the textbook will primarily use system.
20
Figure 3: A system in automation engineering
It goes without saying that if we wish to understand the system, we require a model of the
system. A model of the system is a mathematical representation of the relationship between the
inputs, outputs, and states. The complexity of the required model depends on the purposes that the
model will be used. Modelling a process is a complex endeavour that requires insight into the
process and the ability to handle large data sets quickly and effortlessly.
In order to complete the picture regarding the system, it is necessary to extend our view to
include parts that allow us to interact with the system or influence its behaviour. Such a view is
provided in Figure 4, which shows the key components and their interactions. It is important to
briefly consider the impact of these in order to understand how the system can be influenced and
how it will react. In this view, the eight key components can be described as (the number is the
same as in Figure 4):
1) Actual Process: This represents the process under consideration. Normally, the actual
process is unknown. Instead, a model of the actual process is used.
2) Sensors: The sensors provide the ability to measure the process and understand how the
variables are changing.
3) Actuators: The actuators allow the value of a variable to be changed. If we cannot change
the value of a variable, then it is hard to use it in an automation strategy. When deciding
on which actuators to use, it is important to consider such factors as the variable being
manipulated, the automation requirements (e.g. required accuracy, tolerance, or precision),
and the type of service required (e.g. continuous, discrete, or emergency).
4) Automation Devices: The automation devices are the controllers and related components
that are used to automate the process. Most of the time the automation hardware consists
of computers and other digital devices, such as programmable logic controllers (PLCs),
that implement the required functions. The design of the automation hardware (and
software) requires knowledge of the limitations and requirements of the system.
5) Environment: The environment represents everything that surrounds the system to be
automated that can have an impact on the overall performance of the system. This influence
can be caused either by changes in other processes that interact with the system of interest
21
or by direct environmental changes, such as for example, changes in the ambient
temperature. The system will exchange mass, energy, and information with its environment.
6) Automation Objectives: The automation objectives play a very important role in the
development and implementation of the final automation system. Poorly defined or unclear
objectives can make achieving the project difficult if not impossible. Furthermore, the
objectives often need to be translated from the language of business into actually
implementable objectives on a system. This translation can cause additional uncertainties
and lack of clarity.
7) Operators: Although the human component is often minimised or ignored when designing
automation systems, it is in fact very important. Many complicated automation systems
have failed due to a lack of proper consideration of the operators. In general, the operators
need to have the required information easily available (no fancy graphics are needed) and
they can enter the required information into the system quickly and efficiently. Appropriate
feedback and safety checking of the entered values must be performed to avoid confusion.
The operators interact with the process using a human-machine interface (HMI). An
HMI provides two key functions. It allows the operators to see the important process values
and to manipulate as necessary the process values. Manipulating the values implies that the
operators can change at what value the process operates, for example, changing the flow
rate in a pipe. Finally, when designing the HMI, it is important to consider any safety
features, such as logic, that limits which values can be entered by the operators. This
prevents mistakes both accidental, such as mistyped numbers or the wrong information in
a given field, and malicious, such as changes introduced by illegal access to the system,
from having an impact on the process.
8) Disturbances: Disturbances are everything that can impact the system, but whose presence
cannot be directly controlled. Disturbances can originate in the environment (for example,
the ambient temperature) or in the devices themselves (for example, measurement noise in
sensors). One of the objectives of the automation system is to minimise, as much as
possible, the impact of these disturbances on the process.
The final aspect that needs to be considered is safety. The automation system that has been
designed should allow the process to operate in a safe manner without any unexpected behaviour,
from serious errors to a system failure. The system should also be robust, that is, minor changes
22
in the process should not cause the whole system to fail catastrophically. A robust system can
handle small changes in the process conditions and still attain the required goals.
23
4) Validation of the Proposed Automation Strategy, which validates the proposed
automation strategy using the process model. This determines if the proposed strategy can,
in fact, achieve all the desired automation objectives. Should it be found that the proposed
strategy is lacking, then the strategy needs to be refined and retested. This implies that there
may need to iterate until the final automation strategy is found.
5) Implementation and Commissioning of the Proposed Automation Strategy, which
involves the implementation of the strategy in the real process. Naturally, the
implementation on the real system may lead to changes in the strategy. This implies that
before commissioning, the automation strategy should be tested on the actual process in as
realistic conditions as possible. In certain cases, this may not be feasible and advanced
simulations, using hardware-in-the-loop methods can be implemented to provide a
realistic simulation of the system.
24
software, such as a supervisory control and data acquisition (SCADA) programme, will be
used.
• Level 2 – Control Level: This level considers how to run the algorithms for controlling
the process using the available process information on the time horizon of minutes or even
seconds. Various hardware, such as programmable logic controllers (PLCs) or industrial
PCs (IPCs) are used to compute the required actions. It is on this level that this book focuses.
• Level 1 – Field Level: This level focuses on the sensors and actuators. Information is
actively exchanged with Level 2, often using fieldbuses. The time horizon is often in the
range of seconds or faster.
• Level 0 – Process Level: This level represents the actual process that is running in real
time.
It can be noted that the process description becomes more abstract as we go from bottom to top.
While Level 0 is very concrete and describes everything in great detail, Level 5 is very abstract
and only focuses on describing the process inputs and outputs to give an overall picture of the
process.
25
Section 1.5: Chapter Problems
Problems at the end of the chapter consist of three different types: (a) Basic Concepts
(True/False), which seek to test the reader’s comprehension of the key concepts in the chapter; (b)
Short Exercises, which seek to test the reader’s ability to compute the required parameters for a
simple data set using simple or no technological aids. This section also includes proofs of theorems;
and (c) Computational Exercises, which require not only a solid comprehension of the basic
material, but also the use of appropriate software to easily manipulate the given data sets.
26
18) In the field level, sensors gather the information and transfer it using fieldbuses to the
control level.
19) A process variable that cannot be measured should be used to control the process.
20) Safety is always an unimportant topic in automation engineering.
27
Chapter 2: Instrumentation and Signals
The foundational component of any automation system is the instrumentation, that is, the
sensors, actuators, and the computer hardware which together produce a stream of values, often
called a signal, that can be used for subsequent processing. Before we can look at the sensors,
actuators, and control concepts, it is helpful to understand the types of signals and how they can
be generated.
28
is triggered. Such signals work by assigning one value (say 0) to the normal state and the other
value to the alarm state (say 1). Binary signals are often displayed using what is called a timing
diagram. In a timing diagram, the binary signal is plotted as a function of time. Multiple different
binary signals are normally placed on separate y-axis, but a common time x-axis. Figure 6 shows
such a typical timing diagram.
Based on the classification in the time and value domains, it is possible to have four
different types of signals, which are shown in Figure 7. By convention, a signal that is continuous
in both the time and value domains is called an analogue signal, while a signal that is discrete in
both the time and value domains is called a digital signal.
Since most real processes require and produce continuous, analogue signals, but computers
perform their computations using discrete, digital signals, there is a need to understand how signals
can be converted between the two forms. Converting from analogue to digital signals is shown in
Figure 8, and consists of three components: sampler, quantiser, and encoder. The sampler
measures (samples) the value of the analogue signal on a fixed frequency to convert the signal into
the discrete time domain. Next, the quantiser coverts this sampled signal into the available closest
value (quantum) to create a digital signal. The encoder simply encodes the digital signal into a
29
given digital representation that can be used by the computer. This process is often denoted as an
analogue-to-digital (A/D) converter.
Time Domain
Continuous Discrete
Continuous
Value Domain
Discrete
When quantising a continuous signal, its values are compared against fixed (equidistant)
quantisation levels. If the value of the continuous signal is between two decision thresholds, the
lower value is usually selected. For example, if a continuous signal has a value of 0.44 with
quantisation levels at 0.25 and 0.5, the quantised (sampled) signal will be set to 0.25. The selection
of appropriate quantization levels is important, since this selection affects the accuracy of the
mapping of the process, for example, if the steps are too far apart, important information can be
lost.
When going in the other direction, it is normal to assume that the value of the signal will
not be changed and only the time component needs to be made analogue. This is normally
accomplished using a hold, which holds the value of signal until a new value is received. The most
30
common hold is the zero-order hold, which simply holds the last value received until a new value
is received. A more accurate hold is the first-order or linear hold, which uses an interpolation
between the previous two data points to obtain a linearly varying value over the sampling period.
This process is called digital-to-analogue (D/A) conversion.
31
Figure 9: Typical Calibration Curve
A single sensor depending on its calibration and physical arrangement can be used to
measure different physical variables, for example, a differential pressure cell can measure both
flow rates and level.
Selecting an appropriate sensor depends on the following criteria:
1) Measurement Range (Span): The required measurement range for the process variable
should lie within the instrument’s range.
2) Performance: Depending on the specific application, different factors, such as accuracy,
precision, and speed of response, will need to be considered.
3) Reliability: How well does the sensor work in the given operating conditions, for example,
if the sensor must be placed in harsh operating conditions, can it handle them and for how
long?
4) Materials of Construction: Depending on the application, the required materials of
construction for the sensor may be different, for example, a temperature sensor in a blast
furnace will require a different material than a temperature sensor in the living room of a
house.
5) Invasive or Noninvasive: An invasive sensor comes in direct contact with the object being
measured, for example, inserting a probe into a liquid to measure the temperature. If an
invasive sensor comes into contact with the process, it can influence the process or be
influenced by the process itself. Thus, invasive methods can have issues with long-term
accuracy due to fouling or corrosion of the probe surface. On the other hand, noninvasive
sensors do not come in contact with the process. In such cases, the process is not disturbed,
32
but the measurement may be less accurate. However, noninvasive sensors are generally
easier to use and can be easily retrofitted into an already built environment.
Figure 10: Measurement set-up for pressure sensors: (a) Measuring differential pressure and (b) Measuring absolute pressure (a:
flexible membrane, Pa: ambient pressure, Pm: to-be-measured pressure, and Pf: fixed pressure)
Most transducer-based pressure sensors use some type of electric circuit (for example, a
Wien bridge) to measure the strain induced by the pressure on the system. Common strain gauges
include piezoresistive, capacitive, electromagnetic, piezoelectric, and optical. Figure 11 shows a
typical high-pressure transducer-based pressure sensor. Similarly, manometers are also based on
the effect of pressure on some system property. They include the common hydrostatic manometers,
33
which basically measure the difference in pressure between the two taps, and mechanical
manometers, which measure the effect of pressure on the strain of the material. Mechanical
manometers have the advantage that they do not interact strongly with the fluid and can provide
very sensitive readings. On the other hand, compared to the hydrostatic manometers, they can be
more expensive.
Figure 11: High-pressure transducer-based pressure sensor (a: measuring diaphragm, b: strain gauge, c: reference hole to the
atmosphere, d: true gauge diaphragm, and e: area for the resistor for temperature correction and internal electronic amplifiers)
34
generating devices, can be used to determine the surface level. However, in order to get an accurate
estimate, it is required that the surface be relatively flat and consistent. Froths and other particles
can impact the accuracy and precision of the measurements.
Figure 12: Level measurement and control using a float (a: trip lever, b: refill tube, c: float, d: overflow tube, e: ballcock, f: lift
chain, and g: flush valve)
35
Pressure-based flow sensors measure the pressure difference caused by some constriction
in flow to determine the flow rate. Common pressure-based flow sensors include Venturi tubes,
orifice-plate differential pressure cells, and Pitot tubes. As with mechanical flow sensors, these
flow sensors tend to work best with uniphase flow of simple fluids without any suspended particles.
Figure 13 shows the basic operating principles of a Venturi tube.
Figure 13: Venturi tube (a: datum, b: U-tube manometer, c: manometer fluid, d: inlet, e: outlet, f: main pipe, g: converging cone;
h: throat, i: diverging cone, D1: diameter of the main pipe, D2: diameter of the throat, Z1: reference height 1, Z2: reference height
2, and h: height difference in the manometer)
36
In most industrial cases, pressure-based flow meters are used, since they are simple to use,
robust, and easy to maintain. On the other hand, when dealing with exotic or extreme fluids, then
more complex methods may be required.
Figure 14: Thermocouple (a: metal 1, b: metal 2, c: measurement point, d: reference location, T1: to-be-measured temperature, T2:
reference temperature, and V: voltmeter)
37
Thermocouple Temperature Range Material of
Comments
Type (°C) Construction
C, D, and G 0 to 2320 tungsten/rhenium Cannot be used in
alloys presence of oxygen,
expensive.
Chromel- −273.15 to 25 chromel-gold−iron Cryogenic applications
gold/iron
38
the actuator to respond to a change. In general, it is desired that an actuator respond quickly to
changes and deliver the final desired value in a short period of time. Most actuators are designed
so that 0% corresponds to no value and 100% corresponds to the maximal value. A common
problem with actuators is that their response is nonlinear. One way to resolve this problem is to
use a characterisation function that will convert the desired linear values into the actuator’s
nonlinear values.
Actuators need to be calibrated before being used or to check that they are behaving as
expected. Calibration involves using standards with accurate and well-defined values to compare
against the measured value by the sensor. However, the exact relationships and behaviour of the
calibration will depend on the specific actuator.
There are three common actuators: valves, pumps, and variable current actuators.
39
“trim”) relative to a seat. As the stem moves, it changes the cross-sectional area available for flow,
and thus the resistance to flow. For an air-to-close valve, an increase in air pressure will push the
plug towards the seat, thus reducing the area available for flow, increasing the resistance to flow,
and reducing the flow rate though the valve. For an air-to-open valve, the air enters on the bottom
of the diaphragm, so an increase in air pressure will raise the diaphragm, thus opening the valve.
Figure 15: Pneumatically Actuated Control Valve (air-to-close) (a: supply air connection, b: mechanical stop, c: diaphragm, d:
upper chamber, d: lower chamber, f: spring, g: housing, h: local position indicator, i: stem, j: flow direction, and k: transducer)
Many modern valves have an additional element called a positioner that seeks to overcome
any potential errors in the valve. A positioner basically compares the current valve location against
the reference value and will change the air supply to allow for the difference to be zero.
The behaviour of a valve is normally specified based on the percentage of the total distance
that the valve is opened or closed. This eliminates the need to know the exact flow rates. Therefore,
the flow rates of a valve are often stated in terms of percent open (often abbreviated as %open).
40
Properly selecting a valve for automation (or control) is very important. There are two
variables to consider: sizing and dynamic performance.
41
Furthermore, since a valve is a mechanical system, friction will cause two additional types
of nonlinearities to be present in the system: static and dynamic. Static nonlinearity refers to the
nonlinearity introduced by static friction when initiating changes in the valve position, while
dynamic nonlinearity results from the dynamic friction in the valve, usually between the valve
stem and the seal. Static friction between the stem and seal results in the valve not moving when
there is a small change in the control signal (air pressure) input to the valve. Static friction, or
“stiction,” can significantly affect controller performance.
To find static and dynamic nonlinearities in a control valve, step the valve from 0% open
to 100% open and then back to 0% in small steps and record the steady-state flow at each step.
Plot the data points on a graph of steady-state flow versus %open, and use different lines for
opening and closing. The resulting graph will be similar to that shown in Figure 17, where the
ideal valve behaviour is shown as a dashed line. Static nonlinearity consists of the deadband
region over which the flow rate does not change even though the signal to the valve increases and
the slip-jump behaviour, while dynamic nonlinearity consists of hysteresis, which is the gap
between the two lines. Slip-jump behaviour is caused by the static friction that must first be
overcome before the valve changes its position. Since the dynamic friction is much smaller than
the static friction, the valve will overshoot the position defined by the force as soon as it starts to
move. This will make the curve look like a staircase. Hysteresis arises from the difference between
the measured flow rate when opening and closing a valve. This effect can be explained by the
different effect of dynamic friction on the moving valve. When the valve is being opened, due to
dynamic friction, it will open less than desired. On the other hand, when it is being closed, the
valve will be more open than specified, that is, it will close less than desired.
42
Figure 16: Inherent valve characteristics
Figure 17: Phase plot for the typical behaviour of a valve with stiction (after (Shoukat Choudhury, Thornhill, & Shah, 2005)).
The arrows show the direction in which the values were changed.
43
Section 2.3.2: Pumps
Another actuator that can control the flow rate in a stream is a pump. A pump is a
mechanical device that takes a fluid, most often a liquid, from a storage tank and moves it to some
other location. The main types of pumps are centrifugal pumps, positive-displacement pumps, and
axial-flow pumps. In centrifugal pumps, the flow direction changes by 90° as it moves over the
impeller, while in an axial-flow pump the flow direction is not changed. In positive-displacement
pumps, the fluid is trapped in a fixed volume and forced (or displaced) into the discharge pipe.
The traditional hand pump is a good example of a positive-displacement pump. Of these three
types, the most common type is a centrifugal pump. A positive-displacement pump is often used
if flows are small or extreme precision is required. Figure 18 shows a schematic diagram of a
centrifugal pump, while Figure 19 shows a positive-displacement pump.
Compared to valves, pumps tend to provide better control of the flow rate and have fewer
nonlinear characteristics. However, they have much higher energy consumption than valves. The
main considerations for a pump, as for valves, are sizing and performance.
Figure 18: Centrifugal Pump (a: inflow, b: impeller, c: shaft, and d: outflow)
44
Figure 19: Positive-Displacement Pump (a: inflow, b: packing, c: piston rod, d: stuffing-box bushing, e: liner, f: piston,
g: working fluid, h: valve, and i: outflow)
45
pump is shown in Figure 20. The head, H, normally expressed in units of length, such as metres
or feet, shows how high a given column of liquid could be lifted by a pump. It represents the
effective pressure gradient that the pump can overcome. The efficiency, η, represents how much
work put into the pump is converted into lifting the liquid. As in many engineering applications,
the higher the efficiency, the better it is. For centrifugal pumps, the net positive suction head
(NPSH) is the minimum head (pressure) at the inlet before cavitation occurs. Cavitation is defined
as the boiling of a liquid in a pump, which is evidently a very undesirable event. Therefore, the
head at the inlet must be greater than the specified value.
46
Section 2.4: Programmable Logic Computer (PLCs)
Programmable logic computers (PLCs) are small computers that have been made robust
and rugged. They are often used in industry for controlling processes, such as assembly lines,
robots, or complex chemical processes. PLCs allow the collection of the different signals and their
subsequent processing to reach a decision or action that may need to be taken. Given the
computational power, they can also perform relatively advanced logical and mathematical
functions that can be used to control the process.
As shown in Figure 21, a typical PLC consists of 6 key components:
1) Inputs: These allow information from outside the PLC to be incorporated and used. Most
often, they are electrical signals coming from sensors or switches.
2) Power Supply: This provides the power required to run the PLC and operate all the
circuitry. Internally, most PLCs use a 5-V standard. However, the power supply most often
provides 230 V AC, 120 V AC, or 24 V DC. Furthermore, the power supplies are often
built as a replaceable module, so that depending on the application, the appropriate power
can be provided, for example, in Europe one could use 230 V, but in North America 120 V.
3) Central Processing Unit (CPU): The CPU is the brain of the PLC that performs all the
required instructions, calculations, operations, and control functions.
4) Memory: The PLC must also contain memory or the ability to store relevant information
for future use. The amount of memory available depends on the PLC and the programming
requirements. Some PLCs can have additional memory cards inserted, so that they have
more available memory. There are two main types of memory:
a. Read-Only Memory (ROM): ROM is the permanent storage for the operating
system and system data. Since a true ROM cannot be changed, in practice, an
erasable programmable ROM (EPROM) is used, so that it is possible to update
the operating system for the PLC.
b. Random-Access Memory (RAM): RAM is used to store all other information
required by the PLC including any programmes and variables. Accessing RAM is
very fast. However, when power is lost, the information in RAM is also lost.
Therefore, a PLC will always have an additional battery to maintain power to the
RAM, so that the information that is contained in the RAM is not lost during a
power outage.
47
5) Communications Unit: The communications unit allows for the PLC to interact with other
devices to exchange information using different types of protocols. Often, this exchange of
information involves sending new or updated programmes to the PLC. In general, the
communications unit will often include the ability to communicate with an operator panel,
printers, networks, or other computers.
6) Outputs: These allow the PLC to exchange information with other devices to cause them
to take an action. Such devices include motors, valves, pumps, and alarms.
In a PLC, communication between the components occurs using groups of copper wires called
buses. A bus consists of a bundle of wires that allow for the transmission of binary information,
for example, if the bus contains eight wires, then it is possible to transmit up to 8 bits of information
per bus. A typical PLC consists of four buses:
1) Data Bus: The data bus is used to transfer information between the CPU, memory, and I/O.
2) Address Bus: The address bus is used to transfer the memory addresses from which the
data will be fetched or to which data will be written.
3) Control Bus: The control bus is used to synchronise and control the traffic circuits.
4) System Bus: The system bus is used for input-output communications.
Since a PLC operates more or less similarly to that of a computer, this means that in order
for a PLC to do anything useful, it must be programmed. The basic idea for a PLC is to monitor
and control a process. A process in this context is anything that requires monitoring and control
and can range from a simple unit that requires its output to be maintained at a prespecified value
to a complex, highly interacting system like a room with multiple heating ovens, lights, ventilations
systems, and windows, wherein the temperature, carbon-monoxide levels, and humidity must be
monitored and maintained at safe levels. In PLC terms, a process is said to be in a given operating
48
mode 3, when the process is operating in some specified mode, for example, when the pump is on,
off, or operating. Finally, the PLC requires a user programme that takes the inputs, outputs, and
internal information to make decisions about the process.
Before we look at how a PLC operates, it can be useful to note the different operating
modes (states) that a PLC itself can be in. In general, the operating modes for a PLC are
programming, stop, error, diagnostic, and run. In programming mode, a PLC is being
programmed, usually using an external device. In stop mode, the PLC is stopped and will only
perform some basic operations. In error mode, the PLC has encountered some sort of problem and
has stopped working. In diagnostic mode, the PLC runs without necessarily activating any inputs
or outputs, allowing for the validity of the programme to be determined. Often, test signals are
used in place of the real inputs and outputs. In run mode, a PLC is actively working and performing
the requested actions. Each PLC manufacturer may call these operating modes different names
and not all of them may be present for a given PLC.
Naturally, the most important mode from the perspective of automation is the run mode.
Thus, its behaviour will be examined in greater detail. In run mode, the PLC performs the same
four operations in a repeating cycle:
1) Internal Processing, where the PLC checks its own state and determines if it is ready for
operation. Should the response from hardware or communication units be lacking, the PLC
can give notice of these events by setting a flag, which is an internal Boolean address (or
visual indicator) that can be checked by the user to determine the presence of an error state.
Normally, the PLC will continue operation, unless the error is serious, in which case, it
will suspend operation. In this step, software-related events are also performed. These
include such things as updating clocks, changing PLC modes, and setting watchdog times
to zero. A watchdog is a timer that is used to prevent a programme from taking too long to
execute, for example, it could be stated that if a programme does not terminate in one
second, then it could be stuck inside an unending while-loop and an error state will be
returned.
3
Often also called a state, but this term is avoided since it has another meaning in control and process analysis.
49
2) Reading Inputs: Next, all the input statuses are copied into memory. This means that the
PLC will only use the values from memory rather than checking to make sure that the most
recent value is available. This means that at any given point the programme will use the
same values during the same scan time. Furthermore, reading values from memory is faster
than reading them each and every time from the input.
3) Executing Programmes: After the inputs have been read, the programmes are executed in
the order in which the code has been written. The order of execution can be changed by
changing the associated priority of the given code or using conditional statements and
subroutines. It should be noted that at this point only internal variables and output addresses
are updated in memory; the physical outputs are not changed at this point.
4) Updating Outputs: Once the programmes have been finished, the output memory is
written so that the state and values of the outputs can be updated. This will then complete
a single cycle and the PLC will return to the first step, that is, internal processing.
Since it can be seen that the PLC in run mode performs these four operations repeatedly, the
question becomes what is the best approach for how the PLC should repeat these operations. By
convention, a single pass through the four operations is called a scan and the scan time or cycle
time is the amount of time required to perform a single scan. In practice, the scan time can vary
between scans due to the presence of different events or conditions requiring the execution of more
or less code. In order to accomplish the repetitions effectively, a programme can be associated
with a task, whose execution type can be specified. There are three common execution types:
1) Cyclic Execution: In cyclic execution, the time between scans is fixed. Obviously, the time
must be set so that the PLC has the time to complete all the required code. Naturally, certain
tasks, such as counting or timing, should always be run on cyclic execution.
2) Freewheeling Execution: In freewheeling execution, as soon as one scan has been
completed, then the next scan is started. This is the fastest way of running a task, since
there is no waiting between scans.
3) Event-Driven Execution: In event-driven execution, a task is only executed when a given
Boolean condition is fulfilled. Event-driven execution is useful for emergency stop routines,
start-up routines, and other extraordinary events.
Furthermore, the nature of the task must be specified: can the task be interrupted by another task?
If the task can be interrupted, then it is called pre-emptive; if it cannot be, nonpre-emptive. The
50
difference between these two types of tasks is shown in Figure 22. Finally, the priority of a task
must be specified ranging from high to low (the exact details depend on the specific PLC and
standard used).
51
4) Data Historian, which stores all the values for future retrieval. Selecting an appropriate
sampling time, or how fast the data are recorded, can determine the usefulness of the
stored data for future applications.
5) Network Cables, Switches, and Accessories, which physically connect all the
equipment and allow for the strategy to be implemented.
The main issue with the design of the communication units is the available bandwidth. The faster
the data is sampled and the more computations that need to be performed, the larger the bandwidth
and computational power that will be needed.
In automation, signals can be encoded using many different standards. The two most
common standards are the current-based standard of 4 to 20 mA and the pressure-based standard
of 3 to 15 psig. 4 It should be noted that both of these standards do not start at zero, since a value
of zero is ambiguous: is the device not working properly or is the value actually zero. By using a
live zero, that is, the value of zero corresponds to some nonzero current or pressure means that it
is possible to distinguish between the case of a zero value and a faulty device. Furthermore, a live
zero allows part of the remaining current or pressure to be used for operating the device without
needing additional power supply. This means that the device can be used in remote areas without
its own power supply. The lower limit for the live zero was historically determined as the smallest
measurable value. In most cases, the upper limit was chosen so that the lower and upper limits are
in the ratio 1:5.
4
A psi is a unit of pressure in the imperial system of measurement. It is an abbreviation for pounds (force) per square
inch. The conversion factor is 1 psi = 6.894 757 kPa. The g represents gauge or the value above atmospheric pressure.
52
Section 2.6.1: Basic Concepts
Determine if the following statements are true or false and state why this is the case.
1) An analogue signal is continuous in both the time and value domains.
2) A binary signal is an example of a digital signal.
3) A signal can only be discretised in the value domain.
4) A precise sensor will always give a value close to the true value.
5) If the observer sensor value is 3 kg with a standard deviation of 0.5 kg and the true value
is 10 kg, then we can say that the sensor is precise and accurate.
6) A manometer measures the pressure difference using a transducer.
7) A differential pressure cell can measure the level of a liquid in a tank.
8) Venturi tubes are an example of a pressure-based flow sensor.
9) The Doppler effect can be used to measure flow rates.
10) The Seebeck effect allows us to measure pressure changes.
11) A J-type thermocouple can be used to measure the temperature of molten silica which is at
least 1000°C.
12) It is not possible to use thermocouples to measure temperatures below 0°C.
13) Actuators should be selected so that they are used in the range 20 to 60%.
14) Valves are a type of actuator that restricts flows.
15) An air-to-close valve will remain open should the air supply fail.
16) A quick-opening valve is useful for rapid dosing of a liquid.
17) Slip-jump in valves results from dynamic friction of the moving parts.
18) The efficiency of a pump represents the pressure gradient that it can produce at a given
flow rate.
19) A PLC consists of inputs, power supply, CPU, memory, outputs, and communication
devices.
20) A bus in a PLC is a location in memory used to store information about where different
variables are stored.
21) A PLC in programming mode is being programmed from an external device.
22) A flag in a PLC is a Boolean variable that shows the presence of an error state.
23) A watchdog in a PLC is a variable that prevents the PLC from being interrupted by external
users as it is running.
53
24) A PLC scan is the amount of time it takes for the PLC to read the inputs.
25) Freewheeling execution occurs when the PLC executes a task solely on demand from an
external event.
26) A pre-emptive task can never be interrupted.
27) An analogue-to-digital converter is found in all computer-based automation solutions.
28) A data historian stores the data collected from a process.
29) Live zero implies that when the signal value is zero then the current has a value of 4 mA.
30) A PLC normally has a battery to provide power in case of a power failure.
Table 2: Data for creating the valve characterisation curve for Question 34)
54
Flow Rate, ṁ (kg/min) Flow Rate, ṁ (kg/min)
%open %open
Run 1 Run 2 Run 3 Run 1 Run 2 Run 3
100 11 11 11 40 6 6 6
90 10.7 10.7 10.7 30 4.6 4.6 4.6
80 10 10 10 20 3 3 3
70 9.2 9.2 9.2 10 1.2 1.2 1.2
60 8.3 8.3 8.4 0 0 0 0
50 7.2 7.2 7.2
35) Consider the sensor data shown in Table 3. It is desired to determine if the sensor values
are properly calibrated against the measured values. Determine if the calibration is correct.
Are the values reliable?
Measured Height Sensor Value (m) Measured Height Sensor Value (m)
(m) Run 1 Run 2 (m) Run 1 Run 2
0.00 0.02 0.03 0.30 0.321 0.312
0.10 0.115 0.105 0.35 0.348 0.349
0.15 0.149 0.152 0.40 0.412 0.392
0.20 0.229 0.215 0.45 0.452 0.457
0.25 0.248 0.251 0.50 0.512 0.493
55
Chapter 3: Mathematical Representation of a
Process
In order to understand and provide useful information about a process, it is necessary to
understand how different processes and systems can be represented. In practice, there exist two
main types of representations: mathematical and schematic. A mathematical representation
focuses on providing an abstract description of the process that provides information about the
process. A good mathematical representation of the system can provide a deep understanding of
how the system works and how it will behave in the future. On the other hand, a schematic
representation focuses on the relationships between the different components and how they relate
to each other. It is primarily a visual approach that allows the actual process to be represented on
a piece of paper.
Common mathematical representations include state-space models, transfer function
models, and automata.
56
where F is the Laplace transformed function, f the original function, and s the Laplace variable.
Conventionally, the Laplace transform is denoted by a Faktur L, 𝔏𝔏 (U+1D50F), that is,
F(s) = 𝔏𝔏(f(t)). Converting from the frequency domain to the time domain is conventionally shown
using the inverse of the Laplace transform, 𝔏𝔏−1. Table 4 presents a summary of the most common
Laplace transforms. The following are some useful properties of the Laplace transform:
1) Linearity: 𝔏𝔏(f + g) = 𝔏𝔏(f) + 𝔏𝔏(g).
2) Superposition: 𝔏𝔏(αf) = α𝔏𝔏(f).
6) Initial Value Theorem: The value in the time domain at the starting point t = 0 is given
by
lim f (t ) = lim sF ( s ) (7)
t →0 s →∞
5
Equivalently, the real component of all the poles must be less than 0 or the system is stable.
57
Time Domain Frequency Domain
Case
f(t) F(s)
0 t ≤ 0
Unit Step Function, u u (t ) = s−1
1 t > 0
t n −1 1
Polynomials
( n − 1)! sn
ω
Sine e−atsin(ωt)
(s + a) + ω2
2
n
dn f s n F ( s ) − ∑ s k −1 f ( n − k ) ( 0 )
Derivative n
= f (n) 6
dt k =1
1
Integration ∫ f ( t ) dt s
F (s)
Often, when we are given an equation in the Laplace domain, it may be necessary to convert
it into the time domain. This can be performed by using the inverse Laplace transform, 𝔏𝔏−1, such
that 𝔏𝔏−1(𝔏𝔏(f(t)) = f(t). In most automation-engineering problems, the general case reduces to
finding the time-domain function corresponding to some rational function of s. In such cases,
partial fractioning (see Appendix I for the details) is required to break up the original fraction into
its constituent parts so that the known functions given in Table 5 can be used.
𝔏𝔏(f(t)) f(t)
A A −CD t
Cs + D
e
C
6
If it is assumed that the system is initial at steady-state and using deviational variables, then all derivatives will be
zero and this equation will reduce to the first term snF(s).
58
𝔏𝔏(f(t)) f(t)
A A n −1 C
−D
t
t e
( Cs + D ) ( n − 1)!C
n n
Cβ
Cs + E E − 2α −2αβ t ρ C −2αβ t ρ
e sin t + e cos t
αs + βs +γ α α α
2
αρ
(irreducible
quadratic) β2
with ρ =γ − ≥0
4α
59
s+a
L ( e − at cos (ωt ) ) = (11)
(s + a) + ω2
2
Comparing with the form that we have, we see that a = 5 and ω = 7. Thus, the Laplace transform
is
s+5
(12)
( s + 5)
2
+ 72
Solution
The solution will be found by treating each fraction separately and using the information
in Table 5. For the first term, the general form of the transform can be found from Table 5 as
−D
A A Ct
L−1 = e (15)
Cs + D C
Comparing the general form with our first term, we see that A = 5, C = 10, and D = 1, which
implies that the inverse Laplace form will be
−1
5 5 10 t
−1
L = = e 0.5e −0.1t (16)
10 s + 1 10
For the second term, the general form can be written as
A A −D
t
L−1 = t n −1 C
e (17)
( Cs + D )n ( n − 1) !C n
Comparing the general form with our second term, we see that A = 8, C = 2, D = 1, and n = 5,
which implies that the inverse Laplace form will be
60
−1 8 8 5 −1 2
−1
t 1 4 −0.5t
=
L = t e t e (18)
( 2 s + 1)5
( 5 − 1)!2 5
96
where F is the transformed function and f the original discrete function. Conventionally, the z-
transform is denoted by a script 𝒵𝒵, (U+1D4B5). Table 6 presents a summary of the most common
z-transforms. The following are some useful properties:
1) Linearity: 𝒵𝒵(f + g) = 𝒵𝒵(f) + 𝒵𝒵(g).
2) Superposition: 𝒵𝒵(αf) = α𝒵𝒵(f).
3) Final Value Theorem: Assuming that the poles (roots of the denominator) lie inside the
unit circle, then 7
lim
= f k lim ( z − 1) F ( z ) (21)
k →∞ z →1
4) Initial Value Theorem: The value in the time domain at the starting point k = 0 is given
by
lim f k = lim zF ( z ) (22)
k →0 z →∞
7
The roots are expressed in terms of z. Equivalently, the system is stable.
61
Table 6: Table of Common z-Transforms (Ts is the sampling time)
Continuous Time
Discrete-Time Frequency Domain
Case Domain
Domain (f(kTs)) F(s)
f(t)
0 t ≠ a 0 k ≠ a
Dirac Delta, δ δ (t − a) =
δ k −a = z−a
∞ t = a ∞ k = a
Step Function, 0 t ≤ 0 0 k ≤ 0 1
u (t ) = uk =
u 1 t > 0 1 k > 0 1 − z −1
1
Exponential eat e akTs
1 − e aTs z −1
General Power 1
ak
Series 1 − az −1
First
df
Difference fk – fk – 1 (1 – z−1)F(z)
dt
(Derivative)
Time Shift
f(t − a)u(t − a) fk − auk − a z−aF(z)
(Delay)
As can be seen from Table 6, many of the forms involve z−1. For this reason, automation
engineering, it is common to treat z−1 as the variable, which is called the backshift operator.
Converting between the two representations is rather easy as it involves multiplying by the highest
power present in the equation.
The inverse operation of finding the time-domain representation given the z-transform is
performed using the inverse z-transform. Since most automation-engineering examples consider
rational functions of z, this will require partial fractioning in order to split the rational function into
its constituent parts (see Appendix I for details). Once the constituent parts have been obtained,
we can then use Table 7 to find the corresponding time-domain representation. Instead of partial-
62
fractioning, it may be possible to perform long division to obtain the individual values. However,
this can be quite long and difficult to do.
𝒵𝒵(f(k)) yk
k
Az A A D
= yk
= −
Cz + D C + Dz −1 C C
n −1
Az ∏ ( k − j + 1)
A j1 α k ,α = − D
yk = n = n −1
( Cz + D ) C α ( n − 1) ! C
n
A A k + n − 1 k D
,n∊ℤ yk = n α ,α = −
( C + Dz ) −1 n
C n −1 C
Example 3: Z-Transform
Compute the z-transform of the following function
=yk 5k − 2 , k ≥ 2 (23)
Solution
From Table 6, we see that an exponential function ak has the z-transform
1
(24)
1 − az −1
In our case, this implies that a = 5. However, we can note that the values are delayed by 2 samples.
Therefore, we will need to also use the delay formula from Table 6 to obtain the final result. Thus,
the z-transform is
z −2
(5 k −2
) = 1 − 5z −1 (25)
63
Solution
From Table 7, we can see that this represents the first case with A = 2, C = 1, and D = 5.
This implies that the time-domain representation is
k k
2 A D 2 5
= − = − =2 ( −5 )
−1 k
−1
(27)
1 + 5z C C 1 1
Finally, we can note that there is a relationship between the Laplace transform of the
continuous time domain and the z-transform of the discrete time domain. If we set
z = esT (28)
This means that results obtained in the continuous domain will have a transformed representation
in the discrete domain. Of note, the imaginary axis of the continuous domain is mapped onto the
boundary of the unit circle. This relationship will appear in our further analysis.
64
2) Time-invariant versus time-variant: A model is said to be time-invariant if the
parameters in the model are constant with respect to time. In a time-varying system, the
model parameters can depend on the time period.
3) Lumped parameter versus distributed parameter: A model is said to be a lumped
parameter system if the model does not depend on the location, that is, there are no space
derivatives present. A model that depends on the location, that is, it contains space
derivatives, is called a distributed parameter system. For example, if the temperature T is
2
a function of the x- or y-direction, that is, we have a derivative of the form ∂ T2 in the
∂x
model, then the model is a distributed-parameter system. If the temperature only depends
on the time, then we have a lumped-parameter system. The analysis of distributed-
parameter systems is often much more difficult than that of a lumped-parameter system.
A distributed-parameter system can be reduced to a lumped-parameter model if it is
assumed that the variables are homogenously distributed within the space, and hence, all
the space derivatives are zero.
4) Causal versus noncausal: A system is said to be causal if the future values only depend
on the current and past values. In a noncausal system, the future values depend on the
current, past, and future values. A noncausal system is not physically realisable, since the
future values will never be known.
5) System with memory (dynamic) versus system without memory (static): A system is
said to have memory if the future values depend on both the past and present. On the
other hand, a system is said to be without memory or memoryless if future values only
depend on the current value.
65
where x is the state variable, u is the input variable, t is the time, y is an output, f and g are some
functions, and an arrow above denotes a vector. The state variable is a variable that describes the
current location of the system from which the system’s future behaviour can be determined. A
state variable will often appear in some equation as a derivative with respect to time. The input
variable, u, is a variable that describes the properties of a stream entering a system. Traditionally,
the number of inputs is denoted by m, the number of states by n, and the number of outputs by p.
A system where p = m = 1 is said to be univariate or single-input, single-output (SISO). If p and
m are greater than 1, then the system is said to be multivariate or multi-input, multi-output
(MIMO). A system is said to be multi-input, single-output (MISO) if p = 1 and m > 1.
The general state-space model is often reduced to a linear form
dx
= x + u
dt (30)
y x + u
=
where 𝒜𝒜 is the n×n state matrix, ℬ is the n×m input matrix, 𝒞𝒞 is the p×n output matrix, and 𝒟𝒟 is
the p×m feed-through matrix.
On the other hand, the transfer-function representation focuses solely on the relationship
between the inputs and outputs in the Laplace domain and allows easier analysis of the system
than for a state-space model. The general transfer function representation can be written as
Y ( s ) = ( s )U ( s ) (31)
where G is a matrix containing the transfer function representation of the model, that is
Y1 ( s ) U1 ( s ) G11 ( s ) G1m ( s )
=Y ( s ) = , U (s) = , (s) (32)
Yp ( s ) U m ( s ) G p1 ( s ) G pm ( s )
It is often assumed that each transfer function can be written as
N ( s ) −θ s
G (s) = e (33)
D (s)
where N and D are polynomials of s and θ is the deadtime or time delay in the system. Time delay
arises in real systems due to the transport phenomena, measurement delays, and approximations
introduced when linearising a system. The order of a transfer function is equal to the highest
power of the D-polynomial.
66
Given the simple form of a transfer-function representation, much of the analysis in control
is performed using it.
where ℐ is the n×n identity matrix and s is the Laplace transform variable.
Example 5: Numeric Example of Obtaining a Transfer Function
Consider the example
dx
5 + 3 x =
u
dt (37)
y = x
Taking the Laplace transform of Equation (37) gives
5sX ( s ) + 3 X ( s ) =
U (s)
(38)
Y ( s ) = X ( s )
Substituting Y for X in the first equation of Equation (38) gives
5sY ( s ) + 3Y ( s ) =
U (s) (39)
8
In automation engineering, we often deal with deviation variables that are defined as x̃ = x – xss, where xss is some
steady-state value. Since we assume that the process is initially in steady state, this means that the initial conditions
will always be zero.
9
The inverse exists since the 𝒜𝒜-matrix only contains numeric entries.
67
( 5s + 3 ) Y ( s ) = U (s)
Y (s) 1 (40)
=
U ( s ) 5s + 3
Y (s) 1
G
= (s) = (41)
U ( s ) 5s + 3
(s n
+ an −1s n −1 + + a0 ) Y=
(s) (bn −1 s n −1 + + b0 ) U ( s )
Y (s) (b s n −1 + + b0 ) (44)
(s)
n −1
G
= =
U (s) (s n
+ an −1s n −1 + + a0 )
68
sX ( s ) = − aX ( s ) + bU
1 1 ( s ) + b2U 2 ( s )
Y ( s ) = X ( s )
sY ( s ) + aY ( s ) = bU
1 1 ( s ) + b2U 2 ( s ) (46)
( s + a ) Y ( s ) = bU
1 1 ( s ) + b2U 2 ( s )
b1 b
Y (s)
= U1 ( s ) + 2 U 2 ( s )
s+a s+a
Rewriting this into matrix form gives
b b2 U1 ( s )
Y (s) = 1 (47)
s + a s + a U 2 ( s )
Note that this can be written separately, since linear functions are being considered. As well, note
that the principle of superposition holds, so that we can study each transfer function separately and
then combine the results together.
The reverse operation of converting a transfer function into a state-space representation
does not yield a unique solution or realisation. Consider the following transfer function, where
p < n:
β p s p + β p −1s p −1 + + β1s + β 0
G (s) = n (48)
s + α n −1s n −1 + + α1s + α 0
then the controllable canonical realisation is
−α n −1 −α n − 2 −α1 −α 0 1
1 0 0 0 0
= = 0 1
(49)
0
0 0 1 0 n×n 0
n×1
0 0 β p β p −1 β1 β 0 01×1
=
1×n
69
T T
−α n −1 −α n − 2 −α1 −α 0 1
1 0 0 0 0
= = 0 1
(50)
0
0 0 1 0 n×n 0
n×1
T
0 0 β p β p −1 β1 β 0 01×1
=
1×n
Note that for 𝒞𝒞 in the controllable canonical realisation and for ℬ in the observable canonical
realisation, there will be n – p – 1 zeroes. The fact that the two forms are related by taking the
transpose is not coincidental.
Example 8: Converting a Transfer Function into its Controllable Canonical Realisation
Convert the transfer function
s−2
G (s) = 2
(51)
s − 4s + 1
into its controllable canonical realisation.
Solution
First, we need to make sure that the transfer function is the form given by Equation (48)
and determine the values of the parameters. Since the equations have the same form, we note that
n = 2 (highest power in the denominator) and p = 1 (highest power in the numerator), which implies
that the transfer function satisfies the requirements. Thus, we can simply compare the parameters
and obtain their values, that is, α2 = 1, α1 = −4, α0 = 1, β1 = 1, and β0 = −2. Thus, using Equation
(49), the controllable canonical realisation is
4 −1 1
= =
1 0 0 (52)
=[1 −2] =01×1
Thus, we have defined the four matrices for one of the state-space representations of the given
transfer function.
70
xk +1 d xk + d uk
=
(53)
= yk d xk + d uk
The subscript d in Equation (53) can be dropped if it is clear that a discrete state-space
representation is being considered. The discrete transfer function is the same as the continuous
version except that all s are replaced by either z or z−1. To convert between the discrete state-space
and transfer function representations, Equation (36), can be used, mutatis mutandis.
With discrete transfer functions, it is common to explicitly include the unmeasured
disturbance, denoted by et, in the final model. In such cases, the unmeasured disturbance signal is
assumed to be a stochastic (random) Gaussian, white noise signal. A Gaussian, white noise signal
implies that the values of this signal are normally distributed and independent of past or future
values. The general discrete transfer function can be written as
= ( )
yt G p z −1 , θ ut + Gl z −1 , θ et ( ) (54)
where Gp is the process transfer function, θ the parameters, and Gl the disturbance transfer function.
Since in most applications, it is assumed that the transfer functions are rational functions of z-1, the
most common discrete transfer function equation can be written in a form called the prediction
error model, which has the following form:
−1 B( z −1 ) C ( z −1 )
A( z ) yt
= ut − k + et (55)
F ( z −1 ) D( z −1 )
where A(z-1), C(z-1), D(z-1), and F(z-1) are polynomials in z-1 of the form
na
1 + ∑ θi z −i (56)
i =1
where na is the order of the polynomial and θi are the parameters, B(z-1), is a polynomial in z-1 of
the form
nb
∑θ z
i =1
i
−i
(57)
where nb is the order of the polynomial, and k is the time delay in the system. In general, it is very
rare for this system to be used directly. Instead, any of the following simplifications may be used:
1) Box-Jenkins Model: In this model, the A(z-1) polynomial is ignored. Thus, this model
is given as
71
B( z −1 ) C ( z −1 )
=yt ut −k + et (58)
F ( z −1 ) D( z −1 )
In practice, this method is sufficient to fit an accurate model of the system.
2) Autoregressive Moving-Average Exogenous Model (ARMAX): In this model, the
D(z-1) and F(z-1) polynomials are ignored, which gives
A( z −1 ) yt B( z −1 )ut −k + C ( z −1 )et
= (59)
This model assumes that the denominator for both the input and the error is the same.
However, this model has the beneficial property that the estimation of its parameters
can be performed using least-squares analysis. A further simplification is to ignore the
C(z-1) term. This gives an autoregressive exogenous model (ARX). This model has
the form given by:
A( z −1 ) yt B( z −1 )ut −k + et
= (60)
3) Output-Error Model (OE): In this model, only the model for the input is fit to the
data. The error terms are ignored. Thus, the model is given as
B( z −1 )
=yt ut − k + et (61)
F ( z −1 )
72
where τs is the sampling time. It should be noted that all exponentiation is matrixwise
exponentiation. The corresponding transfer function can then be obtained using Equation (36). For
a simple, first order, continuous transfer function given as
K
Y (s) = U (s) (63)
τ ps +1
the discrete, transfer function is given as
K (1 − e )
τp
−
τs
yk = uk (64)
1 − (1 − e ) z
τp
−
τs −1
If a system has time delay, then it can be converted using the following formula
θ
k= (65)
τ s
where θ is the continuous time delay and is an appropriately selected rounding function
where h are the impulse coefficients. The values of h can be obtained by either performing long
division on the transfer function or partial fractioning the result to obtain the impulse coefficients.
Since the values of h can often quickly taper off, it is possible to convert the infinite impulse
response model into a finite impulse response (FIR) model, that is,
n n
=yk ∑
= hi z uk −i
∑hu i k −i (68)
=i 0=i 0
where n is an integer representing the number of terms selected for the model.
73
Section 3.2.6: Compact State-Space Representation
In many theoretical applications, the state-space representation is often written in a compact
manner that resembles a transfer-function formulism but using matrices. For the standard state-
space representation given by Equation (30), the compact or block state-space representation
can be written as
G= (69)
Using this representation, it is possible to easily partition the matrices and show this in a compact
manner, for example,
11 12 1
2
G = 21 22 (70)
1 2
where the states have been split into four groups and the relationships between the different groups
can easily be shown.
When using the compact representation, various short cuts can be used when combining
two models. When adding two compact representations, that is the transfer functions are in parallel,
1 0 1
0
G1 + G2 =
2 2 (71)
1 2 1 + 2
When multiplying two representations, that is the transfer functions are in series,
1 12 12
2
G1G2 = 0 2 (72)
1 12 12
The inverse of a compact state-space representation can be written as
− −1 − −1
−1
G = −1 (73)
−1
provided that D is invertible. Finally, the transpose of this representation can be written as
T
T T
G = T (74)
T
74
A common operation with state-space models is to transform the order or meaning of the states. In
such cases, the compact representation can be derived as follows. Assume that
x = x
u = u (75)
y = y
where T, R, and S are appropriately sized nonsingular (invertible) matrices. In this case, the
transformed compact representation can be written as
−1 −1
G= (76)
−1
−1
The order of a polynomial, denoted by n, is defined as the highest power present in a given
polynomial, for example, x4 + x2 is a fourth-order polynomial, since the highest power is 4. The
order of a transfer function is equal to the order of the denominator polynomial, D. A transfer
function is said to be proper if the order of the numerator is less than or equal to the order of the
denominator, that is, nN ≤ nD. A transfer function is said to be strictly proper if the order of the
numerator is less than the order of the denominator, that is, nN < nD. For most physical processes,
a transfer function will be strictly proper.
A process is said to be causal if the time delay, θ (or k) is nonnegative; otherwise, the
process is noncausal. In the discrete domain, causality is ensured by a proper transfer function. A
75
causal process does not depend on unknown future values. Again, all physical processes must be
causal or else they would be able to predict the future.
The poles of a transfer function are defined as the roots of the denominator, D, that is, those
values of s (or z) such that D = 0. The zeros of a transfer function are defined as the roots of the
numerator, N.
A process is said to be at steady state if all derivatives are equal to zero, that is,
dx
=0 (79)
dt
If Equation (79) does not hold, then the process is said to be operating in transient mode. It should
be noted that small deviations from zero do not necessarily mean that the process is now in a
transient mode. In practice, it may not be possible to achieve an exact steady state, where all the
derivatives are exactly equal to zero, both due to continual small fluctuations and measurement
imprecisions. In such cases, it is common to define the settling time, ts, of a process as the time it
takes for the process to reach and stay within an envelope centred on the new steady-state value
and has bounds that are 5% of the change in the process variable. Figure 23 shows how the settling
time is computed.
Input Signal
Time, t
0.95 KM
KM
Original
Steady
State
Time, t
θ ts
76
For a process modelled by a continuous transfer function, there are three key parameters of
interest: gain, time constant, and time delay (deadtime or process delay). The gain, K, of the
process represents the steady-state behaviour of the system for a unit change in the input. It is
defined as
y (t → ∞ )
K= (80)
u (t → ∞ )
where it is assumed that the input is bounded as t → ∞. The gain is the same irrespective of the
bounded input used. Using the final value theorem for a general transfer function and a step change
in the input, it can be seen that
sG ( s )
=K lim
= sY ( s ) lim = lim G ( s )
s →0 s →0 s s →0
= lim n
( bn −1s n −1 + + b0 )
e −θ s (81)
( n−1s + + a0 )
s →0 s + a n −1
b0
=
a0
The ratio b0 / a0 is called the gain, K, of the process.
The process time constant represents the transient or dynamic component of the system,
that is, how quickly the system responds to changes in the input and reaches a new steady-state
value. The larger the time constant the longer it takes to reach steady state. It can be obtained from
the transfer function by factoring the denominator into the form
(b n −1 s n −1 + + b0 )
=
(b n −1 s n −1 + + b0 )
(82)
(s n
+ an −1s n −1 + + a0 )
n
∏ (τ s + 1)
i
i =1
which gives the time constants, τ, of the process. If there are multiple time constants, then the
largest time constant will determine the overall process response speed.
The final parameter of interest is the time delay, θ, which measures how long it takes
before the system responds to a change in the input. Time delays can arise from two different
sources: physical and measurement. Physically, time delays are perceived times at which a system
is not responding to changes in the input. They can arise if it takes time for an observable change
to be seen, for example, heating a large tank would take some time before the temperature rises by
an appreciable amount that can be measured. On the other hand, measurement time delays arise
77
due to the placement of sensors. In many systems it may not be possible to measure the variable
immediately where it will act on the process. In this case, it will take some time before the variable
actually affects the system, for example, the flow rate in a pipe could be measured at the beginning
of the pipe and it could take some time before it will reach the process. In the frequency domain,
the time delay is found as
e−θs (83)
where θ is the time delay. In many applications, it may be necessary to convert the exponential
form of the time delay into a polynomial expansion. This conversion can be accomplished using
the Padé approximation, denoted as the n/m Padé Approximation, where n is the order of the
polynomial in the numerator and m is the order of the polynomial in the denominator. The 1/1
Padé approximation is given as
θ
1− s
e −θ s = 2 (84)
θ
1+ s
2
The 2/2 Padé approximation is given as
θ θ
1− s+ s2
e −θ s
= 2 12 (85)
θ θ 2
1+ s+ s
2 12
A table of the Padé Approximation for the exponential function up to 3/3 are given in Table 8,
from which the Padé Approximation for the deadtime can be easily derived.
n
→ 0 1 2 3
m↓
1 1
1 1
0 1 2 1 1
1 1− z 1− z + z 1 − z + z 2 − z3
2 2 6
1 1 1
1+ z 1+ z 1+ z
1+ z 2 3 4
1
1 1 2 1 3 1 2 1 3
1− z 1− z + z2 1− z + z − z
2 3 6 4 4 24
78
n
→ 0 1 2 3
m↓
2 1 1 1 2 1 2
1 2 1+ z + z2 1+ z + z2 1+z+ z
1+ z + z 3 6 2 12 5 20
2 2 1 1 1 3 3 2 1 3
1 1− z 1− z + z2 1− z + z − z
3 2 12 5 20 60
3 1 1 3 3 3 2 1 3 1 1 1 3
1 1 1+ z + z2 + z 1+ z+ z + z 1+ z + z2 + z
1 + z + z 2 + z3 4 4 24 5 20 60 2 10 120
3 2 6 1 2 1 2 1 1 1 3
1 1− z 1− z + z 1− z + z2 − z
4 5 20 2 10 120
Solution
Re-arranging into the required form gives
Y ( s ) 1/ 3
( s ) = 5 e−5s
G= (87)
U (s) s +1
3
from which, by inspection, the gain is ⅓ and the time constant is 5 / 3. The time delay is 5.
to sinusoidal waves with different frequencies. The goal is to see how the process changes the
amplitude or strength and the phase shift, that is, assuming that the original input has the form
sin ωt (88)
79
the response will have the form
Asin(ωt + ϕ) (89)
where A is the amplitude and ϕ is the phase shift. Consider a general transfer function, G(s), then
define the amplitude ratio, AR, (which corresponds to a normalised amplitude) as
Re ( G ( jω ) ) + Im ( G ( jω ) )
2 2
AR G
= = ( jω ) (90)
where Re is the real component of a complex number, Im is the imaginary component, and ||·|| is
the modulus function. It should be noted that in many applications, the logarithm of the amplitude
ratio is used. In most cases, a base-10 logarithm is used. Occasionally, a decibel logarithm will be
used, that is, AR = 20 log ||G(jω)||. The phase angle, ϕ, conventionally expressed in degrees, is
defined as
Im ( G ( jω ) )
φ = arctan (91)
Re ( G ( jω ) )
where arctan is the standard inverse tangent function defined on ]−90°, 90°[. It should be noted
that if the denominator is negative, then it is necessary to add 180° to the value obtained previously.
This is because the arctan function does not work on the complete circle. 10
It can be noted that if the original transfer function is a product of simpler transfer functions,
that is,
G ( s ) = ∏ Gi ( s ) (92)
which is the product of the individual amplitude ratios corresponding to each simpler transfer
function. The phase angle can be computed as
φ = ∑ φGi ( s ) (94)
These two formulae can simplify the determination of the amplitude ratio and phase angles of
complex transfer functions. This formulae result from the fact that all transfer functions can be
10
In some programmes, an “astronomical” arctangent function is defined as arctan2(y, x), which will return the value
in the correct quadrant based on the signs of y and x. If available, it should be used.
80
expressed in polar form as G(jω) = ||G(jω)||e−ϕj, from which it is easy to see that combining
multiple transfer functions as given by Equation (92), the given formulae will result.
The amplitude ratio and phase angle can be graphically presented in two different forms,
either as a Bode plot or as a Nyquist plot. In a Bode plot, the x-axis is the frequency, ω, and the
y-axis is either the amplitude ratio or phase angle. A typical Bode plot is shown in Figure 24.
50
Amplitude Ratio, AR (dB)
-50
-100
-150
-90
Phase Angle, 𝜙 (°)
-135
-180
-225
-270 -1
10 100 101 102 103
Frequency, ω (rad/s)
Figure 24: Bode Plot: The Argument-Ratio and Phase-Angle Plots
In a Nyquist plot, the real component of G(jω) is plotted on the x-axis and the imaginary
component of G(jω) is plotted on the y-axis. A typical Nyquist plot is shown in Figure 25. Both
graphs give similar information. In most applications, Bode plots are used, but a Nyquist plot can
be useful to analysis the interactions between different systems.
81
10
Imaginary Component
6
-2
-4
-6
-8
-10
-1 -0.8 -0.6 -0.4 -0.2 0
Real Component
Figure 25: A Nyquist Plot (for the same process as given by Bode plot in Figure 24)
82
domain, the magnitude of all the poles must be less than 1, that is, the poles must lie inside the unit
circle, for the process to be stable; otherwise, the process is unstable. 11
Finally, it can be noted that if the state-space representation is stable, then so will the
transfer function representation be. However, the converse is not true, since each transfer function
does not have a unique state-space representation and it is possible to construct an unstable state-
space representation for a stable transfer function, by adding an unobservable unstable state.
Table 9: Summary of the Stability Conditions for Different Representations and Time Domains
space matrix, 𝒜𝒜
Transfer
Poles of the transfer function
Function Re(p) < 0 Re(p) ≥ 0
(Roots of D)
space matrix, 𝒜𝒜
Transfer Poles of the transfer function
||p|| < 1 ||p|| ≥ 1
Function (Roots of D)
z2
G3 ( z ) = (97)
z 4 + z3 + z 2 + z −1
11
In the discrete domain with a transfer function, it is very important to take into consideration what variable is being
used and how the stability condition is being phrased. Often, especially in control, stability is discussed in terms of
z−1, in which case the above rules need to be inverted, that is, stability implies poles outside the unit circle. For
consistency, stability in this book will be discussed in terms of z.
83
Solution
For G1, setting 5s + 3 equal to zero and solving, gives a pole of −3/5. According to the
results in Table 9 for a continuous transfer function, the system is stable, since the pole is less than
zero.
For G2, setting the two terms to zero and solving, gives three poles of −3/5 and ±2i. From
Table 9 for a continuous transfer function, we conclude that the system is unstable since the we
have two poles with a real component equal to zero and one pole whose value is less than zero.
For G3, the setting the denominator equal to zero and solving, gives poles of −1.291,
−0.1141±1.217i, and 0.519. For a discrete transfer function, Table 9 states that in order for the
system to be stable, the magnitude of the roots must be less than one. We see that we have at least
one pole (−1.291) whose magnitude will be greater than zero. This implies that the system will be
unstable.
Example 11: Determining the Stability of a State-Space Model
Determine if the given 𝒜𝒜-matrices represent stable continuous processes:
2 0
1 = (98)
3 −2
−5 5 6
2 0 −3 2
= (99)
0 0 −1
2 1
3 = (100)
−1 2
Solution
For 𝒜𝒜1, since it is a triangular matrix, the eigenvalues can be directly found by looking at
the main diagonal entries. This implies that the eigenvalues are 2 and −2. According to the results
in Table 9 for a continuous state-space model, the system is unstable, since one of the eigenvalues
is greater than zero.
Likewise, for 𝒜𝒜2, we can find the eigenvalues by looking at the main diagonal entries. This
gives −5, −3, and −1. Since all of the eigenvalues are less than zero, from Table 9 for a continuous
state-space model, we conclude that the system is stable.
For 𝒜𝒜3, we need to compute the eigenvalues as follows
84
det ( λ I − 3 ) =( λ − 2 ) − (1)( −1)
2
= λ 2 − 4λ + 5 (101)
= 2±i
Since the real part of the eigenvalues is greater than zero, from Table 9 that states that in order for
the system to be stable, the real part of roots must be less than zero, we conclude that the system
is unstable.
polynomial of interest). Any values that are not given are assumed to be zero.
85
d) Continue computing this value until the table has n + 1 rows.
e) A polynomial is stable (all roots of the characteristics polynomial are negative) if
all the values in the first column have the same sign, either strictly positive or
strictly negative.
Row 1 2 3 …
1 an an − 2 an − 4 …
2 an − 1 an − 3 an − 5 …
3 an −1an − 2 − an an −3 an −1an − 4 − an an −5
b1 = b2 = …
an −1 an −1
4 b1an −3 − b2 an −1
c1 = …
b1
…
n+1 z1
4
2) G ( s ) =
s + 3s + s 2 + 2 s + 1
4 3
Solution
For the first transfer function, we can determine the stability by inspection. Since we are
missing one of the powers (s5) and the coefficients are both negative and positive, we can conclude
on the basis of condition (1) of the Routh stability analysis that this transfer function is unstable.
For the second transfer function, we see that condition (1) is satisfied, as all the powers are
present and the coefficients have the same sign. Therefore, we will need to check condition (2) by
constructing the Routh array. There will be 3 (always n / 2, rounded up) columns in the array. In
the first row (denoted as 1 in Table 11), we place the even coefficients ordered in decreasing
86
powers. In the second row, we place the odd coefficients. In Rows 3, 4, and 5, we compute the
values using the formula:
an −1an − 2 − an an −3 3 (1) − 1( 2 ) 1
=b1 = =
an −1 3 3
an −1an − 4 − an an −5 3 (1) − 1( 0 )
=b2 = = 1
an −1 3
c1 =
( 13 ) 2 − 3 (1) = −7
1
3
−7 (1) − ( 13 )( 0 )
=z1 = 1
−7
It can be noted that any values that do not exist (such as an – 5) are equal to zero. As stated by the
definition of the condition, we will always have n + 1 rows. The formulae used to compute the
subsequent values are essentially determinants with the sign in the numerator flipped.
Row 1 2 3
1 1 1 1
2 3 2
3 ⅓ 1
4 −7
5 1
From Table 11, we see that there is a sign change in Column 1, row 4, which implies that the
system is unstable.
87
polynomial, the stability of the system can be determined. Like with the Routh stability test, a table
is constructed. Consider that the polynomial of interest is given as
D ( z )= an z n + an −1 z n −1 + + a1 z + a0 (104)
Construct the following table (similar to that shown in Table 12), where the first row contains all
the coefficients starting from a0 and ending with an. The second row is the first row reversed, that
is, the first column contains an, and the last column contains a0. The third row is computed using
bi a0 ai − an an−i
= (105)
while the fourth row is the third row reversed. Note that only the first n values are reversed.
Effectively, we have now created a new reduced polynomial that needs to be analysed. Thus, the
fifth row is computed using the same formula as for the third row given by Equation (105), but
replacing n by n – 1 coefficients, that is,
This procedure is then repeated until there is row with only 3 elements left (denoted as q0, q1, and
q2), that is, the table will have 2n – 3 rows. In general, for the (2j + 1)th row (j = 1, 2, …, n – 2),
that is, each odd-numbered row, we can write the relationship as follows
row, that is, the even row, will then be the n – j + 1 coefficients written in reversed order. It can be
noted that the odd rows are essentially a determinant of the above two rows.
The conditions for stability can then be stated as:
1) D(1) > 0
2) (−1)nD(−1) > 0
3) |a0| > |an|
4) |b0| > |bn − 1|, and continuing in this manner until the last row is reach, where |q0| > |q2|.
If any of the above conditions fail, then the system will have at least one pole outside the unit circle
and hence be unstable.
Row 0 1 … n−1 n
88
1 a0 a1 … an − 1 an
2 an an − 1 … a1 a0
3 b0 a0 a0 − an an
= b1 a0 a1 − an an−1
= … bn −1 a0 an −1 − an a1
= 0
4 bn − 1 bn – 2 … b0 0
5
…
…
…
2n − 3 q0 q1 … … 0
Example 13: Example of Jury Stability Analysis
Using Jury stability, determine the stability of the following two discrete transfer functions:
5
1) G ( z ) =
z + 5 z + 6 z + 2 z 2 + 3z + 1
6 4 3
4
2) G ( z ) =
10 z + 3 z + z 2 + 5 z + 1
4 3
Solution
For the first transfer function, we need to test the initial constraints before we consider
creating the table. For condition 1, D(1) > 0, we get
1 + 5 + 6 + 2 + 3 + 1 = 18 > 1
which implies that this condition is satisfied. Condition 2, (−1)nD(−1) > 0, gives
(−1)6[1(−1)6 + 5(−1)4 + 6(−1)3 + 2(−1)2 + 3(−1)1 + 1] = 0
which is not satisfied. This implies that the first transfer function is not stable.
For the second transfer function, testing the three initial conditions gives
Condition (1): 10 + 3 + 1 + 5 + 1 = 20 > 0 (satisfied)
Condition (2): (−1)4[10(−1)4 + 3(−1)3 + (−1)2 + 5(−1)1 + 1] = 4 > 0 (satisfied)
Condition (3): |an| > |a0| ⇒ |10| > |1| (satisfied)
Since all the preliminary conditions have been satisfied, the Jury array can be constructed. This is
shown in Table 13. The first row consists of the coefficients arranged in increasing powers, while
the second row consists of the coefficients arranged in decreasing power. In Row 3, we compute
the values using the formula
bi a0 ai − an an−i
= (108)
89
which gives
b0 = 1(1) − 10 (10 ) =
a0 a0 − a4 a4−0 = −99
b1 = (1) 5 − 10 ( 3) =
a0 a1 − a4 a4−1 = −25
b2 =− 1(1) − 10 (1) =
a0 a2 a4 a4− 2 = −9
b3 = 3 (1) − 10 ( 5 ) =
a0 a3 − a4 a4−3 = −47
From here, we should check that the condition |b0| > |bn – 1| is satisfied. Since |−99| > |−47|, it holds
and we proceed to the next step. We reverse the order of the remaining n – 1 coefficients and write
them in Row 4. Effectively, we have created a new polynomial of order n – 1 that we need to test.
Thus, in Row 5, we will use a modified form of Equation (108) to give
ci b0bi − bn −1bn −i −1
= (109)
Effectively, this is the same as Equation (108), but with the value of n reduced by 1. Evaluating
Equation (109) for the n – 2 columns gives
Row 0 1 2 3 4
1 1 5 1 3 10
2 10 3 1 5 1
3 −99 −25 −9 −47
4 −47 −9 −25 −99
5 7592 2052 −284
90
Section 3.3.2.3: Closed-Loop Stability Analysis
For closed-loop systems, stability can be analysed by considering the closed-loop transfer
function, Gcl,
Gc G p
Gcl = (110)
1 + Gc G p
Since it has been shown that the poles of the system are the determining factor for stability, it
therefore suffices to consider only the denominator of the closed-loop transfer function, that is, the
term 1 + GcGp. It is possible to apply either the Routh or the Jury Stability Tests to determine under
what conditions the system will be stable.
However, in some circumstances, it can be instructive to look at the frequency-domain
plots, especially the Bode plot, to determine stability. In order to make the analysis simpler, we
will rewrite the denominator to
GcGp = −1 (111)
Taking the magnitude (or modulus) of Equation (111) gives
||GcGp|| = ||−1|| (112)
while the phase angle for −1 is −180°, since the imaginary component is 0 and the real component
is −1, which after subtracting −180° gives the correct location. Therefore, plotting the Bode plot
for the open-loop transfer function GcGp will allow the stability of the system to be determined by
examining the critical frequency, ωc, which is the frequency corresponding to a phase angle of
−180°. If the value of amplitude ratio at this point is greater than 1 (or 0 if a logarithmic basis is
being used), then the process will be closed-loop unstable. An example is shown in Figure 26.
91
50
-50
-100
-150
ωg ωc
-90
Phase Angle, 𝜙 (°)
-135 PM 𝜙 = -180°
-180
-225
-270 -1
10 100 101 102 103
Frequency, ω (rad/s)
Furthermore, we can define two additional parameters of interest: the gain margin (GM)
and the phase margin (PM). These two margins represent how much room we have before the
system becomes unstable. On a Bode plot, instability implies an amplitude ratio above 1 (or 0 for
the logarithmic case) or a phase angle below −180°. These parameters are shown in Figure 27 for
the Bode plot and in Figure 28 for the Nyquist plot. The phase margin is defined by adding 180°
to the phase angle when the gain crosses the value of 1, which is denoted by ωg and called the gain
crossover, that is,
PM = ϕ(ωg) + 180° (113)
The gain margin is defined as the difference between 1 (or 0 for a logarithmic case) and the value
when the phase angle crosses the phase angle of −180°, which is denoted by ωp and called the
phase crossover, that is,
GM = 1 – AR(ωp) (114)
It is possible to design controllers by specifying the phase and gain margins.
92
50
-100
-150
ωg ωc
0
Phase Angle, 𝜙 (°)
-90
Phase M argin Phase Crossover
-180
-270
Unstable Region
-360
Frequency, ω (rad/s)
Im Im
Phase Crossover
ω = ωc
ω→∞ -1 ω→∞
-1 1 Re Phase 1 Re
|G( jωc)| Margin
Gain Margin Gain Crossover
ω = ωg
ω=0 ω=0
93
zero), such that the knowledge of the input, u(t), and output, y(t) in the interval [0, t] is sufficient
to determine the initial state, x0. This can be accomplished if and only if
2
1) = has full rank n, where is the observability matrix.
n −1 nq×n
t
2) The observability Grammian, o ( t )n×n = ∫ e τ T eτ dτ is nonsingular for all t > 0. The
T
− λi
3) The n-by-n matrix has rank n for all eigenvalues λi of 𝒜𝒜. This allows the
individual states or eigenvalues of 𝒜𝒜 to be classified.
A system is said to be detectable if all unstable states of a state-space representation can be
− λi
observed. This can be determined by examining for each of the unstable states and
determining if it is full rank.
The state equation or the pair (𝒜𝒜, ℬ) are said to be controllable if and only if for any initial
state, x0, and final state, x1, there exists an input, u(t), that transfers x0 to x1 in finite time. This can
be accomplished if and only if:
1) n×np = 2 n −1 has full rank n, where is the controllability matrix.
t
2) The controllability Grammian, c ( t )n×n = ∫ eτ T e τ dτ , is nonsingular for all t > 0.
T
c −1 is a measure of the energy required to control the process. A larger value implies that
more energy (or effort) is required.
3) The n-by-n matrix [𝒜𝒜 − λiℐ | ℬ] has rank n for all eigenvalues λi of 𝒜𝒜. This allows the
individual states or eigenvalues of 𝒜𝒜 to be classified.
94
A system is said to be stabilisable if all unstable states of a state-space representation can be
controlled. This can be determined by examining [𝒜𝒜 − λiℐ | ℬ] for each of the unstable states and
determining if it is full rank.
It can be noted that controllability and observability are duals of each other, that is, if (𝒜𝒜,
ℬ) is controllable, then (𝒜𝒜T, ℬT) is observable. Similarly, if (𝒜𝒜, 𝒞𝒞) is observable, then (𝒜𝒜T, 𝒞𝒞T) is
controllable.
95
MI M j
GI ( jω ) = = − I
jω ω
2
M M
⇒ AR= 02 + − I = I (118)
ω ω
MI
− ω
φ=arctan = −90°
0
A representative Bode plot is shown in Figure 30. The key properties of the integrator are
summarised in Table 14.
Property Value
MI
Laplace Transform GI =
s
Step Response (Time Domain) yt = MIMt
AR |MI| / ω
Bode
Plots
ϕ −90°
Stable No
30
25
20
Response
15
10
0
0 5 10 15 20 25 30
Time, t (s)
96
5
-5
-10
-15
-20
0
Phase Angle, ϕ (°)
-90
-180
-270
-360
100 Frequency, ω (rad/s) 101
where K is the gain and τL is a time constant. The step response of the system can be determined
as
Y = GLU
M
=Y K (τ L s + 1) (120)
s
(τ s + 1)
= KM L
s
In order to obtain a time-domain representation, it is necessary to perform a partial fraction
decomposition of Equation (120) to give
97
Y = KM
(τ L s + 1)
s (121)
1
=Y KM τ L +
s
From Table 5, the time domain representation for Equation (121) is
=yt KM (τ Lδ + ut ) (122)
where δ is the Dirac delta function and ut is the unit step function. This shows that the lead function
is bounded. Its Bode plot can be determined as
GI ( jω ) = K (τ L jω + 1) = K + Kτ Lω j
⇒ AR= K 2 + ( Kτ Lω ) =
2
K 1 + τ L2ω 2 (123)
Kτ Lω arctan τ Lω K >0
=φ arctan
= arctan τ ω + 180° K < 0
K L
A representative Bode plot is shown in Figure 31 for all 4 possible combinations of K and τL. The
key properties of the lead term are summarised in Table 15.
Property Value
Laplace Transform GL K (τ L s + 1)
=
Step Response (Time Domain) yt = KM(τLδ + ut)
AR K 1 + τ L2ω 2
Bode Plots
arctan τ Lω K >0
ϕ
arctan τ Lω + 180° K <0
Stable Yes
Negative values of τL (positive zeros) can
induce an inverse response in a system, that
Comment is, the variable first decreases in value and
increases to reach its new steady-state value
(or vice versa).
98
Amplitude Ratio,AR (dB) 40 40
20 20
10 10
0 0
270 180
Phase Angle, ϕ (°)
210 120
180 -1 90 -1
10 100 101 102 10 100 101 102
Frequency, ω (rad/s) Frequency, ω (rad/s)
40 40
Amplitude Ratio,AR (dB)
20 20
10 10
0 0
90 360
Phase Angle, ϕ (°)
45 315
0 -1 270 -1
10 100 101 102 10 100 101 102
Frequency, ω (rad/s) Frequency, ω (rad/s)
Figure 31: Bode Plot for a Lead Term (top row) K > 0, (bottom row) K < 0, (left) τL > 0, and (right) τL < 0
99
Y = GFU
K M
Y= (126)
(τ p s + 1) s
KM
=
s (τ p s + 1)
= KM
The time response of a stable first-order system is shown in Figure 32, as well as how to compute
the key parameters from its graph. Its Bode plot can be determined as
K K (1 − τ pω j )
GI ( jω )
= =
(τ p jω + 1) 1 + τ p2ω 2
K 2 + ( − Kτ pω )
2
K
⇒ AR= = (130)
(1 + τ p2ω )
2 2
1 + τ p2ω 2
− Kτ pω − arctan τ pω K >0
=φ arctan
=
K 180° − arctan τ pω K <0
In order to avoid a discontinuity when it pass through 0°, it is common to use negative angles when
plotting this function, that is −45° rather than the equivalent 315°. A representative Bode plot is
100
shown in Figure 31 for all 4 possible combinations of K and τp. The key properties of the first-
order system are summarised in Table 16.
Property Value
K
Laplace Transform GF =
(τ p s + 1)
−
t
K
AR
1 + τ p2ω 2
Bode Plots
− arctan τ pω K >0
ϕ
180° − arctan τ pω K <0
Time, t
y∞
0.632 KM
ySS, 2– ySS, 1
K= M KM
Original
Steady State, ySS, 1
Time, t
Time Constant, τp
Time Delay, θ
101
Amplitude Ratio,AR (dB) 0 0
-20 -20
-30 -30
-40 -40
0 90
Phase Angle, ϕ (°)
-90 -1 0 -1
10 100 101 102 10 100 101 102
Frequency, ω (rad/s) Frequency, ω (rad/s)
0 0
Amplitude Ratio,AR (dB)
-20 -20
-30 -30
-40 -40
-90 180
Phase Angle, ϕ (°)
-135 135
-180 -1 90 -1
10 100 101 102 10 100 101 102
Frequency, ω (rad/s) Frequency, ω (rad/s)
Figure 33: Bode Plot for a First-Order System (top row) K > 0, (bottom row) K < 0, (left) τp > 0, and (right) τp < 0
where K is the gain, τp is the process time constant, and ζ is the damping coefficient. This basic
transfer function can be augmented by adding a lead term to model various behaviours to give
K (τ L s + 1)
GII = (132)
(τ s + 2ζτ p s + 1)
2 2
p
102
As well, it can be coupled with a deadtime term to give a second-order plus deadtime (SOPDT)
process model, that is,
K
GIID = e −θ s (133)
(τ s + 2ζτ p s + 1)
2 2
p
−2ζτ p ± 4ζ 2τ p2 − 4τ p2
s=
τ p2
(134)
−2ζ ± 2 ζ 2 − 1
=
τp
Depending on the value of ζ, three different cases can be determined:
1) Case I: Underdamped System, where |ζ| < 1. In this case, the poles will contain an
imaginary component.
2) Case II: Critically Damped System, where |ζ| = 1. In this case, the poles will both be
real and the same.
3) Case III: Overdamped System, where |ζ| > 1. In this case, the poles will both be real.
The behaviour and critical information depends on the particular case being considered.
For the underdamped case, where |ζ| < 1, the poles of Equation (131) will contain an
imaginary component. The presence of an imaginary component will imply that there will be
oscillations present in the time response. If ζ = 0, then the system will continuously oscillate about
a mean value. In all other cases, stability will depend on the sign of ζτp: if positive, the system will
be stable (decaying oscillations); if negative, the system will be unstable (increasing oscillations).
The step response of this system can be written as
−ζ t 1− ζ 2 ζ2 1− ζ 2
y (t ) =
KM 1 − e
τp
cos t+ sin t (135)
τp 1− ζ 2 τp
A typical underdamped step response is shown in Figure 34. Some of the key parameters that can
be extracted from a step response are:
1) Time to First Peak: t p = πτ
1− ζ 2
−πζ a
Overshoot: OS exp
2)= = .
1 − ζ 2 b
103
3) Decay Ratio: The decay ratio is the square of the overshoot ratio, i.e.
−2πζ c
=DR exp
= 2
1 − ζ a.
4) Period of Oscillation: This is the time between 2 oscillations. It is given by
2πτ
P= .
1− ζ 2
5) Settling Time, ts: The time required for the process to remain within 5% of the steady-
state value. The first time this occurs is called the settling time.
6) Rise Time, tr: Time required to first reach the steady state value.
Input Signal
Time, t
Period
New Steady State, ySS, 2
1.05 y∞ a
y∞ c
Output Signal
0.95 y∞
b KM
Original
Steady State, ySS, 1
tr
θ tp Time, t
ts
104
For the critically damped system, where |ζ| = 1, the poles of Equation (131) will both be
the same and contain no imaginary component. The system will be stable if the sign of ζτp is
positive and unstable if ζτp is negative. The step response of this system can be written as
t −ζ t τ
(t ) KM 1 − 1 + e p
y= (136)
τp
A typical stable, critically damped step response is shown in Figure 35. In general, such a system
looks very similar to a first-order plus deadtime system and is often analysed as such. The biggest
difference is the slightly slower initial response, which is often treated as a time delay.
1.0
0.9
0.8
0.7
0.6
Response
0.5
0.4
0.3
0.2
0.1
0
0 20 40 60 80 100 120
Time, t (s)
For the overdamped case, where |ζ| > 1, the poles of Equation (131) will only be real
numbers. This implies that there will be no oscillations in the step response. The system will be
stable if the sign of ζτp is positive and unstable if ζτp is negative. The step response of this system
can be written as 12
−ζ t ζ 2 −1 ζ2 ζ 2 − 1
KM 1 − e p cosh
y (t ) =
τ
t+ sinh t (137)
τp ζ −1
2 τ
p
A typical overdamped step response is shown in Figure 36. In most cases, this system can be
analysed as a first-order plus deadtime process. It can be noted that the overdamped case has the
cosh is the hyperbolic cosine function defined as ½(ex + e−x) and sinh is the hyperbolic sine function defined as
12
½(ex – e−x).
105
slowest initial response of all second-order and first-order systems. This slow initial response is
often treated as a deadtime when fitting a first-order system.
1.0
0.9
0.8
0.7
Amplitude 0.6
0.5
0.4
0.3
0.2
0.1
0
0 20 40 60 80 100 120
Time, t (s)
K K K (1 − τ p2ω 2 − 2ζτ p jω )
=GII ( jω ) = =
τ p2 ( jω ) + 2ζτ p jω + 1 1 − τ pω + 2ζτ p jω (1 − τ p2ω 2 ) + 4ζ 2τ p2ω 2
2 2 2 2
K 2 (1 − τ p2ω 2 ) + K 2 ( −2ζτ pω )
2 2
K
⇒ AR= =
((1 −τ ω ) + 4ζ τ ω )
2
(1 − τ p2ω 2 ) + 4ζ 2τ p2ω 2
2
2 2 2 2 2 2
p p
2ζτ pω
− arctan K > 0, τ pω < 1
1 − τ p2ω 2
2ζτ pω
− arctan − 180° K > 0, τ pω > 1
− K 2ζτ pω 1 − τ p2ω 2
=φ arctan
=
K (1 − τ p2ω 2 ) 180° − arctan 2ζτ pω
K < 0, τ pω < 1 (138)
1 − τ p2ω 2
2ζτ pω
− arctan K < 0, τ pω > 1
1 − τ p2ω 2
When dealing with second-order systems, there is a potential that the amplitude ratio can
be greater than the original starting value of |K|. Specifically, this occurs whenever the denominator
is less than 1. Taking the denominator of the amplitude ratio for a second-order system and solving
it gives
106
(1 − τ ω 2 ) + 4ζ 2τ p2ω 2 < 1
2 2
p
Since the frequency is only a positive real number, the term under the square root must also only
be positive (since a negative would give a complex number), that is,
2 − 4ζ 2 ≥ 0
(140)
ζ ≥ 0.5 ≈ 0.707
If the damping coefficient lies within the region given by Equation (140), then there will be a hump
in the Bode plot, as shown in Figure 37 (top). Since these frequencies magnify the system response,
it is important that special care be taken when designing controllers for such systems.
If a lead term has been added to a second-order system, as given by Equation (132), then
the system will display an inverse response if the zeros of the transfer function are positive, for
example, as shown in Figure 38. The Bode plot for this composite system can be obtained by
invoking the rules for combinations of transfer functions, that is,
K (τ L s + 1)
=GII = G G
(τ p s + 2ζτ p s + 1) II L
2 2
K 1 + τ L2ω 2
=AR AR
= II AR L
(1 − τ ω )
2
p
2 2
+ 4ζ 2τ p2ω 2 (141)
2ζτ pω
φ = φII + φL = arctan τ Lω − arctan
1 − τ p2ω 2
(ignoring all angle complications)
An example is shown in Figure 39.
Representative Bode plots are shown in Figure 37 for different combinations of the
parameters. The key properties of the second-order system are summarised in Table 17.
107
Table 17: Basic Information About a Secord-Order System
Property Value
K
Laplace Transform GII =
(τ s + 2ζτ p s + 1)
2 2
p
2ζτ pω
Bode Plots
− arctan ,
ϕ 1 − τ p2ω 2
108
Amplitude Ratio,AR (dB) 0 0
-40 -40
-60 -60
-80 -80
0 180
Phase Angle, ϕ (°)
-180 -2 0 -2
10 10-1 100 101 10 10-1 100 101
Frequency, ω (rad/s) Frequency, ω (rad/s)
0 0
Amplitude Ratio,AR (dB)
-40 -40
-60 -60
-80 -80
0 180
Phase Angle, ϕ (°)
-90 90
-180 -3 0 -3
10 10-2 10-1 100 101 10 10-2 10-1 100 101
Frequency, ω (rad/s) Frequency, ω (rad/s)
0 0
Amplitude Ratio,AR (dB)
-20 -20
-40 -40
-60 -60
-80 -80
-100 -100
0 180
Phase Angle, ϕ (°)
-90 90
-180 -3 0 -3
10 10-2 10-1 100 101 102 10 10-2 10-1 100 101 102
Frequency, ω (rad/s) Frequency, ω (rad/s)
Figure 37: Bode Plots for τp = 5, (top) ζ = 0.5, (middle) ζ = 1, (bottom) ζ = 2; (left) K = 1 and (right) K = −1
109
1.2
0.8
0.6
Response
0.4
0.2
-0.2
0 20 40 60 80 100 120 140 160
Time, s
Figure 38: Step Response of a Second-Order System with Inverse Response (τL = −25, ζ = 5/√7, τp = 10√7 and K = 1)
10 5
Amplitude Ratio,AR (dB)
180 -45
90 -3 -90 -2
10 10-2 10-1 100 101 10 10-1 100
Frequency, ω (rad/s) Frequency, ω (rad/s)
0 0
Amplitude Ratio,AR (dB)
-10 -10
-20
-20
-30
-30
-40
-50 -40
360 0
Phase Angle, ϕ (°)
270
-45
180
90 -3 -90 -3
10 10-2 10-1 100 101 102 10 10-2 10-1 100 101
Frequency, ω (rad/s) Frequency, ω (rad/s)
Figure 39: Bode Plots for (left) τL = −5, (right) τL = 5, and (top) ζ = 0.5 and (bottom) ζ = 2
110
Section 3.3.4.5: Higher-Order Systems
Analysing higher-order systems is based on the results obtained from the analysis of the
simpler systems. The following are some key points to consider for the analysis in the time domain:
1) Poles: The poles of the process transfer function determine the stability of the system. If
the poles are less than zero, then the system is stable; otherwise, it is unstable. If the poles
contain an imaginary component, then there will be oscillations in the system.
2) Zeros: If the zeros of the transfer function are positive, then there will be an inverse
response in the system.
3) Time Constant: The largest stable pole in absolute magnitude can be treated as the
dominating time constant of the process.
In the frequency domain, the Bode plots are obtained by combining the appropriate simple transfer
functions, using the rules for composition of the amplitude ratio (multiplication) and phase angle
(addition).
Example 14: Sketching the Expected Time-Domain Response
For the following three transfer functions, sketch the expected time-domain response of the
system when a positive step change is made:
1.54 ( −5s + 1)
1) G1 = e −10 s
( 5s + 1)( 4s + 2 )( 2s + 1)
1.54 ( 5s + 1)
2) G2 =
100s 2 − 200s + 1
1.54
3) G3 =
( −100s + 10s − 1) ( 4s + 1)
2
Solution:
First Transfer Function
For the first transfer function, the gain is 1.54 (by inspection), the zero is 0.2, and the poles
are −0.2 (= −1/5), −0.5 (= −2/4), and −0.5 (= −1/2), and the time delay is 10. Since the zero is
positive, we expect an inverse response, while all poles are negative, which implies that the system
is stable. As well, none of the poles have an imaginary component and so there are no oscillations.
The plot would therefore be as given in Figure 40 (left).
Second Transfer Function
111
For the second transfer function, the zero is −0.2. Instead of computing the poles directly,
we can note that this is a second-order system. Therefore, writing it into the standard form for a
second-order system, it can be seen that τp = 10 and ζ = −10. Since τpζ < 0, the system is unstable
and without any oscillations (|ζ| > 1). The “gain” is positive, which implies that the function will
go towards +∞. Thus, the plot would be as given in Figure 40 (middle).
Third Transfer Function
For the third transfer function, there are no zeros or time delay. Similar to the second
transfer function, let us rewrite the denominator into the required form to give
1.54 −1 −1.54
=G3 = .
( −100s + 10s − 1) ( 4s + 1) −1
2
(100s − 10s + 1) ( 4s + 1)
2
By comparison, we can see that the second-order term has the following characteristics, τp = 10
and ζ = −0.5. This implies that the poles are unstable and oscillatory. The second term will give a
stable pole (−0.25 = −1/4). Therefore, the plot of this transfer function will be given as Figure 40
(right).
Figure 40: Sketch of the Transfer Function Step Responses: (left) first transfer function, (middle) second transfer
function, and (right) third transfer function.
It can be noted that when sketching the transfer function, it is important to only give the general
characteristics, while the exact values can be ignored.
112
ringing cases can only occur in the discrete-time domain as a result of how the discretisation is
taken.
Table 18: Graphical Representation of the Different Types of Functions (The ringing cases can only occur in the discrete
domain.)
Stable,
oscillatory
Unstable, pure
oscillatory
Unstable,
Integrator
Unstable,
exponential
growth
Unstable,
oscillatory
Ringing, stable
Ringing, stable
oscillatory
113
Location of the Poles Unit-Step Response
Case
Continuous Discrete Continuous Discrete
Ringing,
integrator
Ringing,
unstable
Ringing,
unstable,
oscillatory
We will assume that a ∊ ℝ so that values of α ≥ 0 will lead to an unstable system. It can be noted
that the results for sine will be the same mutatis mutanda. Examine the impact of the sampling
time on the resulting discrete-time function and its z-transform.
Solution
The behaviour of the transfer function is determined by the values of its poles, that is, the
roots of the denominator. Using the quadratic formula gives the general form of the poles as
where to simplify notation ψ = eaTs . We can note that ψ will always be positive since the
exponential of any real number is positive.
114
In order to understand the behaviour of the discrete function, we will need to examine the
determinant of the equation (the part inside the square root) and consider three cases: when the
determinant is greater than zero, exactly zero, and less than zero.
Case 1: Determinant greater than zero
For the determinant to be greater than zero, it follows that
cos 2 (ωTS ) − 1 > 0 ⇒ cos 2 (ωTs ) > 1 (146)
However, the cosine function is never greater than 1. Thus, this situation cannot occur and there
will not be two distinct real roots.
Case 2: Determinant equal to zero
For the determinant to be exactly zero, it follows that
cos 2 (ωTS ) − 1 = 0 ⇒ cos 2 (ωTs ) = 1 (147)
Taking the square root of the right-hand side and noting that there are two solutions gives
cos (ωTs ) = ±1 (148)
When n is odd, the value of cos(kπn) will oscillate between 1 and −1 which will give the
characteristic ringing behaviour.
Case 3: Determinant less than zero
For the determinant to be less than zero, it follows that
cos 2 (ωTS ) − 1 < 0 ⇒ cos 2 (ωTs ) < 1 (150)
In such cases, there will be two imaginary roots that are complements of each other, that is, ψ + γi
and ψ – γi, where γ is equal to ψ 1 − cos 2 (ωTS ) . This implies that there will be a clear oscillatory
115
behaviour. If we restrict ourselves to the domain [0, 2π[, we can note that cos(ωTs) will be positive
in the region [0, 0.5π[ ∪ ]1.5π, 2π[ and negative in the region ]0.5π, 1.5π[. The function will be
exactly zero at 0.5π and 1.5π. In the positive region, this will place the poles in the right-hand side
of the discrete system, while when negative it will place them in the left-hand side leading to
ringing. When cos(ωTs) is exactly zero, we will have two roots at the origin of the system and we
will have no information about the system. This brings us directly to the constraint given by the
Shannon sampling theorem that the sampling time must lie be greater than 2/ω.
116
accepts the word; otherwise it rejects the word. The set of all words accepted by the automaton is
called the language recognised (or marked) by the automaton.
Mathematically, for a finite-state automaton A, we can write this as the quintuple
A ≡ (𝕏𝕏, Σ, f, x0, 𝕏𝕏m) (151)
where 𝕏𝕏 is the finite set of states, Σ the finite set of symbols, called the alphabet of the automaton,
x0 ∊ 𝕏𝕏 the initial state, 𝕏𝕏m ⊆ 𝕏𝕏 the set of all accepting states, and f the transition function defined
as
f: 𝕏𝕏×Σ → 𝕏𝕏 (152)
The alphabet represents all possible values that the automaton will recognise. It can consist of
letters, values, or any other acceptable symbol. An automaton generates a language, L, which
simply consists of all possible strings (irrespective of the final state) generated by the automaton.
An automaton is said to recognise (or mark) a specific language Lm.
As well, it is possible to define an output function, g, that determines what the output from
the automaton will be. In general, it is defined as
g: 𝕏𝕏×Σ → Y, (153)
that is, the output function depends on the state and inputs. In such cases, this automaton is called
a Mealy Automaton. On the other hand, when the output function, g, is defined as
g: 𝕏𝕏 → Y (154)
that is, the output function only depends on the state, then we have a Moore Automaton.
It is also possible to provide a graphical representation of an automaton. Figure 41 shows
a typical representation of an automaton. The most important components are:
• The states are shown with “Z” followed by a number.
o Normally, Z0 is the initial state.
• Each state is enclosed by a circle.
• The initial state is shown by an arrow pointing to the state and without any additional
markings.
• The transitions between the states are shown with arrows.
• On the arrows, the combination of inputs and outputs that lead to the next state are
shown.
• Accepting states are enclosed by a double circle.
117
Figure 41: Graphical Representation of an Automaton
The sending and receiving of symbols for the inputs and outputs is assumed to be
instantaneous. A finite-state automaton must allocate for each input symbol at each time point a
valid transition. Often such a transition can be a self-loop, that is, a transition where the initial and
final states are the same.
Example 16: Automaton for a Process
Consider the previously mentioned process where it was desired to find the word baba.
Draw the automaton for this process and define the all the components in the mathematical
description of the automaton.
Solution
The automaton is shown in Figure 42.
118
f(Z1, b) = Z1
f(Z2, a) = Z0
f(Z2, b) = Z3
f(Z3, a) = Z4
f(Z3, b) = Z1
f(Z4, a) = Z0
f(Z4, b) = Z1
Note that the transition function should match the arrows drawn in the schematic for the
automaton!
Transitions in an automaton can be spontaneous, that is, we do not know exactly when a
given transition occurs, for example, the transition from filling a tank to full can be spontaneous
(especially, if we do not know the height of the tank). Such a transition is denoted using the symbol
“ε” on the arrow. Spontaneous transitions often arise when there is incomplete knowledge of the
system. Automata containing spontaneous transitions are said to be nondeterministic, since it is
not possible to know in which states the automaton currently is. Another form of nondeterminism
is the presence of multiple transitions with the same label, for example, two transitions labelled a
leading to two different states. In such cases, it is likewise impossible to know in which state the
automaton is in. In all other cases, the automaton is said to be deterministic since it is possible to
precisely determine the next state given all past information.
The states in an automaton can be classified as follows:
1) Periodic States: Periodic states are a set of states between which the automaton can
oscillate. Normally, one takes the largest set of states between which the automaton can
oscillate.
2) Ergodic States: Ergodic states are those states once reached the automaton cannot leave.
3) Transient States: All states that are not ergodic are called transient states.
119
Deadlock is said to occur if an automaton ends up in a rejecting state from which it cannot
leave. Such an automaton has come to a standstill and cannot take further action. Since automata
represent real processes, this is an undesirable state of events and should be avoided. A similar
concept is livelock which is said to occur if an automaton ends up in a periodic set that consists
solely of rejecting states. This means that although the automaton can make a next move it can
never reach an accepting state and terminate. Both such situations are highly undesired. Together
deadlock and livelock are referred to as blocking, since the automaton is blocked from completing
its task.
Example 17: Blocking in an Automaton
Determine if the automaton shown in Figure 43, is blocking. If it is blocking, determine
what types of blocking occur.
It is possible to manipulate automata. The following are some common manipulations and
their definitions:
1) Accessible Operator (Acc): This removes all unreachable states and their associated
transitions. This operation is necessary when performing more advanced manipulations on
automata to clean up the resulting automaton. This operation will not change the generated
120
or recognised languages. A state is defined as being unreachable if there exists no path
from the initial state to the given state.
2) Co-accessible Operator (CoAc): This removes any states and their associated transitions
from which one cannot end up in an accepting state. An automaton where A = CoAc(A) is
called a co-accessible automaton and is never blocking. This operation can change the
generated language but not the recognised language.
3) Trim Operator (Trim): This operation creates an automaton that is both co-accessible and
accessible. The order of operation is immaterial, that is, Trim(A) = CoAc(Acc(A)) =
Acc(CoAc(A)).
Example 18: Trimming an Automaton
Apply the trim operation to the automaton shown in Figure 43.
Solution
Quickly looking at the automaton in Figure 43, we that there are no states that cannot be
accessed from the initial state. Thus, we need to consider the co-accessible operator. Here, we see
that we need to remove states Z5, Z6, and Z3 since we know that they are blocking. However, by
removing Z3, we now make Z2 blocking. Therefore, we must also remove it. In general, this
process is iterative and continues until we have removed all states or there are no more states to
remove. The final automation in shown in Figure 44.
121
Product composition is defined as combination of two automaton considering only the
letters of the alphabet that the two automata have in common, that is, Σ1∪ Σ2. Formally, for two
automata G1 and G2, their product can be written as
( ( )
G1 × G2 ≡ Acc 1 × 2 , Σ1 ∪ Σ 2 , f , x01 , x02 , m1 × m2 ) (155)
where
Figure 45: G1
122
Figure 46: G2
Solution
Before we can start with drawing the final automaton, it makes sense to first consider which
inputs are valid for the final automaton. From Figure 45, it can be seen that, for G1, the inputs are
{a, b, g}. Similarly, from Figure 46, it can be seen that, for G2, the inputs are {a, b}. Therefore,
the common set is {a, b}.
When drawing the final automaton, it helps to start from the initial states of both and work
through all the possible transitions and draw the next state. Thus, starting from (x, 0), with an input
of a, G1 remains in state x, but G2 goes to state 1. Therefore, the new state in the product automaton
will be (x, 1). This is the only valid transition since from (x, 0), an input of b is not valid for G1.
An input must be valid for both automata for it to occur in the product. Note that g will not occur
since it is not a common input. We will then continue in the same fashion by looking at the possible
states and how the inputs would affect them. A state will be marked if all the states in the original
automaton are marked. The final automaton is shown in Figure 47.
As can be seen, product composition is relatively restrictive in that a given input must be
valid for both automata. One way to relax this constraint is to consider parallel composition. In
parallel composition, the inputs are split into two parts: common inputs and private inputs. A
private input only pertains to a given automaton, while common inputs are shared with other
automata. Formally, the parallel composition of two automata G1 and G2, denoted as G1 || G2, is
defined as
( ( )
G1 || G2 ≡ Acc 1 × 2 , Σ1 ∪ Σ 2 , f , x01 , x02 , m1 × m2 ) (158)
123
where
( f1 ( x1 , e ) , f 2 ( x2 , e ) ) if e is a valid common input for both automata
( f1 ( x1 , e ) , x2 ) if e is a private event to G1
f ( ( x1 , x2 ) , e ) ≡ (159)
( x1 , f 2 ( x2 , e ) ) if e is a private event to G2
undefined otherwise
Note that the only difference between parallel and product composition is how the transition
function is defined.
Product composition has the following properties:
1) It is commutative up to a re-ordering of the state components in the composed states.
2) It is associative. This implies that G1 || G2 || G3 ≡ (G1 || G2) || G3 = G1 || (G2 || G3).
Example 20: Parallel Composition of Two Automata
Consider the same two automata as for Example 19. Determine the parallel composition of
these two automata.
Solution
The general procedure for solving such a problem is similar to that of the product
composition. First, we need to determine which inputs belong to which categories. Since input g
only affects G1, it is a private input for G1. The other two inputs {a, b} are the common inputs to
both automata.
Again, we start with the initial states of both automata and work our way through. From
the initial state of (x, 0), we have two valid inputs (the common input a and the private input g).
The common input a will bring us as before to the state (x, 1), while the private input g will bring
us to the state (z, 0). In the state (z, 0), there are three valid inputs (the common events a and b as
well as the private input g). Input a will bring us to state (x, 1), while input b will be a self-loop.
Private input g, which only affects G1, will bring us to state (y, 0). The final automaton is shown
in Figure 48.
124
Figure 48: The parallel composition of G1 and G2
125
Mathematically, a timed automaton can be represented as
A ≡ (𝕏𝕏, Σ, f, ℂ, I, x0, 𝕏𝕏m) (160)
where ℂ is a finite set of clock variables and I is the invariant function that links the states with the
transition constraints, that is,
I: 𝕏𝕏 → Φ(ℂ) (161)
where Φ(ℂ) is the set of transition constraints δ. The transition constraints δ are always either true
or false based on the current clock variables. The allowed transition constraints are (where a ∊ ℝ):
• δ ≡ (c ≤ a)
• δ ≡ (c = a)
• δ ≡ (c ≥ a)
• δ ≡ (δ1 OR δ2)
• δ ≡ ¬(δ)
• δ ≡ ∅ or {}
The transition function is defined as
f: 𝕏𝕏×U×Φ(ℂ) → 𝕏𝕏×2|ℂ| (162)
where 2|ℂ| represents the power set of ℂ.
In certain formalisms, transitions can be specified as either urgent or nonurgent. Urgent
transitions will always be taken as soon as possible, while nonurgent transitions can wait. Normally,
spontaneous transitions are assumed to be nonurgent.
126
2) In a time-variant model, the parameters themselves vary with respect to time.
3) In a lumped-parameter model, there are space derivatives.
4) A noncausal system depends on future values.
5) A system with memory only cares about the current value of the process.
6) A state-space representation provides a model linking states, inputs, and outputs.
7) A transfer function can only be written for linear processes.
8) Every transfer function has a unique state-space representation.
9) Prediction error models are discrete-time models of the process.
10) A white noise signal depends on past values of the noise.
11) In a Box-Jenkins model, the order of the A-polynomial is fixed to zero.
12) In an autoregressive exogenous model, the only orders of the C- and D-polynomials are
zero.
13) It is not possible to convert a continuous model into a discrete model.
14) A process at steady state will experience wild, unpredictable swings in values.
15) The gain of a process represents the transient behaviour of the process.
16) The process time constant represents the delay before a process responds.
17) A continuous transfer function with poles of −2, −1, and 0 is stable.
18) A continuous transfer function with poles of 1, 2, and 5 is stable.
19) A discrete transfer function with poles of 0.5, −0.5, and 1 is unstable.
20) A discrete transfer function with poles of 0.25, 0.36, 0.25±0.5i is stable.
21) A continuous state-space model with eigenvalues of 0.25±2i is stable.
22) A discrete state-space model with eigenvalues of ±0.25i is stable.
23) The alphabet of an automaton represents the allowed inputs into the process.
24) An accepting state is a state that has the desired outcome.
25) The language recognised by an automaton is the set of all words accepted by the automaton.
26) In a Mealy automaton, the output function depends only on the states.
27) Blocking occurs when an automaton cannot reach an accepting state.
28) We denote spontaneous transitions by ε.
29) An automaton with spontaneous transitions is called a deterministic automaton.
30) The co-accessible operator removes all states and their associated transitions that are
unreachable from the initial state.
127
31) In a timed automaton, a guard determines the maximal time in which we can remain in a
given state.
32) For a timed automaton, δ ≡ (c ≤ 1.000) is an acceptable time constraint.
33) For a timed automation, δ ≡ (c = abcd) is an acceptable time constraint.
34) There is no escape from an ergodic set.
a. yk +1 =4 yk + 7uk +5 − 5ek .
∂ 2T ∂T
b. 2
= −α ( t ) , where α is a parameter that depends on time.
∂x ∂t
c. −4 yk − 3ek
yk +1 =
d. ∂T =
−α ( t ) u ( t + 1) , where α is a parameter that depends on time.
∂t
36) For the following continuous-time transfer function, determine their stability. For the stable
transfer functions, determine the gain, time constant, and time delay.
5 ( s + 1)
a. G ( s ) = 3 2
e−3s
6s + 11s + 6s + 1
−5
b. G ( s ) = 32
e −10 s
150 s + 65s + 2 s − 1
4.5
c. G ( s ) = 2
e −10 s
15s + 8s + 1
4.5
d. G ( s ) = 2
e −7 s
15s + 26 s + 7
37) For the following continuous-time state-space models, determine their stability. Convert
the models to a transfer function. For the stable models, determine their gain and time
constant.
128
dx 5 0 2
= x + u
dt 0 −2 1
a.
1 0
y= x
0 1
dx −5 0 −2
= x + u
dt 0 −2 1
b.
2 0
y= x
0 1
−2 1 2 1
dx
= 0 −3 2 x + −0.5 u
dt
0 0 −1 2
c.
2 0 0
=y 0 −1 0 x
0 0 1
a. yk +1 =4 yk + 7uk +5 − 5ek
z −5
b. yk +1 = uk
1 − 4 z −1
z5 + z 4
c. yk +1 = uk
z 6 + z 5 + z 4 + z 3 + z 2 + z1 + 1
−0.5 1 2 1
= xk +1 0 0.5 2 xk + −0.5 uk
0 0 0.25 2
d.
2 0 0
= yk 0 −1 0 xk
0 0 1
129
−1.5 0 0 −1
= xk +1 3
1.5 0 xk + 0.5 uk
1 2 2.25 3
e.
1 0 0
yk = 0 1 0 xk
0 0 1
39) What is the relationship between the eigenvalues of the state-space model and the time
constant (as determined from the transfer function)?
40) For the automata shown in Figure 50, classify the states into marked, ergodic, periodic, and
transient. Determine if there is blocking. If present, give the type of blocking encountered.
130
Figure 50: Automata for Questions 40 and 41
131
Figure 51: Automata for Question 42
132
Chapter 4: Schematic Representation of a
Process
This section will describe the most common schematic methods for representing a process,
including block diagrams, piping and instrumentation diagrams (P&IDs), process flow
diagrams (PFDs), and electrical and logic circuit diagrams.
Another common block is the summation block, which shows how two or more signals
are to be combined. Figure 53 shows a typical summation block. The signs inside the circle show
whether the signal coming in should be added or subtracted. Given the common nature of a
summation block, two simplifications can be made. Rather than using a full circle, the signals are
simply shown to connect and the signs are shown beside each signal. This is shown in the bottom
part of Figure 53. A further simplification is to completely ignore any positive signs and only give
the negative signs beside the appropriate signals. A commonly used standard is to place the
summation signs on the left-hand side of the arrow.
13
Often it will also be used for a time domain representation by ignoring the composition and summation rules and
using slightly different models. In such cases, they are better called process flow diagrams, which are described in
Section 4.2.
133
Figure 53: Summation block: (top) full form and (bottom) short-hand equivalent
One of the most useful features of block diagrams is the ability to easily compute the
relationship between the different signals. For the basic block shown in Figure 52, the relationship
between the input and output can be written as:
Y = GU (163)
while for the summation block, it can be written as
Y = U1 – U2 (164)
Now, consider the process shown in Figure 54, where it is desired to determine the relationship
between Y and U, where there are three blocks in series. The naïve approach would be to denoted
each of the outputs from the two intermediate steps to be denoted as Y1 and Y2 and then write
relationships between each of these variables to obtain the final result, that is,
Y1 = G1U (165)
Y2 = G2Y1 = G2G1U (166)
Y = G3Y2 = G3G2G1U (167)
This shows that the final relationship can be written as Y = G3G2G1U. The easier approach is to
note that since these process blocks are in series, the process models can be multiplied together to
give the desired result (as the final result shows). However, the naïve approach is very useful if
the system is very complex with many different summation blocks and functions.
Figure 54: Block diagram algebra: In order to relate U and Y, the transfer functions between the two points need to be multiplied,
thus, Y = G3G2G1U.
134
Example 21: Complex Block Diagrams
Consider the closed-loop system shown in Figure 55 and derive the expression for the
relationship between R and Y. Assume that all signals are in the frequency domain.
Solution:
Starting from the desired signal R and moving towards Y, the following relationships can
be written
ε = R − GmY
U = Gcε
Y = GpGaU + GdD
Substituting the first relationships into the second and then the combined into the third gives
Y = Gp GaGc(R − GmY) + GdD
Re-arranging this equation gives
Y = Gp GaGcR − Gp GaGcGmY + GdD
Solving this equation for Y gives
G p Ga Gc Gd
=Y R + D
1 + G p Ga Gc Gm 1 + G p Ga Gc Gm
Since we are only interested in the relationship between Y and R, we can set D = 0 to get
G p Ga Gc
Y= R
1 + G p Ga Gc Gm
135
The creation of block diagram for a given process can be quite a complex task, but it is
worthwhile as it allows the essential features of the system to be abstracted out and understood.
136
Section 4.3: Piping and Instrumentation Diagrams (P&ID)
The piping and instrumentation diagram (P&ID) is a detailed description of the process,
where all connections and components are shown. A P&ID contains, in addition to the information
found in a process flow diagram, the following information:
1) Type and Identification number for all components
2) Piping, fittings with nominal diameters, pressure stages, and materials
3) Drives
4) All measurement and control devices
Figure 57 shows a typical P&ID for part of a chemical plant.
Figure 57: P&ID for a Gas Chilling and Separation Plant According to Canadian Design Standards (Note the engineering stamp
in the bottom middle box.)
137
Section 4.3.1: P&ID Component Symbols According to the DIN EN
62424
Table 19 shows the typical component symbols according to the DIN EN 62424 Standard. 14
Additional symbols can be found in the standard itself.
Table 19: Component Symbols for P&IDs According to the DIN EN 62424
Jacketed pipe
Pump
with jacket
Bag
Horizontal pressurised
vessel
Fan
14
The older German standard DIN 19227 matches closely the ISA or North American standard. Differences include
how the different sensors or functions are denoted and minor details regarding the proper location for various pieces
of additional information. This book will follow the new standard without necessarily making any comments about
the other possibilities in order to avoid confusion.
15
This represents a general pipe.
138
Symbol Name Symbol Name
Double-pipe heat
exchanger
Gas bottle
Furnace
U-shaped-tube heat
exchanger
Finned-tube heat
Cooling tower
exchanger with axial fan
Cooler
139
Symbol Name Symbol Name
Needle valve
Pressure reducing valve
Manual valve
Spring safety valve
Symbol Name
Pipe (process flow)
Pneumatic signal
Electrical signal
Hydraulic signal
140
Symbol Name
Electromagnetic Signal
There are many different fields in the equipment label. These are shown in Figure 58. The
left fields (#1 to 3) are only used if needed and there are no restrictions on what can be placed
there. Field #1 often gives the supplier, while Field #2 gives the standard value of the component.
The two central fields (#4 and 5) show the important information about the component. Field #4
shows the PCE category 16 und the PCE processing category (see Table 23 for additional
information). Field #5 shows the PCE tag that is arbitrary. The right fields (#6 to 12) show
16
PCE is an abbreviation for “Process Control Engineering”.
141
additional information about the component. For example, Fields #6 to #8 show alarms and
notifications related to upper limits, while Fields #10 to 12 contain alarms and notifications related
to lower limits. The fields located furthest from the center contain the most important information.
Field #9 shows the importance of the component. A triangle (▲) shows a safety-relevant
component, while a circle (●) shows a component required for the good manufacturing process
(GMP). A square (■) shows a quality relevant component.
Table 23 shows the PCE categories, while Table 24 shows the PCE processing functions.
For motorised drives (PCE category N), there are only two possibilities for the processing function:
S, which implies an on/off motor, and C, which implies motor control. For valves (PCE category
Y), there are also limitations: S implies an on/off valve, C implies a control valve, Z implies an
on/off valve with safety relevance, and IC implies a control valve with a continuous position
indicator. For process control functions, there are some very specific rules:
1) The PCE category is always the same U.
2) The following letters are often A, C, D, F, Q, S, Y, or Z. Combinations of these letters are
possible.
142
Letter Meaning
A Analysis
B Burner Combustion
C 17 Conductivity
D Density
E Voltage
F Flow
G Gap
H Hand
I Current
J Power
K Time Schedule
L Level
M Moisture
N Motor
O Free
P Pressure
Q Quantity/Event
R Radiation
S Speed, Frequency
T Temperature
U anticipated for PCE control functions
V Vibration
W Weight
X Free
Y Valve
Z Free
Table 24: PCE Processing Categories
17
Officially, this is a free variable to be set as needed. Practically, it is often used for conductivity.
143
Letter Meaning Comment
Q Quantity only Field 4
R Recording only Field 4
S Switching only in Fields #6,7, 8, 10, 11, and 12; in
Field #4 for process control functions
Y Computation only in Field 4
Z Emergency only in Fields #6,7, 8, 10, 11, and 12; in
Field #4 for process control functions
The labels for the other fields are not standardised. However, in a P&ID, the same label
should be used for the same component/idea. All P&IDs require a legend, where all the
components are briefly described, including such information as their name, engineering data (size,
material), and operating conditions. Appropriate stamps and signatures may need to be affixed
depending on local laws, for example, in Canada, all engineering documents require a stamp and
signature from a practising engineer.
144
Section 4.4: Electric and Logic Circuit Diagrams
Since much automation is implemented using electrical signals and logic statements, it is
useful to understand the basics of how such circuit diagrams are constructed. As well, some of
these symbols will re-appear when considering graphical programming languages.
There exist two main standards for drawing the shapes in electric and logic circuit
diagrams: the official DIN EN 60617 (a.k.a. the IEC 617) standard and the nonpreferred, but
commonly encountered, ANSI IEEE 91-1991 standard. The official standard, although not
explicitly showing the nonpreferred symbols, states that it is permissive to use locally accepted
national versions of the symbols. Common symbols for both standards are shown in Table 25.
Furthermore, when it comes to showing connections, for example, the splitting of a wire,
different formats are possible. The recommended approach is to use T-junctions to show a split (as
shown by Figure 59a). However, often, the split will be shown as in Figure 59b. A simple crossing
of wires is shown by Figure 59c.
Resistor
Inductor
Direct-Current
Essentially a battery
Voltage Source
Alternating-
Current Voltage
Source
Diode
Capacitor
AND Gate
145
Item DIN-60617 Symbol ANSI Symbol Comments
OR Gate
Inverter
NAND Gate
NOR Gate
XOR Gate
Ground
The arrow is placed
over the element that
is variable, for
Variable
example, a variable
resistor:
Negation is placed
where the signal
enters or leaves a
General Negation
block (see, for
example, the NAND
or NOR gates above).
146
Figure 59: Connections: a) recommend form for contact; b) commonly encountered form for contact; and c) no contact
147
11) Write the process model between U and Y for the block diagrams shown in Figure 60.
12) Draw the process flow diagrams for the following process descriptions. Hint: Knowledge
of chemical engineering and physical behaviour of systems required.
a. The DEA solution enters the treatment unit via a throttle valve and is heated in three
consecutive heat exchangers. The heated solution enters the first evaporation
column which is operated under vacuum at 80 kPa and a temperature of 150°C.
Most of the water is evaporated here. The water vapour is used in the first heat
exchanger to heat the incoming solution. The concentrated DEA solution is
transferred from the first evaporator to a second evaporation column via a second
throttle valve, so that the pressure can be lowered to 10 kPa. The second
evaporation column is a thin film evaporator (similarly built to a scraped wall heat
exchanger), which is heated by high pressure steam. Here most of the DEA is
evaporated. The remaining HSS slurry is removed from the column by a positive
displacement pump. The DEA vapour is used to heat the feed in the second heat
exchanger. The third heat exchanger in the feed line is heated by medium pressure
steam to achieve sufficient evaporation in the first evaporation column. After
exchanging heat with the feed stream, the water vapour and DEA vapour streams
148
are completely liquefied in two condensers operated with cooling water, before
being pumped to a T-junction and returned to the gas scrubbing process.
b. A concentrated solution of 99% triethylene glycol (C6H14O4) and 1% water is
commonly used to absorb moisture from natural gas at 4.1 MPa. Natural gas is
mainly methane, with smaller amounts of ethane, propane, carbon dioxide and
nitrogen. The water-saturated natural gas is contacted with the triethylene glycol at
40°C in a trayed absorber column to remove the water. The dried gas in then ready
for piping to market. The triethylene glycol solution leaving the absorber column
is diluted by water, and must be regenerated for re-use. It first passes through a
flash drum at a pressure of 110 kPa to release dissolved gases. Then, it is heated in
a heat exchanger with the hot regenerated glycol. The dilute solution then enters
the top of a packed regeneration column. As it flows downward over the packing,
it passes steam flowing upwards which evaporates water from the glycol solution.
The reboiler at the bottom of the regeneration column uses medium-pressure steam
to heat the triethylene glycol solution to 200°C to generate the vapour that passes
up the column. At the top of the column, the vapour (i.e. the water evaporated from
the triethylene glycol solution) is vented to the atmosphere. The hot regenerated
solution from the bottom of the regenerator column is cooled in a heat exchanger
with the dilute solution from the absorber. It is then pumped through an air cooler
and then back to the absorber column at approximately 45°C.
13) Using the sketch of the process flow diagram in Figure 61 and the process description
below, provide a properly formatted process flow diagram that includes all the required
components and information. The process description is as follows. Ethyl chloride
(C2H5Cl) is produced in a continuous, stirred tank reactor (CSTR) filled with a slurry of
catalyst suspended in liquid ethyl chloride. Most of the heat of reaction is absorbed by
vaporising 25 kmol/hr of the liquid ethyl chloride. This vapour leaves the reactor with the
product stream. The reactor is jacketed to allow additional temperature control if required.
All of the ethyl chloride in the product stream is condensed and enough ethyl chloride is
returned to the reactor to maintain steady state. The waste gas is sent to the flare system.
149
Figure 61: Sketch of Process Flow Diagram for Question 13
14) Evaluate the P&IDs shown in Figure 62. Have they been corrected drawn? Is there anything
that is missing? Are all the streams correctly shown?
15) Given the P&ID in Figure 63, determine where the controller is located and what signals it
requires.
150
Figure 63: P&ID for Question 15
16) For the process shown in Figure 64, answer the following questions:
a. What kind of alarm does the controller provide?
b. How is the level measured? What kind of signal is produced?
c. What kind of valve is used to control the level?
d. What do the double lines for item LI-135 mean?
151
Figure 64: P&ID for Question 16
17) Imagine that you producing maple syrup. The P&ID along with the current values is shown
in Figure 65. Determine if there are any measurement errors.
152
Figure 65: Maple Syrup P&ID for Question 17
153
Chapter 5: Control and Automation
Strategies
Having looked at the different instruments that can be used for automation and how to
describe the process and its interconnections, it is now necessary to see how the desired automation
can actually be implemented. The control or automation strategy is the method used to
control/automate the process to achieve the desired objectives. Although two different words can
be used here, the overall concepts are very similar: produce a system that can operate on its own
with minimal human interference. Depending on the field and even industry, one of these two
words may be more common.
There exist many different ways to classify the different types of strategies that can be
implemented. Often, in practice, these strategies can be combined to produce a final overall control
strategy. The following are the most common types of control strategies:
1) Open-Loop Control (or steering, servo response): In open-loop control, the desired
trajectory is set and implemented. The object follows this trajectory without taking into
consideration any variations in the environment or surroundings. Clearly, if there are any
changes in the environment, the object may not achieve its trajectory.
2) Closed-Loop Control (or regulation, regulatory response): In closed-loop control, the
actual value of the system is always compared against the setpoint value. Any deviations
are then corrected using a controller. This allows for the system to make corrections based
on imperfections in the original specifications, changes in the environment, or unexpected
events. In most control strategies, some aspect of closed-loop control will be implemented.
3) Feedforward Control: In feedforward control, known disturbances are measured and
corrective action is taken so that the disturbance does not impact the plant. This is a way
of taking into consideration future information about the process and taking action now.
4) Discrete-Event Control: In discrete-event control, control only occurs, when some logic
condition is triggered. This is often used in safety-relevant systems to trigger immediate
action or raise an alarm, for example, if the pressure is above a certain threshold, then the
pressure release valve should be opened. Often, such systems are modelled using automata.
154
5) Supervisory Control: In supervisory control, the control loop does not control a process,
but it controls another control loop. Supervisory control loops are common in complex
industrial systems, where there may be multiple objectives and variables to control.
In principle, if we are given a mathematical function that converts u(t) into y(t), more
commonly called a plant model and denoted by Gp, then by taking the inverse of this model as the
controller will allow us to attain the goal of making y(t) = r(t). However, in practice, the following
issues arise:
1. Unrealisability of the Model Inverse: Due to time delays and unstable zeros of the process,
it may not be possible to obtain a realisable inverse model.
2. Plant-Model Mismatch: It is very likely that the mode for Gp is not exact, which implies
that the incorrect parameters are given to the controller leading to incorrect results.
3. Disturbances: In reality, there will be disturbances that prevent y(t) from reaching the
value specified by r(t). One solution to this problem is to implement feedforward control
155
that measures the disturbance and takes corrective action. However, this only solves the
problem if the disturbance variable can be measured.
Example 23: Heating the House: Part I: Open-Loop Control
156
the input into the controller. In order to emphasise that the output must be measurable in order for
closed-loop control to occur, the measuring transfer function, Gm, is explicitly shown. In most
applications, it will be assumed that Gm has a minimal impact on the overall system, and hence, it
will be ignored.
157
Figure 69: Closed-Loop Control of the House Temperature
Furthermore, other disturbances may occur that are not easily measured, but whose impact
can be controlled by the closed-loop controller. Figure 69 shows people in the room (S1), an open
window (S2) and direct sunlight (S3). Since these will influence the room temperature, their impact
will be noticed by the room temperature sensor that will cause the controller to make appropriate
changes to maintain the temperature at its desired value.
In closed-loop control, the following are the key ideas to consider (Seborg, Edgar,
Mellichamp, & Doyle, 2011):
1) The closed-loop system should be stable; otherwise, the system is worse than before.
2) The impact of disturbances should be minimised.
3) The controller should provide quick and effective change between different setpoints, that
is, setpoint tracking should be good.
4) There should not be any bias, that is, the output should reach the desired value.
5) Large actuator values should be minimised.
6) The controller should be robust, that is, small changes in the process characteristics should
not make the overall system unstable.
158
When designing a closed-loop control strategy, there are two common approaches to take:
1) State Feedback, where it is assumed that the controller is a constant K and all the states
are measurable and available, that is, yt = xt. The control law is given as ut = −Kxt.
2) Proportional, Integral, and Derivative (PID) Control, where the control law can be
written as
1
U ( s )= K c 1 + +τ Ds ε ( s) (168)
τIs
where Kc, τI, and τD are parameters to be determined. There exist different forms of the PID
control law depending on the industry, era, and implementation. It is common to drop the
D term, that is, set τD = 0, and have a PI controller.
In addition to these common methods, there also exist various nonlinear approaches that can be
applied to improve overall control, such as deadbanding or squared-error control.
159
It is possible to design different types of observers, depending on the intended application.
The most common observer is the Luenberger observer which seeks to minimise the error in the
predicted and actual states. Assume that the Luenberger observer can be written as
(
)
xˆ = xˆ + y − yˆ + u
(169)
=yˆ xˆ + u
where ℒ, the observer gain, is an appropriately sized matrix that needs to be designed and ◌̂
represents an estimated value. Rewriting Equation (169) gives
xˆ = ( − ) xˆ + y + ( − ) u
(170)
=yˆ xˆ + u
Let the error be defined as
e= x − xˆ (171)
Taking the derivative (or difference) of Equation (171) gives
e= x − xˆ (172)
Substituting Equations (30) and (170) into Equation (172) gives
e = x + u − ( − ) xˆ − ( x + u ) − ( − ) u (173)
= ( − ) e
From Equation (173), it can be seen that for the error to reach zero 𝒜𝒜 – ℒ𝒞𝒞 must be stable, that is,
the eigenvalues of 𝒜𝒜 – ℒ𝒞𝒞 must lie to make the process stable. 18
Now that we can estimate the state values, it makes sense to design a state controller.
Assume that the state controller law can be written as
u = −xˆ (174) 19
Before examining the general case, let us consider the situation, where perfect information can be
obtained about the states and there is no need to design an observer, that is, 𝒞𝒞 = ℐ, which implies
that y = x . In this situation, we can use the basic state-space equations, given by Equation (30),
to describe the system. Substituting Equation (174) into Equation (30) and re-arranging gives
18
continuous domain: Re(λ) < 0; discrete domain: ||λ|| < 1
19
Often, the estimated state is replaced by the true state value. As it will be shown, this makes sense in many cases
since we have full information about the states by actually measuring them.
160
x =−
x ( x ) =−
( ) x
(175)
=y x + u
Thus, it can be seen that the stability of the controlled (overall, closed-loop) system is determined
by the location of the eigenvalues of the 𝒜𝒜 – 𝒦𝒦𝒦𝒦 matrix.
Now consider the case, where we do not have full information about the process. In this
case, we will need to consider two different equations: the observer equation and the true state-
space model. Substituting the control law given by Equation (174) into the observer equation,
Equation (170), gives
xˆ = ( − − + ) xˆ + y
(176)
=yˆ xˆ − xˆ
The fact that both terms are present in this equation raises the question if the controller and
observer must be designed simultaneously or could they be designed separately.
In fact, the linear, state-space law presented here coupled with the linear observer are fully
separable and stability will be assured if both components are stable. In order to show this, rewrite
the controller law as
u=− ( x − e ) (177)
Now, combining this equation with the error equation, given as Equation (173), into a single
equation, we can see that the combined system consisting of the states and errors can be written as
x − x
= (179)
e 0 − e
Since the combined system matrix is triangular, the eigenvalues can be obtained by considering
the eigenvalues of the diagonal elements, that is, the eigenvalues of the 𝒜𝒜 – ℬ𝒦𝒦 and 𝒜𝒜 – ℒ𝒦𝒦
matrices. Furthermore, since neither of the two matrices interact with each other, it can be
concluded that both can be designed separately and then combined. As long as each is stable, then
the overall system will also be. This result is called the separation principle and is a very powerful
result in designing state-feedback systems.
161
Section 5.1.2.2: Proportional, Integral, and Derivative (PID) Control
Another class of common controllers is the proportional, integral, and derivative (PID)
controllers. This class of controllers provides effective control for many industrial processes and
can be configured to deal with a wide range of different situations. The general form of the PID
controller can be written as
1
Gc = K c 1 + +τ Ds (180)
τIs
where Kc is the proportional term or controller (proportional) gain, τI is the integral term or
the integral time constant in units of time, and τD is the derivative term or the derivative time
constant in units of time. Another common representation is given as
1
Gc =K c + K I + KDs (181)
s
where KI is the integral gain and KD is the derivative gain. In many industrial plants, it is possible
to find the terms reset for integral and rate for derivative, for example, τI would be called the reset
time constant.
In industry, different combinations of this controller can be found including the rather
common proportional and integral controller (PI), where τD = KD = 0, that is, the D-term is ignored.
In order to understand the behaviour of this controller, each of the three terms (P, I, and D) will be
investigated separately. As well, the two common configurations (PI and PID) will be considered
in greater detail.
where Rs is the setpoint which gives a step change of Mr and Kp is the process gain. It is assumed
that the overall closed-loop transfer function is stable. From Equation (182), it can be seen that the
162
steady-state value for the closed-loop transfer function is not 1. This implies that the final value
will not be equal to the setpoint. For this reason, pure P-controllers are rarely used.
Example 25: Investigation of the Proportional Term on Stability and Performance
Consider the following first-order system
1.5
Gp = e −10 s (183)
20 s + 1
controlled with a proportional controller Gc = Kc. Setting Kc equal to −0.25, 0, 0.5, 1.0, and 2.0,
show how the closed-loop response to a step change of 2 in the setpoint changes.
Solution:
Figure 71 shows the results for changing the Kc. It can be seen that for none of the cases is
the setpoint attained. There is offset for all of the cases. Furthermore, for Kc = 0, the process
remains at zero, since no control is being implemented. As Kc increases, the amount of oscillation
and length of time required to attain a steady-state value increase. In fact, if Kc is increased further,
the process will become unstable. Similarly, for Kc < 0, the process is initially stable. However,
increasing the value will rapidly make the system unstable.
163
Section 5.1.2.2.b: Integral Term
The integral term, τI, provides a measure of additional stability to the system as well as
removing any bias present. It represents the contribution of past errors on the current controller
action. In general, the integral term is always combined with a proportional term to give the
proportional and integral controller. Furthermore, a controller containing only the integral term
will have no bias or offset, that is,
1
s G
sGc G p τIs p Mr M rGp
lim = Rs lim = lim = Mr (184)
s →0 1 + G G s →0 1 s s →0 τ s + G
c p 1+ G I p
τIs p
where Rs is the setpoint which makes a step change of Mr. It is assumed that the overall closed-
loop transfer function is stable. From Equation (184), it can be seen that the closed-loop gain is
exactly equal to the step change in the setpoint, which implies that there will be no bias or offset.
Since the integral term represents the effect of past errors on the current controller action,
it is possible that in a real implementation, integral (reset) wind-up can occur. This occurs when
the controller output is above the physical limit of the actuator. Since the controller does not have
a way of knowing that the physical limit has been reached, it continues to increase the desired
controller output as the error keeps on increasing. This makes the integral term very large. When
there is a need to now decrease this value, the controller decreases the output value from its large,
unphysical value until it goes below the upper limit. The time delay between when the actuator
should have started to respond and when it is observed to be responding is called integral wind-up.
This is shown in Figure 72, where it can be seen that at 100 min, when the setpoint is changed, it
takes the process another 20 minutes before it even starts changing, since the true actuator value
remains saturated at its upper limit. Integral wind-up can be avoided by including the physical
limits of the actuator in the controller, that is, by making values beyond the physical limits of the
actuator equal to the physical limit.
164
3
Setpoint
Actual
2
Process output, y
1
0
0 50 100 150 200 250
10
Controller
Actual
5
Input, u
Integral Wind-Up
165
Figure 73: Effect of Changing τI for a I-Controller. The solid, black line is the setpoint.
where Rs is the setpoint which makes a step change of Mr. It is assumed that the overall closed-
loop transfer function is stable. From Equation (186), it can be seen that irrespective of the change
in the setpoint, the system will return to zero, which implies that the derivative term cannot track
the setpoint. Therefore, the main role of the derivative term is for disturbance rejection, since in
that case, it is desired that the system return to the same initial value.
The derivative term as written cannot be physically realised, since the numerator is greater
than the denominator. In order to avoid this problem, it is common to rewrite the derivative term
into the following form:
N (187)
Gc , real = τ D
N
1 +
s
166
where N is a filter parameter to be selected. It can be noted that as N → ∞, this form will become
equal to the original version.
Using a derivative term introduces two potential problems into the control strategy: jitter
and derivative kick. Jitter occurs when error signal fluctuates greatly about some mean value
causing the estimated value of the future error to also fluctuate greatly. This in turn causes
unnecessary fluctuations in the controller output, which can lead to issues with the actuator. Figure
74 shows the typical situation where jitter is present. Jitter can be mitigated by filtering the error
signal used in computing the derivative term with a low-pass filter, which removes the high
frequency component of the noise. Derivative kick occurs when the setpoint has a sudden change
in value (for example, a step change) causing the instantaneous error to be practically speaking
infinite. This causes the controller error to spike for a very short period of time after the change
occurs. Figure 75 shows the typical situation when derivative kick occurs. When the setpoint
changes at 10 s, there is a corresponding spike in the actuator value. Note that in practice, due to
saturation in the actuator, the impact of the derivative kick will be less than shown. Nevertheless,
it will be present. Derivative kick can be lessened by solely using the change in the output rather
than the error when computing the derivative term, that is,
ut = τ D syt (188)
Since it has been shown that the overall impact of the derivative term is primarily for disturbance
rejection, that is, making yt ≈ 0, this approach is reasonable.
167
4
2
Output, y
Setpoint
-1
Actual
-2
0 50 100 150 200 250 300 350 400 450
Time (s)
168
controlled with a derivative controller Gc = τDs. Varying the value of τD from 1 to 11 in increments
of 2 show the closed-loop response of the controller to a white-noise disturbance of magnitude
0.05.
Solution:
Figure 76 show the results. It can be seen that as the magnitude of the D-Term increases,
so does the magnitude of the response. This implies that the D-Term only influences the magnitude
of the response.
169
will provide a bias-free controller. This controller can be interpreted as only considering the current
and past information about the process and how that impacts the overall control performance.
PI control can be used for both disturbance rejection and setpoint tracking in many different
applications including flows, levels, and temperatures. Large time delays and highly nonlinear
systems can limit its effectiveness.
Kc 1 −1 2
=uk (1 − z −1
) + + τ (1 − z ) εk (192)
(1 − z −1 ) τI
D
Equation (192) is often called the positional form of the discretised PID controller. Re-arranging
Equation (192) to give
1 2
(1 − z ) u
−1
k =∆uk =K c (1 − z −1 ) + + τ D (1 − z −1 ) ε k
τI
(193)
produces another common PID equation called the velocity form of the discretised PID controller.
In industrial implementations, it is possible to encounter both forms. Although these forms do not
have an impact on controller design, they will have an impact on understanding the values obtained.
170
Section 5.1.2.3: Controller Tuning
Having established the different types of controllers that can be used and understood some
of behaviour of the parameters on the overall control system, the remaining question is how do we
correlate a given set of performance criteria (for example, the objectives of control previously
mentioned) and the different controller parameters. One easy approach would be to use some
simulation software to obtain the desired parameter values using a trial-and-error method. As one
can easily see, this approach could take very long and not necessarily provide the optimal
parameter values. Instead, various correlations or approaches have been developed that will allow
for the performance of a controller to be specified. In this section, we will consider the methods
for tuning state-space controllers and PID controllers. Irrespective of the approach used, there will
always be a need to simulate the resulting control system to make sure that there are no issues with
the performance. Furthermore, it should be noted that for certain applications, there exist, specific
controller tuning rules that provide optimal performance for the problem at hand, for example,
level controllers are often tuned using special rules that seek to minimise large deviations from the
setpoint.
The general approach to controller tuning can be summarised by Figure 77. Before starting
the tuning procedure, it is required that the process be understood or modelled, that the
performance criteria be clearly specified, and that the control strategies of interest be known. The
first step will be to determine the initial controller parameters, followed by a simulation (or actual
implementation, if the system can handle repeated perturbations). Based on the test and a
comparison with the desired performance, new controller parameters can be obtained and new tests
performed. This would be repeated until either the desired criteria are satisfied or the time available
has run out. At this point, it may happen that the process understanding is found to be deficient
and additional information would need to be sought. If the controller has not been implemented on
the real system during the initial controller testing, then it will be necessary to repeat this procedure
once more on the actual system. Very often, it will be found that the performance may not be as
expected given the differences between the simulated and actual processes. However, following
this procedure will minimise the risk of the occurrence of such a situation.
171
Figure 77: Controller Tuning Workflow
n −1
2) Compute ∆( s ) = s + α1s + + α n −1s + α n , which is the characteristic polynomial of .
n
172
−α1′ −α n′ −1 −α n′ 1
1 0 0 0
3) Compute =
= , .
0 0 0 0
0 0 1 0 0
4) Compute = n−1 and ′ = n−1 .
[α1′ − α1 α n′ − α n ] ′ −1 .
5) =
Similarly, Ackermann’s formula, uses the following steps to place the poles:
n
1) Compute ∆( s ) = ∏ ( s − λi ) = s n + α1′s n −1 + + α n′ −1s + α n′ .
i =1
n −1
2) Compute ∆( s ) = s + α1s + + α n −1s + α n , which is the characteristic polynomial of .
n
−α1′ −α n′ −1 −α n′ 1
1 0 0 0
3) Compute =
= , .
0 0 0 0
0 0 1 0 0
4) Compute = n−1 and ′ = n−1 .
5) [ 0 0 1 ]1×n ∆ ( ) .
−1
=
It is also possible to design the observer using Ackermann’s formula which gives
= ∆ ( ) −1 [ 0 1 ]1×n
T
0 (194)
When using pole placement, the following points should be borne in mind:
1) The magnitude of 𝒦𝒦 gives the amount of effort required to control the process. The
further the desired poles are from the actual poles of the system, the larger the controller
gain 𝒦𝒦.
2) For multi-input systems, 𝒦𝒦 is not unique.
3) (𝒜𝒜, ℬ) and (𝒜𝒜 − ℬ𝒦𝒦, ℬ) are controllable. However, due to pole-zero cancellations, the
resulting system may not be observable.
4) Discrete systems can be controlled in the same manner, mutatis mutandi.
173
obtained, they will be fine-tuned to obtain the desired performance. There are two main approaches
to controller tuning: model-based and structure-based.
In model-based controller tuning, a model of the process is required and the closed-loop
behaviour of the resulting system is specified. Using this information, it is possible to obtain the
resulting form of the controller transfer function. Comparing the resulting controller transfer
function with the standard PID controller allows equations for the constants to be determined. The
most common model-based approach is the internal model control (IMC) framework. The main
advantage of this approach is that it allows the engineer to specify the desired closed-loop
behaviour of the system, while the main disadvantage of this approach is that a relatively accurate
model of the system is required. Note that the specification of the closed-loop transfer function
can be used to add robustness to the system by changing the speed (time constant) of the response.
The faster the system responds to changes the less robust is the resulting closed-loop system. In
many cases, the simplified IMC (SIMC) rules provide better control performance for industrial
systems. The SIMC rules take into consideration additional factors, such as disturbances in the
input and faster response for systems with large time constants. SIMC rules recommend PI
controllers for first-order systems and PID controllers for second-order systems.
In structure-based controller tuning, the structure (or type) of a controller, the objective
(disturbance rejection or setpoint tracking), and metric for measuring good control are specified.
Minimising this metric allows the values of the parameters to be determined. The most common
structure-based approach is using the integrated time-averaged error (ITAE) as the metric. Using
the ITAE metric penalises persistent errors, which can be small errors that last for a long period of
time, and provides a conservative approach to control. The main advantage of this method is that
a model of the system need not be provided, while the main disadvantages are that the engineer
has no control over the closed-loop response of the system and that the resulting system is not very
robust to changes in the process.
Table 26 and Table 27 present some common tuning methods for first-order transfer
functions. Table 28 presents the SIMC tuning method for a second-order transfer function. It
should be noted that the PID controller has the following series form:
1
Gc =K c 1 + (1 + τD s ) (195)
τI s
174
where the controller parameters with the tilde (◌̃) have the same meaning as the corresponding
controller parameters without a tilde.
Controller Method Kc τI
τ
ITAE 0.586 θ
−0.916
Structure-based
θ
(setpoint tracking) K τ 1.03 − 0.165
τ
ITAE 0.859 θ
−0.977
τ θ
0.680
(disturbance rejection) K τ 0.674 τ
SIMC
Model-based
1 τ
(τc chosen so that τc / θ > 0.8 min(τ, 4(τc + θ))
K θ +τc
and τc > τ / 10)
Controller Method Kc τI τD
τ
ITAE 0.965 θ
−0.85
θ
0.929
Structure-based
θ 0.308τ
(setpoint tracking) K τ 0.796 − 0.147 τ
τ
ITAE 1.357 θ
−0.947
τ θ
0.738
θ
0.995
0.381τ
(disturbance rejection) K τ 0.842 τ τ
IMC
τ
Model-based
2 +1 τ
(τc chosen so that 1 θ θ
+τ τ
τc / θ > 0.8 and K 2τC +1 2 2 +1
θ
θ
τc > τ / 10)
K 1 τ1
Gp = e −θ s min(τ1, 4(θ + τc)) τ2
(τ 1s + 1)(τ 2 s + 1) K θ +τc
with τ 1 > τ 2
175
Example 28: Designing a PI Controller
Consider the following first-order system
1.5
Gp = e −10 s (196)
20 s + 1
Determine the controller parameters for a PI controller using the IMC method.
Solution
Before solving the problem, it is helpful to determine the values of the various constants
Gain: K = 1.5
Time Constant: τ = 20
Time Delay: θ = 10
For the IMC method, there is a need to also specify the value of τc, which is essentially the closed-
loop time constant. The smaller the value, the faster the response is, but less robust is the overall
system. The constraints given with this method imply that τc > 0.8θ = 8 and τc > 0.1τ = 2. For the
purposes of this example, set the value of τc to be 10, which satisfies both constraints.
Therefore, the controller parameters can be computed from Table 26 as follows:
1 τ 1 20 2 (197)
=Kc = =
K θ + τ c 1.5 10 + 10 3
τ I= τ= 20 (198)
The resulting behaviour of the closed-loop system is shown in Figure 78. It can be seen that the
process responds almost exactly as expected.
3
2.5
1.5
Process Value
1
Setpoint
Actual Value
0.5
-0.5
-1
0 50 100 150 200 250 300 350 400 450
Time (s)
176
Section 5.1.2.4: Controller Performance
Once a controller has been designed, it is often necessary to measure its performance and
determine if the controller is attaining its objectives. As with any such measurements, performance
is measured against some (engineering-related) specification. Unlike most other equipment, the
specification for a controller involves time, either explicitly when speed of response is a criterion,
or implicitly, for statistics such as standard deviation. The performance of a controller can be
measured based on two different sets of criteria: how the controller responds to a change in setpoint,
that is, the servo response, and how the controller responds to disturbances, that is, the regulatory
response.
Since the objective in servo response performance is how well the controller responds to a
setpoint change, it is easy to determine an appropriate measure for performance assessment. For
this reason, servo response is often used to design a controller. As a first approximation, a closed-
loop system can be considered to be a second-order system with time delay. Therefore, the
response of the closed loop to a step change in setpoint would be the step response of a second-
order system. The most common servo control performance measures are just characteristics of a
second-order system responding to a step input, that is, rise time, overshoot, and settling time of
the controlled variable, as shown in Figure 79. The rise time, τr, is defined as the first time the
process reaches the setpoint value. The overshoot is defined as the ratio of how much the process
goes over (or under) the setpoint divided by the magnitude of the step change. Note that if the step
change is negative, then the overshoot will also be negative (that is, it is really an undershoot) so
that the ratio remains positive. The settling time, τs, is defined as the last time for which the process
lies outside the 5% bounds. The 5% bounds are defined as a boundary on either side of the new
setpoint that is defined as 2.5% of the difference (yss, 2 – yss, 1), where yss is the steady-state value
and the numeric subscripts represent the initial and final values. The settling time is roughly three
times the closed-loop time constant.
177
4
Setpoint
3.5 Actual Value
3
a
2.5
2 0.05b
Process Value
1.5
b
0.5
Settling time,
0
τs Overshoot = a/b
-0.5
0 50 100 150 200 250 300 350
Time (s)
Rise time, τr
On the other hand, for performance assessment of regulatory response, the objective is less
certain. Instead, various quantitative measures are used to quantify performance assessment,
including:
1) Standard deviation of manipulated variable: This is the simplest and most important
measure of control performance. However, it is difficult to specify the desired value a
priori since it depends on the nature and magnitude of disturbances affecting the process.
What can be specified, or at least described qualitatively, is the trade-off between control
error and control action. One way of thinking of a controller is that it moves variation
from one variable (usually the controlled variable) to another (usually the manipulated
variable). As disturbances affect the process, the controller will respond by changing the
178
manipulated variable. The response will then mitigate the effect of the disturbances.
Larger disturbances will require greater control action than small disturbances.
2) Mean of the output variable: This can be used to assess how well the controller
maintains the given setpoint in the presence of disturbances.
3) Advanced performance assessment: More advanced performance assessment methods
are available, such as the minimum variance controller and the Harris Index, which can
provide appropriate benchmarks for determining good performance.
179
own SISO control loops. A decoupler basically takes the controller output from the other
controllers and treats them as a measurable disturbance that needs to be counteracted. Decouples
can be very effective in controlling a multivariate system when the interactions are relatively
straight forward and not too nonlinear.
In feedforward control design, the objective to design a controller that can compensate for
a measured disturbance before it can affect the process. Assume that the process model is Gp and
the disturbance model is Gd, then for the feedforward controller shown in Figure 80, the basic form
of the feedforward controller can be written as
Gd (199)
G ff = −
Gp
In the ideal situation, this will exactly cancel out the effect of the measured disturbance. However,
in practice, such a controller cannot be implemented for the following two reasons:
1) Time Delay: If the time delay in the process response is larger than the time delay in the
disturbance response, then the overall time delay for the process will be negative
requiring knowledge of future information about the process. Since such a situation is
impossible, the general solution is to drop the unrealisable time delay from the final
controller.
2) Unstable Zeroes in Gp: If the process contains unstable zeroes, then the resulting transfer
function will also be unstable. In such a case, it will not be possible to realise the
controller. A common solution in this case is to drop the offending zeroes from the final
representation.
There are two common feedforward controllers that can be designed:
1) Static controllers where only the gains of the process are considered, that is,
Kd (200)
G ff = −
Kp
180
where τp is the process time constant, τd is the disturbance time constant, and θff = θd – θp.
If θff is negative, then the term is often ignored. Ideally, |τp / τd| < 1, which avoids large
spikes when this controller is used.
For the simulation, assume that the measured disturbance is driven by Gaussian white noise with
a magnitude of 0.5 and there is a step change in the setpoint of 2 units after 100 s.
Solution
Using Equation (200), the static feedforward controller can be computed as
K −0.5 1 (205)
G ff , s =
− d =
− =
Kp 1.5 3
Note that the gain can be obtained by setting s = 0 and evaluating the resulting value.
When creating the dynamic feedforward controller, it is important that the transfer
functions be written in their standard form, that is, all roots are of the form τs + 1. In this particular
example, the zero of the process transfer function needs to be written into this form to give
1.5 ( − s + 1) −10 s
Gp = e (206)
( s + 1)(10s + 1)
The dynamic feedforward controller can be designed using Equation (199). This gives
−0.5
e −5 s
G ff , d =
−
Gd
=
−
( 5s + 1)( 7 s + 1) 1
=
( s + 1)(10s + 1) e5 s (207)
Gp 1.5 ( − s + 1) 3 ( 5 s + 1 )( 7 s + 1)( − s + 1)
e −10 s
( s + 1)(10s + 1)
However, this controller as written cannot be realised since there is an unstable pole and the time
delay requires future values. In order to obtain a realisable dynamic feedforward controller, both
181
the unstable pole and time delay terms will be dropped. This gives the following form for the
controller
1 ( s + 1)(10 s + 1)
G ff ,d = (208)
3 ( 5s + 1)( 7 s + 1)
Figure 81 shows the effects of both feedforward controllers on the process. It can be seen
that without the feedforward controller the process has greater oscillations. Adding the static
feedforward controller tends to decrease the impact of the oscillations. However, the behaviour is
still rather jittery. The dynamic feedforward controller has smoothed out the jitter and the
behaviour is cleaner.
2.5
1.5
Setpoint
w/o Feedforward Control
Output, y
1 Static Feedforward
Dynamic Feedfoward
0.5
-0.5
0 50 100 150 200 250 300 350 400 450
Time (s)
182
example, a pressure relief valve will only open if the pressure is above a certain value and will
close once the pressure falls below the threshold.
Another type of discrete event control is interlocking, where a specified set of
circumstances must hold before a given action can occur, for example, a microwave cannot be
started until the microwave door has been closed, which minimises the impact of the radiation on
the user. Interlocking is an important component of safety considerations in order to prevent
operators from taking inappropriate action. Designing the correct interlocks can be a challenging
proposition.
A special type of discrete-event control occurs when binary signals are used, for example,
a sensor will report when the elevator has reached the correct floor, and then the motor of the drive
will be switched off. The exact height of the elevator above the ground is not continuously
measured and monitored. When dealing with binary signals, there are two possible types of
controllers: logic control and sequential control.
In logic controllers, also called combinatorial controllers, one obtains the control variable
as a combination, that is, a logical operation, of signals, for example, system output signals (sensor
values such as door open or closed) or user inputs (e.g emergency button pressed or not pressed).
Consider a simple example of a lathe. A lathe is turned on when the user presses the power button
and the chuck is closed. The lathe is switched off when an end position is reached or the emergency
stop button is pressed.
In sequential control, individual control operations are performed in certain steps. The
advancement to the next step occurs either after a certain time has passed (time-dependent
sequence control), for example, a simple traffic light, or in the presence of a specific event
(process-dependent sequence control), for example, traffic lights that change their signal when a
pedestrian presses the button. In contrast to the logic controllers, it is therefore not possible to
clearly determine the manipulated variable even if all signal values are known, since one also has
to know at which point in the process one is currently located.
183
subsidiary (or slave) controllers. They can be used to control large systems containing many
different variables and even locations. A supervisory control system can range from a simple
nested control loop system to complex model predictive control systems. There are two primary
control systems cascade control and model predictive control (MPC), which is often called
advanced process control (APC) in the petrochemical industry.
184
Figure 82: Block Diagram for Cascade Control
185
There are many different implementations of model predictive control. The most popular
implementation in the industry is the dynamic-matrix controller (DMC) approach, which is
detailed here. The objective function for model predictive control is
min
∆u
( ) ( )
r − yˆ T r − yˆ + ∆u T ∆u
( ) ( )
subject to (209)
yˆ = y * + ∆u
where r is the reference vector, ŷ the vector of the predicted process values with control, 𝒬𝒬 the
process scaling matrix, ∆u the vector of the changes in the controller action, ℛ the input scaling
matrix, y* the vector of the process values without control, and 𝒜𝒜 the dynamic matrix.
Furthermore, let m be the control horizon, p the prediction horizon, d the process deadtime, and n
the settling time. It should be noted that 1 ≤ m ≤ p – d and p > d.
The solution requires the step response of the process, that is,
∞
=yt ∑a z i
−i
∆ut (210)
i =1
where ai is the step-response coefficient. The step-response coefficient can be calculated either by
polynomial division of the transfer function model or using the coefficients of the impulse response.
The coefficients ai of the step response have the following relationship to the coefficients of the
impulse response hj
(211)
i
ai = ∑ h j
j =1
Furthermore, the settling time is defined as the time at which the first coefficient an is within a
range of between 0.975 and 1.025 times the value of a∞, where a∞ is the steady-state value. All
step response coefficients after the settling time n can be assumed to be equal to an + 1. The p × m
dynamic matrix 𝒜𝒜 can written as
a1 0 0
a a1
2
= 0 (212)
a1
a p a p −1 a p − m +1
For a univariate system with only one input variable and one output variable, the solution for
Equation (209) is
186
( + ) T T ( r − y * )
−1
u K C=
∆= e T
(213)
where
n
yt*+l =yt − ∑ ( ai − al +i ) ∆ut −i (214)
i =1
Once the solution has been implemented, then the first control action Δu1 will be implemented by
the controller. At the next sampling time, the above optimisation procedure is repeated, a new
optimal value is calculated, and the first control action is implemented. This allows the system to
take unexpected process changes into consideration.
Example 30: Design of a Model Predictive Controller
Design a model predictive controller for the following SISO system:
2 z −1
Gp = (215)
1 − 0, 75 z −1
Set up the required matrices and perform the first step of the iteration. For this, assume that m = p
= 3. Let 𝒬𝒬 = ℐp and ℛ = ℐ3, where ℐn is the n×n identity matrix. Furthermore, a step change occurs
at t = 0, with the process having previously been in steady state.
Solution
To determine the required model predictive controller, we must first determine the step-
response model. This can be determined using long division, which gives the impulse response
coefficients from which the step response coefficients can be easily calculated. Thus,
2 z −1 + 1.5 z −2 + 1.125 z −3
1 − 0.75 z −1 2 z −1 (216)
−2 z −1 + 1.5 z −2
1.5 z −2
−1.5 z −2 + 1.125 z −3
1.125z −3
It can be seen that hi = 2(0.75)i – 1 for i ≥ 1. In general, for a transfer function of the form
β z −d (217)
Gp =
1 − α z −1
the coefficients of the impulse response can be given as
βα i − d i≥d
hi = (218)
0 i<d
The required step response coefficients can be found using Equation (211)
187
i i
ai
= j h ∑ 2 ( 0.75 )
∑= j −1
(219)
=j 0=j 1
1 − α i − d +1
ai β=
(1 − 0.75i )
(220)
= 2
1−α 1 − 0.75
It follows that
=
(1 − 0.75)
a1 2= 2
1 − 0.75
=
( 1 − 0.752 )
a2 2= 3.5 (221)
1 − 0.75
=
(1 − 0.753 )
a3 2= 4.625
1 − 0.75
Incidentally, since d = 1 for this example, the step response coefficients with a smaller d have a
value of zero and can thus be ignored in the summation.
In the next step, the settling time is calculated. For a converging geometric series (implies
that the process of interest is stable), the value to which the series converges is given by
β 2
(222)
K=
p a=
∞ = = 8
1 − α 1 − 0.75
This gives the settling time for the first value for which the process lies in the interval 0.975×8 and
1.025×8. Since the process under consideration has no oscillations, only the lower limit is of
interest to us. Given that the settling time is equal to the value of i in Equation (220), we get
1 − α n − d +1 0.975β
β = , (223)
1−α 1−α
Note that n is always an integer, so we need to round the resulting value up to the nearest integer
value.
The 3×3 dynamic matrix 𝒜𝒜 is then
188
a1 0 0
a a1
2 2 0 0
= = 0 3.5 2 0 (226)
a1 4.625 3.5 2
a p a p −1 a p − m +1
This gives
T
2 0 0 1 0 0 2 0 0 1 0 0
+ 3.5
T
2 0 0 1
0 3.5 2 0 + 0 1 0
4.625 3.5 2 0 0 1 4.625 3.5 2 0 0 1
(227)
38.640 625 23.1875 9.25
= 23.1875 17.25 7
9.25 7 5
17.25
9.25 7 5
(228)
0.134 046 −0.184 200 0.009 896
−0.184 200 0.387 349 −0.201518
=
0.009 896 −0.201 518 0.463 818
1
r = 1 (230)
1
189
The predicted uncontrolled position will be equal to the steady state value, i.e. zero since no control
has been made. This implies that
0
*
y = 0 (231)
0
Only the first controller action Δu1 = 0.363 902 will be implemented. At the next time point,
Equation (232) will be recomputed using the new values for r and y*.
For a multivariate system, the vectors and matrices become “supervectors” and
“supermatrices”, meaning that a vector consists of many vectors, for example
∆u1
(233)
∆u =
∆uh
where ∆ui is the input vector for the ith input. Let us consider a MIMO System with s outputs and
h inputs. This gives a dynamic matrix 𝒜𝒜 with the following form
11 1h
= (234)
s1 sh
where 𝒜𝒜ij is the dynamic matrix between the jth input and ith output. From Equation (213), it
follows that
h n
yi*,t +l =yi ,t − ∑∑ ( aij ,k − aij ,l + k ) ∆u j ,t − k (235)
=j 1 =
k 1
and
190
ps
∆u j = ∑ k ( r − y ),
i =1
ji i
*
i j = km + 1, k = 0,1,..., h − 1 (236)
where aij, k is the kth coefficient of the step response for the process between the jth input and ith
output and Δuj, t – k is the change in the control action for the jth input at time point t − k.
191
where Kdb is the deadband constant. The deadband can be specified as either some fixed value of
the setpoint (for example, within 5°C of the setpoint) or as a percentage (within 5% of the setpoint).
Deadbanding is useful when tight control is not desired, that is, small deviations are permissible.
It is often used with level control for surge tanks as these will often need to maintain a general
level rather than a specific value. Furthermore, the controller can be made more aggressive outside
the band to quickly drive the system to the desired value.
A more generalised approach to deadbanding is called gain scheduling, where the
controller gain changes depending on the value of the scheduling variable. Most often, the domain
of the scheduling variable is partitioned into different regions. For each region, a different
controller gain may be assigned. Mathematically, this can be written as
K c ,1 st < K gs ,1
K K gs ,1 ≤ st < K gs ,2
c ,2 (238)
ut = Gc
K c ,n
K gs ,n < st
where Kc, i is the controller gain for the ith region, Kgs, i is the ith scheduling limit, and st is the
scheduling variable. This approach allows for a nonlinear process to be controller with a series of
linear controllers, which would not be possible with a single controller.
where sign is the sign function that returns −1 if et is negative, 0 if the value is zero, and 1 otherwise.
192
When implementing ratio control, the ratio itself should not be controlled, but rather the
ratio controller should set the setpoint for one of the variables using the ratio, for example, if R =
u1 / u2, then we could set u2 = Ru1 and use this u2 as the setpoint to the u2 controller. In all cases,
division should be avoided since if one of the variables becomes zero, this will then cause an error.
As well, it should be noted that ratio control is implemented using the absolute values of the
variables and not their deviational values as is common with other forms of control.
R = (F2 / F1)s
F2s
× FC
Solids (F1) F2m Water (F2)
Valve
Process
ym
ys VC
Product (y)
193
Section 5.5.5: Input-Position Control
Input-position control, also called valve-position control, allows controlling multi-input,
single-output systems using more advanced methods. In this control strategy, it is normally
assumed that there are two inputs: a fast-acting but expensive (or otherwise restricted) input, u1,
and a slow-acting but cheap (or otherwise abundant) input, u2. An example would be cooling an
exothermic reactor using both coolant (expensive, but fast) and cooling water (abundant, but slow).
In general, the cheap input is used for controlling the process, but the expensive input can be used
to improve the speed of response. Basically, at steady state, it is assumed that the expensive input
will attain some steady-state value u1s, so that the overall process will be controlled by u2. A
schematic of this control strategy is shown in Figure 85.
ys − u1
Gc1
u1s Process
− u2
Gc2
Since input-position control can be treated as a modification of cascade control, the fast
loop given by u1 is tuned first and then the slower loop given by u2. This also implies that the rule
regarding time constants between the loops for cascade control should hold, that is, τc2 / τc1 should
be between 4 and 10. In general, both controllers are designed as simple PI controllers without any
anti-windup features.
194
Section 5.5.6: Nonlinear Characterisation
Nonlinear characterisation allows nonlinearities present in actuators to be dealt with
separately from the controller itself. The nonlinear characterisation block converts the linear
controller output into the nonlinear actuator output, for example, if the controller gives a flow rate,
then this block can convert the flow rate into the corresponding value. Very often, this block is a
look-up table with interpolation between the given data points. Such an approach can allow for the
system to be focused on those areas that are highly nonlinear.
195
2) In closed-loop control, it is important to be able to measure the output.
3) Plant-model mismatch can derail open-loop control.
4) Closed-loop control should provide stable, biasfree, and robust control.
5) A state-space controller requires measurement of the states.
6) In state-space control, the separation principle implies that we can separate the design of
the observer and controller.
7) A proportional-only controller will always provide biasfree control.
8) The integral term considers the effect of future values on the system.
9) Integral wind-up occurs when the disturbance changes a lot causing the manipulated
variable to fluctuate.
10) Derivative kick occurs in PID controllers when there is a step change in the setpoint.
11) Increasing the absolute value of Kc in a PI controller will cause the system to become more
stable.
12) The proportional term in a PID controller considers the current values of the error.
13) A PI controller can be tuned using the IMC method.
14) The rise time of a closed-loop system can be used to determine how well a controller
regulates the disturbance.
15) The settling time is defined as three times the closed-loop time constant.
16) For regulatory controller performance, it is easy to specify the desired values.
17) Feedforward control seeks to minimise the effects of unmeasurable disturbances on the
process.
18) A decoupler is a type of feedforward control.
19) In feedforward control, it may be necessary to remove terms such as time delay or unstable
zeros from the final controller.
20) Interlocking occurs when a series of discrete events must be fulfilled before some action
can occur.
21) Batch control is an example of sequential control.
22) Supervisory control allows us to create a network of controllers each of which can be
controlling another controller.
23) In cascade control, the master controller should always be faster than the slave controller.
196
24) Model predictive control allows constraints and economic conditions to be considered in
controlling the process.
25) Model predictive control requires good models.
197
2 −2 −5 s
=c. G p = e − s , Gd e
( 3s + 1)(10s + 1) 15s + 1
31) Design static feedforward controllers for the processes in Question 31). Simulate and
compare the performance of the two types of feedforward controllers for a setpoint change
of +2. You can assume that the disturbance is driven by Gaussian, white noise.
32) Consider a cascade loop with the following two transfer functions:
2 −2
=G p , slave = e − s , G p , master e −20 s (240)
3s + 1 30 s + 1
Design appropriate PI controllers for this cascade loop. What aspects should you take into
consideration when designing this controller? Simulate the system.
33) Consider the same situation as in Question 32), but now you also wish to ensure that the
slave loop does not have any oscillations and reaches the setpoint as fast as possible. Using
simulations, design appropriate controllers for this system.
34) You need to design a controller for a process whose model has been determined
experimental to be
1
Gˆ p = e −10 s (241)
15s + 1
However, you do not know how well the experimental model reflects the true process.
Using the IMC tuning method, design a PID controller assuming that the experimental
model is correct. Knowing that the model may be incorrect, do not pick a too small τc.
Simulate your model assuming Equation (241) is correct. If your controller is satisfactory,
then try simulating the closed-loop assuming that the true process model is given by
198
35) For the following two-input, two-output system, design a decoupler between u2 and y1. The
PID couplings are y1 with u1 and y2 with u2.
10 −2
e −15 s e −10 s
y1 (10s + 1) (15s + 1)(10s + 1) u1
y = (242)
2 5 (10 s + 1) 5 u2
e −25 s e −30 s
(15s + 1)( 20 s + 1) (10s − 1)
36) Simulate the system given by Equation (242) with and without the decoupler. What is the
effect of the decoupler? The PI controllers are given as
1 1
ε1 = 1 + ( r1 − y1 )
10 25s
(243)
1 1
ε2 = 1 + ( r2 − y2 )
5 40 s
37) Using the DMC method, design a model predictive controller for the following system:
z −10
yt = ut (244)
1 − 0.25 z −1
38) Using the DMC method, design a model predictive controller for the following system:
2 −2 −15 s
e −5 s e
1 10 s + 1
y 5s + 1 u1
(245)
y = 5 4
u
2 e −10 s e −10 s 2
15s + 1 10 s + 1
199
Chapter 6: Boolean Algebra
Boolean algebra is the algebra of binary variables that can only take two values, for
example, true and false or 1 and 0. It is very useful for solving problems in logic and is a
requirement for good programming. George Boole (1815 – 1864) is the discoverer of Boolean
algebra.
A Boolean expression is a group of elementary terms that are linked with connectors
(operators). The mathematical space in which a Boolean algebra is defined will be denoted using
a double-struck B (𝔹𝔹, U+1D539).
Other Word
Operator Symbol Statement
Representations Representation
Conjunction ∧ (U+2227) a ∧ b a·b, ab, AND
a AND b,
a & b
Disjunction ∨ (U+2228) a ∨ b a + b, a OR OR
b, a || b
Negation ¬ (U+00AC) ¬b, b′ b̄ NOT b, !b NOT
Implication → (U+2192) a → b — IF-THEN
Equivalence ↔ (U+2194) a ↔ b — IF-&ONLY-IF
200
All Boolean expressions can be written using ∧, ∨, ¬, 0 and 1. The precedence of the
operators is such that ∧ has a higher precedence than ∨, for example, a ∨ b ∧ c = a ∨ (b
∧ c).
201
b. a ∧ a = a
9) Involution
a. ¬¬a = a
10) Absorption
a. a ∧ (a ∨ c) = a
b. a ∨ (a ∧ c) = a
With these axioms, it is possible to define a complete Boolean algebra.
An important law is De Morgan’s Law:
¬(a ∨ b) = ¬a ∧ ¬b (246)
¬(a ∧ b) = ¬a ∨ ¬b (247)
This law can be used to simplify many complex Boolean expressions or convert between two
representations.
202
Table 30: Truth table for the Boolean Operators (left) AND and (right) OR
AND OR
A B AB A B A+B
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
There are two common representations for Boolean functions: the sum-of-products (SOP)
form and the product-of-sums (POS) form.
203
2) F = (A + B)C
3) F = ABC + B′(D + E)
4) F = BC + DE′?
Solution
Only 1) and 4) are in the sum-of-product form, since these representations are a sum of the
products of individual variables. In 2) and 3), we have a product of many variables (A and B) in 2)
and (D and E) in 3).
A minterm is a row in the truth table where the value is “1”. The symbol for a minterm is
mi, where i is the decimal row number. The compact sum-of-products form is Σm(i,…), where i is
the row number of the minterms. When the minterms are converted into a functional representation,
each variable, whose value is 1, will be written in its plain form, while each variable, whose value
is 0 will be written in its negated form, for example, for m2, the minterm with the value 0102, the
term will be given as A′BC’.
204
A B C F
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
The rows in red are the rows, where the function has a value of 1. We can find the decimal
row number simply by converting the binary representation into a decimal value, that is, for the
first red row (011)
0112 = 2 + 1 = 3
and
1012 = 22 + 1 = 5
1112 = 22 + 2 + 1 = 7
Thus, the compact sum-of-products form is
Σm(3, 5, 7).
It should be noted that the ordering of the Boolean variables is important. When the ordering is
changed, then the compact sum-of-products form will also change.
205
Solution
Only 2) and 3) are in the product-of-sums form, since these representations are products of
sums with individual variables. In 1) and 4), we have a sum of many variables (A, B, and C) in 1)
and (B, C, D, and E) in 4).
A maxterm is a row in the truth table with the value of 0. The symbol for a maxterm is Mi,
where i is the decimal value of the row. The compact product-of-sums form is ΠM(i,…), where i
is the decimal row value of the corresponding maxterm. When maxterms are converted into a
functional representation, then each variable with the value of 0 is converted as written, while each
variable with a value of 1 is written in its negated form, for example, M2, the maxterm with the
value 0102, would be written a A + B’ + C.
Example 37: Compact Product-of-Sums Form
What is the compact product-of-sums form for the function F = (A + B)C.
Solution
First, we require the truth table for the function. Then, we can easily find the rows with a
value of 0.
A B C F
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
206
A B C F
1 0 1 1
1 1 0 0
1 1 1 1
The rows in red are the rows where the function has a value of 0. We can obtain the row
number by converting the binary values into a decimal representation, for example, for the first
row (000)
0002 = 0 + 0 + 0 = 0
and
0012 = 0 + 0 + 1 = 1
0102 = 0 + 2 + 0 = 2
1002 = 22 + 0 + 0 = 4
1102 = 22 + 2 + 0 = 6
Therefore, the compact product-of-sums form is
ΠM(0, 1, 2, 4, 6).
It is important to note that the order of Boolean variables is important. When the order is changed,
then the compact product-of-sums form will also change. Also, it is obvious that any terms in the
sum-of-products form are not in the product-of-sums form!
207
A B F
0 1 0
1 0 0
1 1 1
FD = AB + C
The dual of a function is often represented by a superscript D.
208
3) Using the Quine-McCluskey algorithm, which is often used for large (greater than 10
variables) Boolean functions.
In general, the Karnaugh map is the best method for minimising a Boolean function.
The Karnaugh map for three variables is shown in Figure 87. The diagram is created so
that on one axis lies one variable and on the other axis the remaining two variables. Each row and
column has one of the two possible values (0 or 1) so that each adjacent row or column only differs
by one entry, for example, when the row is 01, then the next row must be 11, since only one entry
should be changed.
209
Figure 87: Karnaugh map for the function F = Σm(0, 3, 5)
The Karnaugh map for four variables is shown in Figure 88. Each row and column has two
variables. The Karnaugh map for five variables is shown in Figure 89. When we are looking for 1,
it is common to not bother with writing the 0.
Figure 89: Karnaugh map for the function F = ΠM(2, 5, 7, 9, 13, 15, 16, 17, 18, 20, 24, 25, 27)
210
The general procedure for finding the minimal sum-of-products form is:
1) Construct the Karnaugh map.
2) Circle the 1 into the largest groups possible.
3) Write the corresponding sum-of-product form based on the circled groups. For each group,
we only write the variables whose value is not changed. Variables with a value of 0 are
negated, for example, in Figure 88, for the loop in the first row, A varies between 0 and 1,
which means that it is ignored. The other variables remain constant and have a value of 0.
Thus, we write the negated forms of these variables, that is, B′C′D′.
The general procedure for finding the minimal product-of-sums form is:
1) Construct the Karnaugh map.
2) Circle the 0 into the largest groups possible.
3) Write the corresponding sum-of-product form for F′ based on the circled groups. For each
group, we only write the variables whose value is not changed. Variables with a value of
0 are negated, for example, in Figure 88, for the loop in the first row, A varies between 0
and 1, which means that it is ignored. The other variables remain constant and have a value
of 0. Thus, we write the negated forms of these variables, that is, B′C′D′.
4) Convert F′ to F.
Of course, we can look for the loops using trial and error, but we have no guarantee that we will
find the best loops. Therefore, we wish to find a procedure that we can always find the best loops.
Before we can describe such a procedure, we need to define certain words. An implicant
is a single 1 or group of 1’s. A prime implicant is an implicant that cannot be further combined,
that means, that a single 1 creates a prime implicant if there are not adjacent 1. Two adjacent 1’s
create a prime implicant if they cannot be combined into a group of four 1’s, while four adjacent
1’s create a prime implicant if they cannot be combined into a group of eight 1’s. Figure 90 shows
the difference between an implicant and a prime implicant. We can state that a sum-of-products
form with nonprime implicants is not a minimal form, but not all prime implicants will necessarily
be required for the minimal sum-of-products form. An essential prime implicant is a minterm
that is covered only by a single prime implicant. All essential prime implicants must be in the
minimal sum-of-products form. Thus, we can say that the objective is to find all the essential prime
terms. Figure 92 shows the procedure for minimising a Karnaugh map.
211
Figure 90: Prime implicant and implicant
Solution
1) We start with the first 1 (cell: 0000). The largest group that we can
find is four 1. This group is an essential prime implicant.
2) The next unlooped 1 is in the cell 0010. This 1 can only be combined
with the 1 in cell 0000. This group is also an essential prime implicant.
212
3) The next free 1 is in cell 0111. Here we have two possibilities. We
could make the loop with either cell 0101 or cell 1111. This implies that
we have a prime implicant.
4) The next free 1 is in cell 1011, which we can combine with cell 1111.
This is the only possibility for combining this cell. Therefore, this group
is also an essential prime implicant.
5) The last step is to write the minimal sum-of-product form. First, we will write all the essential
prime implicants, that is, A′B′D′, A′C′ and ACD. Then, we must select one of the remaining
prime implicants (A′BD or BCD). There is no difference between which of these two prime
implicants we select. The minimal sum-of-products form is then
F = A′B′D′ + A′C′ + ACD + {A′BD or BCD}
213
Section 6.5: Chapter Problems
Problems at the end of the chapter consist of three different types: (a) Basic Concepts
(True/False), which seek to test the reader’s comprehension of the key concepts in the chapter; (b)
Short Exercises, which seek to test the reader’s ability to compute the required parameters for a
simple data set using simple or no technological aids. This section also includes proofs of theorems;
and (c) Computational Exercises, which require not only a solid comprehension of the basic
material, but also the use of appropriate software to easily manipulate the given data sets.
214
19) All essential prime implicants are in the minimal sum-of-products form.
20) A Karnaugh map can be used to determine the minimal product-of-sums form.
215
CD
AB 00 01 11 10
1 0 0 0
00
1 1 0 0
01
0 1 0 0
11
0 1 1 0
10
216
Chapter 7: PLC Programming
When using a PLC, it is necessary to transfer the required information to the PLC using
some methods. There are two possible approaches. We could use an ad-hoc approach that depends
on the PLC or situation or we could use some type of standard. It is obvious that using standards
is better since we can re-use the information, for example, the same code can be re-used for
different cases without having to worry about compatibility problems. The IEC/EC 61131 is the
standard for PLC programming and will be described in the following sections. This standard
consists of five different programming languages and a common set of rules that apply to all the
programming languages.
217
3) Remainder of the POU with the instructions.
Before a POU can be used, each programme must be associated with a task. Before we can load a
task into the PLC, we must first define:
1) Which resources do we need? In the standard, a resource is defined as either a CPU (central
processing unit) or a special processor.
2) How is the program executed and with what priority?
3) Do variables have to be assigned to physical PLC addresses?
4) Do references to other programs have to be made using global or external variables?
The priority of a task shows how the given task should be executed. There two important parts to
define the priority:
1) Scheduling: Scheduling focuses on how the programme is executed. There are two
possibilities: cyclically, that is, the programme will be continually executed; and on
demand, that is, the programme will only be executed as need.
2) Priority Type: The priority type represents whether the programme can be interrupted.
Again, there are two possibilities: nonpre-emptive and pre-emptive. A nonpre-emptive
task must always be completed before another task can be started. A pre-emptive task can
be stopped if a task higher priority occurs. Figure 95 shows the two possibilities. As well,
the priority level needs to be set. This ranges from 0 for the highest priority to 3 for the
lowest priority.
Defining the above components creates a configuration. Figure 94 shows a visual representation
of the components of a configuration and how these are combined together.
The call hierarchy is defined as follows: a programme can only call function blocks and
functions. A function block can only call other function blocks and functions, while a function can
only call other functions. Recursion cannot be implemented in this standard. POUs cannot call
themselves nor can they be called as a result of a chain of POUs.
218
Configuration
Resource Resource
Task Task
POU POU
…
Function Block
Function Function
Task …
POU
… Function Block
POU
…
219
the input variable outside of the POU cannot be changed. This concept is also often called
call by value. All POUs can use this type.
3) Output Variables (VAR_OUTPUT): The output variable will be returned to the calling
POU as a value. This concept is also called return by value. All POUs can use this type.
4) Input-and-Output Variables (VAR_IN_OUT): The actual parameter will be transferred
to the called POU as a pointer, that is, the location of the variable will be given so that any
changes made to the variable are directly stored. The concept is also called call by reference.
For variables with complex data structures, this can lead to efficient programming.
However, since the variable location is passed, this means that (undesired) changes will
impact the variable even outside the calling function. All POUs can use this type.
5) External Variables (VAR_EXTERNAL): This variable can be changed outside of the POU
using the variable. An external variable is required to have read and write access to a global
variable of another POU within a given POU. It is only visible for POUs that list this global
variable under VAR_EXTERNAL, all others have no access to this global variable. The
identifier and type of a variable under VAR_EXTERNAL must match the corresponding
VAR_GLOBAL declaration in the program. Only programs and function blocks can use this
type.
6) Global Variables (VAR_GLOBAL): A globally declared variable can be read and written
to by several POUs. To do this, the variable must be specified in the other POUs under the
VAR_EXTERNAL with the same name and type.
7) Access Variables (VAR_ACCESS): Access variables are global variables for the
configurations that act as a communication channel between components (resources) of the
configurations. It can be used like a global variable within the POU.
220
Section 7.3.1: Simple Elements
Each PLC programme consists of basic elements that are defined as the smallest unit that,
when combined together, build declarations and instructions, which form a complete programme.
These simple elements can be classified into delimiters, keywords, literals, and identifiers.
221
Delimiter Meaning, Clarification
4. Separator for components of a FB instance (when
accessing it)
e, E Leading character for exponents of floating-point literals
Quotation Mark ' Start and end of strings
Dollar sign $ Start of a special symbol in a string
Prefix for Time literal Introductory characters for time literals, combinations of
t#,T#; d#, D#; lowercase and uppercase letters are permitted
d, D; h, H; m, M;
s, S; ms, MS;
date#, DATE#;
time#, TIME#;
time_of_day#;
TIME_OF_DAY#;
tod#, TOD#;
date_and_time#;
DATE_AND_TIME#;
dt#, DT#
Colon : Separator for:
1. Time within time literals
2. Definition of the data type for variable declaration
3. Definition of a data-type name
4. Step names
5. PROGRAM ... WITH ...
6. Function name / data type
7. Access path: data / type
8. Jump label before the next instruction
9. Network name before the next instruction
Assignment (Walrus) 1. Operator for initial value assignment
2. Input connection operator (assignment of actual
Operator :=
parameters to formal parameters when calling the POU)
3. Assignment operator
(Round) Brackets (…) Start and end of:
1. Initial value list, also: multiple initial values (with
repetition number)
2. Range specification
3. Field index
4. Sequence length
222
Delimiter Meaning, Clarification
5. Operator in instruction list (calculation level)
6. Parameter list when calling the POU
7. Subexpression hierarchy
Square Brackets […] Start and end of:
1. Array index (access to an array)
2. String length (when declaring a string)
Comma , Separator for:
1. Lists
2. Initial-value lists
3. Array indices
4. Variable names (when there are multiple variables with
the same data type)
5. Parameter list when calling a POU
6. Operator in instruction list
7. CASE list
Semicolon ; End of:
1. Definition of a (data) type
2. Declaration (of a variable)
3. Structured text command
Period-Period .. Separator for:
1. Range specifications
2. CASE branches
Percent % Introductory character for hierarchical addresses for directly
represented and symbolic variables
Assignment Operator => Output binding operator (assignment of formal parameters
to actual parameter when calling a PROGRAM)
Comparison >,<; >=, <=; Comparison operators in expressions
=, <>
Exponent ** An operator in expressions
Multiplication * Multiplication in expressions
Division / Division in expressions
Ampersand & AND operator in expressions
223
using all lowercase, all uppercase, or a mixture of the two. In this book, all keywords are shown
in capitals. The keywords include the following possibilities:
1) Names of elementary data types
2) Names of standard functions
3) Names of standard function blocks
4) Names of the input variables for the standard functions
5) Names of the input and output variables of the standard function blocks
6) The variables EN und ENO in the graphical programming languages
7) The operators of the instruction list language
8) The elements of the structure text language and
9) The elements of sequential charts
Table 32 shows all the keywords in the IEC standard.
A
ABS ANY ANY_MAGNITUDE
ACOS ANY_BIT ANY_NUM
ACTION ANY_DATE ANY_REAL ARRAY
ADD ANY_DERIVED ASIN
AND ANY_ELEMENTARY AT
ANDN ANY_INT ATAN
B
BOOL BY BYTE
C
CAL CLK CTU
CALC CONCAT CTUD
CALCN CONFIGURATION CU
CASE CONSTANT CV
CD COS
CDT CTD
224
D DINT DT
DATE DIV DWORD
DATE_AND_TIME DO
DELETE DS
E
ELSE END_PROGRAM EN
ESIF END_REPEAT ENO
END_ACTION END_RESOURCE EQ
END_CASE END_STEP ET
END_CONFIGURATION END_STRUCT EXIT
END_FOR END_TRANSITION EXP
END_FUNCTION END_TYPE EXPT
END_FUNCTION_BLOCK END_VAR
END_IF END_WHILE
F
FALSE FIND FUNCTION
F_EDGE FOR FUNCTION_BLOCK
F_TRIG FROM
G
GE GT
I
IF INITIAL_STEP INT
IN INSERT INTERVAL
J
JMP JMPC JMPCN
L
L LEFT LN
LD LEN LOG
LDN LIMIT LREAL
LE LINT LT
225
LWORD
M
MAX MOD MUX
MID MOVE
MIN MUL
N
N NEG NOT
NE NON_RETAIN
O
OF OR
ON ORN
P
P PROGRAM PV
PRIORITY PT
Q
Q QU
Q1 QD
R
R RELEASE RETCN
R1 REPEAT RETURN
R_EDGE REPLACE RIGHT
R_TRIG RESOURCE ROL
READ_ONLY RET ROR
READ_WRITE RETAIN RS
REAL RETC
S
S SEMA SINGLE
S1 SHL SINT
SD SHR SL
SEL SIN SQRT
226
SR STN SUB
ST STRING
STEP STRUCT
T
T TIME_OF_DAY TP
TAN TO TRANSITION
TASK TOD TRUE
THEN TOF TYPE
TIME TON
U
UDINT ULINT USINT
UINT UNTIL
V
VAR VAR_EXTERNAL VAR_IN_OUT
VAR_ACCESS VAR_GLOBAL VAR_OUTPUT
VAR_CONFIG VAR_INPUT VAR_TEMP
W
WHILE WORD
WITH WSTRING
X
XOR XORN
227
we wish to use a reserved symbol in a string literal, we must place a dollar sign before the
reserved symbol, for example, '$$45' will give “$45”. As well, there are various
nonprintable special characters that can be represented using the dollar sign. Table 33 lists
some of the more common special characters.
3) Time Literals, that give the value for time points, durations, and dates.
The octothorpe is used to give additional information about the literal, for example, 2# implies a
binary representation. The additional information always comes before the octothorpe. Common
representations are:
1) Binary Representation: 2#
2) Hexadecimal Representation: 16#
3) Duration Representation: T# or TIME#
4) Date Representation: D# or DATE#
5) Time-of-Day Representation: TOD# or TIME_OF_DAY#
6) Date-and-Time Representation: DT# or DATE_AND_TIME#
20
This term comes from the days of typewriters, where the writing head with the ink ribbon was attached to a carriage
that had to be pushed at the end of each line to the beginning of the new line.
228
It is possible to use any defined data structure with the octothorpe. Numerical and time literals may
also contain underscores in order to make the presentation more legible. Capitalisation is not
important.
Time literals have some special properties. There are multiple different types of time
literals: duration, date, time of day, and date and time. For each case, there is a special
representation with its own rules.
Duration is represented by T#. After the octothorpe, the duration is given using the
following units:
1) d: Day
2) h: Hours
3) m: Minutes
4) s: Seconds
5) ms: Milliseconds
Each unit is separated by an underscore. 21 The units must be placed from largest to smallest. The
smallest unit can have a decimal value, for example, T#1m_10s_100.7ms. The highest value
can “overflow”, for example, the time duration T#127m_19s is valid and will be automatically
converted into the proper representation of T#2h_7m_19s. A negative value is also possible, for
example, T#-22s_150ms.
Dates are represented using D#. After the octothorpe comes the date in scientific notation,
that is, year-month-day, for example, D#2017-02-28.
The time of day is represented using TOD#. After the octothorpe comes the time in the
format Hours:Minutes:Seconds.Decimal Part, for example, TOD#12:45:25.21. Note that the
24-hour clock is used.
The date and time is shown using DT#. After the octothorpe comes the date in scientific
notation followed by a dash and the time in the time-of-day format, for example, DT#2017-05-
30-2:30:12.
21
The underscore is not obligatory to separate the units, but it does help readability of the text.
229
Section 7.3.1.4: Identifiers
Identifiers are alphanumeric strings that allow the PLC programmer to give individual
names to the variables, programmes, and related elements. These include jump and network names,
configurations, resources, tasks, runtime programmes, functions, function blocks, access paths,
variables, derived data types, structures, transitions, steps, and action blocks. The identifiers must
satisfy the following rules:
1) The first element cannot be a number (✗ 1Prog).
2) No more than one underscore can be used together (✗ A__B [with two underscores]).
230
groups of elementary data types that can be referenced by the given general data type given in
brackets:
1) Bit Sequence and Boolean (ANY_BIT)
2) Signed and Unsigned Integers (ANY_INT)
3) Floating-Point Numbers (ANY_REAL)
4) Dates and Times (ANY_DATE)
5) Strings and Durations (ANYSTRING, TIME)
The general data types ANY_INT and ANY_REAL can be represented together by the group name
ANY_NUM.
Table 34: The elementary data types in the IEC 61131-3 Standard. The initial letters in the data types represent: D = double, L =
long, S= short, and U = unsigned.
231
Data Type Keyword Bits Range Initial Value
DT Date with Time dt#0001-01-01-
of Day 00:00:00
TIME Duration — — t#0s
STRING (Single) String — — ''
WSTRING Double (String) — — ""
For an elementary data type, it is possible to define the initial value and range. The initial
value is defined as the value of the variable when it is first used. The range defines what the
possible values for the variable are.
232
Section 7.3.3.3: Data Structures
Using the keywords STRUCT and END_STRUCT, it is possible to define new hierarchical
data structures that contain arbitrary elementary or other already defined derived data types as
subelements. If a subelement is in turn a structure, a hierarchy of structures is created, for which
the lowest structure level is formed of elementary or derived data types.
As in many other programming languages, the components of a data structure are accessed
using a period and the component name, for example, VAR.TEST[3], where the component
TEST is an array.
TYPE
COLOUR : (red, yellow, green);
SENSOR : INT;
MOTOR :
STRUCT
REVOLUTIONS : INT := 0;
LEVEL : REAL := 0;
MAX : BOOL := FALSE;
FAILURE : BOOL := FALSE;
BRAKE : BYTE := 16#FF;
END_STRUCT;
END_TYPE;
where the element COLOUR is an enumeration that can only take the values red, green, and
yellow; SENSOR is an INT; MOTOR is a data structure that contains the following elements:
REVOLUTION with an initial value of 0, LEVEL with an initial value of 0, MAX with an initial
233
value of FALSE, FAILURE with an initial value of FALSE, and BRAKE with a hexadecimal
initial value of FF.
234
Name Symbol Commentary
Copies the value from left to right if and only if
Positive-transition a FALSE → TRUE transition in the variable
sensing contact VarName is detected; otherwise, FALSE is
copied.
Copies the value from left to right if and only if
Negative-transition a TRUE → FALSE transition in the variable
sensing contact VarName is detected; otherwise, FALSE is
copied.
Copies the value on the left into the variable
Coil 22
VarName.
Copies the negated value of the left into the
Negated coil22
variable VarName.
Copies TRUE to variable VarName, if the left
Set coil22
link is TRUE; otherwise, no change.
Copies FALSE to variable VarName, if the left
Reset coil22
link is TRUE; otherwise, no change.
Saves TRUE to the variable VarName if and
Positive-transition only if a FALSE → TRUE transition is detected
sensing coil22 on the left link; otherwise, no change in the
variable.
Saves TRUE to the variable VarName if and
Negative-transition only if a TRUE → FALSE transition is detected
sensing coil22 on the left link; otherwise, no change in the
variable.
22
The value on the left is always transferred to the right-hand side.
235
Name Symbol Commentary
Figure 96 shows how the typical Boolean operators can be implemented in ladder logic.
The AND operator is implemented by placing the two contacts in series, while the OR operator
places the two contacts in parallel. This follows from the observation that the electricity flows
from left to right. For an AND operation, we need both contacts to be true for the electricity to flow.
This implies that both need to be in series. On the other hand, for the OR operation, electricity can
flow through either of the two paths. Therefore, the contacts should be placed in parallel.
23
tnw represents a Boolean variable that determines if the given link should be performed.
236
Figure 96: (top) AND and (bottom) OR in ladder logic
237
Section 7.4.3: Examples of Using Ladder Logic
Example 41: Ladder Logic for a Boolean Function
Please write the corresponding ladder diagram for the following Boolean function:
Q = XY + XZ + YZ
Solution
When we want to create the ladder logic diagram, we should first convert the Boolean
function into a minimal form. In our case, we can easily convert it to
Q = XY + (X + Y)Z
In the ladder logic diagram, we will require (at least) one row for each term that is separated by a
“+”, since each row corresponds to an AND Term. Thus, in our example, we will require 3 rows.
All the values are not negated. Thus, the open contact will be used for all values. In order to save
the resulting function value in Q, we require a coil. Figure 98 shows the ladder logic diagram for
this example.
238
2. Once the fluid reach level sensor 2 (L2), that is, it reads TRUE, close both valves and turn
on the mixer (M1) for five minutes. Go to Step 3.
3. Turn off the mixer and wait one minute. Go to Step 4.
4. Open the bottom valve (V3) and let the fluid drain. Go to Step 5.
5. Once the bottom level sensor 1 (L1) reads FALSE, that is, the tank is empty, close the
bottom value. Go to Step 1.
239
Figure 99: Ladder Logic for Example 42
240
where Label names a given row of instructions and along with the colon can be ignored; the
Operator or Function is an operator in instruction list or a function, Operand is zero, one,
or more constants or variables for the operator or input parameters for the functions that are
separated by commas; and Comments is an optional field that provides additional information
about what the given instruction row does. All fields in italics are optional.
Table 36: Changes in the Current Result for Different Operator Groups
241
Impact of the Operator Group
Abbreviation Example Operators
on the Current Result
Create C LD
Process P GT
Unchanged U ST; JMPC
Unconditional CAL block call, since the
following instruction must reload the current
Undefined −
result, because it does not have a clearly defined
value after the function block has been returned.
LD N ANY Load
ST N ANY Save
S BOOL Set
R BOOL Reset
AND / & N, ( ANY Boolean AND
OR N, ( ANY Boolean OR
XOR N, ( ANY Boolean Exclusive OR
ADD ( ANY Addition
SUB ( ANY Subtraction
MUL ( ANY Multiplication
DIV ( ANY Division
GT ( ANY >
242
Operator Acceptable Modifiers Operand Definition
GE ( ANY ≥
EQ ( ANY =
NE ( ANY ≠
LT ( ANY <
LE ( ANY ≤
JMP C, ( LABEL Jump to LABEL
CAL C, ( NAME Call function NAME.
RET C, ( Return from a function call
) Take the last deferred instruction
The current result can be linked with the result of an instruction sequence using the bracket
operators. When the modifier “(” appears, the associated operator, the value of the current result
and the data type of the current result are cached. The data type and value of the following line are
loaded into the current result. When the “)” operator appears, the cached values and data type
based on the operator and modifiers are linked with the current result. The result is then stored as
the current result. Expressions in brackets can be nested.
Table 38: Two Possibilities for Calling the Function LIMIT(MN, IN, MX)
243
A function has at least one output parameter (function value) that is returned using the
current result. Should the function have additional output parameters, these can be returned using
parameter assignments. A call without formal parameters takes place in one line. The original order
of the output declarations must be observed. In the case of formal parameter assignments, this is
done line by line, followed by bracket line. With formal parameter assignment, the output
parameters are marked with =>, e.g., ENO => ErrorOut means that ENO is an output value
and is saved in the ErrorOut variable. The programming system assigns the function value to a
variable with the function name. This name is declared automatically and does not have to be
specified separately by the user in the declaration section of the calling block.
Table 39: Three Methods for Calling the Function Block ZEIT1(IN, PT) with output variables Q and ET.
244
Method 1 Method 2 Method 3
ST Aus ST Aus
LD ZEIT1.ET LD ZEIT1.ET
ST WERT ST WERT
ST Save CR → 10 1 0 10 10 103
FB1.il FB1.i1
CAL FB1 FB1: internal 10 1 0 10 10 112
computation
245
Instruction (* Comments *) CR X1 X2 W1 FB1.i1 FB1.o1
LD Load the 112 1 0 10 10 112
FB1.o1 output o1
from FB1 → CR
ST W1 Save CR → W1 112 1 0 112 10 112
GT 90 (CR > 90)? → 1 1 0 112 10 112
CR
246
Section 7.6: Function-Block Language (FB)
The function-block language is a graphical model with Boolean operators and complex
functionality represented using blocks. Motivated by electronic circuits, the signals flow between
the blocks and are converted from Boolean inputs into Boolean outputs. Although this language is
based on electrical circuits, the current standard has adopted different representations for the
blocks symbolising AND and OR.
AND
OR
247
Name Symbol Comments
This is placed within the function
Falling block next to the corresponding
Edge variable in order to show a falling
edge transition.
Leaves a POU and returns to the
Return
calling POU.
If the left connection snw 24 is TRUE,
Conditional
then exit the POU and return to the
Return
calling POU; otherwise ignored.
Jump to the network with the given
Jump
identifier NAME.
If the left connection snw24 is TRUE,
Conditional
jump to the network with the given
Jump
identifier NAME; otherwise ignored.
Inputs and outputs are defined upon first use. Figure 100 shows an example of a function
block diagram with common components. The exact method for labelling the variables is not
specified in the standard; any reasonable method can be used.
24
snw represents a subnetwork that returns a Boolean value.
248
Figure 100: Diagram using the Function-Block Language
249
Figure 102: The Function Q in the Function-Block Language
250
The IF command has many different forms. The obligatory components are the IF, THEN,
and END_IF commands. The IF command opens the IF block, while the END_IF closes it. The
other possibilities are the ELSE and ELSIF commands. The ELSE block is only performed if all
previous expressions have been evaluated as FALSE. The ELSIF block is only performed if all
previous expressions have been evaluated as FALSE and the corresponding Boolean expression is
TRUE. This command can be repeated as often as desired. This gives the following possibilities:
1) IF expression THEN code block; END_IF;
2) IF expression THEN code block; ELSE code block; END_IF;
3) IF expression THEN code block; ELSIF expression THEN code block; ELSIF expression
THEN code block; ELSE code block; END_IF;
The FOR command also has many different possibilities. The obligatory parts are FOR,
TO, DO, and END_FOR. The FOR command opens this code block and the END_FOR command
closes it. The TO command specifies the end value and the DO command closes the declaration
line of the FOR command. The optional part is the BY command that gives the step value. If no
step value is given using the BY command, then it is assumed that the step is one. The two
possibilities for the FOR command are:
1) FOR Counter := expression TO expression BY expression DO code block;
END_FOR;
2) FOR Counter := expression TO expression DO code block; END_FOR;
251
Keyword Description Example Comments
IF A>100 THEN
f:=1;
IF … THEN
ELSIF d=e THEN
ELSE, Selection of alternatives using
Branching f:=2;
ELSIF Boolean logic.
ELSE
END_IF
f:=4;
END_IF
CASE f OF
CASE … OF 1: f:=11;
Selects a code block based on the
ELSE Multiple Selection 2: f:=14;
value of the expression f.
END_CASE ELSE f:=-1;
END_CASE;
FOR h:=1 TO 10
FOR … TO …
BY 2 DO Repeated running of a code block
BY … DO FOR Loop
f[h/2]:=h; with start and end conditions.
END_FOR
END_FOR;
WHILE m>1 DO
WHILE … DO Repeated running of a code block
WHILE Loop n:=n/2;
END_DO with end conditions.
END_WHILE;
REPEAT
REPEAT …
i:=i*j; Repeated running of a code block
UNTIL REPEAT Loop
UNTIL i>10000 with end conditions.
END_REPEAT
END_REPEAT;
EXIT Breaking a loop EXIT; Immediate exit from a loop
Command
; Shows the end of a command.
delimiter
252
Operator Description Priority
(…) Brackets Highest
Function(…) Function Evaluation
** Exponentiation
-, NOT Negation, Boolean Complement
*, / Multiplication, Division
MOD Modulo
+, - Addition, Subtraction
>, <, ≤, ≥ Comparison Operators
= Equality
<> Inequality (≠)
AND, & Boolean AND
XOR Boolean exclusive OR
OR Boolean OR Lowest
253
As necessary, the appropriate values are opened or closed to control the tank level. The stirrer can
only work if the tank is full; otherwise, the command is ignored.
Solution
(*Tank States*)
TYPE T_STATE:(FULL,NOT_EMPTY,EMPTY); END_TYPE;
(*Valve States*)
TYPE T_VALVE:(ON,OFF); END_TYPE;
FUNCTION_BLOCK Weightcontrol
VAR_IN
Command: INT;
Weight: Real;
Full_weight,Empty_weight: Real; (*Same data type declared on
one line*)
END_VAR
VAR_OUTPUT
V1: T_VALVE := OFF;
V2: T_VALVE := OFF;
Speed: REAL := 0.0;
254
END_VAR
VAR (*Internal Variables*)
State: T_STATE := EMPTY;
END_VAR
(*Determine the Tank State: Compare the full and empty weights *)
IF Weight >= Full_weight THEN
State := FULL;
ELSIF Weight <= Empty_weight THEN
State := EMPTY;
ELSE
State := NOT_EMPTY;
END_IF
(*Implementation of Commands: 1-Fill, 2-Stop, 3-Stir, 4-Empty*)
CASE Command OF
1: V2 := OFF;
V1 := SELECT(G := State=FULL,IN0 := ON,IN1 := OFF);
(*ON only if G is false*)
2: V2 := OFF;
V1 := OFF;
4: V1 := OFF;
V2 := ON;
END_CASE;
(*Stirrer Speed*)
Speed := SELECT(G := Command=3; IN0 := 0.0; IN1 := 100.0);
END_FUNCTION_BLOCK
255
• Powerful constructs to control the flow of commands.
However, it has the following disadvantages:
• The conversion of the programme into machine code cannot be directly influenced
since it is performed using a compiler.
• The higher abstraction level brings with it a loss of efficiency, that is, the translated
programme is longer and slower.
Figure 104: Steps in Sequential Function Charts: (left) general step and (right) initial step
The transition conditions are marked with a horizontal line with identifiers. The Boolean
description, often called a guard, shows the requirements for a transition to occur. The guard can
be written in any of the other PLC languages. Figure 105 shows some possibilities. The most
frequently used PLC languages for describing transitions is structured text, function block
language, or ladder logic. Often, the guard is ignored.
256
Figure 105: Transitions Conditions in Different PLC Languages
When the POU is called, the specially marked initialisation step is made active. All the
assigned instructions will be performed. When the transition conditions become TRUE, the
initialisation step will be made inactive and the next step will be activated. When a transition
257
occurs, the active attribute (often called a token) is passed from the current active step to its
successor. This active attribute wanders through the individual steps, multiplying for parallel
branches, and coming together again. It may not be completely lost nor is uncontrolled distribution,
which occurs when multiple tokens are present in a single step, possible.
Figure 106: Components of an Action Block: a: Qualifier; b: Action Name; c: Indicator Variable; d: Process Description
258
Qualifier Short Name Description
D delay Means that the action is delayed by the specified time
before being implemented.
P pulse Means that the action occurs for a very short period of
time.
DS delayed and saved Means that the action is first delayed and then saved.
SD saved and delayed Means that the action is first saved and, then after the
delay, if the step is still active, implemented.
SL saved and time Means that a time-limited action is saved.
limited
259
Figure 107: Alternative Paths in Sequential Function Charts
Figure 108: Usual Decision Order for Alternative Paths in Sequential Function Charts
Figure 109: User-Defined Decision Order for Alternative Paths in Sequential Function Charts
260
Figure 110: Parallel Paths in Sequential Function Charts
261
Figure 111: Schematic of the Reactor
Solution
Before the solution to the problem is provided, it is useful to consider the general procedure
for solving such problems. This procedure can be written as
1. Define all the variables and their values, especially for the Boolean variables.
2. Write the process description as a series of steps. Note that a single sentence can be
associated with multiple steps or multiple sentences can be combined into a single step.
3. Draw the sequential function chart.
Defining the Variables
The variables are defined as follows.
Input Variable Symbol Data Type Logical Values Address
Start Button START BOOL Pressed START = 1 E 0.0
Reactor Status S1 BOOL Tank empty S1 = 1 E 0.1
Level Sensor 1 S2 BOOL Level 1 reached S2 = 1 E 0.2
Level Sensor 2 S3 BOOL Level 2 reached S3 = 1 E 0.3
Temperature S4 BOOL Temperature S4 = 1 E 0.4
Sensor reached
262
Pressure Sensor S5 BOOL High-Pressure S5 = 1 E 0.5
Alarm
Valve 1 Y1 BOOL Valve open Y1 = 1 A 4.1
Valve 2 Y2 BOOL Valve open Y2 = 1 A 4.2
Release Valve Y3 BOOL Valve open Y3 = 1 A 4.3
Pressure Release Y4 BOOL Valve open Y4 = 1 A 4.4
Valve
Heater H BOOL Heater on H = 1 A 4.5
Agitator Motor M BOOL Motor on M = 1 A 4.6
Figure 112 shows the sequential function chart along with the corresponding text, so that is clear
how each of the components were created.
263
Section 7.8.5: Validity of a Sequential Function Chart
With sequential function charts, it is easy to create complex networks. However, the
question remains if these networks are truly valid and result in proper operation.
Although there exists a method to determine the validity of a sequential function chart, it
not guaranteed that it will find all valid networks. The proposed method only determines if the
network is valid. If the method fails, there is no guarantee that the chart is truly invalid. The
procedure is:
1) Replace all step-transition-step by a
single step.
264
The validity is then determined using the following rule. A sequential function chart is valid when
the chart can be reduced to an implementable single step.
Example 48: Determining the Validity of a Network
Determine the validity of the following sequential function chart shown in Figure 113.
Solution
The method is followed until no further reductions can be produced. The first step is to
apply Rule #1 to give Figure 114.
265
Figure 114: First Reduction
266
Figure 117: Fourth and Final Reduction
The reduced chart is obviously valid, since it contains only a single step and a single transition.
Thus, we can conclude that the proposed sequential function chart is in fact valid.
267
6) LE means less than.
7) A task with a priority value of 3 has the highest priority.
8) In the function-block language, a double arrow denotes a jump between two parts of the
function-block network.
9) In the function-block language, we can use &.
10) In ladder logic, a coil can be used to save a value.
11) In ladder logic, we can create feedback loops.
12) In instruction list, the statement SN HIPPO is a valid one.
13) In instruction list, the brackets () delay the implementation of an instruction.
14) In structured text OR has a higher priority compared to AND.
15) In structured text, we can use the CASE command.
16) In sequential function charts, N means that as soon as the step is ended, the action is stopped.
17) In sequential function charts, R means that an action is delayed by the given time.
18) In sequential function charts, it is possible to easily determine the validity of the result chart.
19) Ladder logic is a great idea to create complex, high-level PLC programmes.
20) Instruction list is designed for simple, optimised PLC programmes.
268
Figure 118: Validity of Sequential Function Charts
22) Give the sequential function charts for the controlling the following systems:
a. Stirring process: Figure 119 shows the P&ID diagram of a stirred tank B with flow
controller US2. The binary input signals to US2 are the high-level alarm L, the start
signal S and the end signal E. The binary output signals from US2 are V1 for
switching the input valve, V2 for switching the drain valve, and R for switching the
stirrer motor. The following sequence is required: After the start signal reaches 1
(S = 1), a liquid is to be dosed by opening the input valve (with V1 = 1) and turning
the stirrer on (R = 1) until the level L reaches its upper limit (L = 1). Then, valves
are closed and the stirrer should alternately between being switched on for 1 min
and switched off for 1 min. This switching on and off should, regardless of the
current cycle, be ended immediately when the end button is pressed (E = 1). Then
the drain valve should be opened for 5 minutes. Then everything should be switched
into the idle state, that is, V1 = V2 = R = 0. When S = 1, the process is started from
the beginning.
269
b. Washing Machine: The control for a simple washing machine, shown in Figure
120 with an explanation of the variables in Table 44, should implement the
following sequence. After the input signal START has a value of 1, valve V1 should
be opened until the binary level sensor L1 reports that the desired water level has
been reached. Then, the MOTOR of the washing drum should be switched on
alternately for a period of time T_on and switched off for a period of time T_off.
During this alternating switching on and off, the electrical HEATING is first
switched on until the water temperature has reached a certain value, which is
reported by the binary sensor T2. Then, the process should wait a certain minimum
waiting time T_wait before any further heating occurs. Once the motor has
stopped running, the alternative switching of the motor is also stopped. Then, the
PUMP is switched on and valve V2 is opened at the same time. Once the level sensor
L0 reports an empty drum, the initial state is reached, and the process can be
repeated.
270
Table 44: I/O for the Washing Machine
23) In the examples below, various Boolean functions of the form Q = f(X, Y, Z) are given.
For each, please provide a) the function in its sum-of-products and product-of-sums forms,
b) the reduced function found using a Karnaugh diagram; and c) the PLC programme using
instruction list, ladder logic, and function-block language for the minimised function.
a. The function shown using ladder logic in Figure 121.
b. The function that implements a majority decision rule for a 2-out-of-3 redundancy
system, that is, the output Q is 1 if and only if at least two of the inputs are 1.
c. The function shown by the truth table in Table 45.
d. The function shown by the truth table in Table 46.
e. The function Q = f(B, G, M) is described as follows:
i. Three sensors in a sorting system measure the properties of parts and deliver
the following binary signals to the inputs of a PLC:
1. B, where B = 1 means a hole is present,
2. G, where G = 1 means green paint is present, and
3. M, where M = 1 means a metallic material is present.
ii. Parts produced without errors have the following properties:
1. Either metallic and green (with or without a hole)
2. Nonmetallic, not green, and with a hole.
271
iii. The output Q of the PLC should be 1 when the part is to be rejected, i.e., if
it does not have the above properties of a faultlessly produced part.
X 0 0 0 0 1 1 1 1
Y 0 0 1 1 0 0 1 1
Z 0 1 0 1 0 1 0 1
Q 0 1 1 0 1 1 1 1
X 0 0 0 0 1 1 1 1
Y 0 0 1 1 0 0 1 1
Z 0 1 0 1 0 1 0 1
Q 0 0 1 1 1 0 1 1
272
Chapter 8: Safety in the Automation
Industry
As automation becomes more widespread, there is a corresponding need to consider the
safety of those who come in contact with the automated systems. Furthermore, automated systems
need to take into consideration safety constraints themselves when they implement various actions.
For these reasons, it is helpful to briefly review the different safety regulations. Obviously, it is
always your engineering obligation to make sure that you have checked the most recent and most
relevant regulations and laws applying to your specific situation.
In general, safety can be divided into two parts: physical and digital. Physical safety
considers the steps and regulations required to ensure that the plant and its surroundings are safe
for the workers, visitors, and the environment. Environmental protection considers not only
hazardous substances, but also the emission of electromagnetic radiation or noise. Digital safety
considers the steps required to ensure that the communication networks and the associated devices
cannot be hacked and used to create an unsafe physical situation. Furthermore, digital safety must
ensure that no sensitive information can be stolen or used in an inappropriate manner. This aspect
is very important given the increasing legislative interest in making sure that confidential personal
information remains confidential.
273
3) Work, which is energy stored in springs, electrical circuits, and other devices. When
released, this can lead to catastrophic failure and impressive damage. A common electrical
example is a short circuit.
4) Heat, which is energy crossing a boundary. Heat exchange is always based on a
temperature difference between two points in space. Since heat always influences the
environment, touching hot surfaces, for example, can lead to burns. The same situation
applies to touching very cold surfaces, which can also lead to burns or frostbite.
In order to increase the safety of a physical system, it can be useful to consider the following steps
when designing the overall system:
1) Minimise: Avoid using (or use as little as possible) any hazardous substances.
2) Substitute: Replace hazardous substances by ones that are less hazardous but with similar
properties.
3) Moderate: Replace extreme operating conditions by ones that are less severe.
4) Simplify: Create designs or processes that are less complex and simpler.
5) Isolate: Create situations where the effect of a hazard has minimal impact on the overall
system, for example, physically separating the office space from the production area.
The above ideas can be framed within the inherently safer predesign (ISPD) approach, which
consists of the following 4 steps:
1) Identify: Determine what the hazards are and how they can impact the process.
2) Eradicate: Remove the effects of as many of the hazards as possible, for example, by
designing fail-safe systems, that is, should a system encounter a failure it ends up in an
inherently safe mode that cannot cause further problems. A common example of this is the
design of control valves to fail open or closed depending on the process conditions, for
example, a control valve for a critical cooling jacket should fail open so that the system
remains cooled even if the valve has failed.
3) Minimise, simplify, and moderate: If a hazard cannot be eradicated, then try and limit its
effects on the system.
4) Isolate: Create structures that will limit the amount of damage that can occur, for example,
by segregating hazardous operations.
Another approach to this situation is to perform a hazard-and-operability study (HAZOP) to
determine where the given hazards lie and how best to mitigate them. The HAZOP procedure
274
consists of the following four steps: determine, using a systematic search, possible faults; find the
causes for the faults; estimate the effects of the faults on the system; and suggest appropriate
countermeasures. A HAZOP requires that a detailed plan of the process be available. Thus, such
analysis is often performed at a later stage of design after the overall process design has already
been completed. This implies that, due to the high cost or structural changes required, it could be
too late to make substantive changes at this point. Thus, HAZOPs are often used to provide an
understanding of the hazards present and their risk.
Finally, it can be mentioned that when designing safety systems, it is useful to consider
redundancy, that is, having more than one channel or way to achieve a given task. As well, this
implies that different channels should be used for different tasks (control, alarm, and monitoring),
so that there is less risk of catastrophic failure. Thus, for example, alarms and monitoring should
not occur on the same channel. If it should fail, alarm signals can no longer be transmitted in
addition to the less important monitoring signals. There are two main ways to implement
redundancy. In the first approach, often called homogeneous redundancy, the same task is
implemented by multiple (identical or similar) devices, for example, the temperature is measured
using three temperature sensors at the same point. However, this approach carries the risk that
systematic errors in the sensors or devices are propagated into the system. In the second approach,
often called heterogeneous redundancy or redundancy by diversity, the same task is
implemented using different devices, for example, three separate path-planning computer systems
that use different computational algorithms could be implemented and the decision taken by
majority vote, that is, if two or more algorithms give the same result it is followed. Selecting the
appropriate approach depends on the requirements and standards of the process.
275
where F is the occurrence frequency, P is the probability that the hazard cannot be mitigated, and
W is the probability that without any safety system in place an undesired state will be reached.
Since it makes little sense to define the risk with an exact value, it is common to instead associate
a given level to the individual variables and look at the combination of levels.
For C, the following levels are defined:
• C1: Minor injuries
• C2: Major or permanent injuries of one or more people or a single death
• C3: Up to 5 deaths
• C4: More than 5 deaths.
For F, two levels are defined:
• F1: During the course of the day, people are in the danger zone less than or equal to
10% of the time.
• F2: During the course of the day, people are in the danger zone more than 10% of the
time.
For P, two levels are defined:
• P1: It is possible to mitigate the hazard (one should provide the appropriate steps to do
so).
• P2: It is not possible to mitigate the hazard.
For W, three levels are defined:
• W1: The undesired state will occur less than once every 10 years.
• W2: The undesired state will occur less than once per year.
• W3: The undesired state will occur more often than once per year.
The above levels are then combined to give an overall safety integrity level (SIL). There are four
safety integrity levels labelled SIL1 to SIL4, where the larger number reflects a more hazardous
level. The relationship between the different parameters is shown in Figure 122.
276
Figure 122: Relationship between the parameters and the safety integrity levels
277
1) DIN 31635 which standardises the transliteration of the Arabic script used to write Arabic,
Ottoman Turkish, Iranian, Kurdish, Urdu, and Pasto
2) DIN EN ISO 216 which standardises writing paper and certain classes of printed matter,
trimmed sizes, A and B series, and indication of machine direction
3) DIN ISO 509 which covers the production of technical drawings, relief grooves, and types
and dimensions of them.
4) DIN EN 772-7 which covers clay masonry units, namely the determination of water
absorption of clay masonry damp proof course units by boiling water.
Other countries use similar systems, for example, Austria prefixes its codes with ÖNORM
while the United States of America uses the ANSI system.
Safety regulations in Germany (and most of Europe) for machines can be split into three
types:
• Type A Regulations: These regulations cover the basic safety concepts, design
principles, and general aspects of machines. An example of a Type A regulation is the
EN ISO 12100 standard that provides the general principles of design.
• Type B Regulations: These regulations are baseline safety standards and requirements
for protective equipment. There are two subtypes: B1-Regulations that cover specific
safety aspects and B2-Regulations that cover the standards for protective equipment
required for machines. An example of a Type B1 regulation is the EN ISO 13855
standard that provides the guidelines for the arrangement of protective devices, while a
Type B2 regulation would be the EN 953 standard that considers fixed guards for
machines.
• Type C Regulations: These regulations are the specific safety standards for a particular
machine or group of machines. An example of a Type C regulation would be the EN
693 standard that provides the standards for hydraulic presses.
278
company to various threats including loss of proprietary information, damage to the process by
illegal changing of process operating conditions, and legal issues due to distribution of confidential
personal information.
Digital security can be achieved by creating strong passwords, changing the passwords on
a regular basis, and checking for any intruders. Strong antivirus software should also be
implemented. Multiple interacting networks should be considered to provide additional levels of
security. Finally, the workers should be educated in proper digital safety, as the digital system is
only as strong as its weakest link. People placing unknown USB-drivers into work computers can
easily introduce unwanted viruses into the company network.
279
11) Selecting a course of action based on two-out-of-three voting is an example of redundancy
by diversity.
12) A risk with an occurrence frequency greater than 10% is always an SIL 4 risk.
13) A risk with a hazard impact level of C3 implies that it can cause only minor injuries.
14) A risk with a mitigation level of P2 implies that it cannot be mitigated.
15) A risk with a W level of W3 implies that the undesired state will occur more often than
once per year.
16) In Germany, Type A regulations cover the detailed requirements for the safety of a specific
machine.
17) An example of a B2 regulation would be the design of protective guards for machines.
18) An example of a C regulation would be the standards for the design of chemical reactors.
19) Using simple passwords and minimal digital security is a good idea for a critical chemical
process.
280
Q-SHOP ENGINEEERING
Saturday, March 22, 2008
PT-3
PE-
PE-3 spare
Cooling water, in
4
TI-
5
TE-4 C02, out
TI-5
TE-5
_1
FT
FE-1
-2
PIC
TT
TE-2 C-2
4
6 7
HEX-1
M-1
P-179
PT-2 3
PE-2
PE TE-1
PE-1 Spare TI-3
1
C02, in
2
V-3
ESD
V-4
ESD-Bypass
281
Bibliography
Seborg, D. E., Edgar, T. F., Mellichamp, D. A., & Doyle, F. J. (2011). Process Dyanamics and
Control (3rd ed.). Hoboken, New Jersey, United States of America: John Wiley & Sons,
Inc.
Shoukat Choudhury, M. A., Thornhill, N. F., & Shah, S. L. (2005). Modelling valve stiction.
Control Engineering Practice, 641-658.
282
Appendix I: Partial Fractioning
When solving equations in the frequency domain and it is desired to convert them back
into the time domain, it may be necessary to perform partial fractioning to obtain a solution.
Although there exist many different approaches, the following is one simple method that will allow
the final result to be obtained easily. Consider a rational function of the form:
N (s) N (s)
= (251)
D (s) nl nq
∏ ( α s + β ) ∏ (α s + β js + γ j )
ni 2 nj
i i j
=i 1 =j 1
where nl represents the number of distinct linear terms, nq the number of distinct irreducible
quadratics (those that have imaginary roots as their solution), and α, β, and γ are known constants.
Let n be the overall order of the system. In order to perform partial fractioning, write the following
fraction depending on the form of the root:
n
Bk
1) For each linear term (αs + β)n, put the term, ∑ .
(α s + β )
k
k =1
m
Ak + Bk s
2
2) For each irreducible quadratic term, (αs + βs + γ) , put the term, m
∑ .
(α s + βs +γ )
2 k
k =1
Once the form of the partial fractioning solution has been obtained, it is necessary to solve for the
unknown parameters. First, cross-multiply, so that the denominators are the same. Then, it is
necessary to solve for the unknown parameters by equating the unknown side with the known,
N(s). The easiest way to solve this is using the following approach:
1) For each linear term, set s = −β / α to obtain Bn of the linear terms. This will reduce the
nl nq
∏ (α s + β js + γ j ) =
nj
equation to the form Bn ∏ (α i s + βi ) N ( s ) evaluated at the
ni 2
j
=i 1 =j 1
i≠n
given root.
2) For each quadratic term, set s equal to the imaginary roots. This will also reduce the
equation to a simpler form and allow for An and Bn to be solved.
For the remaining terms, create a system of equations by selecting different values of s and
evaluating the known values, so that the remaining unknowns can be solved. You will need n –
nl – 2nq equations in order to find the remaining n – nl – 2nq terms.
283
Example 49: Partial Fractioning
Consider the following fraction
3s + 1
(252)
( s + 2 )( s + 1)
2
(s 2
+ 1)
It can be noted that for the first term s + 2, as well as the last term s2 + 1, there will only be a single
component, since its exponent is one. For the middle term, (s + 1)2, there will be two terms, since
the exponent is two. For the linear terms, we set a simple constant term in the numerator, while for
the quadratic term, we include a linear term in the numerator.
Next, we need to determine the values of the constants in the numerator. Before doing this,
let us cross-multiply and determine the general form of the numerator
A ( s + 1) ( s 2 + 1) + B ( s + 2 )( s + 1) ( s 2 + 1) + C ( s + 2 ) ( s 2 + 1) + ( Ds + E )( s + 2 )( s + 1) = 3s + 1 (254)
2 2
As was previously mentioned, we can see that setting s = −1 or −2 will cancel every term but one,
allowing us to effortless compute that term. This gives for s = −1
( )
C ( −1 + 2 ) ( −1) + 1 = 3 ( −1) + 1
2
−2 (255)
C= = −1
2
Similarly, for s = −2, we get
A ( −2 + 1)
2
(( −2) + 1) =
2
3 ( −2 ) + 1
−5 (256)
A= = −1
5
For the quadratic term, we can set s = ±j, which will give us a linear system of equations in two
unknown (D and E) that we can then solve to obtain the value of D and E. This gives
284
( Dj + E )( j + 2 )( j + 1) =3 j + 1
2
(257)
( − Dj + E )( − j + 2 )( − j + 1) =−3 j + 1
2
285