0% found this document useful (0 votes)
16 views

Computer Systems For Automation and Cont

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Computer Systems For Automation and Cont

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 497

Computer Systems for

Automation and
Control

Second Edition 1998

Gustaf Olsson Gianguido Piani


Lund Institute of Technology ABB Energy Information Systems
Lund, Sweden St.Petersburg, Russia
Copyright

„COMPUTER SYSTEMS FOR AUTOMATION AND CONTROL“ (2nd Edition), by


Gustaf Olsson and Gianguido Piani. Lund, Bologna, St.Petersburg 1998.

The 1st Edition of the book has been published in 1992 in English by Prentice-Hall
International and in 1993 in German by Hanser Verlag, München together with
Prentice-Hall. This manuscript is the basis for the 2nd Edition in English.

Computer Systems for Automation and Control


© Prentice Hall International (UK) Ltd., 1992
ISBN 0-13-457581-4

Steuern, Regeln, Automatisieren - Theorie und Praxis der Prozeßleittechnik


© Prentice Hall International (UK) Ltd., London
and Carl Hanser Verlag, München, Wien, 1993
ISBN 3-446-17497-4
Contents

Abbreviations .............................................................................................................. xi

Preface ...................................................................................................................... xv

Contact via Internet ..................................................................................................xvii

About the Authors .................................................................................................... xviii

1 Introduction ......................................................................................................... 1
1.1 Computers in Process Control .................................................................... 1
1.2 A Bit of History ............................................................................................ 4
1.3 Systems ...................................................................................................... 6
1.4 Some Typical Applications of Computer Control Systems ......................... 8
1.5 A Guide for the Reader............................................................................. 10

2 Process Computers’ Application Issues ............................................................ 13


2.1 Real-time Process Control ........................................................................ 13
2.1.1 Example: The Plastic Extruder ..................................................................................14
2.1.2 Control by Conventional Programming .....................................................................15
2.1.3 Control Using Interrupts ............................................................................................17
2.2 Types of Process Control Applications ..................................................... 20
2.2.1 Sequencing and Binary Control.................................................................................20
2.2.2 A Simple Control Loop: the Temperature Regulator .................................................21
2.2.3 Reference Value Generation.....................................................................................22
2.2.4 Several Control Loops ...............................................................................................23
2.2.5 Interconnected Systems............................................................................................23
2.2.6 Time-critical Operations ............................................................................................24
2.2.7 The Complexity of the Process Control Problem ......................................................24
2.3 General Problem Areas of Computer Control Systems ............................ 27
2.4 Case Studies ............................................................................................ 30
2.4.1 Case Study 1: Control of an Electrical Drive System ................................................30
2.4.2 Case Study 2: Biological Wastewater Treatment - The Activated Sludge Process ..31
2.5 Summary .................................................................................................. 32

3 System Description and Modeling ..................................................................... 34


3.1 Models for Control .................................................................................... 35
3.1.1 Types of Models ........................................................................................................35
3.1.2 The Timescale of Dynamic Models ...........................................................................36
3.1.3 Modeling Dynamical Systems ...................................................................................37
3.1.4 Modeling of Discrete Events .....................................................................................38
3.2 Elementary Aspects of Dynamic Systems ................................................ 38
3.2.1 Mechanical Systems .................................................................................................38
3.2.2 Electrical and Magnetic Circuits ................................................................................41
3.2.3 Mass Balance............................................................................................................46
3.2.4 Equations about Energy Conservation ......................................................................50

3.3 Continuous Time Dynamic Systems ......................................................... 51


3.3.1 Time vs. Frequency Domain Approach - a Historical Perspective ............................51

iii
iv Computer Systems for Automation and Control

3.3.2 Representation in State-Space Form ........................................................................52


3.3.3 Linear Systems in State-Space Representation .......................................................54
3.3.4 Input/Output Descriptions..........................................................................................55
3.3.5 The Validity of Linear Models ....................................................................................58
3.3.6 Non-linear Systems ...................................................................................................59
3.3.7 Numerical Simulation of Dynamic Systems ..............................................................61
3.4 Discrete Time Dynamic Systems .............................................................. 64
3.4.1 State Description .......................................................................................................64
3.4.2 Input/Output Relations and the Shift Operator ..........................................................65
3.5 Controllability, Estimation and Observability ............................................. 69
3.5.1 Controllability .............................................................................................................69
3.5.2 Estimating the State from the Measurements ...........................................................70
3.6 Systems with Uncertainty ......................................................................... 74
3.6.1 State Estimation with Stochastic Disturbances .........................................................74
3.6.2 Fuzzy Systems ..........................................................................................................76
3.7 Combinatorial and Sequencing Networks ................................................. 79
3.8 Summary .................................................................................................. 82

4 Physical Process Input and Output ................................................................... 84


4.1 The Components of the Process Interface ............................................... 84
4.1.1 Sensors .....................................................................................................................85
4.1.2 Actuators ...................................................................................................................86
4.1.3 Bandwidth and Noise ................................................................................................87
4.1.4 Measurement Signal Transmission...........................................................................87
4.2 Sensor Properties ..................................................................................... 88
4.2.1 Accuracy and Precision .............................................................................................88
4.2.2 Dynamic Sensor Characteristics ...............................................................................90
4.2.3 Static Sensor Characteristics ....................................................................................91
4.2.4 Non-linearities ...........................................................................................................92
4.2.5 Impedance Characteristics .......................................................................................92
4.2.6 Selection of the Proper Input/Output Impedances ....................................................93
4.3 Binary and Digital Sensors ....................................................................... 94
4.3.1 Position Sensors .......................................................................................................94
4.3.2 Limit Sensors ............................................................................................................96
4.3.3 Level Switches ..........................................................................................................97
4.3.4 Digital Sensors, Fieldbus Sensors ............................................................................97
4.4 Analog Sensors ........................................................................................ 98
4.4.1 Motion Sensors .........................................................................................................99
4.4.2 Force, Torque, and Pressure Sensors ....................................................................101
4.4.3 Proximity Sensors ...................................................................................................103
4.4.4 Temperature Sensors .............................................................................................103
4.4.5 Flow Rate Measurement .........................................................................................106
4.4.6 Chemical and Biochemical Measurements .............................................................110
4.5 Signal Conditioning and Transmission ................................................... 111
4.5.1 Signal Conditioning with Operational Amplifiers .....................................................111
4.5.2 Electrical Conductors ..............................................................................................113
4.5.3 Electrical Disturbances............................................................................................116
4.5.4 Signal Grounding ....................................................................................................119
4.5.5 Choice of Signal Type: Voltage vs. Current Signals ...............................................121
4.5.6 Optical Signal Transmission ...................................................................................123
4.6 Binary Actuators ..................................................................................... 123
4.6.1 Controlled Switches ................................................................................................124
4.6.2 The Switch Off of Inductive Loads ..........................................................................125

4.7 Electrical Drive Actuators........................................................................ 126


4.7.1 Power Amplifiers .....................................................................................................127
Contents v

4.7.2 Position and Velocity Control in Drive Systems ......................................................128


4.7.3 Stepping Motors ......................................................................................................130
4.7.4 Direct Current Motors ..............................................................................................131
4.7.5 Asynchronous and Synchronous Motors ................................................................131
4.8 Control Valves ........................................................................................ 132
4.9 Summary ................................................................................................ 134

5 Signal Processing ........................................................................................... 136


5.1 The Sampling of Analog Signals ............................................................ 136
5.1.1 Interfacing Analog Signals to a Computer...............................................................136
5.1.2 Multiplexers .............................................................................................................137
5.1.3 Signal Sampling ......................................................................................................138
5.1.4 Selection of the Sampling Time ..............................................................................140
5.2 Conversion between Analog and Digital Signals .................................... 146
5.2.1 Digital-Analog Conversion .......................................................................................146
5.2.2 Analog-Digital Conversion .......................................................................................147
5.3 Analog Filtering ....................................................................................... 150
5.3.1 First Order Low Pass Filters....................................................................................151
5.3.2 Higher Order Low Pass Filters ................................................................................153
5.3.3 High Pass Filters .....................................................................................................154
5.4 Digital Filtering ........................................................................................ 157
5.4.1 General Structure of Digital Filters ..........................................................................157
5.4.2 Digital Low Pass Filters ...........................................................................................157
5.4.3 Digital Low Pass Filters of Higher Order .................................................................162
5.4.4 Digital High Pass Filters ..........................................................................................162
5.5 Basic Measurement Data Processing..................................................... 165
5.5.1 Tests and Alarms ....................................................................................................166
5.5.2 Scaling and Linearization ........................................................................................167
5.5.3 Advanced Data Processing .....................................................................................168
5.5.4 A Data Structure for Measurement Signals ............................................................168
5.6 Summary ................................................................................................ 169

6 Control Structures ........................................................................................... 171


6.1 Continuous vs. Time-discrete Controllers ............................................... 172
6.1.1 Sampled Signals .....................................................................................................172
6.1.2 Continuous vs. Time-discrete Control Design.........................................................172
6.2 On/off Control ......................................................................................... 173
6.3 Continuous Controllers ........................................................................... 174
6.3.1 Simple Controllers ...................................................................................................175
6.3.2 Feedforward from the Reference Value ..................................................................176
6.3.3 The General Form of the Feedforward Controller ...................................................178
6.3.4 Feedforward from Load Changes and Process Disturbances ................................181
6.3.5 Summary of the Principal Control Structures ..........................................................184
6.4 Continuous PID Controllers .................................................................... 186
6.4.1 The Basic Form of the PID Controller .....................................................................186
6.4.2 Differentiation of the Measurement Signal ..............................................................188
6.4.3 Series Representation of the PID controller ............................................................189
6.4.4 The PIPI Controller..................................................................................................190
6.4.5 Other Parametrizations of the PID controller ..........................................................191
vi Computer Systems for Automation and Control

6.5 The Practical Realization of the PID Controller ...................................... 192


6.5.1 Discretization of the PID Controller .........................................................................192
6.5.2 Selection of the Sampling Rate in Control Systems................................................195
6.5.3 Limitation of the Control Signal ...............................................................................196
6.5.4 Prevention of Integral Windup .................................................................................196
6.5.5 Bumpless Transfer in the Change of the Controller Operational Mode ..................199
6.5.6 Limitation of the Rate-of-Change of the Control Signal ..........................................200
6.5.7 Computational Aspects ...........................................................................................201
6.5.8 Algorithm of the PID Controller ...............................................................................202
6.5.9 Implementation with Application-Oriented Block Language ....................................203
6.6 Control Structures Based on PID Controllers ......................................... 205
6.6.1 Cascade Control .....................................................................................................205
6.6.2 Selective Control .....................................................................................................207
6.7 The Performance Limits of PID Controllers ............................................ 208
6.7.1 Time Delays ............................................................................................................208
6.7.2 Complex Dynamics .................................................................................................211
6.7.3 Predictable Parameter Variations - Gain-Scheduling Control .................................212
6.7.4 Unknown Parameter Variations - Self-Tuning Control ............................................212
6.7.5 Systems with Several Inputs and Outputs ..............................................................214
6.8 The General Linear Discrete Controller .................................................. 214
6.8.1 Description of the General Controller Using the Shift Operator ..............................214
6.8.2 The Properties of the General Controller ................................................................215
6.8.3 Special Cases of the General Discrete Controller ..................................................219
6.8.4 Different Criteria for the Quality of the Discrete Controller ......................................221
6.9 The Practical Realization of the General Discrete Controller.................. 222
6.9.1 Parameter Update ...................................................................................................223
6.9.2 Prevention of Integral Windup in the General Discrete Controller ..........................223
6.9.3 Bumpless Transfer between Manual and Automatic Control Mode ........................224
6.9.4 Computational Aspects ...........................................................................................224
6.9.5 Algorithm for the General Controller .......................................................................225
6.10 State Feedback ...................................................................................... 228
6.11 Summary ................................................................................................ 229

7 Combinatorial and Sequencing Control .......................................................... 232


7.1 Elementary Switching Theory ................................................................. 232
7.1.1 Notations .................................................................................................................232
7.1.2 Basic Combinatorial Theory ....................................................................................233
7.1.3 Additional Gates ......................................................................................................236
7.1.4 Flip-flops..................................................................................................................239
7.1.5 Realization of Switching Circuits .............................................................................241
7.2 Representation of Logical Functions with Help of Ladder Diagrams ...... 243
7.2.1 Principal Characteristics..........................................................................................243
7.2.2 Sequencing Circuits ................................................................................................245
7.3 Programmable Logic Controllers (PLC) .................................................. 247
7.3.1 Basic Structure ........................................................................................................247
7.3.2 Basic Instructions and Execution ............................................................................248
7.3.3 Additional PLC Instructions .....................................................................................252
7.3.4 PLC Programming ..................................................................................................252
7.4 PLC Programming with Help of Function Charts .................................... 253
7.4.1 The Representation of Complex Control Sequences in Form of Function Charts ..253
7.4.2 Computer Implementations of Function Charts ......................................................257
7.4.3 Application of Function Charts in a Practical Industrial Control Example ...............258
7.5 Summary ................................................................................................ 261
Contents vii

8 Bus Systems ................................................................................................... 263


8.1 From Centralized to Distributed System Architectures ........................... 263
8.2 Bus Structure and Operation .................................................................. 267
8.2.1 General ...................................................................................................................267
8.2.2 Mechanical Construction .........................................................................................268
8.2.3 Bus Interface Electronics ........................................................................................270
8.2.4 The Bus Electrical Interface ....................................................................................274
8.2.5 Bus Operations .......................................................................................................275
8.2.6 Synchronous Data Transfer ....................................................................................276
8.2.7 Asynchronous Data Transfer ..................................................................................276
8.2.8 Block Transfer .........................................................................................................278
8.2.9 Interrupt Handling ....................................................................................................278
8.2.10 Bus Allocation and Master Arbitration ...................................................................280
8.2.11 Construction of a Bus System ...............................................................................281
8.3 The VME Bus (IEEE 1014) ..................................................................... 281
8.3.1 General Features ....................................................................................................281
8.3.2 Data Transfer ..........................................................................................................282
8.3.3 Priority Interrupt .......................................................................................................283
8.3.4 Bus Master Arbitration.............................................................................................283
8.3.5 Utility Signals ...........................................................................................................284
8.3.6 VMEbus Extensions ................................................................................................284
8.4 Other Bus Standards .............................................................................. 284
8.4.1 The IBM PC Bus .....................................................................................................284
8.4.2 ISA ..........................................................................................................................285
8.4.3 EISA ........................................................................................................................286
8.4.4 PCI ..........................................................................................................................286
8.5 Summary ................................................................................................ 286

9 Digital Communication in Process Control ...................................................... 288


9.1 Information and Communication............................................................. 288
9.1.1 What is Information? ...............................................................................................288
9.1.2 Communication .......................................................................................................290
9.1.3 A Model for the Communication Process................................................................290
9.2 The Open Systems Interconnection (OSI) Model ................................... 292
9.2.1 Changing Requirements for Data Communication .................................................292
9.2.2 Open Systems Interconnection Basics ...................................................................293
9.2.3 Virtual Devices ........................................................................................................297
9.3 Physical Links (OSI Physical Layer) ....................................................... 299
9.3.1 Basic Quantitative Aspects of Communication .......................................................299
9.3.2 Electrical Conductors ..............................................................................................301
9.3.3 Bit Coding ................................................................................................................302
9.3.4 Carrier Modulation ...................................................................................................304
9.3.5 Time Synchronization ..............................................................................................305
9.3.6 The EIA-232-D and the „RS“ Interface Standards ..................................................306
9.3.7 The Multipoint Electrical Interface RS-485 ..............................................................307
9.3.8 Optical Data Transmission ......................................................................................308
9.3.9 Radio Data Communication ....................................................................................311
9.4 Communication Protocols ....................................................................... 312
9.4.1 The OSI Data Link Layer .........................................................................................312
9.4.2 Virtual Channels and Multiplexing ...........................................................................312
9.4.3 Error Detection and Correction ...............................................................................314
9.4.4 Character-oriented Protocols ..................................................................................315
9.4.5 Bit-oriented Protocols, HDLC ..................................................................................316
9.4.6 The Telemetry Protocol IEC 870 .............................................................................317
9.4.7 Block-oriented Protocols .........................................................................................319
9.4.8 The higher OSI layers (Layer 3 to Layer 7) .............................................................320
9.4.9 The TCP/IP Protocol ...............................................................................................321
viii Computer Systems for Automation and Control

9.5 Local Area Networks............................................................................... 324


9.5.1 Communication Networks .......................................................................................324
9.5.2 Network Topologies ................................................................................................325
9.5.3 Medium Access Control (MAC) ...............................................................................327
9.5.4 The Ethernet Network Standard (IEEE 802.3) ........................................................328
9.5.5 The Token Bus Network Standard (IEEE 802.4) ....................................................331
9.5.6 The Token Ring Network Standard (IEEE 802.5) ...................................................333
9.5.7 FDDI ........................................................................................................................334
9.5.8 Network Communication Devices ...........................................................................334
9.6 Communication in Process Monitoring and Control ................................ 336
9.6.1 The Hierarchical Structure of the Technical Process ..............................................336
9.6.2 Data Collection and Information Flow in Process Control .......................................337
9.6.3 The Manufacturing Automation Protocol (MAP) .....................................................342
9.6.4 The Manufacturing Message Specification (MMS) .................................................344
9.7 Fieldbuses .............................................................................................. 345
9.7.1 A Solution for Low-level Plant Communication .......................................................345
9.7.2 Bitbus ......................................................................................................................346
9.7.3 PROFIBUS ..............................................................................................................347
9.7.4 Toward a Fieldbus Standard? .................................................................................349
9.8 Communication over Public Networks .................................................... 349
9.8.1 The Phone Network and Modems ..........................................................................350
9.8.2 Digital Networks ......................................................................................................351
9.8.3 The Integrated Systems Digital Network (ISDN) .....................................................353
9.8.4 ATM.........................................................................................................................354
9.9 Summary ................................................................................................ 355

10 Real-time Programming and Operating System Support ................................ 357


10.1 General Concepts about Processes ....................................................... 358
10.1.1 Sequential vs. Real-time Programming ................................................................358
10.1.2 Programs and Processes ......................................................................................359
10.1.3 Concurrent Programming, Multiprogramming and Multitasking............................360
10.2 The Management of System Resources ................................................ 361
10.2.1 Single-processor vs. Distributed System Architecture ..........................................361
10.2.2 The Function of Operating Systems in Real-time Environments ..........................363
10.2.3 Distributed Operating Systems .............................................................................364
10.2.4 CPU Management and Process States ................................................................365
10.2.5 Strategies for Process Selection ...........................................................................368
10.2.6 Internal Memory Management ..............................................................................368
10.3 Mutual Exclusion and Deadlock.............................................................. 370
10.3.1 Resource Protection..............................................................................................370
10.3.2 Mutual Exclusion ...................................................................................................371
10.3.3 Deadlock ...............................................................................................................374
10.4 Process Synchronization: Semaphores and Events ............................... 376
10.4.1 Semaphores ..........................................................................................................376
10.4.2 Events ...................................................................................................................379
10.5 Interprocess Communication .................................................................. 380
10.5.1 Common Memory Areas .......................................................................................380
10.5.2 Mailboxes ..............................................................................................................381
10.5.3 Pipes .....................................................................................................................382
10.5.4 Remote Procedure Calls (RPC) ............................................................................383
10.5.5 Comparison of the Methods for Synchronization and Communication .................383
Contents ix

10.6 Methods for Real-time Programming ...................................................... 384


10.6.1 What is a Real-time Program? ..............................................................................384
10.6.2 The Programming Environment ............................................................................385
10.6.3 Real-time Program Structure ................................................................................386
10.6.4 Interrupt and Exception Handling ..........................................................................388
10.6.5 Time-related Functions and Time Efficiency .........................................................389
10.6.6 Intrinsic Functions of Operating Systems .............................................................391
10.6.7 Process Priorities and System Performance ........................................................392
10.6.8 Testing and Debugging .........................................................................................393
10.7 Languages and Operating Systems for Real-time Programming ........... 394
10.7.1 Requirements for Real-time Languages and Operating Systems.........................394
10.7.2 The Programming Language ADA ........................................................................395
10.7.3 C and C++ .............................................................................................................396
10.7.4 BASIC ...................................................................................................................397
10.7.5 FORTRAN .............................................................................................................397
10.7.6 Pascal and Modula-2 ............................................................................................398
10.7.7 The Operating System UNIX.................................................................................398
10.7.8 OSF/1 and DCE ....................................................................................................400
10.7.9 MS-DOS, Windows, and Windows NT .................................................................400
10.7.10 OS-9 ....................................................................................................................401
10.7.11 VAX/VMS ............................................................................................................402
10.8 Summary ................................................................................................ 402

11 The User Interface .......................................................................................... 404


11.1 The User Interface as a Component in Process Control ........................ 404
11.2 Psychological Models ............................................................................. 407
11.2.1 Physiology and Cognition ......................................................................................407
11.2.2 The Levels of Human Action .................................................................................408
11.2.3 The Dual-Memory Theory .....................................................................................410
11.2.4 Errors ....................................................................................................................411
11.3 Human Control of Complex Systems...................................................... 413
11.3.1 Mental Models of Complex Systems .....................................................................413
11.3.2 Syntactic Information and Semantic Knowledge ...................................................415
11.3.3 The Management of Complexity ...........................................................................416
11.3.4 The User Interface as a Tool to Deal with Complexity ..........................................418
11.4 The Equipment for the User Interface .................................................... 420
11.5 A Practical Approach to User Interface Design ...................................... 423
11.5.1 General Principles .................................................................................................423
11.5.2 Use of Language in the User Interface .................................................................425
11.5.3 Coding ...................................................................................................................428
11.5.4 Process Representation ........................................................................................430
11.5.5 Operator Commands ............................................................................................434
11.5.6 Menus ...................................................................................................................436
11.5.7 User Interface Evaluation ......................................................................................436
11.6 Graphical User Interfaces, The X Window System................................. 437
11.7 Summary ................................................................................................ 439

12 System Integration .......................................................................................... 441


12.1 The Structure of Process Control Systems - Lessons Learned
from History ............................................................................................ 441
12.2 Integration of Computer Control Systems............................................... 443
12.2.1 Integration Levels ..................................................................................................443
12.2.2 System Rack Integration .......................................................................................444
12.2.3 Interface Design ....................................................................................................446
12.2.4 Selection of the Integration Level ..........................................................................447
x Computer Systems for Automation and Control

12.3 Systems Reliability.................................................................................. 447


12.3.1 The Reliability of Equipment .................................................................................447
12.3.2 Models for the Computation and Determination of Reliability ...............................448
12.3.3 Reliability of Process Control Systems .................................................................450
12.3.4 Software Reliability ................................................................................................451
12.4 The Functions of a Computer Control System........................................ 453
12.4.1 Monitoring .............................................................................................................453
12.4.2 Control ...................................................................................................................454
12.4.3 Automatic Control..................................................................................................454
12.4.4 A Process Database for Monitoring and Control ...................................................455
12.4.5 Derived Variables ..................................................................................................459
12.4.6 Access to the Process Database, Queries and Protocols ....................................459
12.4.7 Control Operations via the Process Database ......................................................462
12.4.8 Advanced Languages for Process Control ...........................................................463
12.5 Project Realization and Quality Control .................................................. 464
12.5.1 Project Organization ..............................................................................................464
12.5.2 Quality Control as Part of System Development ...................................................465
12.5.3 Towards the Automated Factory? .........................................................................466
12.6 Summary ................................................................................................ 468

Appendix: Standards and Standardization Organizations ....................................... 469

Bibliography ............................................................................................................. 473


Abbreviations

A/D Analog/Digital (converter), also ADC


AM Amplitude Modulation
ANSI American National Standards Institute
AR Auto Regressive (digital filter)
ARMA Auto Regressive Moving Average (digital filter)
ANSI American National Standards Institute
ASCII American Standard Code for Information Interchange
ASK Amplitude Shift Keying
ASN Abstract Syntax Notation
ATM Asynchronous Transfer Mode
BBM Break-Before-Make (contact)
BER Basic Encoding Rules
BiΦ-L biphase-level
BMP Basic Multilingual Plan
CCITT Comité Consultif International de Télégraphie et Téléphonie;
now. ITU-T
CEN Comité Européen de Normalisation
CENELEC Comité Européen de Normalisation Electrotechnique
CIM Computer Integrated Manufacturing
CMOS Complementary Metal-Oxide Semiconductor
CPU Central Processing Unit
CRC Cyclic Redundancy Check
CSMA/CD Carrier-Sensing Multiple Access / Collision Detection
D/A Digital/Analog (converter), also DAC
DCE Data Communication Equipment
DCE Distributed Computing Environment
DDC Direct Digital Control
DDDC Distributed Direct Digital Control
DIN Deutsches Institut für Normung
DIP Dual In-line Package (construction type for electronic board
components)
DMA Direct Memory Access
DO Dissolved Oxygen
DSP Digital Signal Processor
DTE Data Terminating Equipment
EBCDIC Extended Binary-Coded Decimal Interchange Code
EIA Electrical Industries Alliance
EISA Extended Industry Standard Architecture

xi
xii Computer Systems for Automation and Control

EMC electromagnetic compatibility


FBD Function Block Diagram
FCS Frame Check Sequence
FDDI Fiber Distributed Data Interface
FDM Frequency Division Multiplexing
FEP Front-End Processor
FET Field-Effect Transistor
FM Frequency Modulation
FMS Flexible Manufacturing System
FPLA Field-Programmable Logic Array
FSK Frequency Shift Keying
FTAM File Transfer Access and Management
FTP File Transfer Protocol
I/O Input / Output
GTO Gate Turn Off
HC High-Speed CMOS Logic
HDLC High-Level Data Link Control
IC Integrated Circuit
IEC International Electrotechnical Commission
IEEE Institute of Electrical and Electronic Engineers
IGBT Insulated Gate Bipolar Transistor
IL Instruction List
I/O Input / Output
IP Internet Protocol
IPS Internet Protocol Suite
ISA Industry Standard Architecture
ISA Instrument Society of America
ISDN Integrated Systems Digital Network
ISO International Organization for Standardization
ITU International Telecommunication Union
JK Indication of the Master-Slave flip-flop
LAN Local Area Network
LAPB Link Access Procedure-Balanced
LAPD Link Access Procedure, D-channel
LD Ladder Diagram
LED Light-Emitting Diode
LLC Logical Link Control
LSI Large Scale Integration
LS-TTL Low-power Schottky Transistor-Transistor Logic
MA Moving Average (digital filter)
MAC Medium Access Control
Abbreviations xiii

MAP Manufacturing Automation Protocol


MBB Make-Before-Break (contact)
M&C Monitoring and Control
MHS Message and Handling System
MIPS Mega Instruction Per Second
MMI Man Machine Interface
MMS Manufacturing Message Specification
MOSFET Metal-Oxide Silicon Field Effect Transistor
MSI Medium Scale Integration
MTBF Mean Time Between Failures
MTTF Mean Time To Failure
MTTR Mean Time To Repair
NC Numerical Control
NFS Network File System
NRZ Non-Return to Zero
ONC Open Network Computing
OSF Open Software Foundation
OSI Open System Interconnection
PAL Programmable Array Logic
PD Proportional-Derivative (regulator)
PI Proportional-Integral (regulator)
PID Proportional-Integral-Derivative (regulator)
PIPI Proportional-Integral-Proportional-Integral (regulator)
PLC Programmable Logical Controller
PLD Programmable Logic Devices
PM Phase Modulation
PROFIBUS Process Fieldbus
PROM Programmable Read-Only Memory
PSK Phase Shift Keying
PTT Post and Telecom
PWM Pulse Width Modulation
QAM Quadrature Amplitude Modulation
RAM Random Access Memory
RC resistive-capacitive circuit
RL resistive-inductive circuit
ROM Read-Only Memory
RPC Remote Procedure Call
RS Recommended Standard (EIA)
RTD Resistance Temperature Detector
RZ Return to Zero
SCR Silicon Controlled Rectifier
xiv Computer Systems for Automation and Control

SDLC Synchronous Data Link Control


SFC Sequential Function Chart
S/N Signal/Noise ratio
SONET Synchronous Optical Network
SPDT Single-Pole Double-Throw
SPST Single-Pole Single-Throw
SR Set-Reset (flip-flop)
TCP/IP Transmission Control Protocol / Internet Protocol
TDM Time Division Multiplexing
TDMA Time Division Multiple Access
TOP Technical and Office Protocol
TRIAC TRIode AC semiconductor
TTL Transistor-Transistor Logic
UART Universal Asynchronous Receiver Transmitter
UCS Universal Multiple-Octet Coded Character Set
UDP User Datagram Protocol
VMD Virtual Manufacturing Device
VME VERSA Module Eurocard
VT Virtual Terminal
Preface

„Computer Systems for Automation and Control“ deals with the principal aspects
of computer applications in system control, with particular emphasis on industrial and
process automation. The description is not limited to the hardware and software
components of process control computers but covers additional topics such as
systems modeling, signal processing, digital control and data communication. The
accent is put on the integration of the different components, as well as of the
computer system in its operating environment, including the interface with the human
user.
The book is intended for readers with different backgrounds. Some of them may
have process-related experience and know quite a lot about traditional control
methods, and still feel insecure about the use of digital technology. Other readers
may be computer experts, entirely at home with software but less so with process
control. A third group of readers could be project managers who need a broad
picture of the subject without getting too involved with specific details. Therefore the
topics have been selected and presented in such a way as to integrate the reader’s
knowledge with computer-oriented or application-oriented information, depending on
his or her particular needs.
Automation is a very broad concept and as such can mean everything and
nothing. Many of the textbooks in this area promise a lot in their title, while in fact
they focus only on a much more restricted field, usually either mathematical control
theory or practical programming issues. Yet the Nyquist stability criterion is of no use
in programming binary control sequences, as little as Boolean algebra in the
dimensioning of a feedback control circuit. In the following, automation will be
presented as an integrated concept by treating the major issues of each related field
of knowledge singularly as well as in relation to the others. Each chapter is self-
contained to allow an easy selection of the desired topics and presents the key
theoretical issues together with practical details. Particular emphasis is given to
standard components and methods accepted by both the industry and
standardization organizations, as technical solutions oriented to generally accepted
standards stand the best chances of success in the future. Moreover, standards
support modularity - one of the most important factors in the systems approach.
Process control can be realized in many different ways and with different
technologies, from specifically-built integrated circuits to system boards and to large
turnkey systems. This book focuses on design from board level upwards, because in
practice system integration at different levels is the most common way to work. The
Authors do not claim to teach how to design perfect systems, but rather how to look
for acceptable and reasonable solutions using readily available components.
Research on real-time computing has been carried out at the Department of
Automatic Control of the Lund Institute of Technology since the end of the 1960s.
Based on this experience, from the early 1980s a new course in computer
applications in control could be offered. The purpose of the course is to combine
theoretical and practical issues and present a broad view of computer and control
engineering. Thanks to the traditionally close ties between industry and universities
in Sweden, the course has profited largely from industrial field experience. Prime
movers in the development of the course were Hilding Elmqvist, Leif Andersson,
Sven-Erik Mattsson, Johan Wieslander and Gustaf Olsson.

xv
xvi Computer Systems for Automation and Control

The course was not only appreciated by the students but also by professional
engineers, one of which was the Co-Author Gianguido Piani. This was his first
contact with the Department in Lund, and after some years spent in different
European countries he returned, this time as guest lecturer for the course. In the
spring of 1992 this course was offered in the frame of a Swedish-Baltic cooperation
at the Polytechnical Institute in Kaunas (Lithuania), the first engineering course held
there in English.
The Authors hope that automation technology will increasingly help in the
practical solution of many of today’s most pressing problems such as resource
conservation, environmental control and improving the living standards for the
populations of the world’s poorest countries.

Acknowledgements
A number of people have contributed in different ways to the preparation of this
book. They include Gunnar Lindstedt, Ulf Jeppsson, Bo Peterson, Sven-Göran
Bergh, Anders Peltomaa and Dr. Jaroslav Valis at the Department of Industrial
Automation, Lund Institute of Technology. Leif Andersson, with his broad experience
in real-time programming has provided several valuable hints.
The first draft of the manuscript, written in a combination of „Swenglish“ and
„Italiese“ (i.e. an English strongly influenced by Swedish and Italian), was read by
Professor Otto J.M. Smith at the University of California in Berkeley, by Professor
John F. Andrews at Rice University in Houston, by Dr. Robert „Bob“ Hill, City of
Houston, by Walt Schuk in Cincinnati and by Professor Don Wiberg at the University
of California in Los Angeles. Their comments and suggestions have decisively
contributed to the preparation and improvement of the text.
Further „feedback“ was provided by Dag Brück, Ola Dahl, Prof. Viktor Denk,
Ingvar Ekdahl, Richard Franz, John Lawrence, Dr. Krister Mårtensson, Mike
Neumann, Klas Nilsson, Prof. Odd Pettersen, Tomas Schöntal, Bengt Simonsson
and Mike Thompson.
Several of the proposed ideas were iterated in endless discussions with many
friends, among them Helena Rosenlind, Stefano Castelli and Cornelia Verbeek.
Many companies have also supported this work by providing information and
materials and by providing the opportunity to discuss current trends in technology
with their engineers. Finally, the Authors wish to thank many others who in different
ways helped us in this initiative and in particular Klas Nilsson for the computer
simulations to prepare the graphics contained in the text and Lena Somogyi at the
Department, who gave lot of practical support.
Contact via Internet

The Department of Industrial Electrical Engineering and Automation at the Lund


Institute of Technology (Sweden) has its own Home page on the Internet, that can be
reached at the following address:

http://iea.lth.se

At the same site can be found current information about all courses offered by
the Institute and the related didactical materials. In particular, for the course that
uses this book as main reference current and earlier test examples are available, as
well as all materials related to the practical laboratory exercises, computer simulation
examples, and more. Also copy of all technical and research reports produced at the
Institute are now available on-line at the same address. Please notice that part of the
materials is in English and part in Swedish.

The Authors would be happy to receive feedback from the readers about this
book. They can be contacted at the following addresses:

[email protected]
and

[email protected]

xvii
About the Authors

Gustaf Olsson (1940) is professor in Industrial Automation at the Department of


Industrial Electrical Engineering and Automation at the Lund Institute of Technology,
Sweden; he has held visiting positions at several universities and companies in
Europe, the United States, Japan and Australia. His interests include the control of
wastewater treatment plants and applications in power systems and manufacturing.

Gianguido Piani (1958) is currently with ABB Energy Information Systems, where
he deals with business development of power network control systems in Russia. His
main fields of interests are computer applications for energy management and the
integration of automatic control equipment in work environments. He was earlier
visiting lecturer at the Lund Institute of Technology.

xviii
1 Introduction

The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital
computer or the gears of a cycle transmission as he does at the top of a mountain or
in the petals of a flower. To think otherwise is to demean the Buddha, which is to
demean oneself.
[Robert M. Pirsig, Zen and the Art of Motorcycle Maintenance]

1.1 Computers in Process Control


The use of digital computers in automatic control is of fundamental importance
for the technological infrastructure of the modern society. Industrial production,
transportation, communication and environmental protection depend largely on
computer-supported control systems. Without some form of control, very few
technical systems could operate, which holds for the train as well as for the nuclear
reactor. Digital computers play here a fundamental role; in many situations there is
no viable alternative to computer-supported process control.
To describe the particular role played by the computer in process control, it is
necessary first to define what is meant by the term „process“. A physical process is a
combination of operations carried out in order to act on, and change, something in
the physical world. Movement, chemical reactions and heat transfer are all
processes in this sense. Examples of processes are any industrial or chemical
production, room conditioning (that brings a change in the physical variables
temperature and humidity), and transportation, which consists in the controlled
change of speed and position of a vehicle. Information processing alone does not
bring changes in the physical world and thus cannot be considered to be a physical
process in this sense.
The German technical standard DIN 66201 gives a precise definition of the
physical process as „a combination of related events in a system through which
matter, energy and information are changed, transported or stored“. The technical
process is defined as „a process, of which the physical values can be collected and
influenced with technical means“. The difference between the physical and the
technical process lies therefore in the fact that the physical process does not
necessarily have to be controlled from outside, while the technical process includes
information processing for the purpose of control. 1
Every physical process is characterized by its input and output elements in terms
of
• materials
• energy
• information
Some examples are reported in in Table 1.1.

1
The term „process“ can be used to describe transformation of matter and energy as well as a
program in execution. In general there should be no problem in understanding from the context what
process is referred to. Where there might be doubt, we will use the term „physical process“ or
„technical process“ to indicate a transformation of matter/energy and program module or task for the
other meaning of the term.
2 Chapter 1: Introduction

Input / Output Chemical reactor Room conditioning Aircraft control

Material input Reagent feed stream

Material output One or several new


product(s)

Energy input Added heat or cooling Added heat or cooling Fuel to power the
engines

Energy output Heat from the reaction Heat radiation The aircraft movement

Information input Control of feed flow Control of heating/ Control of engine


rates and added heat cooling fluid speed and position
temperature and of the aerodynamic
flow rate surfaces

Information output Measurements:: Measurements: Measurements:


temperature, flow temperature angle of attack, roll,
rates, pressure, pitch, speed, altitude
concentration(s)

Table 1.1: Examples of process input/output

In general, materials, energy and information can be considered as flows that


enter, exit and are changed by the physical/technical process.
Materials and energy are obviously basic components of a physical process.
Information is also an indispensable part of any process, although it is not too long
since this aspect has been understood and accepted. In addition, there are many
other factors that cannot be controlled or manipulated, but also influence a process.
These factors are regarded as disturbances that lead the process away from the
desired operating point (Figure 1.1). Disturbances are not physical quantities in
themselves, but appear as sporadic variations in the material, energy and
information flows.
An industrial process delivers as output a product from the raw materials and
energy input. The information input to the process includes work instructions,
expressed as the set of parameters that can explicitly be controlled. The output
information of the process is the set of measured variables and parameters that
describe its current state and evolution. Much information lies also in the final
product itself. Information is therefore not just the data for monitoring and control, but
includes company know-how and organizational routines, down to memos circulating
between offices and delivery orders. This type of information is as important as any
other element for balancing and optimizing the production process.
The input and output elements of a process should be considered in the
following in a very broad sense. For instance, in the case of transportation it might
not be immediately obvious what the output is. In fact, transportation involves a
change in geographical position (i.e. a physical state) so that work is produced, and
work is a form of energy. The output of the „transportation“ process is therefore a
change of the physical state „energy“.
1.1: Computers in Process Control 3

environment

disturbances

material material
input physical/ output
technical process
energy energy
input output

information information
input output

Figure 1.1: The model for a generic physical/technical process

Information is important in the control of physical processes because it enables


better use to be made of other two factors, matter and energy. Considering the
paramount problems resulting from industrial activities, with related resource
depletion, waste production and environmental pollution, anything that improves the
efficiency of a process and contributes to reduce waste is of great interest. In fact,
information processing that leads to more efficient operation of technical processes
is already quite a profitable activity.
Digital computers are essentially devices to process information (Figure 1.2) and
may also operate on the particular information related to physical processes (Figure
1.3). In most applications, computers are used to check and, if necessary, produce
the required control signals so that the operating parameters of a technical process
remain within given limits even in presence of external disturbances.
Industrial process control differs in many respects from conventional data
processing. For common data processing applications such as accounting and text
editing, input and output are pure data that can be recorded and transmitted on any
medium able to carry it. The computer can set its own timing to produce the output. A
more powerful computer will work faster, but produce the same result as a slower
device.

information information
input computer output

Figure 1.2: Operation of a digital computer


4 Chapter 1: Introduction

environment

disturbances

material material
input physical/ output
technical process
energy energy
input output

information information
input output

output input
computer

Figure 1.3: Use of the computer in process control

The situation is different for process computers. Here the computer does not
have full control of the execution flow but instead must follow the pace at which
things happen in the outside world. The computer must be able to react sufficiently
fast to external events. Computer control systems must continuously process the
input data, very often without the possibility of changing the amount and rate at
which they are received. At the same time they might have to perform other
functions, for instance, information exchange with human operators, data
presentation on displays and reaction to particular signals. This mode of data
processing is so important that it has received its own name: real-time.

1.2 A Bit of History


The first practical example of a process computer application dates back to
1959; it concerned some functions at a Texaco petrochemical plant in Port Arthur,
Texas (USA). Texaco carried out this pioneering work together with the computer
producer Thomson Ramo Woolridge. The RW300, a computer built with electronic
tubes, monitored flows, temperatures, pressures and compositions in the refinery.
The computer calculated the desired control signals on the base of its input data and
then either autonomously changed the set points of analog regulators or indicated to
the operators what controls had to be implemented manually. The machine had a
very small capacity compared with the computers of today: its typical addition time
was 1 ms and a multiplication took around 20 ms. Reliability was not a strong point
either: the mean time between failures (MTBF) was a matter of hours or at most
days.
The first applications of process computers had all the odds against them. In
order for a computer investment of some million US dollars to be economically
justified, the process or plant to be controlled had to represent an investment of at
least an order of magnitude larger than the computer control system itself. This
1.2: A Bit of History 5

meant that the process necessarily had to be very complex, as in the case of large
chemical plants. Another key issue was - and remains - the structuring of the control
problem as prerequisite for the application of computers.
Economy was not the only problem. Hardware reliability was low because of the
electronic tubes. Software was written in Assembly language and not a single bit of
the scarce memory available was left unused. Still these pioneering efforts were
supported by many computer manufacturers who saw a great potential market for
these new applications.
Computer control is an area where an unusually constructive interaction between
theory and practice has taken place. As described later in the book, computer control
has special features of its own. Conventional mathematical methods based on
continuous time analysis cannot be used directly for the design of control loops that
have to be implemented in computers. For this reason, computer control indicated
early on the necessity for a special theory of sampled control, at the same time
providing the foundation for its development. A fortunate coincidence was the
development of the US space program in the 1960s and especially the Apollo
project, that acted as catalyst for the theoretical and practical aspects of computer
control.
An important step was taken in 1962, when ICI (Imperial Chemical Industries) in
England introduced the concept of direct digital control (DDC). Basically, the idea
was to replace several conventional analog control loops with a central computer. A
large and expensive control panel with hundreds of analog controllers and recorders
could be replaced by some computer terminals. The computer simulated numerically
the analog controllers in a way that was not much different from today’s solutions.
The basic idea of DDC is still applied in many of today’s industrial computer
systems. A reason for its success is that the control problem had already been
defined and structured to allow the use of analog techniques. There were therefore
less risks than in pioneering implementations where the objectives of computer
control were not fully understood and adequately defined. The obvious drawback
with DDC was that system reliability critically depended on the central computer.
However, for an additional investment a second computer could be installed to take
over, should the first fail. The computer of 1962, a Ferranti-Argus, was considerably
better than the 1959 generation. Addition and multiplication times had already
improved by a factor of 10, and also reliability had increased an order of magnitude.
The advent of the transistor in the 1960s led to notable progress for computer
applications. The introduction of the transistor-based minicomputer in the mid 1960s
brought the price for computing power to an order of magnitude less than for
mainframes, even though the price tag of a typical minicomputer was still higher than
US $ 100,000. Anyway, computer control began to be considered for smaller and
less complex applications. Minicomputers could be installed close to the process and
therefore became popular in small automated production and testing units. The three
factors: better computer hardware, simpler processes and a more developed control
theory, acted in combination to accelerate the success of computer control.
Every decade seems to bring a new computer technology with considerable
advantages in performance and price over the preceding one. Powerful card-
mounted microprocessors have been available since the mid 1970s and today even
the most simple process control units can be economically realized with digital
techniques. Current personal computers are more powerful than the minicomputers
of the 1960s and 1970s, typical performance includes a central processing unit with
16 or 32 bit word length, some Megabytes of primary memory, Gigabytes of
6 Chapter 1: Introduction

secondary storage, and all at costs already much lower than for the earlier
computers.
Computer applications that are largely popular in industrial control are the open
buses. Here the accent is put not on specific components, but on the interface (the
bus) between operational modules. The hardware modules in a bus system are
selected to fit the intended application without leaving any resources unused.
On the other hand, computing power is not everything. The efficiency of a
system does not depend only on its control computers. The on-board computer of
the first lunar spaceship, Apollo 11 in 1969 had 64 kbyte of primary memory and of
course no disk unit. Today, nobody would give a second look at such a machine, but
the lesson to learn by considering what that computer helped accomplish, it is that
attention has to be given to the goals of the technical process on its whole rather
than just to the size of computer hardware. High computing power should therefore
not be a sales argument in itself; computer power should instead be considered in
relation to the dynamics and complexity of the process under control. A slow
computer can very well control a slow (e.g. a chemical or biological) process.
In a digital control system it is comparatively easy to try new control strategies
since a digital computer may completely change the way it works when its programs
are modified, without having to redesign and recable the whole system. Thus digital
control systems offer not just a new way to implement established principles for
control, but an entirely new technique that has greater flexibility and opens new
possibilities. Process knowledge, system dynamics and control theory are necessary
ingredients for a computer control project to be successful, but they represent only
half of the picture. The structuring of the entire solution in terms of hardware units,
software modules and communication remains a major challenge.
The one-sided concentration of our attention on computer technology can also
distract our attention from other basic problems. Yet also the following should be
considered. After about thirty years of computer usage, we now have enough
experience to ask ourselves about the real advantages they brought in industry and
administration. In the 1950s and 1960s, before computers became so widespread,
one income-producing person could support a whole family including paying housing
mortgages. In the typical family of today, at least two people must work full time to
keep up with a satisfying, yet more demanding, lifestyle. What a couple of decades
ago was painted to become a kind of Golden Age thanks to computers and
automation turns out now to be less golden than expected if new problems, from
unemployment to the environmental situation, are taken into the picture. A similar
case might be today’s overrating of Internet and „network companies“. Without
disregarding anything of their merits and advantages, they still do not provide a
reliable and effective tool to solve real-life problems. The intense focus on computer
use, for example with fancy pictures and sounds, may distract attention from where
the real problems are.

1.3 Systems
Processes and their control systems consist of different parts interacting in
complex ways. The components are connected together so that matter, energy and
information are exchanged in order to obtain a certain result. It is not easy to give a
general definition of a „system“, but the following important aspects can be identified:
1.3: Systems 7

• The idea of a system is a mental aid to interpret and understand the function of
any complex structure where different components interact with each other.
• There are many ways to divide a system in order to describe it. Any of its
components can be further divided into smaller parts, or the divisions may take
a different form. It is important to always select the right level of detail.
• It is usually not necessary to know the internal workings of an element to
foresee the global functions of the system it belongs to. It is sufficient to know
its input/output relations (the black box principle).
• The goal of a system is to reach a result quantitatively or qualitatively higher
than the sum of the results of the single components taken alone. The system
adds „something more“, to justify its function (synergy principle). This
„something more“ is not the result of a single system component, but rather of
the way the single parts interact.
Systems may be of many different types, e.g. electrical, chemical, mechanical or
biological. A computer is a system built with the basic functional components: central
processing unit (CPU), memory and peripheral devices. Taken alone, these units do
not do anything. Put together with the operating software, the result is a computer
that can accomplish many things. The human body is an extremely complex system
built with organs that serve different functions. The body is able to fulfill its basic
goal, to sustain its own life, because each organ functions together with the others.
Different mathematical methods can be used to describe systems and their
elements. Although strongly emphasized in most textbooks, such methods can be
applied only where all the elements of a system as well as its external environment
can be described in form of quantitative relations. We will see in Chapter 3 that
mathematical descriptions are not the only ways to describe systems. When they can
be used, they obviously have the advantage of the correctness of their formalism.
An important aspect of systems knowledge is system dynamics, i.e. the
prediction of future system behavior and the selection of appropriate control actions
in order to influence that behavior. System dynamics is particularly tricky because of
the many interactions among the different system components that have to be taken
into consideration. It happens often that the evolution of a system seems to lead in
the „wrong“ direction or at least against „intuitive“ expectations. Every car driver
knows instinctively what system dynamics is. The driver plans to increase or reduce
the pressure on the gas pedal at the sight of a hill, so that the car speed remains
constant. The car behavior is normally known and predictable, but might turn to be
unpredictable if not altogether uncontrollable if the road is wet or icy. Similar
problems are encountered every day in the control of technical processes.
In large applications, one of the major problems is how to structure the system.
Many people must cooperate, some technical components must be gradually
exchanged and new facilities added. In the approach to complex systems it is
important to have both deep and broad views.
Problems cannot usually be solved at one level only, instead they must be put in
the right perspective and focused on at the right level. This does not mean having to
know all the details of any given situation, but rather that one should be able to
investigate specific details whenever this is necessary. A solution found at the wrong
level is often not a solution at all; it could even make things worse. It does not help to
check a program for bugs for a missed printout, if the printer is switched off. Every
engineer may tell some own anecdotes in this respect.
8 Chapter 1: Introduction

The boundaries between what used to be the private realms of electrical


engineers, programmers, application experts and users are today becoming more
and more fuzzy and confused. Complex systems cannot be considered from one
point of view only and solutions defined on the basis of specialist knowledge from
only one field. A special approach is needed to understand and build complex
systems consisting of many different parts in mutual interaction. We will give some
indications about how the analysis and design of automated systems can be
approached with success.

1.4 Some Typical Applications of Computer Control Systems


Applications of computer control can be found everywhere, as they range from
consumer products to high-tech industry. Today, in a standard car computers are
used to control both the ignition timing and the air/fuel ratio in the engine, as well as
the temperature in the passenger compartment. Not even the radio tuning is left to
the driver alone anymore.
The control systems for a chemical process and for railroad junctions at a large
train station may seem at a first glance to have little in common with robots for car
painting or the space shuttle board computers. However, similar basic functions are
found in all these systems: data acquisition, the execution of clock- or interrupt-
driven functions, feedback control, data exchange with other computers and
communication to a human operator.
The general structure of a process computer interacting with a physical/technical
process consists of the following parts (Figure 1.4):
• central data processing unit (CPU)
• communication channels
• analog to digital (A/D) and digital to analog (D/A) converters
• sensors and actuators
• physical/technical process

analog digital
signals data
A/D and D/A
converters
sensors and network
actuators interface

digital
signals
communication
network or bus
system

physical/ technical process


process computer

Figure 1.4: The basic structure of a process control system


1.4: Some Typical Applications of Computer Control Systems 9

The physical process is monitored with sensors, i.e. devices that convert
physical variables such as temperature, pressure or position into electrical variables
that can be measured directly, such as resistance, current or potential difference.
Examples of sensors are thermistors (temperature sensors), end position switches
and ultrasound microphone pickups. Conversely, a process can be influenced with
help of actuators. Actuators transform electrical signals in physical actions, principally
movement (displacement and rotation) that can be used to other purposes, e.g. to
open a valve. Examples of actuators are servo motors, hydraulic valves and
pneumatic positioners.
A digital control system works only on information in numerical (digital) form, so
that the collected electric variables must be transformed via analog to digital (A/D)
converters. The inverse operation is less problematic because the computer can
control directly actuators like motors and valves through electric signals.
Information from different source points distributed in space is brought to the
central unit through communication channels. The central control unit interprets all
incoming data from the physical process, takes decisions on the base of program
instructions, sends control signals, exchanges data with the human operators and
accepts their commands.
Not unexpectedly, the manufacturing industry provides good ground for many
applications of digital computers. Numerically controlled (NC) machines produce
high-precision mechanical parts following well determined sequences of operations.
NC machines are built for different types of applications; their operations depend on
the stored software, which can be changed at comparatively little time and cost. The
flexibility and sophistication of industrial robots is mainly owed to computer control.
When a machine alone cannot process a part, flexible manufacturing systems (FMS)
can take over in a work cell or a section of a plant. In FMS the operations of each
machine, the mutual interactions and the transport of components from one machine
to the other are all controlled by computers.
The process industry, including chemical, metallurgical and the paper and pulp
industry, offers several challenges. The different unit processes are often
interconnected and large material flows continuously circulate between them. In
addition, the processes mostly operate around the clock, so reliability is a key factor.
The number of measurement variables is large, timescales range all the way from
seconds to days and the physical size of the plants is considerable. The capital and
material costs are usually extremely high, so that even small changes in operating
conditions and quality have an impact on the economy and competitiveness of a
plant. The quality of a computer control system is therefore of decisive importance.
Electrical power systems range among the most complex systems ever built.
They include the primary power sources, such as hydroelectric plants, steam boilers
and nuclear reactors, as well as large transmission and distribution networks. To
describe the interconnected power system of a medium size country, thousands of
equations for generators, turbines, power lines, loads, etc. are needed. Electrical
power cannot be economically stored in large quantities and has to be produced in
the same moment as it is consumed. The control of power generation and
transmission must be extremely fast and accurate, in order to identify power load
changes and match them in time by changing the generation levels or the exchanges
with other producers. Power utilities need to keep track of working hours for the
industry and in some cases even of the beginning and end of popular television
programs.
10 Chapter 1: Introduction

Transportation includes many computer control problems. The control of traffic


lights is well known, but it is far from trivial to find the best control strategy. How
many of us have cursed the red lights and been unhappy with the priorities which
always seem to be given to a different traffic direction! The control of all the traffic
lights in a city section is a true challenge since the traffic intersections are more or
less strongly coupled to each other, which leads to complicated interaction effects.
In this book we also have another scenario in mind. Automation means not only
fancy advanced applications like automated factories and robots. In most of the
world these applications make little sense because of the lack of technological basis
and of the necessary know-how. On the other hand, automation is needed also in
less and medium developed countries in order to save scarce energy and materials
resources and improve the efficiency and security of environmentally dangerous,
highly polluting industrial processes.

1.5 A Guide for the Reader

The Purpose of the Book


The main goal of this book is to present an integrated view of computer control
of industrial processes. There are so many disciplines that have to be combined in
order to realize complex systems, that it is impossible to cover all aspects in detail in
one book. Because of the breadth of the topic and its interdisciplinary character,
each chapter can easily be expanded to a thick book (in most cases such thick
books already exist). The problem is here to limit the scope of each chapter to help
the reader - with reasonable effort - combine different disciplines in order to get the
complete picture of industrial and process computer control.
The book does not present new theories for computer hardware, software or
control principles, rather it attempts to integrate known ideas into a general frame.
Hardware and software, theoretical concepts and their practical consequences are
presented together to let the reader understand the role played by each component
of a computer control system. The reader of this book may not directly be a
developer of real time programming systems or new control methods, but instead will
hopefully be a „competent customer“ or user, sufficiently knowledgeable to combine
the right pieces of hardware and software into a functioning computer control system
as well as to understand its potential and limitations. We hope however that also
system developers and other specialists will use the book to widen their perspective
and look at their own specialty under a new focus.

Necessary and Desired Background


We have tried to present the material in such a way that the reader does not
need specialized knowledge of any of the particular fields that are treated. However,
we had to assume some necessary theoretical background, such as
• elementary calculus
• elementary electric circuit theory
• elementary feedback control theory
• basic principles of computer structure and operations
• programming in some high-level language, as for instance Basic, Fortran or C
1.5: A Guide for the Reader 11

Some understanding of differential equations and matrix analysis is useful to get


a deeper insight in some of the arguments, though they do not represent an absolute
requirement.
In the selection of the themes presented in this book we have striven for
completeness, on the other hand we have often come across certain limits. For
example, it would have been useless to discuss the basics of digital data processing
or describe a particular programming language, as this knowledge today is part of
the basic curriculum of every engineer and moreover can be found in numerous
other specialized textbooks. We have instead included more detailed descriptions of
bus systems and real-time programming, because this is still quite new information
that represents a meaningful addition to basic knowledge in hardware and software.
The same holds for control theory, as the analysis of a simple controller is a
compulsory part of all engineering curricula, and there also is a wealth of good
literature available on the subject. The case is however different with the digital
(sampled) control theory, as the qualified and very extensive books might rather keep
some non-specialist reader away from this subject, if they do not need the full range
of information that is contained there.
In other special fields, from digital filter theory to data communication we have
made an effort to combine in a balanced way the presentation of the main themes
with practical suggestions and hints.

Book Outline
The single chapters present each different parts or aspects of a computer
control system. The Chapters 2 through 6 are dedicated to theoretical aspects in
modeling and control (though with many references to practical issues and existing
equipment), while Chapters 7 through 11 deal with modern hardware equipment and
software methodology in the construction of process control systems.
In Chapter 2 the concepts of real-time programming and computer process
control are defined. The idea of concurrent processes is illustrated through a simple
example. Different process control problems are then classified with respect to their
character and to their complexity. The identified problem areas act as pointers to the
later chapters of the book.
In Chapter 3 different system descriptions and concepts are illustrated, with
emphasis on the description of dynamic systems, first with continuous and then with
time-discrete models. Further we present some approaches for the description of
physical processes that deliver insufficient information.
Measurement, data acquisition and signal transmission are discussed in Chapter
4. Basic operating principles for sensors and actuators are described together with
the issues related to electrical noise, disturbances and signal conditioning.
Chapter 5 deals with signal processing - principally filtering - to limit the effect of
noise and disturbances; both analog and digital filtering are treated. The sampling
theorem about the conversion of analog signals to digital and vice versa represents
the main subject of this chapter. In addition some methods for basic signal testing
are described.
Chapter 6 describes the computer implementation of regulators. Different control
structures are described together with the related digital controller implementations in
order to give a taste of their possibilities as well as of their limitations.
Chapter 7 deals with sequencing control and its implementation in
programmable logical controllers (PLCs), i.e. simple, self-contained computers that
12 Chapter 1: Introduction

operate on binary measurements and control signals. Despite - or thanks to - their


simplicity, PLCs play a significant role in many industrial applications. In this chapter
also function charts are shown as a means to structure the programming code, even
in very complex control situations.
Bus systems and architectures are discussed in Chapter 8, with particular
emphasis given to the VME standard.
Data communication is a very important topic in industrial automation. In Chapter
9 the Open System Interconnection (OSI) model is used as a framework to describe
the different aspects and levels of the communication process. Some standards
often found in industrial applications are described, in particular the Manufacturing
Automation Protocol (MAP) scheme and Fieldbus network solutions.
Chapter 10 is an introduction to the specific methods of multiprogramming and
real-time programming: resource protection, synchronization and data exchange
between program modules. In this chapter it is shown how an operating system
supports the execution of several programs under real-time requirements. Current
operating systems and programming languages are briefly evaluated in relation to
their real-time capabilities.
The interface between the user and the computer plays a crucial role in the
practical operations of control systems and is often an essential factor for the
success of an application. Some principles of importance for applications in industrial
environments are described in Chapter 11.
The topics of Chapters 3-11 are put together in Chapter 12 in a practically-
oriented approach to control systems. In industrial practice digital control systems are
not built starting anew each and every time, and for this reason this chapter
addresses questions like which components are available, how do they perform and
how can they be interconnected. Several systems are available on the market that
may be programmed with help of parameters instead of with ordinary programming
code; „off-the-shelf“ software can also be used for many applications. Some typical
industrial applications are presented in this chapter in order to illustrate the different
problems and approaches in practical problem-solving.
All programming examples in the book are in Pascal because of its readability,
also for non-specialists. Each chapter contains recommendations to specialized
literature, to guide the reader in further studies of the respective subjects.

Further Reading
The quote at the beginning of this chapter is taken from one of the classic books
of the 1970s [Pirsig 1974]. Many of its comments about technology and how to deal
with it are still worth considering. Yet the author warns: „Don’t use this book as a
reference guide for the oriental doctrine Zen. It is not very factual on motorcycles,
either.“
The masterwork of the 1980s about complex structures, information,
communication and artificial intelligence is most probably [Hofstadter 1979].
Countless connections between music, art, old languages, biology and computers
develop naturally in the narration and constantly lead the reader to look at things
under new perspectives.
Numerous good articles have been published in Scientific American about
process control and its technological implications, e.g. [Spector 1984] and [Ginzberg
1982]. For an highly qualitative description of the possibilities offered by software,
check [Kay 1977, 1984].
2 Process Computers’ Application Issues

Aim: To familiarize the reader with the basic issues and requirements for
computer systems in process automation and control

Overview
This chapter is an introduction to the typical problems encountered in process
automation and how these can be tackled with computer control systems. Each
problem or part of a problem will show the necessity for the respective solution and
act as introduction to the material that is presented in later chapters. To exemplify
the problems encountered in practice and the way they are approached, two case
studies are described in detail, the electrical drive system and the control of
biological wastewater treatment plants. These case studies will be referred to
throughout the book as they provide a wealth of practical examples to illustrate the
theory. These particular case studies were chosen because of their different
timescales and because they embody many of the problems that are experienced in
other control applications.
The problem of real-time operation from the point of view of computer
programming is examined in Section 2.1. Section 2.2 illustrates typical process
control applications and in Section 2.3 are described the main problem areas in
computer control, with reference to their further treatment in the text. The case
studies (the electrical drive system and the control of biological wastewater treatment
plants) are presented in Section 2.4.

2.1 Real-time Process Control


Computers that are connected to physical processes show different problems
than computers used for „conventional“ information processing. A basic aspect is
that computers that interact with an external process must operate at a speed in
relation to that of the process (Figure 2.1). The very definition „real-time“ points to the
fact that no appreciable delays must be noticed in the reaction of the computer
system to external events.
environment

human real-time physical /


operator process technical
computer process

Figure 2.1: Use of the process computer

The other main peculiarity in computer process control is that the execution
order of a program cannot be determined beforehand. External signals may interrupt
and change the program sequence, so that this will be different for every new
execution run. In addition, the resources of real-time computer systems must be
14 Chapter 2: Process Computers’ Application Issues

used effectively and the timing constraints must be respected. To achieve these
results special programming methods are required. To make things more
complicated, the lack of a predictable execution order makes testing much more
difficult in real-time systems than in conventional computer systems.
One important property of the real world is the parallel operation. All things
around us, ourselves, and physical processes of virtually any kind can be considered
as consisting of numerous „sub-processes“ that operate in parallel. This property has
the important consequence that a computer connected to such a process for the
purpose of interacting with it, or control it, must take into account - and in some
situations behave - according to this parallel nature. The natural consequence of this
parallel behavior is that the computer itself must be able to conduct parallel
operations. This is different from the operation of a general purpose computer, in
which a sequential mode of operation is natural.

2.1.1 Example: The Plastic Extruder


The control of a plastic extruder will serve as an example for a typical process
computer problem. The computer must at the same time control (i.e. keep constant)
a temperature and coordinate a sequence of operations. If programming is done by
conventional methods, the problem of structuring the code becomes soon
overwhelming. A different approach is thus called for.
A plastic extruder is shown in Figure 2.2. A container holds molten plastic
material; the temperature of the plastic mass must be kept within a narrow range.
The control computer reads regularly the actual temperature and calculates the heat
that is necessary to keep it at the desired value. Heat is provided by an electrical
element controlled by a relay. The relay closing time corresponds to the delivered
heat.
The lower part of the extruder consists of a piston that pushes a certain amount
of molten plastic through the mouthpiece. When the piston is in the right end
position, the cylinder is filled with plastic. The piston is then quickly moved to the left
to eject the desired amount of plastic. The position of the piston is monitored by a
pulse sensor that gives a specified number of pulses per millimeter displacement, so
that the volume of ejected plastic material can be calculated from the number of
pulses generated during the movement. The piston movement must be halted as
soon as the required number of pulses has been reached.
The computer system must control the temperature and the piston movement
simultaneously. The temperature is delivered as a continuous signal from a sensor.
The piston position is calculated from the number of pulses; in addition two sensors
indicate with binary signals when the piston has reached one of the end positions.
The computer has no independent internal clock and must therefore represent the
time with an internal counter.
2.1: Real-time Process Control 15

heat control

temperature
molten plastic

pulse train

pulse process
counter computer
pressure
cylinder
move
move right
left
command

end position right


end position left

Figure 2.2: The plastic extruder

2.1.2 Control by Conventional Programming


In the following it will be investigated how far real-time problems can be solved
by conventional programming. The program routine for temperature control is shown
in Figure 2.3 in form of a flow diagram. The computer updates the time counter
(represented by C) in a wait loop until either the desired time for heating
(„heat_time“) or a maximum of 10 seconds have elapsed. In this way the computer
cannot do anything else while it waits for the correct temperature to be reached.
Obviously, this is not the most efficient way to use the computer.
The control sequence for the piston movement is shown in the flow diagram of
Figure 2.4. The computer gives a start command for movement to the right and then
monitors the end position sensor with no interruption until it receives an indication
that the end position has been reached. The piston movement is then reversed to
the left and the computer must add and test the pulse signals, waiting for one pulse
at a time (indicated by n). The sequence is completed when the prescribed number
of pulses („pulse_ref“) has been reached. The full sequence is then repeated. As in
the case of temperature control, the computer cannot do anything else while it is
waiting in loops testing for signals.
16 Chapter 2: Process Computers’ Application Issues

start

measure temperature
calculate heat power need
set variable heat_time
heater contact on

C=0

C=C+1

wait
yes 1 second
C = heat time ?

no

no
C = 10 ?

yes

heater contact
off

Figure 2.3: Flow diagram for temperature control in the plastic extruder

Each of the two different tasks can be solved straightforwardly with sequential
code. However, it is no longer trivial to combine the two tasks into one single
program. Waiting loops cannot be used, since computer resources do not allow long
time delays, and one activity cannot wait for the other. In principle it is possible to
design a code without waiting loops. The program would however have to jump all
the time between the two tasks and check what to do next. The code would soon
become cumbersome and difficult to analyze. The forced serial disposition of
instruction blocks which must actually be executed in parallel introduces strong ties
between functions which should rather remain separated from each other.
2.1: Real-time Process Control 17

start

move piston to the right

no
end position
reached?

yes

stop piston
move piston to the left
n = 0 [number of pulses]

no new incoming
pulse ?

yes

n=n+1

n = pulse ref
no

yes

stop piston

Figure 2.4: Flow diagram for piston movement control in the plastic extruder

2.1.3 Control Using Interrupts


The major difficulty in writing a control program for the extruder process lies in
how to tell the computer that it is time to switch from one task to the other. The
problem is solved in practice by writing two independent tasks to run on the same
machine, one for the temperature regulation and the other for the control of the
18 Chapter 2: Process Computers’ Application Issues

piston movement. A signaling method called interrupt is used to indicate the


processor when it is time to run one task or the other. With the introduction of
interrupts the waiting loops can be substituted with waits for interrupts.
An interrupt is essentially an external signal that indicated the CPU that a
particular event has occurred. The event is indicated by sensors and induces the
CPU to interrupt its normal operation sequence and to start a new one. In this way
external signals can control what program module must be executed. A particular
type of interrupt is related to time. An electronic clock generates an interrupt signal
when a specified time has been reached or a time interval has elapsed. This clock is
not part of the CPU and is built with different components, although very often it is
installed on the same board with the CPU. In this way the CPU does not have to
continuously check the time. More about interrupts is contained in Section 10.6.
With help of interrupts the temperature control problem takes a simpler solution.
A time interrupt is connected to the variable „heat_time“. After the heater is switched
on, the task sets a clock for „heat_time“ seconds and waits for its signal to resume
execution. The corresponding instruction is „wait_time(heat_time)“, as illustrated in
Figure 2.5.

start

measure temperature
calculate heat power need
set variable heat_time
heater contact on

wait command
wait_time (heat_time) sec
clock interrupt (it resumes
program execution)

heater contact
off

wait command
wait_time (10-heat_time) sec
clock interrupt (it resumes
program execution)

Figure 2.5: Use of time-driven interrupts for temperature control in the plastic extruder

In a similar way, the piston sequencing control waits for two interrupts, one from
the right end position sensor and the other that signals the arrival of a new pulse that
indicates movement (Figure 2.6). The interrupts are related to instructions of the type
„wait_interrupt(x)“, where x indicates the channel where the interrupt signal is
2.1: Real-time Process Control 19

expected. The statement „wait_interrupt“ suspends the execution of the program.


Only when an external signal causes the related interrupt, the program can resume
its execution.

start

start piston movement


to the right
activate interrupt generation

wait for end position interrupt


wait_interrupt
(end position) external interrupt (it resumes
program execution)

stop piston
start piston movement
to the left
n=0

wait for next pulse interrupt


wait interrupt (pulse)
external interrupt (it resumes
program execution)

n=n+1

no
n = pulse ref ?

yes

stop piston

Figure 2.6: Use of interrupts for piston movement control in the plastic extruder

The interrupt feature gives the possibility to switch the execution from one
program task to another as a consequence of external events; this is all that is
needed to solve the control problem in an elegant and straightforward way. If each
20 Chapter 2: Process Computers’ Application Issues

program module is independent of the others, new features can be added to the
system without endangering the existing structure. The problems related to
multiprocessing and the methods for real-time programming are treated in Chapter
10.

2.2 Types of Process Control Applications


Process control applications span over many fields. In this section the major
aspects will be illustrated with help of some examples. To begin with it will be
considered what is needed in control and regulation and then a look will be taken at
the intrinsic complexity of technical processes.

2.2.1 Sequencing and Binary Control


The simple chemical reactor shown in Figure 2.7 is an example for application of
sequencing control. In the chemical reactor the reagents are mixed by stirring. The
flow of the feed chemicals and of the effluent fluid are controlled through the input
valves A, B and the output valve C respectively. The tank level is monitored by the
pressure sensor P. The tank temperature is indicated by the sensor T. This
temperature is regulated by letting hot or cold water flow in a mantle surrounding the
tank; the water flows are controlled by the valves D (hot) and E (cold).
A B

component #1 in component #2 in

coolant out

C
D E

product out

T P
mixer
hot fluid cold fluid
input input

Figure 2.7: A simple chemical reactor with temperature control

In this example, the following steps take place in the reactor:


1 Open valve A and fill chemical component 1
2 When the pressure sensor P indicates that the desired level is reached,
close valve A
3 Start the mixer
4 Open valve B and fill chemical component 2
5 When the pressure sensor P indicates that the new required level is
reached, close valve B
2.2: Types of Process Control Applications 21

6 Open valve D to heat the tank


7 When the temperature sensor T indicates that the desired temperature is
reached, close valve D
8 Start a timer for the duration of the chemical reaction
9 When the timer indicates the end of reaction period, stop the mixer
10 Open valve E to cool the tank
11 Check the tank temperature. When the temperature drops below a defined
limit, close valve E and open valve C to empty the tank.
12 Close valve C. Start the sequence again from the beginning.

Many computer control applications are based on logical statements like those
described here. The control computer input and output data are binary, which means
that sensors indicate two state or limit values such as valve open or closed, indicator
activated or deactivated, button pushed or released, etc. The controls given by the
computer have a similar form, like for example motor start/stop, heater on/off, etc.
When the control task consists only of binary decisions, the computations are
particularly simple. There are computers, called programmable logical controllers
(PLC), that are specifically built to carry out this type of tasks. These computers are
treated more in detail in Chapter 7.

2.2.2 A Simple Control Loop: the Temperature Regulator


Consider a tank filled with a fluid that must be kept to a constant temperature
(Figure 2.8). In this example the signals are analog, i.e. the temperature
measurement is represented by a continuous value instead of a binary threshold
variable, and the added heat can be graded (modulated).
The temperature is measured by a sensor that gives as output a proportional
voltage signal (the proportional relation holds at least within the range of interest).
The measurements are fed into the computer regularly, e.g. once every second, and
the actual temperature value is compared with that of the desired (reference)
temperature, that is also stored in the computer. The required heating or cooling
action is computed from the difference between the desired and actual temperatures
(Figure 2.9).
The final control elements can have different forms and the control signals will
consequently be of different types. The fluid can be heated by switching on a heater
for a determined time interval; another solution could be the use of a heat exchanger
connected to feed lines for steam and cold water. In the first case the heater switch-
on time represents the control action; in the second case the control takes place by
opening and closing the line valves for steam and coolant fluid.
The temperature regulator shows some elementary features of a control loop.
The temperature must be measured periodically at a rate that is determined by the
time constant of the process. If the heat capacity of the tank is large, the time
constant is relatively long. Conversely, if the volume is small and the heater is
powerful, then the process time constant is small and the control system must
measure the temperature and correspondingly switch the heater on and off
comparatively often. The basic properties of process dynamics must therefore be
considered in computer control design. Control algorithms are discussed further in
Chapter 6.
22 Chapter 2: Process Computers’ Application Issues

Figure 2.8: A simple temperature control system

temperature
(reference value) control signal
controller tank
to heater
element
temperature
(actual value)
control computer

Figure 2.9: Example of a simple control loop - a temperature control system

2.2.3 Reference Value Generation


Sometimes, in order to produce a certain compound in a chemical reactor, the
required reaction temperature may have to follow a reference (set point) value that is
continuously recalculated while the reaction is taking place. The calculation of the
reference temperature cannot be delayed, the current updated reference value must
always be available to be compared with the actual temperature. This is shown
schematically in Figure 2.10.

reference control
value signal
reference value controller technical
calculation process

measurement value
control computer

Figure 2.10: Reference value generation


2.2: Types of Process Control Applications 23

A system that follows a particular reference signal (setpoint value) so fast and so
precisely as possible is called servomechanism, or briefly servo. In servo systems
the setpoint value can be either calculated or be available in tabulated form. For
example in robot control a trajectory describes the movement of a mechanical arm
as functions of time. The trajectory is computed as a curve in space (called path or
contour) and stored as a table together with the desired times in the computer
memory. In this way a sequence of reference values for the arm joint position
controllers is available all the time. In many cases the trajectory must be calculated
on-line while the robot arm is moving. This generates a heavy computing load
because of the complex geometry of a robot arm.
When a new reference position is defined, it is first compared with the current
position. The computer can then send correction signals to the motors that control
the mechanical joints. The inverse operation, to find the arm position from the angles
of the joints, may also have to be performed. Both computations are resource-
intensive and time critical.

2.2.4 Several Control Loops


In many applications there are several control loops for temperature, level,
pressure, position, etc. In most cases, all these individual tasks can be treated
independently of each other and are consequently carried out by local controllers,
each having typical features for example as shown in Figure 2.9. In an alternative
solution, a central control computer executes the same control routine based on
different parameters and operational data for each loop. These control routines may
also be executed at different time intervals. The computer must have sufficient
capacity to process all the data in the required time.
Consider an office or apartment building where the temperature of each
individual room must be controlled. The actual temperature in each room depends
on the influence of external factors (windows and doors that are opened or closed,
the number of people in the rooms, whether lights are turned on, etc.). One single
computer can be used to regulate the temperature by dedicating its attention to one
room at a time. The computer executes the same control program many times over,
each time on the basis of different input and output data.

2.2.5 Interconnected Systems


In complex process and manufacturing plants are used different types of control
at the same time and there are several types of interactions among different partial
processes. An industrial process may for example be started up under sequencing
control similarly to the example of the tank in Section 2.2.1. Once the process has
reached the desired operating state, a feedback control system may take over
control for more precise regulation around the target state. Examples in this sense
are the electric motor drive system and the chemical reactor. The motor or the
reactor are brought to the operating state with help of sequencing control, then a
feedback controller takes over to keep the rotation speed or the temperature
respectively close to the desired value.
An example from the manufacturing industry illustrates another type of
interaction of control structures. In a production line a robot moves components to be
processed between some numerically controlled (NC) machines. The position and
the velocity of each machine unit, including the robot, is controlled via several
feedback loops of the types shown in Figures 2.9 and 2.10. Obviously, the machines
24 Chapter 2: Process Computers’ Application Issues

do not work independently of each other, but have to be coordinated. A supervisory


production control system must provide for the synchronization of the machines and
the robot. The machines send binary signals to the supervisory system to indicate
operational states like „operation completed“, „robot blocked“, „machine ready to
receive new part“, etc. The supervisory system selects the most appropriate controls
to efficiently use the machines and the robot, while trying to avoid conflicting
situations, as machines waiting too long time or blocking each other.
Feedback and sequencing control are first treated separately in Chapters 6 and
7 and system integration is discussed in Chapter 12. The concept of coordination
control of common system resources (like the robot in the above-mentioned
example) is treated in Chapter 10.

2.2.6 Time-critical Operations


Many processes require extremely fast control performance. Consider for
example the speed control of a rolling mill. The different motors along the machinery
have to be synchronized with extremely high accuracy, otherwise the steel band may
break or bend too much. The control idea is to allow all the time for a small slack of
the steel band, keeping it somewhat loose. Considering the high speed of the band
(10 - 100 m/s), the change of speed of any single motor must be recognized within a
few milliseconds and immediately lead to the correction of the speed in the other
motors. Of course, this means very high requirements on the execution speed of the
control computer.

2.2.7 The Complexity of the Process Control Problem


A control computer is used not only for regulation and operating sequencing
tasks of the kind shown above, but must perform additional operations, for example
recognize alarm situations and react to them appropriately. A control computer also
collects operational data, calculates statistical parameters, shows current information
to the process operators and accepts their commands. The most important tasks of a
process computer are illustrated in Figure 2.11.
The very number of sensors, control loops and indicators are sufficient to make
process control a complex task, but this is still only part of the picture. Additional
complexity is added by the characteristics of the process itself, where the most
important factors are the following:
• non-linearities
• varying environmental conditions
• changing process conditions
• long time delays
• internal process couplings.
Almost all physical processes are inherently non-linear. In fact, linear relations
are mostly an artificial simplification of the real state of things. For instance, in
mechanical systems the relation between spring force and extension is often non-
linear, i.e. if the spring extension is doubled, the resulting force will not double. The
reaction rates for most chemical processes depends on the temperature in a non-
linear way. At a certain operating temperature, a temperature change of a few
degrees brings a change in the reaction time; this does not mean that the same
change at another temperature leads to a similar change in the reaction time.
2.2: Types of Process Control Applications 25

process computer
human
operator user interface

reference value
calculation

controllers
technical
process
reaction to
alarm states

sequencing control

binary signals

alarm indications

continuous (analogue) measurement values

Figure 2.11: Computer tasks in process control

Yet, because of their simplicity (at least compared with non-linear descriptions)
linear models provide very useful approximations of physical systems. Linear and
non-linear models will be discussed in Chapter 3.
An important kind of non-linearity is the saturation of magnetic materials in
electrical machines. The magnetization of the armature is not even a single-valued
function, but depends on the „history“ of the motor, i.e. how the actual operating
state was reached (hysteresis effect). Bringing an electric motor from zero to half-
speed is not the same as reducing from full to half speed. The design of a control
system must take also such factors into consideration.
Non-linearities play a role not only in the physical processes, but also in the
interface to the computer, i.e. in sensors and actuators. An on/off valve is a typical
case, its state can be only fully open or fully closed. A computer might indicate on the
base of sophisticated mathematics that the optimal input flow to a process is 46 per
cent or 107 per cent of the full scale value, but still the valve may only be able to
operate at either 0 per cent or 100 per cent of its flow range. In addition, fast and
changing control signals to such a valve might lead to wearout and should therefore
be avoided.
Varying environmental conditions appear for instance in aircraft dynamics. An
aircraft behaves differently at low altitudes than at high altitudes because of the
different air pressures. The response to a wing flap movement is stronger at low
altitudes where air is denser. Consequently an autopilot has to take the altitude -
together with dozens of other factors - into consideration to control the aircraft under
varying conditions.
A power boiler is an example of a process with varying dynamical behavior. Due
to inherent non-linearities it responds quite differently at low and high power levels.
This means that the controller parameter settings must depend on the power level at
which the boiler is working. The operating parameters can be stored in a table as
function of power, in a method known as gain-scheduling control.
26 Chapter 2: Process Computers’ Application Issues

Time delays or dead times are a big problem in control. They result in the
controller taking decisions on the basis of old data, up to the point that it might
generate the wrong commands. Time delays are present in all processes where
some values cannot be measured directly. For example, to control the concentration
of a fluid, the concentration value is measured downstream along a pipe and fed
back to a control valve. Due to the delay for the flow to reach the measuring point,
the information is late and this may cause instability, i.e. difficulty in reaching and
maintaining the desired value. Not only long pipes create time delays. Many types of
sensors may need a long time before they deliver the exact measurement value,
leading to delayed control actions which may be cause for instability.
The consequence of signal transmission delays can be illustrated by a
suggestive experiment, shown in some science museums. You speak into a
microphone and listen to your own voice in a headphone. If the signal from the
microphone is delayed for more than a few fractions of a second, you get confused
very soon and cannot keep talking. This demonstrates the instability caused by time
delays. A similar effect is sometimes encountered when talking on the phone via
satellite circuits. The time delays may lead to difficulties for the talkers to coordinate
their conversation.
A controller in a system with time delays has to „remember“ old control actions,
i.e. it must store the value of control output values and use it in later calculations.
There are controllers that can compensate for time delays. They contain in some
form a model of the process under control and in some way estimate the current
value for variables that cannot be measured directly without delay. Controllers of this
type are discussed in Chapter 6.
Internal couplings and interactions add a lot of complexity to a process, even
when this would be basically simple. An example in this sense is the temperature
control of the rooms in a building. If a window is opened in one room, the
temperature will change not only locally, but to some extent also in the neighboring
rooms. Internal system couplings where each one input influences several outputs
can be illustrated in block diagram form (Figure 2.12).
disturbances

input signals output signals


(control) (measurements)

technical process

Figure 2.12: Internal couplings and interactions in a technical process

A power generation and transmission system combines most of the difficulties


that have been mentioned. The system is extremely complex in most terms: it has a
large number of components, shows complex dynamics, its operations are time-
critical, it is subject to continuously changing loads and environmental conditions and
2.3: General Problem Areas of Computer Control Systems 27

the requirements on responsiveness and reliability are extremely high. There is much
more than one could imagine behind the availability of electric power at any outlet,
with constant voltage and frequency and without interruptions all year around!
Effective control of large systems such as the electric power network can only be
realized with the help of computers.

2.3 General Problem Areas of Computer Control Systems


The processes described in Section 2.2 show some aspects which have to be
considered in computer control systems. The technical process to be controlled is
only part of the issue; another part is the control computer itself. The basic
consideration when selecting a control system is that its capacity must match the
requirements related to the system to be controlled. Many other parameters must
also be considered in order to estimate the required capacity for the process
computer (Table 2.1).

Original factor Related parameter in the control solution see Chapter

Time scale System dynamics, system modeling 3


Frequency of measurements 5
Frequency of control actions 5, 6
Hardware requirements 7, 8
Software requirements 10

Type of process Measurement hardware, sensors 4


variables Frequency of measurements 5

Measurement Filtering 3, 5
disturbances Type of processing

System Control hardware, actuators 4


controllability

System complexity Control strategy, relation between input 3, 6, 7


and output signals
Controller complexity 3, 6, 7
Hardware requirements 7, 8
Software requirements 10
Operating systems, programming languages 10
Communication requirements 9

Goals to achieve Control strategy 6, 7, 12

Spatial localization Data collection, communication 9


of information Networks, protocols

Ease of utilization Psychological factors 11


User interface design

System integration Distribution of resources, reliability 12

Table 2.1: Some of the problem areas in computer process control. Aspects of the technical
process to be controlled that are reflected in the type of solution.
28 Chapter 2: Process Computers’ Application Issues

Representation of the Temporal Evolution of a Process


The data collected with measurements must deliver an accurate picture of the
dynamics of the process. The choice of sampling rate (i.e. of the measurement
frequency to fetch new data) is of great importance, and by far no trivial task.
A high sampling rate leads to a larger load on the computer, because it must
process more data. In some cases there might be even costs associated with the
collection of process data, for example in concentration measurements where
chemical reagents are required. This means that the number of measurements
should be minimized, yet keeping their frequency sufficiently high to be able to detect
important changes in the process variables under study. In other words, a
compromise must be found between the cost of the measurements and the cost of
not detecting important changes in the process.
It is not only the measurement frequency but also the complexity of the
calculations between the sampling instances that influence the load on the computer.
This problem will be examined more in detail in later chapters of the book.

Measurement Data Collection and Signal Processing


All measurement signals contain both information and disturbances.
Measurements are not perfect due to calibration errors, inaccuracy of the sensors or
noise. The transmission of a signal from a sensor to a computer via an electrical
conductor may be influenced by electrical noise.
Signal filtering and information extraction are important tasks, as known from
everyday experience. If a lot of people sit around a table and talk, a microphone
would pick up just a mixture of voices from which no meaningful information could be
obtained. Yet a human ear can „filter“ out a specific voice from the rest and extract
the relevant information. The same must be done by a filter with measurement
information.
A filter is basically a device or a calculation that operates on a signal, extracting
from it information according to predefined criteria. Obviously, the filter should be
designed in such a way to pass through the desired information and block the
undesired. Filters can be realized with analog as well as with digital techniques. Both
types are examined in Chapter 5.
Even if the sensor is accurate and the transmission good, the delivered
measurement may not always represent the desired process variable correctly. For
example, the measurement of the level of a liquid may be incorrect due to ripple; a
concentration measurement may be misleading because of inhomogeneities in the
tested substance.

System Complexity
The complexity of the technical process is reflected in the complexity of the
process computer. The number of sensors and actuators is an indication for the
number of necessary input and output ports and means in general higher processing
power, internal and external memory capacity, etc. The process hardware - sensors,
actuators and bus systems - are treated in Chapter 4 and 8.
The couplings between the internal process variables and the input and output
data of the technical process determine the complexity of the controller software.
Real-time programs are much more difficult to test than conventional sequential
programs, so the code has to be so well structured that most errors can be identified
2.3: General Problem Areas of Computer Control Systems 29

beforehand. The program structure, suitable programming languages and operating


systems to deal with complex tasks are described in Chapter 10.

Localization of Information
Complex monitoring and control systems are built out of several computers
connected together; in many cases these computers build hierarchical structures.
The communication between computers is therefore a central issue in modern
process control systems. In order to use the available capacities rationally, it is
necessary to determine the type and amount of information that has to be
exchanged between computers. Not all computers must know everything that is
going in the technical process. Communication reliability is very important, and
solutions must be devised so that the data always reaches the right destination and
is not distorted or lost.
Communication also raises the question of standardization. Obviously cables
and contacts have to fit, signal levels must be compatible and the computer software
must understand the same meaning in the exchanged signals and messages.
Communication issues are dealt with in Chapter 9.

Ease of Utilization
A process computer or process control system may work unattended but still it
does not work for itself, there is always some communication to be exchanged with
the human user. The process operator must receive information from the computer
and be able to input commands.
Graphical interfaces on computer terminals become more and more
sophisticated. Modern displays offer a fantastic potential to show complicated
information for the user. Colors, shapes, pictures, curves and other graphical
representations can be used to inform the operator about the current state of the
process. However, all these types of presentations require computing power, and
when the operator communication competes with other tasks, the human operator
may have to wait for the information. On the other hand, not all information can be
kept waiting, as alarms and other important messages must be given priority.
Therefore the software has to be selective and choose what information is
appropriate for the operator and compatible with the current requirements and
computing capacity. This subject is further dealt with in Chapter 11.

System Integration and Control Reliability


A key issue in all computer control is system reliability. This concept was already
a central issue in the pioneering years, as mentioned in Section 1.2. The concept of
using only a central computer with Direct Digital Control (DDC) was much criticized
because of its low reliability. Even if the overall computer quality has increased
dramatically since the 1960s, the problem of system reliability remains of central
interest, because a centralized computer still represents a potential single-point
failure. The obvious solution to this problem is to decentralize the computing power
by letting small local computers control minor parts of a larger process.
Decentralization and integration of complex process control systems are further
treated in Chapter 12.
Reliability does not only depend on the hardware structure of the computer
system. Software reliability is a crucial aspect of many large systems. In January
1990, during about 9 hours the US telephone network could dispatch only about 50
30 Chapter 2: Process Computers’ Application Issues

per cent of its traffic. The reason was an undetected error, or „bug“, in a very
complicated computer program.
We will discuss some realistic aspects of how to influence system reliability, in
part by defining hardware structures that are relatively insensitive to component
failures and in part by structuring the real-time code so that at least predictable errors
are avoided from the beginning.

2.4 Case Studies


The systems described in this section - an electrical drive system and a
biological wastewater treatment plant - will be used in the following chapters as
examples for two different types of processes. These systems are notably different in
their timescale and in the technical construction and therefore illustrate quite well
many of the typical problems encountered also in other computer control
applications.

2.4.1 Case Study 1: Control of an Electrical Drive System


The problem of converting electrical power to mechanical power is extremely
important. Mechanical power is needed in many places and electrical power is
distributed easily. From industry to households, electrical motors are in operation
everywhere.
The conversion of electrical into mechanical energy takes place in motors. As
known from physics, electromagnetic force can be generated by an electric current;
this force is converted in mechanical power (torque) in the motor. Motors can be
powered by different types of electric power: d.c., a.c. monophase and a.c.
multiphase. The working point of a motor does not depend on the input current but
also on its magnetization history, on the load and on the frictional losses, just to
name a few of the intervening factors. Without referring in detail to the theory of
motors, it is here sufficient to state that the optimal working point for energy transfer,
i.e. the conversion of electric into mechanical energy with minimal losses, can be
reached with an appropriate selection of amplitude, frequency and phase for the
input voltage.
The generation of a signal with the required characteristics is made in power
electronics circuits. These can be supplied with different types of power sources
(a.c., d.c.) and therefore allow large flexibility in the selection of the type of motor.
The combination of motor, power electronics and control unit is called electrical drive
system; it is schematically shown in Figure 2.13. Electrical drive systems are
available for a very broad spectrum of power, speed and torque ratings.

control power motor /


unit electronics drive load

Figure 2.13: The main components of an electrical drive system


2.4: Case Studies 31

The construction of an electrical drive system is a challenge for both mechanical


and electrical engineers. In fact, to achieve good results, close cooperation between
people with specializations ranging from electrical engineering, mechanical systems,
electronics, control and computer science and of course the actual application field
(like e.g. transportation or robot technology) is necessary.
In this text electrical drive systems will serve to illustrate those situations where
very fast control reactions are required.

2.4.2 Case Study 2: Biological Wastewater Treatment - The Activated Sludge


Process
In modern societies large amounts of water are consumed, so that treatment of
wastewater has become one of the major environmental issues. Wastewater can be
treated by mechanical, chemical and biological methods in order to remove or
reduce the amount of pollutants that it contains. In most modern wastewater
treatment plants all these three methods are used together. Here we will briefly
consider the control of biological treatment, which is a widespread treatment method
for both municipal and industrial wastewaters.
In the activated sludge process, microorganisms suspended in the aerator react
with the organic pollutants contained in the wastewater and with dissolved oxygen to
produce more cell mass, carbon dioxide and water. In other words, the
microorganisms multiply by feeding on the organic pollutants in the wastewater and
release carbon dioxide and water.
The process installation contains two main parts, the aerator and the
sedimentation unit (Figure 2.14). The aerator is the biological reactor that contains
the microorganisms and where the reaction with the wastewater and the oxygen
contained in the air takes place. In the sedimentation unit the activated sludge,
consisting of living and inactive organisms and other inert mass, is separated from
the rest of the liquid. A part of the concentrated sludge is recycled and inserted again
in the aerator in order to keep constant the mass of viable microorganisms for the
process; the input wastewater and the microorganisms must be kept in a specified
relation. Part of the sludge is removed from the sedimentation unit for disposal. The
process effluent consists of the clarified overflow from the sedimentation tank. The
effluent liquid and the microorganisms in the sludge are less dangerous for the
environment and therefore easier to dispose than untreated wastewaters.
The timescale of a biological process is usually in the order of hours to days and
is therefore not at all critical for a process computer. This does not mean that
biological processes are easy to control, for they present their own problems. The
composition and concentration of the influent raw wastewater is usually unknown.
The concentrations of the pollutants are sometimes so small, that they can hardly be
measured: the dirtiest water is still 99.95% water! Yet, even small concentrations of
pollutants may be harmful for the environment since they can accumulate in living
organisms.
There are many types of microorganisms in a biological reactor and only a small
fraction of them are actually known and have been researched. Many of the
microorganisms are in competition, if one colony outgrows another the balance of the
process is affected and its dynamics and performance might change. The
concentration of dissolved oxygen, the type of substrate, pollutants, the pH-value
and temperature are only a few of the factors that influence the growth rate of
microorganisms.
2.5: Summary 32

suspended micro-
organisms and substrate
(activated sludge)
influent clarified water
wastewater output

sedimentation
aerator unit
solid / liquid
separation

concentrated
airflow input sludge

recirculated sludge disposed sludge

Figure 2.14: The activated sludge process in wastewater treatment

To keep the aerator environment rich in oxygen, air must be pumped into the
aerator. The air flow rate is of primary importance for the overall process efficiency. If
the dissolved oxygen concentration is below a certain minimum (in the range of 1-2
mg/l), the microorganisms will not be able to metabolize („eat up“) the pollutants at
the normal rate and the process is slowed down. On the other hand, pumping air
costs energy. The choice of the dissolved oxygen concentration determine the type
of organisms that will dominate and consequently how the pollutants will be removed
from the wastewater.
Wastewater can also contain toxic substances that may either inhibit the growth
of some microorganisms, or even kill them. From the point of view of process control
this means that depending on the changed operating conditions new types of control
actions must be selected. Diagnostic or estimation methods must be used to identify
the current state of the process.
Simple models to describe the dynamics of biological systems are described in
Chapter 3. The measurement problems are discussed in Chapter 4 and control
schemes are treated in Chapter 6.

2.5 Summary
The programming of process computers operating under real-time conditions
cannot be carried out with conventional programming methods because of particular
requirements like:
• a real-time system does not only consist of one but of several programs, each
specialized for a particular task
• the execution order of real-time programs can not be determined in advance
• the execution order can be changed by external signals (interrupts).
A computer may be used for both sequencing and feedback control. In many
systems these tasks are integrated. The capacity of a computer control system
2.5: Summary 33

depends on many factors such as the number and type of the input and output
signals of the technical process, the number and type of sensors and actuators,
internal process couplings, process dynamics and controller complexity. A process
computer system must continuously ensure the correct operation of the technical
process; the coordination and synchronization of several, dedicated simple tasks is
therefore especially important.
Data exchange among different computers is a central issue in process control
systems. Data communication encompasses both the connection between the
computer and the physical process, the computer-internal data exchange, the
connection between different process computers and the interface to the human
user.

Further Reading
The example of the plastic extruder in Section 2.1 has been inspired by [Hassel /
Tuvstedt 1978].
Software reliability is the theme of the article [Littlewood / Strigini 1992]. The
failure in the US telephone system in January 1990 was widely reported in the press,
see for example [Newsweek 1990].

Journals
The list of specialized journals that address the no-man’s land between theory
and practice in automation and control is not as long as it should be.
Control Engineering and the ISA Journal (published by the Instrument Society of
America) are dedicated to new applications of automatic control with attention to
practical, on-field issues. Interesting articles on industrial automation are also found
in Chemical Engineering and in IEEE Spectrum. Important scientific publications -
but somewhat too abstract and theoretical for common practical applications - are
Automatica, the IEEE Transactions on Systems, Man and Cybernetics, the IEEE
Transactions on Industry Applications, the IEEE Transactions on Robotics and
Automation and the IEEE Transactions on Power Systems.
Two good German journals are „at“ („Automatisierungstechnik“) and „atp“
(„Automatisierungstechnische Praxis“), published by Oldenbourg Verlag in Munich
(Germany).
3 System Description and Modeling

Aim: Explanation of the fundamental issues in systems analysis with help of


dynamic models and other descriptions and their use in the construction of models

Overview
A system description - or model - contains condensed knowledge of a
physical/technical process. A model of the process is often needed for its control, to
enable the control computer produce appropriate commands to the process on the
basis of the collected measurement information. The model indicates how the
technical system will react to a particular control action or to an external disturbance
and, conversely, what control action is needed to reach a particular system state.
Yet, models are not always needed: for simple control tasks like opening a valve to
fill a tank or automatically switch on a lamp when it is dark, a model would be
superfluous. Other control tasks are much more complex and an elaborate
quantitative model of the process is therefore needed for control. For example, in
robot technology an explicit model of the movement dynamics and of the path to
follow is indispensable for control.
The basic aspects of dynamic models are described in Section 3.1. There are
two main ways to develop models, either starting from basic physical principles or by
using measurement data. Some examples of the application of these principles are
presented in Section 3.2 and in Section 3.3 it is shown how general descriptions of
continuous dynamic systems can be formulated by following these examples; in this
section are also introduced the state-space and the input/output descriptions. The
time discretization of systems is of fundamental interest for computer control, and the
basic related principles are described in Section 3.4.
If the collected measurement data is used in context with system knowledge, it is
possible to calculate process variables that could otherwise not be measured. The
procedure of reconstruction or estimation of state quantities is the consequence of a
basic system property called observability. Observability indicates whether the
available set of measurements is adequate to give information about the system. A
related property is system controllability. This property gives an indication on whether
the system parameters that can be influenced by actuators are sufficient to control
the process as desired. Observability and controllability are treated in Section 3.5.
Some uncertainties are always connected to process models; in some cases
they can be described, which simplifies their treatment. In Section 3.6 uncertainty
factors are described both in statistical terms and with linguistic expressions, as for
example in fuzzy systems. The general principles for the analysis of sequencing
networks, that are widely used in process control, are described in Section 3.7.
We will refer to dynamic or sequencing models throughout the whole book.
Particularly important are models in measurement technology (Chapter 4), signal
processing (Chapter 5), the definition of control algorithms (Chapter 6) and
sequencing control (Chapter 7).
A word of warning must also be mentioned about the use - and abuse - of the
term „system“. It is one of those general words that mean everything or nothing,
depending on the context. This chapter is mainly devoted to methods for analysis
and description of physical systems, i.e. the processes we want to control. Chapter

34
3.1: Models for Control 35

12 is also dedicated to systems but in a broader sense, how to connect a technical


process with its control circuitry in order to achieve the envisioned result. The
„system“ of Chapter 12 is therefore more complicated of that treated in the present
chapter. Also the approach is different. This chapter shows ways to describe and
analyze systems, while Chapter 12 shows how to approach their construction.

3.1 Models for Control


A process model is of fundamental importance for control. Any control strategy is
based on some understanding of how the physical process will react to an input
signal. Therefore the ability to analyze and to model dynamic systems is a basic
prerequisite for successful realization of control.

3.1.1 Types of Models


There are many different ways to describe systems with help of models. The
choice of one method or the other depends on the information at hand, the possibility
of collecting further information from the system and - most important of all - the
purpose for which modeling is done. Contrary to science, where the purpose of
modeling is to gain insight of a system, a model in control engineering is adequate if
the related control process operates as desired (e.g. stable output with small
variations around a given value, reproducibility of the answer to an input signal, etc.)

Example 3.1 Model of an internal combustion engine


A combustion engine is an extremely complex dynamic system. There is no
general model for the engine, and in fact the model depends on the actual goal, so
that models for different goals may look quite differently.
A scientific model which aims to describe the intricate details of the
combustion process must consider phenomena such as the geometry of the
cylinder, the mixing of air and fuel as they meet in the cylinder compartment, the
chemical composition of the fuel, the propagation in space and time of the
combustion and the resulting forces that bring the piston in movement. The
timescale lies in the millisecond range.
A model for the design of a control system for the air/fuel ratio will reflect a
different view of the motor. The goal is here to keep the air / fuel flow ratio close to
the stoichiometric relation. The spatial distribution of the combustion does not
need to be considered; the mass flows of air and fuel alone are sufficient for
control. Also the timescale is different than the millisecond range of the scientific
model, but rather something like 10-100 times higher.
The driver needs still another model of the motor. The relation between the
action on the throttle pedal and car acceleration becomes more important, while
the details of the combustion or of the air/fuel mixing process may be neglected.

In control applications the interest is oriented to dynamic systems, i.e. those


systems the state of which can be simulated in advance and that can be controlled
with help of appropriate signals. In a dynamic system the effect of the input signals is
not immediately effective, but only after some time. There are many different ways to
model dynamic systems, of which the following are the most important ones:
36 Chapter 3: System Description and Modeling

• Continuous time description. A system is described in terms of linear or non-


linear differential equations for mass, energy, force or momentum balance. In
many cases, non-linear equations can be linearized, and their treatment
becomes in this way easier.
• Sampled time description. The physical properties are described in terms of
linear or non-linear difference equations. This means that information about the
system is available only at specified discrete time instants. This type of
description is actually almost unavoidable in computer-supported process
control, because computers based on the von-Neumann design (that represent
the most common type of computer architecture) operate sequentially in time.
The choice of the sampling period, i.e. of the time interval for discretization, is
the most important aspect of this modeling.
• Discrete event models, or also sequencing systems. An example for
sequencing control was presented in Section 2.2.1. In this description the
system inputs and outputs are time-discrete, and often consist of binary on/off
signals. Many sequencing systems can be described as queueing systems and
modeled by so called Markov chains or Markov processes.
• Systems with uncertainty. The controlled system itself and the measurements
are often influenced by undesired noise and disturbances. In some cases
disturbances and insufficient knowledge about the technical process can be
given a statistical interpretation. In other cases, the uncertainty factors can be
described by linguistic and logical expressions instead of quantitative terms.
This is for example the case with the „if-then-else“ rules of expert systems. A
special algebra, the so-called fuzzy algebra, has been developed to describe
uncertainties.
A common misunderstanding lies in the assumption that a process can be
ultimately described by only one model. Actually, the opposite is true. The complexity
and structure of the model must be in relation to the actual purpose of modeling, the
choice of a process model depends therefore on how the model is to be used.
Different controllers need also different process models. In control applications the
most appropriate model will usually be the simplest one on which basis the control
action satisfies predefined quality criteria.
Systems and processes can be considered in terms of their input and output
signals; the relation can be described in both time-domain or frequency-domain
mode.

3.1.2 The Timescale of Dynamic Models


The timescale is probably the most important single aspect in the
characterization of a dynamic process. Most technical systems and plants contain
several processes with very different response times. For this reason in the
description of a process it is important to select a timescale that is in relation to the
actual purpose.
An example from the manufacturing industry shall illustrate the point. The control
tasks can be structured into different levels (see Section 9.6.1). The events at the
machine level take place within fractions of a second, as for example the control of a
robot arm or of a machine tool. At the next higher level, the cell control level, the
problem is the synchronization of different machines, for example when a robot must
move single components between two machine tools. The timescale is here of the
order of seconds to minutes. At the cell level it is assumed that the specific machine
3.1: Models for Control 37

control tasks have already been solved at the lower levels. The problem at the cell
timescale is whether a machine is correctly supplied with material, if the robot is free
to pick up a new component, etc. At an even higher level the entire production is
planned, i.e. what parts to produce and with what specific characteristics. Such
decisions may take days or weeks, and in comparison the dynamics of a single
machine is considered to be instantaneous.
Another example of different timescales within the same technical system is
found in biological wastewater treatment. Compressed air is injected in the aeration
tank to keep aerobic microorganisms (that need oxygen) alive; this operation takes a
few minutes. Concentration changes due to disturbances in the input wastewater
flow appear only after a few hours, while for a change in the metabolism of the
microorganisms are necessary some days or even weeks. In a study of weekly
changes in the metabolism, the hourly phenomena can be considered to be
instantaneous. On the other hand, in order to control the air supply it is necessary to
measure the dissolved oxygen concentration on a minute-to-minute basis, while in
this timescale microorganism compositions and concentrations are considered to
remain unchanged.
The relevant timescale of a dynamic model depends also on the user, where
also an automatic controller can be considered as a kind of „user“. A plant operator
could check the state of the technical process and make control decisions in a
timescale of minutes to hours. A process engineer or logistics supervisor may be
interested only in daily production rates or process changes, and would thus need
still another timescale for the process description. The plant manager, finally, may
want to look at completely different aspects of the plant operation, such as variations
of plant productivity or seasonal demand changes. Each perspective and action has
its own timescale.

3.1.3 Modeling Dynamical Systems


Many processes are well known and their fundamental behavior has long since
been studied, while other processes are poorly known and difficult to quantify. For
example, the dynamics of aircraft and of nuclear reactors have been researched
extensively and accurate - though complex - models are available. Other processes
are difficult to quantify in mathematical models. For example, a laboratory
fermentation process with only a single type of microorganism that grows on a well-
defined substrate may be described quite accurately. On the opposite, a biological
wastewater treatment process contains a complex mixture of many types of
organisms feeding on substrates that are difficult to characterize. Such a process
can be described only in part by conventional quantitative models. When quantitative
expressions are no longer sufficient or become too complex, semantic (linguistic)
descriptions of the process behavior offer further possibilities for its characterization.
Other examples of processes that are known only in part are steel production,
solid/liquid separation, many biochemical processes and rotating kilns.
Processes with parameters that change in time present their own special
problems. For example, in a biological system a new substrate entering the process
may cause the appearance of new species of organisms. This can very well change
the full dynamic behavior of the system.
In many cases the modeling of complex systems is difficult, expensive and time-
consuming, especially when the important step of experimental verification is
included. In principle there are two main ways to develop a system model. In the
physical modeling approach the model is derived from physical relations and balance
38 Chapter 3: System Description and Modeling

equations. This methodology will be presented in Section 3.2 with help of some
simple examples. The other possibility to build a dynamical model is from
experimental data. The technical process is disturbed (excited) on purpose with
different types of input signals, and the input and output data series are analyzed in
a procedure known as parameter identification. If the analysis is made online as
the experiment progresses, the procedure is called recursive estimation.
Most often modeling practice is a combination of physical modeling and
parameter identification. With more insight into the fundamental properties of the
process it becomes easier to obtain an accurate dynamic description. Still, even the
most elaborate models based on physical insight have to be verified by
experimentation.
Many processes and systems are spatially distributed. For example, the
concentration of a liquid in a tank may not be homogeneous but be distributed in
space and change with time. The physical balance relations to describe such
systems must then be expressed in form of partial differential equations. In process
control applications such systems are mostly approximated by finite differences in
space, so that the system can be described by ordinary differential equations.

3.1.4 Modeling of Discrete Events


The modeling of sequencing or discrete event systems is quite different from
dynamic systems modeling on the basis of mathematical relations. For the dynamic
feedback control of particular process variables such as temperature, level or
pressure no process model is actually necessary. In this type of control the controlled
variable is maintained with a certain accuracy around the desired value by switching
an actuator on or off.
There is no fully coherent theory for the modeling of sequencing control. In
binary control all possible non-normal states or alarm states that can take place must
be considered in the system analysis. What happens if a pump breaks, if a
measurement is not available, if the power supply fails, and so on? The preparation
of an exhaustive list of all possible events in a process is a very difficult task and
cannot be approached with a systematic theory.
The manufacturing machines served by a robot described in Section 2.2.5
require a model for synchronization. This control problem is quite different from
simple feedback control. The synchronization must be correct in the sense that a
certain piece has to be delivered to the right machine at the right time and in proper
order. This problem has much in common with the handling of system resources by
operating systems; to a certain extent queueing theory can be applied.

3.2 Elementary Aspects of Dynamic Systems


The physical approach for dynamic systems modeling makes use of balance
equations for force, mass, energy and torque. A few simple examples of dynamic
systems are presented here to illustrate some of the general principles of their
modeling.

3.2.1 Mechanical Systems


The cornerstone of dynamical models for any mechanical system is Newton’s
law. The force F is the sum of all forces that act on each body of a system; this force
3.2: Elementary Aspects of Dynamic Systems 39

is represented by a vector characterized by an amplitude and a direction. The


application of Newton’s law requires the definition of a suitable coordinate reference
for the description of the body’s motion, i.e. its actual position, velocity and
acceleration. The mass of the body is m and the vector z represents its position.
Also the acceleration a is a vector with the same direction as F . The force balance
is
d 2z
F = m⋅a = m
dt 2
Newton himself stated actually a more general form of this equation, in relation
to the impulse m ⋅ v :
d
F=
dt
( m ⋅ v)
The force equation can alternatively be written as a system of first order
differential equations in the so-called state-space form (Section 3.3.2). If the direction
of the force is given, the position z and the velocity v are expressed as the scalars
dz dt = v and dv dt = F m . There is also a more general form of the dynamics
equations, the Lagrange equations.

Example 3.2 Mechanical system with spring and damper


Many mechanical systems are similar to the one shown in Figure 3.1. A mass
m is connected to a fixed wall by a spring and a damper. The spring force is
proportional to its relative displacement, while the damper yields a force
proportional to the mass velocity.

m F

Figure 3.1: Newton’s law for translation

Newton’s law states in this case


d 2z dz
m⋅ = −b ⋅ −k⋅z + F
dt 2 dt
After simple rearranging we obtain
d 2z b dz k F
+ ⋅ + ⋅z =
dt 2 m dt m m

Many servomechanisms can be described by the equation presented in Example


3.2. The qualitative solution to the equation depends on the relative size of the
40 Chapter 3: System Description and Modeling

coefficients b , k and m . For a small damping b there will be an oscillatory


behavior, while for larger values of b the position changes under action of the force
without any oscillations. Systems of this type are often characterized by the relative
damping, natural oscillation frequency, bandwidth and gain.
Newton’s law for rotational systems is
d (J ⋅ ω )
=T
dt
where T is the sum of all torque that act on the body, J is the moment of inertia
and ω the angular velocity (Figure 3.2). Often J is not constant, as for example in
the operation of an industrial robot or of a rolling mill, so that its time dependence
has to be taken into consideration.

J

Figure 3.2: Newton’s law for rotation

By defining the angular position ε , the rotational dynamics can be written in


state-space form. It is assumed that the rotating direction is known and that J is
constant. Then the differential equations are written in the form dε dt = ω and
dω dt = T J .

Example 3.3 Electric motor torque


An electric motor is connected via a stiff axis to a load. The resulting net
torque T is the difference between the driving torque Tm and the load torque TL .
The motor torque Tm is primarily a function of the rotor current, of the generated
magnetic flux and, in some motor types, of the angular velocity and position. The
current depends on the electrical transients in the rotor circuit.
Also the combined load torque TL depends on many factors. The Coulomb
friction causes a load torque d 0 which does not depend on the rotational velocity
but on the direction of the rotation (indicated as sgn(ω ) ) and acts always against
the direction of the rotation (Figure 3.3). (The function sgn(ω ) takes the value +1
for positive ω and -1 for negative values of ω .) In some systems there is a viscous
damping with a torque d 1 ⋅ ω , characterized by the parameter d 1 . In a compressor
or in a pump the load torque depends also on the turbulence of the fluid, and the
torque becomes a quadratic function of the speed, i.e. d 2 ⋅ ω 2 , with d 2 a
parameter that depends on the operating conditions.
3.2: Elementary Aspects of Dynamic Systems 41

1 torque
d 2ω 2
0.8

0.6
d1ω

0.4
d0
0.2

0
0 0.2 0.4 0.6 0.8 1
ω
Figure 3.3: The torque of a motor as function of the angular speed

In summary, the total load torque can be expressed as the sum of the named
load torque and of an external load TL0 :

TL = d 0 ( sgn(ω )) + d 1 ⋅ ω + d 2 ⋅ ω 2 + TL 0

The total torque balance in the motor can be expressed as:


d ( Jω )
= Tm − TL
dt
where J represents the combined moment of inertia for motor and load.

An industrial robot is a complex mechanical system consisting of stiff arms that


are linked to each other. The dynamic description of the motion of a robot arm is
based on Newton’s laws. In their generalized form these equations are called
Lagrange equations. Other mechanical structures are elastic, as for example the
wings of an airplane. In elastic mechanical systems oscillatory modes may appear; in
general such dynamic systems are very difficult to control.

3.2.2 Electrical and Magnetic Circuits


The dynamic behavior of most electrical and magnetic circuits is governed by
only a few basic laws. Kirchoff’s laws describe the relationship between the voltages
and currents in an electric circuit. Electric circuits are build by branches and nodes. A
branch is defined as a conductor or an element with two terminations. The branch
element can be passive, i.e. store or sink current, or active and generate a voltage or
a current. A node is a point where three or more branches are connected together.
At a node the current can take more than one path. Kirchoff’s current law states
the net sum of all the currents into any node is zero.
Kirchoff’s voltage law is stated:
the net sum of the voltage drops around any closed path is zero.
42 Chapter 3: System Description and Modeling

The voltage law is a consequence of the energy conservation principle. In writing


the voltage balance, one may go around the path in either direction and add together
the voltage drops provided that the voltage across each element in the path is
accounted for only once.
The fundamentals of electromagnetic theory are formulated in Maxwell’s
equations. From a dynamic system point of view there are two elements with time-
dependent operation, the capacitor for storing electric charge and the inductor for
storing magnetic energy.
A capacitor in a circuit stores electric charge, i.e. the energy is stored in an
electric field. The current that flows through the capacitor is proportional to the time
derivative of the voltage across it:
dv
i = C⋅
dt
where C is the capacitance expressed in coulomb/volt or Farad.

Example 3.4 A simple resistor-capacitor circuit


Let’s consider the simple resistance-capacitance (RC) circuit of Figure 3.4. We
want to describe how the voltage over the capacitor depends on an input voltage
source.
R

C
v v
in out

Figure 3.4: A passive first-order low pass RC filter

The Kirchoff’s voltage law applied to the circuit gives


vi − R ⋅ i − vo = 0
where R is the resistance and the capacitor voltage v o is expressed by
dv o 1
= ⋅i
dt C
By eliminating the current i from the circuit differential equation, the result is
dv o
RC ⋅ = −v o + v i
dt
This first order differential equation is characterized by its time constant T :
T = RC
Since the dimension of R is [ V ⋅ A −1 ] and that of C is [ A ⋅ V −1 ⋅ s ], T = RC has
dimension time [s]. If the initial capacitor voltage is zero, a sudden change in the
input voltage v i will cause an exponential change in the capacitor voltage:
3.2: Elementary Aspects of Dynamic Systems 43

(
v o (t ) = v i 1 − e − t T )
In Figure 3.5 the transient responses of the RC circuit are shown for different
values of the time constant T = RC . The response becomes slower for larger
values of T .
voltage
1
T=0.1
0.8 0.2

0.6 0.5

0.4 T=1.0

0.2

0
0 0.2 0.4 0.6 0.8 1
time
Figure 3.5: Capacitor voltage of the RC circuit for different values of T = RC for a input
voltage step

In electronics and in communication technology it is common practice to


analyze systems with help of sinusoidal input signals. Assume that the input
voltage of a circuit is described by:
v i (t ) = Vi ⋅ sin(ωt )

where Vi is the peak amplitude. The output capacitor voltage also becomes
sinusoidal a short time after the input signal has been applied.
The output signal has the same frequency as the input signal, but a different
amplitude and phase:
v o (t ) = Vo ⋅ sin(ωt − φ )

where Vo = Vi 1 + (ωRC)  and φ = arctan(ωRC) .


2
 
The amplitude of the output voltage decreases and lags in phase more and
more for increasing frequencies. A circuit with these properties is called a low-
pass filter, since it lets low frequencies pass through but attenuates higher
frequencies.

This simple capacitor circuit illustrates the two major methods for the description
of a linear system, the time-domain analysis and frequency-domain analysis. The
time-domain analysis illustrates the time behavior of the system, e.g. its response to
a particular input signal - the step - in course of time. The frequency-domain analysis
focuses on the system behavior under excitation by different frequencies.
When a magnetic field varies in course of time, an electric field is produced. This
is stated by Faraday’s law, also known as the induction law, which is one of the
44 Chapter 3: System Description and Modeling

Maxwell’s equations. According to the induction law, the induced voltage e at the
terminals of an ideal coil (i.e. only with windings and no resistance) is equal to

− =e
dt
where Ψ is the flux linkage through the coil windings (the flux linkage is the
magnetic flux Φ intercepted by the coil multiplied by the number of windings N ).
The flux linkage Ψ for a current I flowing in the coil and for an inductance L is
Ψ = L ⋅ I . In other words, in a coil or inductance energy is stored in a magnetic field.
The differential equations for the capacitance and inductance represent the
basis for the description of electric and magnetic circuits. Other relations of algebraic
nature can be derived from these basic equations. The relation between the flux
density B [ V ⋅ s ⋅ m -2 , Tesla] and the magnetic field intensity H [ A ⋅ m -1] is a property
of the material:
B = µ⋅H
where µ is the magnetic permeability. In a ferromagnetic material the total
permeability is not constant and for large values of H the value of the flux Φ , that is
proportional to B , will saturate. The relation between the magnetic flux and the
current generating the field intensity is shown in Figure 3.6.
In the description of magnetic circuits hysteresis phenomenona must often also
be taken into consideration. Because of the hysteresis effect the flux density is not a
direct function of the input current, but depends also on the previous magnetization
history.

Φ positive
saturation

+
u linear
area i
- Φ
negative
saturation
N

(a) (b)

Figure 3.6: (a) Simple magnetic circuit; (b) typical magnetization curve without hysteresis

Example 3.5 Separately excited direct current (d.c.) motor


The d.c. motor is the earliest form of electric motor. It converts d.c. electrical
energy into mechanical energy in form of rotational torque (Figure 3.7). In the d.c.
motor there are two magnetic fields. The stator field is generated either by a
permanent magnet or by an electromagnet; the latter must be connected to a
separate voltage source. For simplicity we assume here that the stator field is
constant in time. When a voltage is applied to the rotor circuit, a rotor magnetic
field is generated.
3.2: Elementary Aspects of Dynamic Systems 45

power supply for the stator field

stator

speed ω

N pole S pole

torque Tm

magnetic flux rotor


Figure 3.7: Schematic diagram of a d.c. motor

The windings are arranged in such a way that the rotor field is always
orthogonal to the stator field. It is known that whenever two magnetic fields are at
an angle between each other, the result is a torque that forces them to become
parallel. This is the operating principle of the compass needle: if it is not parallel to
the earth’s magnetic field lines, it turns until it becomes parallel. While the rotor
turns in order to bring its magnetic field parallel to the stator field, the rotor
windings are switched mechanically by the commutator, changing in this way the
orientation of the rotor field. In this way, the result is that the rotor field orientation
is always kept fixed in space and orthogonal to the stator field. The torque is
therefore kept constant for all rotor angles.
The torque generated by the motor is proportional to the stator magnetic flux
density and to the rotor current i . Since in this example the magnetic flux density
is considered to be constant, the motor torque Tm is
Tm = km ⋅ i
where km is a constant that depends on the motor. By now considering also
the load torque TL , the mechanical part can be described as follows (see Section
3.2.1):
d (J ⋅ ω )
= k m ⋅ i − TL
dt
where J is the total (motor and load) moment of inertia. As a result of the
rotation of the rotor windings through the stator magnetic field, an induced voltage
e is formed. With constant stator field, this voltage is proportional to the rotational
speed ω :
e = kg ⋅ ω

where k g is a constant. If the units are consistent and losses are neglected,
then k g = km = k . According to Lenz’s law it follows that the magnetic flux
46 Chapter 3: System Description and Modeling

generated by the induced voltage e will be oriented against the flux generated by
the original current flowing in the conductor.
The electrical circuit of the rotor is represented by its resistance R and
inductance L . Assuming that L is constant, the induction law defines the voltage
across the circuit as:
dΨ d ( L ⋅ i ) di
= = L⋅ = v − R ⋅i − k ⋅ω
dt dt dt
where i is the rotor current and v the applied voltage. The motor dynamics is
illustrated in Figure 3.8. The applied voltage results in a rotor current that
generates a motor torque. The torque drives the mechanical rotor that begins to
turn at a certain angular speed. The induced voltage acts like a feedback from the
mechanical rotor to the electrical circuit of the rotor.

mechanical load

v rotor
voltage load angular
torque -T velocity ω
L

i
∫ ∫
1 1
+ + km +
L J
motor
torque T
-Ri m
-v -R
i
rotor
current

-k
induced g angular
voltage velocity ω

rotor circuit mechanical part


Figure 3.8: Block diagram of the d.c. motor

3.2.3 Mass Balance


In many industrial processes it is of basic importance to model the mass
balances of different components. All equations for mass balance in an open system
in which mass can be exchanged with the outside world have the same structure:
accumulated mass = input mass - output mass
These equations can be formulated for each individual component as well as for
the total mass. The input mass may be added via an inflow channel or pipe, or
originate from chemical reactions or from biological growth. Similarly, the output may
be represented by the outflow in a channel, by the consumed mass in a chemical
3.2: Elementary Aspects of Dynamic Systems 47

reaction or by the decay of organisms in a biological process. Some examples will


illustrate the balance equation principles.

Example 3.6 Total mass balance


A tank is filled with a completely mixed, incompressible fluid (Figure 3.9). The
input and output mass flow rates are q in and q out (in kg/s) respectively. A simple
balance equation is given by
dM
= q in − q out
dt
where M is the total mass (kg).
q in

q out

Figure 3.9: Tank with a single, completely mixed component

Example 3.7 Component mass balance


A tank is filled with a mixed liquid with a homogeneous concentration c
(Figure 3.10).
q in

ci in

q out, c

Figure 3.10: Concentration dynamics in a simple mixing tank


48 Chapter 3: System Description and Modeling

Here it will be formulated the mass balance of a component. The influent


concentration c i [ kg m 3 ] can be controlled as desired. The influent and effluent
flow rates are assumed constant and equal to q [ m 3 s ]. The total mass of the
components in the tank is determined by the volume V and is equal to V ⋅ c . The
effluent concentration is assumed to be the same as in the tank. The component
mass balance is then written
d (V ⋅ c )
= q ⋅ ci − q ⋅ c
dt
Since the volume V is constant:
V dc
⋅ = − c + ci
q dt
The form of this differential equation is the same as for the electrical circuit in
Example 3.4. The time constant is defined here by T = V q . A sudden change in
c i will lead to a change in the tank concentration with a function similar to that
shown in Figure 3.5. The solution of the differential equation has the form

(
c(t ) = ci ⋅ 1 − e −t T )
It is intuitively clear that the concentration will change more slowly if the inflow
rate is small compared to the volume V (this corresponds to a large value of T ).
The behavior of the component mass balance has therefore the same dynamic
properties as a low-pass filter.
In principle, the analysis of the tank system could be carried out in frequency
domain, similarly as for the electric low-pass filter. In such way the influent
concentration would have to be varied (modulated) like a sinusoidal function and
the frequency response of the effluent concentration be then observed. This is
however not very practical in chemical processes, because the time constants may
be of the order of hours. Such an experiment would then last for many days.

Example 3.8 Aeration of a wastewater treatment tank


The equation for the description of the dissolved oxygen (DO) concentration in
the aerator of a wastewater treatment plant or in a fermentor is non-linear. It is
here assumed that the tank works as a batch reactor, i.e. the water flows into and
out of the tank are not constant but take place only at determined times. Air is
supplied from a compressor at the flowrate u .
The transfer rate from gaseous oxygen to dissolved oxygen is determined by
the transfer rate coefficient kL ⋅ a . For simplicity this coefficient is considered to be
proportional to the airflow rate, i.e. kL ⋅ a =α· u , where α is a proportionality
constant. The dissolved oxygen transfer rate is zero when the DO concentration
saturates ( c = c s ) and is at its maximum when the DO concentration is zero; this is
( )
modeled by α· u c s − c [ mg ⋅ l -1 ⋅ s -1]. Microorganisms consume the dissolved
oxygen during their growth and decay with a respiration rate R . A simple equation
for mass balance at the DO concentration c can be written as:
3.2: Elementary Aspects of Dynamic Systems 49

dc
dt
( )
= α ⋅u cs − c − R

Because of the product between u and c , the system is non-linear.

Example 3.9 Continuous wastewater treatment plant - simple


representation of the interaction between microorganisms
and substrate
The basic features of a biological wastewater treatment plant were illustrated
in Section 2.4.2. The influent wastewater is characterized by its substrate
concentration s i and contains no living organisms. In the aerator, that is assumed
to be completely mixed, a mixture of substrate with concentration s and
microorganisms with concentration c x is kept in suspension (the concentrations
are measured in [ mg l ] or [ kg m 3 ]). The flow rates are indicated in Figure 3.11.

influent flow = Q Q + Qr clarified water


output

sedimentation
aerator unit

airflow input

recirculated sludge = Qr disposed sludge

Figure 3.11: Simple model of an aerator in a wastewater treatment plant

The mass balances of substrate and microorganisms in the aerator are written
in the form:
accumulated mass = influent mass - effluent mass + growth - consumption
Microorganisms with the concentration c xr are recycled from the
sedimentation unit. The growth rate of the microorganisms is modeled by µ· c x ,
where the specific growth rate µ [ h -1 ] depends on the substrate concentration
s
µ = µ ⋅
K+s
where K is a constant parameter. The growth is quite limited for small values
of s and approaches a maximum value µ for high concentrations of substrate.
The microorganism concentration decreases due to cell decay and is proportional
to the organism concentration, b ⋅ c x . The microorganism mass balance equation
has the following aspect:
50 Chapter 3: System Description and Modeling

dc x
V⋅ = Qr c xr − (Q + Qr ) ⋅ c x + V ⋅ (µc x − bc x )
dt
The substrate enters the aerator via the influent flow and the sludge recycle
stream. Since the substrate is assumed to be dissolved, its concentration is the
same in both aerator and sedimentation tank. The substrate in the aerator is
consumed because of the microorganism metabolism. The corresponding
substrate utilization rate is µ ⋅ C x Y , where the variable Y is called the yield factor.
The equation for substrate mass balance can then be written in the form
ds µ
V⋅ = Q ⋅ si + Qr ⋅ s − (Q + Qr ) ⋅ s − V ⋅ ⋅ c x
dt Y
The system dynamics is here obviously non-linear. The specific growth rate µ
depends on the substrate concentration and the flow variables are multiplied by
the concentration values.

3.2.4 Equations about Energy Conservation


In several process control systems temperature values must be regulated.
Dynamic models of temperature control systems must take energy flows and the
storage of heat energy in consideration. In many systems heat flows through objects
at a rate that is proportional to the temperature difference across the object, i.e.
1
q= ⋅ (T1 − T2 )
R
where q is the heat flow [W], R the thermal resistance and T the temperature.
The heat transfer is often modeled as proportional to a surface area A and inversely
proportional to the length l of the heat flow path, i.e. 1 R = k ⋅ A l , where k is the
thermal conductivity. The conservation of heat energy can be formulated as:
dT
C⋅ =q
dt
where C is the thermal capacity [Joule/°C] and q the net sum of heat flows into
and out of the body.

Example 3.10 Heat balance of a liquid in a tank


The heat balance of a tank filled with liquid can illustrate the principle for
energy conservation (Figure 3.12). The liquid has a homogeneous temperature T ,
and the ambient temperature is Ta . The thermal capacitance for the tank is Ci .
The thermal resistance is R1 at the top and bottom sides and R 2 at the lateral
walls. A heat element supplies the liquid with the heat energy u q [W]. The heat
balance is written as:
dT  1 1
Ci ⋅ = uq −  +  ⋅ (T − Ta )
dt  R1 R 2 
A large temperature difference across the walls will cause a rapid temperature
change in the tank. If the thermal resistances R1 and R 2 are large, then the
temperature rate of change will be smaller.
3.3: Continuous Time Dynamic Systems 51

q1
(R )
1

q2
T (R )
2

uq (W)

Figure 3.12: A system in thermal equilibrium. Ta is the ambient temperature and T is the
tank temperature.

3.3 Continuous Time Dynamic Systems


3.3.1 Time vs. Frequency Domain Approach - an Historical Perspective
The description of dynamic systems by ordinary differential equations goes back
at least to Isaac Newton. James C. Maxwell made what has probably been the first
systematic study of the stability of feedback systems by studying the centrifugal
pendulum governor, developed by James Watt around 1788 to control his steam
engine. In his paper from 1868, Maxwell developed the differential equations of the
governor - i.e. the controller, linearized them around an equilibrium point and found
that the stability of the system depends on the roots of its characteristic equation. If
these roots have negative real parts, then the system is stable.
The major technological challenge in the USA in the 1910s and 1920s was the
realization of the intercontinental phone link. The related research work led to many
important discoveries in electronics and control theory and provided the foundation
for their establishment as scientific disciplines. The development of the electronic
amplifier in the time after World War I made long distance telephone calls possible.
To compensate for the electrical energy losses over long distances, a large number
of amplifiers had to be used. Many amplifiers in series cause however large
distortions, since the non-linearities of each amplifier are also amplified by the
cascaded devices.
The development of the feedback amplifier by Harold S. Black solved this
problem. The application of new and more complex technical systems required at the
same time the use of new mathematical methods. To analyze a system of fifty or
more amplifiers the characteristic equation analysis was no longer suitable. The
communication and electronic engineers developed therefore a new analysis method
on the basis of complex analysis and introduced the concept of frequency response.
In 1932 the Swedish-American researcher Harry Nyqvist published his famous
theorem on how to determine stability from a graph of the frequency response. The
Nyqvist criterion represents nowadays only a minor part of introductory courses in
control theory, but was considered a revolution in control system design at the time
of its introduction. In fact, this theorem was considered so important for the military
that it was kept secret in the United States until after the end of World War II.
52 Chapter 3: System Description and Modeling

Technical processes are in most cases very complex and non-linear. The
feedback of processes variables began to be carried out in a standard fashion during
the 1940s; a controller based on the proportional-integral-derivative (PID) concept
was developed. The frequency response method proved to be powerful when it was
used for the analysis of linearized versions of process dynamics.
During the 1950s several researchers returned to system descriptions by
ordinary differential equations as a basis for process control. The American and
Russian space programs stimulated this development, since ordinary differential
equations represent a natural form to describe the dynamics of a spacecraft. The
development was also supported by the introduction of the digital computers, as
calculations that until then were not practical and time-consuming could now be
performed straightforwardly. The digital computer required also a new mathematics.
The engineers did not work directly with the frequency form or the characteristic
equations, but with the differential equations in state form. New fundamental issues
could then be addressed, such as controllability, observability and state feedback.
Variational calculus was extended to handle the optimization of flight trajectories.
In chemical and mechanical engineering it is natural to derive differential
equations models from the physical properties of a system. This approach is realistic
also in advanced control applications, even if PID controllers are still used in many
technical realizations. Therefore the use of both differential equations and of
frequency descriptions is common. Descriptions in the frequency domain are still
common in electrical and electronic engineering and quite natural for many
applications. Complex systems are instead preferably described in terms of ordinary
differential equations.

3.3.2 Representation in State-Space Form


The state-space representation is the standard way to represent a set of
ordinary differential equations. When the equations are written as a system of first-
order differential equations, they are said to be in state-space form. The major
advantage of this representation is that computer algorithms for the solution of these
equations can be implemented easily. In addition, some theoretical aspects are also
more readily seen when the equations are in state-space form. One example is the
relation between the internal variables and the external input and output signals. Also
the study of control systems with more than one input and one output can be treated
readily in the state-space form. The background mathematics for the study of state-
space equations is mainly linear algebra. If one is willing to use vector and matrix
notation, the complexity of the description can be greatly reduced. However, linear
algebra is not an absolute prerequisite to achieve at least a basic understanding of
the dynamics of a system.
Most physical processes can be modeled by building blocks like those described
in Section 3.2. In general the balance equations are non-linear, and often they are
coupled to each other. The dynamic process description can thus encompass a
number of first-order, coupled and non-linear differential equations that describe
balances for energy, total mass, component mass, force and torque.
The state-space concept is a practical and appropriate way for the description of
dynamic systems. The state is the collection of all the variables - the so-called state
variables - that appear in the first-order derivatives of the dynamic system. The
state-space concept has fundamental importance. If the present state of the dynamic
system and its input signals are known, then it is possible to predict the future state
3.3: Continuous Time Dynamic Systems 53

evolution of the system. It is not necessary to know the previous history, i.e. how the
actual state was reached. In other words, the state is the minimum amount of
information about the system that is needed to predict its future behavior.
The state x can be described as a column vector with the state variables as its
components

x = ( x1 x 2 2 x n )
T

It is seldom possible to measure all the state variables directly. They are internal
variables that cannot always be observed via sensors. For this reason the state-
space description is also called internal description. The output values, i.e. the
measurements, are denoted by y 1, y 2 ,…, y p , and are described by a vector y :

(
y = y1 y 2 2 y p )T
In general the number of sensors p connected to the technical process is less
than the number of state variables n . It is therefore not trivial to calculate x from y .
We consider here systems that are influenced by input signals. There are two
kinds of inputs to technical systems: signals that can be controlled either manually or
automatically via some kind of technical equipment and signals that it is not possible
to manipulate. The first signals are called control signals or control variables u 1 ,
u 2 ,…, u r and are denoted by the vector u :

u = (u 1 u 2 2 u r )
T

Other input signals can influence the system, but cannot be controlled. Their
values represent environmental influence on a system like e.g. load changes or
disturbances that are caused by temperature, radiation, undesired magnetic
couplings, etc. These signals are collectively indicated with the vector v :

v = (v 1 v 2 2 v m )
T

The purpose of a control system is, by using the available measurements y , to


calculate such control signals u so that the purpose of the technical system is
fulfilled despite the influence of the disturbances v . The system can be represented
by a block diagram (Figure 3.13) in which are indicated the control inputs, the
disturbances and the output variables. These concepts are explained in the following
simple example.
v
disturbances

reference or output or
control measurement
variables variables
(internal)
u x state variables y

Figure 3.13: Block diagram of a controlled system


54 Chapter 3: System Description and Modeling

Example 3.11 Mechanical systems


The system in Example 3.2 (Section 3.2.1) has the two states position z and
velocity v . The input variable u is the force F . The position z (output variable)
can be measured. In vector form the system is described by:

x = (z v ) ; u = F ; y = z = (1 0) x
T

The state equations are then written as:


dx  0 1  0 
=  ⋅x+  ⋅ u , y = (1 0) ⋅ x
dt  0 0  1 m

3.3.3 Linear Systems in State-Space Representation


Most of the examples shown in Section 3.2 are linear dynamic systems and can
therefore be modeled by linear differential equations. In general there is no product
between the state variables, inputs and outputs, such as x 12 , x ⋅ u or x 1 ⋅ x 2 . A
linear system with n state variables, r input variables and constant coefficients is
described by the following state equations:
dx1
= a11 x1 +  + a1n xn + b11u1 +  + b1r ur
dt

dxn
= an1 x1 +  + ann xn + bn1u1 +  + bnr ur
dt
where the parameters a ij and b ij are constants. Since the equations are linear
differential equations with constant coefficients they have many attractive properties.
It is for example always possible to find an analytical solution of x(t ) given arbitrary
control signals u(t ) . The initial conditions are defined by n constants:

x(0) = ( x10 2 x n0 )
T
x 20

In matrix notation the state equation becomes a much simpler aspect:


dx
= A ⋅ x + B⋅ u (3.1)
dt
where A and B are matrices that contain the following constant parameters:
 a11 a12 2 a1n   b11 2 b1r 
   
 a 21 a 22 2 a 2n   b21 2 b2r 
A= B=
     
   
 a n1 a n 2 2 a nn   bn1 2 bnr 
With only one control input, the matrix B is a single column.
3.3: Continuous Time Dynamic Systems 55

There is a linear relationship between the internal state variables x and the
measurements y . Sometimes there is also a direct coupling from the control
variables u to the output variables y :
y 1 = c11x 1 +  + c1n x n + d 11u 1 +  + d 1r u r


y p = c p1x 1 +  + c pn x n + d p1u 1 +  + d pr u r

or in vector-matrix notation:
y = C⋅ x + D ⋅ u (3.2)
where
 c11 c12 2 c1n   d 11 2 d 1r 
   
C=   D=  
c  d 
 p1 c p 2 2 c pn   p1 2 d pr 
If there is only one output variable, then C consists of a single row. Usually there
is no direct coupling from the input to the output variables, so that the matrix D is
zero.
A linear system has many attractive properties (compare for example with some
of the properties of non-linear systems mentioned in Section 2.3.7). The most
important property of linear systems is the superposition principle. This means for
example that if for a specific change of the input signal amplitude ∆u the output
signal change is ∆y , then for an input amplitude change that is twice as large
( 2 ⋅ ∆u ), the change in the output will be 2 ⋅ ∆y .
In linear systems the contributions from different input signals are additive, i.e. if
the input signal u 1 brings the output signal y 1 and u 2 leads to y 2 , then the total
output for an input u 1 + u 2 will be y 1 + y 2 . As a consequence the influence of the
control input signal and of a disturbance signal can be analyzed separately.
It is quite attractive to look for linearized descriptions of dynamic systems. It must
however be asked whether this is a realistic approach, since most technical
processes are basically non-linear. If the non-linearities are „smooth“, i.e. do not
present any stepwise changes, then under certain conditions a non-linear system
can be considered as a linear one. A linear description is then valid for small
deviations around an equilibrium point.
Many process variables in industrial systems must be kept around some steady
state value; the purpose of control systems is to bring the process variables to their
reference values. As long as the deviations from the reference are small, the linear
description is adequate. If, however, the deviations are too large, then more
elaborate models may be needed since the non-linear terms will be most significant.

3.3.4 Input/Output Descriptions


The frequency response method (Example 3.4 and Section 3.3.1) leads to the
complex analysis and the Laplace transform. The main concepts are here the
transfer function, block diagrams and their manipulations, poles and zeros. A
particular advantage of system analysis in the frequency domain is the fact that the
56 Chapter 3: System Description and Modeling

related data can often be collected experimentally, so that a useful system model is
obtained directly. For this reason the frequency response method is often used for
the description of complex systems such as feedback amplifiers and many
electromechanical devices and systems.
If only the relation between the input and output signals of a system is described,
some of the internal variables and their couplings remain hidden; the system
representation becomes more compact and has fewer parameters than the state-
space description. Since only the input and output variables are included in the
model, it is called external description, as opposed to the internal state-space
representation. Many controllers, like for example the PID controller described in
Chapter 6, are tuned on the basis of a input/output model of the technical process.
In the internal description of Equations (3.1, 3.2) the state variables x can be
eliminated and the system dynamics takes the following form:
dny d n − 1y d nu d n − 1u
+ a1 +  + an y = b0 + b1 +  + bn u
dt n dt n − 1 dt n dt n − 1
where the coefficients a i and b i can be derived from the A , B , C and D
matrices. In systems with many input and output variables there is an input/output
relation between every input/output variable pair (in the following we shall restrict our
discussions to systems with only one input u and one output y ). From the n th order
differential equation can be obtained the Laplace transform:

( s n + a1 ⋅ s n − 1 +  ) ( )
+ a n ⋅ Y ( s ) = b 0 ⋅ s n + b1 ⋅ s n − 1 +  + b n ⋅ U( s )

where s is the Laplace variable and Y ( s ) and U( s ) are the Laplace transforms
of y (t ) and u (t ) respectively. The advantage of this method is that the complex
variables s that represent differentiation operators can in this way be manipulated by
algebraic methods. Here it is assumed that the initial condition of all the states is
zero.
The input/output relationship of a linear system can be expressed by its transfer
function G( s ) . This function is defined as the ratio between the Laplace transforms
of the output and the input signals of the system:
Y(s) b s n + b1s n − 1 +  + b n
G( s ) = = 0 (3.3)
U( s ) s n + a1s n − 1 +  + a n
The transfer function can also be calculated directly from the internal state-
space description (Equations 3.1, 3.2). The following relation holds:
Y(s) −1
G( s ) = = C ⋅ ( sI − A ) ⋅B+ D (3.4)
U( s )
where I is an identity matrix of order n . The derivation is quite straightforward
and is described in most control textbooks. In a system with only one input and one
output the C matrix consists of single row and the B matrix of a single column, while
A is a n ⋅ n matrix. Usually D (which then is a 1⋅ 1 „matrix“) is zero. In this case G
becomes a scalar. For several inputs and outputs G( s ) is a matrix with elements
G ij ( s ) , indicating the transfer function from each input u i to each output y j .
3.3: Continuous Time Dynamic Systems 57

Example 3.12 Transfer function of a mechanical system


The transfer function of the mechanical system in Example 3.2 (Section 3.2.1)
is
Z(s) 1
G( s ) = =
F( s ) ms 2

where Z ( s ) and F( s ) are the Laplace transforms of the position z and of the
force F respectively. The state equations were derived in Example 3.11. The
transfer function can also be calculated directly from the state equations (see also
Equation 3.4):
−1
−1  s −1  0  1
G ( s ) = C ⋅ ( sI − A ) ⋅ B = (1 0)    =
0 s   1 m  ms 2

Example 3.13 Low-pass filter


The RC filter of Example 3.4 can be characterized by its transfer function.
Assuming that the voltages are initially zero, the input/output relation can be written
as:
Vo ( s ) 1
G( s ) = =
Vi ( s ) 1 + sRC
The amplitude gain and the phase shift for a sinusoidal input is obtained by
replacing s with jω in the transfer function.

Since the input/output description contains fewer coefficients than the internal
state-space description, it is always possible to derive an input/output description
from the internal one; the opposite does however not hold uniquely. This is quite
natural, since the state variables x can be expressed in different coordinate systems
and units, while y and u depend on the physical nature of the process and are
therefore defined from the very beginning.
The denominator of the transfer function is also called characteristic equation.
The roots of the characteristic equation are called poles and are of great
importance. The values of the poles are identical with the eigenvalues of the A
matrix. The roots of the numerator of the transfer function are called zeros. By using
the notation z1,…, z m for the zeros and p1,…, p n for the poles (with n > m ) the
transfer function (Equation 3.3) can be written in the form:
K ⋅ ( s − z1) ( s − z m ) α1 αn
G( s ) = = +  +
( s − p1)( s − p n ) s − p1 s − pn

where α i are real or complex constants. This means that the output y can be
written as a sum of exponential functions called modes:
y (t ) = c1 ⋅ e − p1 ⋅t +  + c n ⋅ e − p n ⋅t + [terms that depend on u (t ) ]
58 Chapter 3: System Description and Modeling

A real pole corresponds to a real exponential function, while two complex


conjugated poles can always be combined into one term.
If two poles have the values
p k , k + 1 = −σ ± jω

then the pole pair corresponds to a term of the transient response in the
following form:
c k ⋅ e −σt ⋅ σin(ωt )

The poles (or the eigenvalues of the A matrix) of a linear system completely
determine whether the system is stable or not. If the real parts of the poles are
negative, then the transient answer for a limited signal u is also limited, i.e. the
system is stable.
The zeros determine the size of the coefficients of the exponential functions in
the transient answer, but otherwise do not influence the stability of the system. If a
pole is located close to a zero, then the corresponding mode is small. If the zero
coincides with the pole, the corresponding mode is cancelled.

3.3.5 The Validity of Linear Models


There are in practice several dynamic phenomena that can not be described by
linear differential equations with constant coefficients. The consequences of non-
linearities will be illustrated here with some examples. The systems described below
behave linearly for small signals; the non-linearities appear for large input signals.

Example 3.14 Signal limitations


In real systems all signals are limited. In many technical processes the use of
valves as final control element is commonplace. Since the valve cannot be more
than 100% open, in many cases a mathematically desirable control signal just
cannot be realized (Figure 3.14). This causes certain problems in control - the
windup - as further discussed in Chapter 6.
output
signal y

input
signal u

Figure 3.14: Response function of an actuator with limitations

Another example of signal limitation is the rotor current in an electrical motor.


The current must be limited, otherwise the motor would burn. Consequently the
control system for an electrical motor cannot behave linearly, in particular for fast
accelerations and large torque values, when also the currents need to be large.
3.3: Continuous Time Dynamic Systems 59

Example 3.15 Aeration process


Let us consider again the wastewater treatment plant of Example 3.8 in
Section 3.2.3. The superposition principle is not valid for the aeration process.
Here it is assumed that the air inflow u and the respiration rate R are constant
and that the dissolved oxygen (DO) concentration is kept at an equilibrium value of
3 mg/l. In Figure 3.15 is shown that when the air inflow is changed by a step value
(2%, 4% etc.), the DO concentration approaches a new steady-state value within
an hour. A 4% change will quite accurately double the concentration change with
respect to a 2% variation, i.e. the behavior looks quite linear. These changes are
also symmetrical around the steady state value. However, already for an 8%
change in the air inflow rate the asymmetry of the response is obvious. If the air
flow rate is changed ±20%, the upward and downward changes are not
symmetrical, and furthermore are not 5 times larger than the variation due to a 4%
change. These curves show how non-linearities appear in practice.
Oxygen Oxygen
concentration (mg/l) concentration (mg/l)
4 4.5
+20%
4
3.5 +8%
3.5
+4 0
+2 3
3 0
-2 2.5
-4
2
2.5
-8%
1.5 -20%
2 1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
(a) time (hours) (b) time (hours)

Figure 3.15: Changes of the dissolved oxygen concentration in an aeration tank for a
stepwise change of the airflow (input variable) at a time t = 0 . Different
values are shown for the input variable: (a) ±2%, ±4% and ±8%; (b) ±20%.

The systems described above have „smooth“ non-linearities, i.e. the systems still
behave linearly for small inputs. Many systems need more accurate descriptions
than linear differential equations for large deviations from some equilibrium point, so
that non-linear terms have to be added. It is the purpose of the model that ultimately
warrants whether a linear description is adequate or not.

3.3.6 Non-linear Systems


The systems in Section 3.3.5 are non-linear systems that under some
assumptions can be approximated by linear equations. Other types of non-linearities,
however simplified, cannot be reduced to linear descriptions. Relay systems are a
common example. A relay delivers a binary on/off signal; the ideal relay has a
positive constant output for any positive input and a constant negative output for any
negative input. Obviously such a system does not satisfy the superposition principle.
60 Chapter 3: System Description and Modeling

Examples of systems with significant non-linearities are:


• different kinds of relays (with dead bands, hystereses, etc.)
• valves (dead band, saturation)
• non-linear deformations in mechanical springs
• pressure drops in pipe constrictions
• friction forces
• aerodynamic damping
• steam properties
• direct current (d.c.) motors with series field windings (the torque is function of
the square of the rotor current)
• alternating current (a.c.) motors
A non-linear system (cf. Examples 3.8 and 3.9 in Section 3.2.3) can be written in
the following form:
dx 1
= f1( x1, x 2 , 2, x n , u 1, 2, u r )
dt

dx n
= f n ( x1, x 2 , 2, x n , u 1, 2, u r )
dt
where n states and r inputs have been defined. Also this type of system can be
written in a compact vector form (the state vector x and the control vector u are
defined in Section 3.3.2):
dx
= f( x, u) (3.5)
dt
The function f is a vector where each component is a function, i.e.

f = (f1 f2 2 fn )
T

When the system is in steady state, then the derivatives of f are zero. Assuming
that the equilibrium state is x with the corresponding constant control signal u , the
condition at steady state is
f ( x, u ) = 0 (3.6)

Note that Equation (3.6) corresponds to n single equations. There may be


several solutions to these equations, where each solution corresponds to some
equilibrium point.
Also a sensor may behave non-linearly (see Chapter 4). Thermal or pressure
sensors have a non-linear relationship between the physical variable and the sensor
output signal. The measurement characteristics may be linear for small signals, but
have to be described by non-linear relations for large signals. Thus Equation (3.2)
has to be written in a more general form,
3.3: Continuous Time Dynamic Systems 61

y 1 = g 1( x 1, x 2 , 2, x n , u 1, 2, u r )

y p = g p ( x 1, x 2 , 2, x n , u 1, 2, u r )

In matrix notation this can be written more compactly as


y(t ) = g( x(t ), u(t )) (3.7)

where the vector g consists of the functions g 1, g 2 ,…, g p , i.e.:

(
g = g1 g 2 2 g p )T
Usually there is no analytical solution to non-linear systems. The solutions must
be obtained numerically, which in most cases is adequate. It is important to find the
state equations of a system in order to derive a model from them. Once a model is
given in differential equation form there are always methods to find the solution.

3.3.7 Numerical Simulation of Dynamic Systems


For the solution of non-linear differential equations in most cases numerical
methods are used. A basic solution to the differential equations is obtained by
approximating the time derivatives with simple difference equations. This method is
known as the Euler approximation with forward differences:
x(t + h ) ≈ x(t ) + h ⋅ f( x(t ), u(t ))

If the initial conditions x( 0) are known, the states x( h ) , x( 2h ) , x( 3h ) ,… can be


computed; they are close to the true solution at the times h , 2h , 3h , etc. It is here
very important to choose a step size h that in principle must be as small as
possible, yet compromises must be made. A too short step size will lead to
unreasonably long processing times (this of course depends also strongly on the
type of computation, the mathematical equation, the amount of variables and the
processor power). On the other hand, a too large value for h will cause numerical
problems and lead to unwanted results. These problems may become significant, in
particular if the modeled system contains at the same time both fast and slow
dynamical processes together.

Example 3.16 The problem of a too long step size


To illustrate the problem of a too long step size let us consider the simple first-
order system:
dx
= −a ⋅ x
dt
where x ( 0) = 1 and a > 0 . The system has the analytical solution x (t ) = e − at .
The differential equation can be solved numerically by a forward Euler
approximation. By approximating the derivative with a finite difference the equation
becomes:
62 Chapter 3: System Description and Modeling

dx (t ) x (t + h ) − x (t )

dt h
and the solution is
x (t + h ) ≈ x (t ) − ha ⋅ x (t ) = (1 − ha) ⋅ x (t )

In Figure 3.16 it is shown what happens for different choices of the step size
h . For larger values of h such that 1 − ha > 1, i.e. h > 2 a , the solution x will
oscillate with alternating sign and with an increasing amplitude. The problem of
oscillations due to a too long integration step is called numerical instability. This
instability has nothing to do with the system itself and is only caused by a too raw
approximation in the computation of the solution.
1 1
h=0
0.8
h=0 0.8
h=0.05 h=0.1
0.6 0.6
h=0.4
0.4 0.4

0.2 0.2

0 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2
time time
(a) (b)
Figure 3.16: Numerical solutions of a simple first order difference equation for different
values of the step size h : (a) h = 0.05 , (b) h = 0.1 and 0.4 .

There are many integration methods with their merits and drawbacks; particularly
widespread are the Runge-Kutta methods. Most of the integration techniques have a
variable step length that is automatically adjusted to satisfy a predefined error
criterion.
Today are available several commercial simulation packages for the solution of
non-linear differential equations. By „solution“ it is intended here that the transient
response of the state variables can be obtained by numerical integration of the
differential equations, given appropriate initial conditions and with the input signals
specified as functions of time. With such programs the user has to formulate the
differential equations and then some conditions about the numerical integration
method, the step size, the presentation form of the output variables (printout or
graphic plot), etc. A good simulation program must at least be able to:
• Check out the equations to examine if they are consistent
• Sort the equations into an appropriate sequence for iterative solution
• Integrate the equations
• Display the results in the desired form (tables or graphical diagrams)
3.3: Continuous Time Dynamic Systems 63

Modern simulation packages have simple commands to change parameters or


initial values and provide several integration routines from which the most suitable
one for the specific problem can be selected. These software packages have also
advanced output features to present the results in easy readable graphic formats.
There are several powerful simulation software packages available in the market.
The software packages Mathematica, Simnon, MATLAB®, Simulink, Easy-5 and
ACSL are all commercially available for personal computers or workstations. The
Matlab package has rapidly gained enormous popularity as an analysis tool because
it supports several mathematical methods, like e.g. matrix calculations, linear algebra
analysis, parameter identification, time series analysis and control system synthesis.
The simulated diagrams in this book were obtained with Simnon, a package
developed at the Department of Automatic Control of the Lund University (Sweden).
Simnon and ACSL are equation-oriented simulation packages, i.e. the systems
are defined in ordinary differential equation form. Other simulation packages (e.g.
Easy-5 and Simulink) are supplied with ready modules to describe process units
components; the users can add their own simulation modules to the software. The
operation of such simulation packages means to connect together a number of
modules of unit processes. Otherwise the package contains the same type of
numerical integration and interaction tools as the equation-oriented simulation
software.
One reason for the limitation of the block-diagram simulators has to do with
computational causality. In block-diagram simulators it is always defined what is the
input and what is the output of the equations. But in real-world situations causality is
sometimes not defined; for example simultaneous events are non-causal. Modeling
an electrical resistor, it is not evident ahead of time, whether will be needed an
equation of the type
u = R ⋅i
or one of the form
u
i=
R
It all depends on the environment in which the resistor is located. Consequently
the modeling tool should relax the causality constraint that has been imposed on the
modeling equations in the past. This concept has led to the object-oriented modeling
paradigm, since it provides a modeling language with a true correspondence
between the physical objects and their representations inside the model. An example
of object-oriented simulation package is Dymola from Dynasim AB (based in Lund,
Sweden). Dymola, developed by Hilding Elmqvist (who also created Simnon), is a
tool that can be used in the construction of complex models that are then processed
by another simulation program (e.g. Simnon, Simulink).
Special simulation packages have been developed for specific applications, as
for example flight simulators or simulators of nuclear reactors and power systems.
These systems must simulate well-defined technical processes under extremely
realistic situations and are principally used for operator training and in system design.
In many cases these simulators are designed and built together with the real control
system and can process the same data (of course, commands from the simulator are
not sent out to the real technical process).
64 Chapter 3: System Description and Modeling

3.4 Discrete Time Dynamic Systems


A computer works in discrete time and therefore cannot process continuously
varying data. The data collection and the generation of control signals by a computer
does necessarily take place at defined time instances. Here it doesn’t help to
increase the processor speed: a faster processor does not operate according to a
different principle than a slower one, it just operates on more data in the same
amount of time, yet the data remains discrete.
In the following is developed a model of the physical process that is suitable for
computer control applications. According to this model the process measurement
data are collected at regular time intervals. These intervals do not need to be
constant, however the problem description becomes simpler if a constant interval
length for the discrete dynamic model is assumed. This interval length is called
sampling time. Practical applications of signal sampling will be treated in more detail
in Section 5.1.
Another simplification that is useful for the development of time-discrete process
models is the assumption that both measurement data and control signals remain
constant during the sampling interval. In fact, this is also the way that the sample-
and-hold circuits in the computer interface operate (Section 5.1).

3.4.1 State Description


A non-linear process (Equation 3.5) can be approximated with a difference
equation:
x[(k + 1)h ] ≈ x (kh ) + h ⋅ f (x, u) (3.8)
where h is the sampling time and k the progressive number of the sampling
interval; f( x, u) is the time derivative of the system state x as defined in Equation
(3.5). The approximation is valid if h is sufficiently small and the derivative is
„smooth“. The difference equation is actually the same as that used in numerical
simulations (Section 3.3.7). A linear system with constant coefficients (Equation 3.1)
is discretized as:
x1[(k + 1)h ] = (1 + h ⋅ a11 )x1(kh ) +  + h ⋅ a1n x n (kh ) +
+ h ⋅ b11u1(kh ) +  + h ⋅ b1r u r (kh )

x n [(k + 1)h ] = (1 + h ⋅ an1 )x1(kh ) +  + h ⋅ ann x n (kh ) +


+ h ⋅ bn1u1(kh ) +  + h ⋅ bnr u r (kh )
This can be written in matrix notation as:
x[(k + 1)h ] ≈ x (kh ) + h ⋅ A ⋅ x (kh ) + h ⋅ B ⋅ u(kh ) = (I + h ⋅ A ) ⋅ x (kh ) + h ⋅ B ⋅ u(kh )
A finite difference approximation as in Equation (3.8) is not necessary for linear
or linearized systems. Since linear differential equations can be solved analytically,
also the corresponding discrete time equations can be derived from Equation (3.1). It
is assumed that the control signal u(t ) is constant between the sampling instances,
3.4: Discrete Time Dynamic Systems) 65

i.e. that the system includes a sample-and-hold circuit. The discrete time system can
then be written in the matrix form:
x[(k + 1)h ] = Φ ⋅ x (kh ) + Γ ⋅ u(kh ) (3.9)
where Φ is an n ⋅ n matrix and Γ an n ⋅ r matrix. The exact relations between
the A and B matrices and the Φ and Γ matrices are

Φ = e Ah = I + hA +
( hA ) 2 + 2
2!
 Ah 2 
Γ =  Ih + + 2 ⋅ B
 2! 
The conversion between the matrices in time-continuous and in time-discrete
form can be carried out with standard software. The finite difference approximations
Φ ≈ I + h ⋅ A and Γ ≈ h ⋅ B approach the exact solution for small values of the
sampling interval h . The measurement data are however collected only
intermittently, for this reason in the time-discrete case Equation (3.2) is valid only at
the sampling instances:
y( kh ) = C ⋅ x( kh ) + D ⋅ u( kh ) (3.10)

With a digital computer the solution of the discrete system is possible in a simple
way. After the formulation of the difference equations the computer generates the
solution of successive values of x step by step.

3.4.2 Input/Output Relations and the Shift Operator


Similarly as in time-continuous systems, also in discrete-time systems it is often
convenient to relate directly the input u of a process to its output y . This holds in
particular when the controller is written in the same form, i.e. it operates on the
process output value in order to calculate a control signal. The discrete-time analysis
can be handled easier by using the shift operator q . The effect of the application of
q on a time-dependent variable z(t ) is the same as to shift the time by the interval
h (also called forward shifting):
q ⋅ z ( kh ) = z[ ( k + 1) h ] (3.11)

With help of the shift operator, difference equations can be changed in algebraic
equations that are easier to manipulate and solve; the principle is similar as the use
of Laplace transformations with the complex variable s in order to simplify the
manipulation of differential equations.
The backward shift operator q −1 shifts the time function one sampling interval
backwards:
q −1 ⋅ z ( kh ) = z[ ( k - 1) h ] (3.12)

In general, the shift operator q can operate several times on a discrete time
function:
q n ⋅ z ( kh ) = q ⋅ q ⋅  ⋅ q ⋅ z ( kh ) = z[ ( k + n ) h ]
66 Chapter 3: System Description and Modeling

The shift operator q can also be applied on a vector x( kh ) , which simply means
that it acts on each vector component.
If a process description is available in time-discrete internal state-space form
(Equations 3.9 and 3.10), by eliminating the state vector x and rearranging
algebraically the terms, the relation between process input and output can be
expressed as:

[ ] [ ]
y ( k + n )h + a1 ⋅ y ( k + n − 1)h + ⋅ + an ⋅ y ( kh ) = b0 ⋅ u [ ( k + n ) h ]++ bn ⋅ u ( kh )

The shift operator q allows a more compact description :

(q n + a1 ⋅ q n −1 + ⋅ + an ) ⋅ y (kh) = (b0 ⋅ q n + b1 ⋅ q n −1++bn ) ⋅ u (kh) (3.13)

We have seen in Chapter 3 how the input/output relation of a linear system can
be described by the transfer function G( s ) , defined as the ratio of the Laplace
transforms of the output vs. the input signals of the system. An analogous
description can be obtained with the shift operator q and discrete systems. The
discrete transfer operator H (q ) is defined from Equation (3.13) as follows:
y ( kh ) b0 ⋅ q n + b1 ⋅ q n − 1 ++ bn
H (q ) = = (3.14)
u ( kh ) q n + a1 ⋅ q n − 1 + ⋅ + a n
The expression of Equation (3.13) may be shifted n sampling periods
backwards, which is equivalent to multiplying both sides of the equation by q − n . The
input/output relation is then expressed as:

[ ] [ ]
y ( kh ) + a1 ⋅ y ( k − 1)h + ⋅ + an ⋅ y ( k − n )h = b0 ⋅ u ( kh )++ bn ⋅ u ( k − n )h[ ]
By using the backward shift operator q −1 explicitly, the relation gets a simpler
expression:

(1 + a1 ⋅ q −1 + ⋅ + an ⋅ q −n ) ⋅ y (kh) = (b0 + b1 ⋅ q −1++bn ⋅ q −n ) ⋅ u (kh)


The corresponding discrete transfer operator is:
y ( kh ) b0 + b1 ⋅ q −1 ++ bn ⋅ q − n
( )
H * q −1 =
u ( kh )
=
1 + a1 ⋅ q −1 + ⋅ + a n ⋅ q − n
(3.15)

If the numerator and denominator in Equation (3.15) are multiplied with q n , the
( )
result is Equation (3.14), i.e. H * q −1 = H(q ) .
The discrete transfer operator can be derived directly from the state-space
description (Equations 3.9, 3.10). Here is just stated the main result, the proof is
reported in common control theory books. The relation between the discrete transfer
operator and the state-space matrices is:

( )
H (q ) = H * q -1 =
y (kh )
u (kh )
= C ⋅ (q ⋅ I - Φ ) -1⋅Γ + D (3.16)
3.4: Discrete Time Dynamic Systems) 67

This calculation is made as if q were a complex number, although it is formally a


mathematical operator. We are mostly interested in systems with one input u and
one output y , so that the matrix C is a single row, Γ a single column and Φ a n ⋅ n
matrix. Usually D is equal zero, which means that there is no algebraic (i.e. direct
physical) coupling from the input to the output of the technical process.
Also in the discrete case, as for the continuous transfer operator, the
input/output coefficients are uniquely given from the internal state-space description.
Similarly, since the state vector x can be expressed in different coordinate systems,
there are many possible Φ , Γ , C and D that can be derived from H (q ) . The
transfer operator description is univocal for a system, while the state-space matrices
are not.

Example 3.17 Mechanical system in sampled state-space form


To exemplify the use of the time-discrete state-space description, let us
consider again the mechanical system of Example 3.11 (Section 3.3.2).
To begin with, a sampling time h is selected. The matrices Φ and Γ can then
be calculated:
1  1 h
Φ = e Ah = I + Ah + ( Ah ) 2 +... =  
2  0 1

 1   h 2 / 2m  h  h / 2
Γ =  Ih + Ah 2 +... ⋅ B =  =  
 2   h/m  m 1 
The sampled model for the mechanical system becomes:
 1 h h  h / 2
x[(k + 1)h ] =   ⋅ x(kh ) +   u (kh )
 0 1 m 1 

y (kh ) = C x(kh ) = (1 0) x(kh )

The transfer operator can now be calculated by using Equation (3.16). Note
that we treat q as if it were a complex number. Then
−1
 q − 1 −h   h 2 / 2m  h 2 q + 1
H (q ) = (1 0)     =
 0 q − 1  h / m  2m (q − 1) 2
This can be rewritten in the form
m 1
(q 2 − 2q + 1)y (kh ) = (q + 1)u (kh )
h2 2
which is interpreted as
m
h2
[ y [(k + 2)h ] − 2y [(k + 1)h ] + y (kh )] = [u [(k + 1)h ] + u (kh )]
1
2
or analogously:
m
h2
[ y (kh ) − 2y [(k − 1)h ] + y [(k − 2)h ]] = 21 [u [(k − 1)h ] + u [(k − 2)h ]]
68 Chapter 3: System Description and Modeling

This is the sampled model of the mechanical system. For comparison, let us
make a simple difference approximation of the continuous time model as initially
described in Example 3.2, Section 3.2.1. A backward difference approximation
yields the following result:
m
h2
[ y (kh ) − 2y [(k − 1)h ] + y [(k − 2)h ]] = u (kh )
and for a forward difference approximation the result is:
m
h2
[ y [(k + 2)h ] − 2y [(k + 1)h ] + y (kh )] = u (kh )
The approximations calculated with forward and backward differences are
similar, apart from the shift in time 2h. For small values of h the time-discrete state-
space description gets closer to the difference approximations.

To summarize, in order to discretize a system described in continuous time we


may proceed in two ways. The approximate way is to derive the time discrete
equations as in Equation (3.8). If the continuous system is linear, then Φ and Γ can
be calculated from A and B . From the state-space time-discrete form of the system,
the transfer operator H can be derived with help of the relation of Equation (3.16).
We have already remarked that the poles of a continuous system are identical
with the eigenvalues of the A matrix. In a similar way the poles of a discrete time
system are identical with the eigenvalues of the Φ matrix.
Consider the first order continuous system
dx
= −a ⋅ x
dt
Since a > 0 the system is stable and converges to zero independently of the
initial condition, i.e.
x (t ) = e −at x (0)
The sampled data version of the system is
x ((k + 1)h ) = e −ah x (kh ) = ϕ ⋅ x (kh )

Assume that h is very small, so that the product ah is close to zero. Then ϕ is
just below 1. Physically this means that the system state changes very little between
each sampling instant. If, on the other hand, h is large, then ϕ becomes close to
zero. This means that the system will „remember“ very little between two sampling
instants. It is therefore obvious that the sampling time h is related to the size of the
coefficient a and has to be chosen with great care in order to avoid the introduction
of an instability factor in the system. The selection of the sampling time is further
discussed in Chapter 5.
Stated differently, the eigenvalues λ of A correspond to the eigenvalues e λh of
Φ . In the first order example above we saw that a negative real eigenvalue ( −a ) of
the continuous system may lie anywhere on the negative real axis for the system to
be stable. The corresponding location for the discrete system ( e − ah ) is on the real
axis between 1 and 0.
3.5: Controllability, Estimation and Observability 69

A second order oscillating system has continuous eigenvalues in −σ ± jω . This


corresponds to a stable oscillation if σ > 0 (Section 3.3.4). The corresponding
eigenvalues for the discrete version of the system becomes e −σh + jωh and
e −σh − jωh . It is obvious, since we are considering the same physical system, that
these eigenvalues correspond to the same oscillatory behavior, but observed only at
sampling intervals h time units apart. We note that the time-discrete eigenvalues are
situated within the unit circle as long as σ > 0 .
The first and second order examples can be generalized to higher order
systems: if the eigenvalues (and consequently the poles) of the time discrete system
are located within the unit circle, then the system is stable. Thus, the inside of the
unit circle corresponds to the left half plane for continuous systems.

3.5 Controllability, Estimation and Observability


3.5.1 Controllability
In any technical process there are some fundamental issues that must be
addressed. The first such issue is whether there are sufficient control variables to
manipulate the system in a desired way. This issue is known as controllability.
Roughly speaking, a system is controllable if its state x can be brought to any
desired point by a suitable choice of control signals u . Only when a system is
controllable its poles (or eigenvalues) can be moved to any desired location by
feedback. (These issues are going to be discussed further in Chapter 6.)
If a process is uncontrollable, it means that parts of the system are physically
disconnected from the input u . This is shown here for the case when the system
contains distinct eigenvalues or poles, that is, no poles have the same value. In such
a system the state variables can be selected separately from each other, i.e. the
system can be represented as:
dx 1
= λ 1 ⋅ x 1 + b1 ⋅ u
dt

dx n
= λ n ⋅ x n + bn ⋅ u
dt
or also in matrix form
 λ1 0  0   β1 
   
dx  0 λ 2  0  β
= ⋅ x +  2 ⋅u
dt  4 4  4   4 
   
0 0  λ4 β n 

with λ i ≠ λ j for all i ≠ j .


This state form is called diagonal form. The states in a diagonal system are also
called natural (oscillation) modes (see example 3.13 in Section 3.3.4). The input
signals influence the different state variables separately. In a controllable system all
the elements in the B matrix are non-zero, otherwise the state variables
corresponding to zero entries in B could not be influenced by the control signal. In
70 Chapter 3: System Description and Modeling

such case the associated states would follow their natural behavior. A similar
reasoning can be made also for time-discrete systems.
Similarly as for a continuous system, also a time-discrete system can be written
in diagonal form as long as the eigenvalues are separate from each other, i.e.
 λ1 0  0   β1 
   
 0 λ2  0  β
x [(k + 1)h ] = x(kh ) +  2  u
        
   
0 0  λn β n 
Exactly like the continuous system, all the β i have to be non-zero in order for
the system to be controllable.
The controllability of time-continuous and time-discrete linear systems can be
tested with mathematical methods. However, no mathematical method can replace
the control engineer’s physical understanding of the process. For example it often
happens that some modes are controllable only up to some degree (which
corresponds to small values of the related β i coefficient). Also when a mathematical
test indicates the controllability of a system, certain modes might be so weakly
controllable that no regulator could be designed and used for practical purposes.

3.5.2 Estimating the State from the Measurements


A second issue related to system properties has to do with instrumentation and
observation. Does the available instrumentation give sufficient information about the
state of the system? Is it possible to indirectly calculate the full current state vector
x(t ) , if the current and previous values of the output signal y(t ) are known? This
property is called observability.
In most cases the system state is not measured directly, i.e. there are fewer
sensors than the number of state variables. Still, in many situations it is important to
know the full state x even if adequate sensors are not available or if they are just too
expensive. Under certain conditions it is possible to estimate the state x from the
measurements y . In the following the notation x shall be used to denote the
estimated value of x , as it may differ from the true value.
For the calculation of the non-measurable state variables a so called estimator
can be used. Estimators can be derived for a continuous as well as for a time-
discrete system model. Here is discussed the time-discrete estimator, since it is
directly suitable for implementation on a process computer. The estimator is actually
a description of the technical process in form of difference equations (Equation 3.9),
extended with a correction term to update the estimated state variables with the real
measurement values y as soon as these are available:

[ ] [ ]
x (k + 1)h = Φ ⋅ x (kh ) + Γ ⋅ u(kh ) + K ⋅ y(kh ) − C ⋅ x (kh ) (3.17)

The D matrix (Equation 3.10) is in most cases zero. If the system has only one
sensor, then K is a vector, otherwise it is a matrix. In a „perfect“ estimation x is
equal to x and the last term in Equation (3.17) is zero, since y = C ⋅ x . The
estimated value would then obey the same dynamical equation as the true state x
(Equation 3.9). As long as x is different from x , the last term, i.e. the difference
between the true measurement y and the estimated measurement C ⋅ x is used for
3.5: Controllability, Estimation and Observability 71

error correction. The error is weighed by the matrix K and contributes to the
compensation of the correct (unknown) x and the estimated value x . The estimator
is illustrated in Figure 3.17, where it is shown how the model output C ⋅ x is
continuously corrected with the true measurement values y . If K is properly chosen,
then x can approach x .

technical process

u x y
process process
input Φ,Γ C output

x - y
Φ,Γ -C +

estimator

K
computer

Figure 3.17: Estimator of the same order as the technical process (full-order estimator)

The process drawn in the upper box represents the technical process, while the
estimator is an algorithm for the realization of Equation (3.17) in a computer. In other
words, the estimator is nothing else than the computer simulation of the technical
process that is regularly corrected with the actual measurement data. To examine
the convergence of the estimator the estimation error ~ x can be used:
~
( )
x kh = x kh − x kh ( ) ( )
By subtracting Equation (3.17) from Equation (3.9) and inserting Equation (3.10),
it results

[ ]
~ (k + 1)h = Φ ⋅ x
x [
~(kh ) − K ⋅ y − C ⋅ x (kh ) =
]
(3.18)
~(kh ) − KC ⋅ x
= Φ⋅x ~(kh ) = (Φ − KC) ⋅ x
~(kh )

If K can be chosen so that ~ x( kh ) converges to zero sufficiently fast, then the


estimator is satisfactory. This means that ~ x( kh ) will converge to x( kh ) regardless of
the initial conditions. Furthermore, the convergence of the error can be carried out
much faster with appropriate choice of K than the original system dynamics that is
determined by Φ.
The fact that K can be chosen so that the estimator works in the desired way
depends on the system property observability. This property depends only on the
values of the Φ and C matrices. Roughly speaking, observability refers to the
possibility to obtain information on all the states x of the system by monitoring the
72 Chapter 3: System Description and Modeling

sensed outputs y . The observability also guarantees that a suitable matrix K can be
x( kh ) converges to zero arbitrarily fast. Unobservability means that
found so that ~
some state or subsystem are physically disconnected from the process output and
therefore do not appear in the measurements. If the system is described by its
transfer operator, the system is observable if the nominator and the denominator
have no common factors.

Example 3.18 Estimation of the angular velocity in a mechanical system


Consider a motor that is connected to a heavy load by a resilient shaft. In a
paper machine or in a rolling mill, the elasticity of the axis may cause oscillations of
the load (Figure 3.18). Since the primary goal is to control the angular velocity of
the load, this velocity has to be measured. The velocity can also be estimated, if
the angular position of the load can be measured. The load dynamics can be
described by Newton’s law. The resilient shaft acts like a spring with a force
proportional to the angular difference ε between the motor and the load. In
addition the velocity difference ω between the motor and load causes a damping
torque that is proportional to the velocity. For a motor torque Tm and a moment of
inertia J L the Newton’s law for the load is:

d 2ε dε
JL ⋅ = Tm − k ⋅ ε − c ⋅
dt 2 dt

Tm ε, ω

Figure 3.18: Electric drive consisting of motor and load connected by an elastic shaft

The dynamics can be written in state format:


dx 1
x1 = ε = x2
dt
dε dx 2 k c 1
x2 = =ω =− ⋅ x1 − ⋅ x2 + ⋅ Tm
dt dt JL JL JL
y (t ) = x 1

The derivatives are approximated by finite differences with the sampling


interval h :

[ ]
x 1 (k + 1)h ≈ x 1(kh ) + h ⋅ x 2 (kh )

[ ]
x 2 (k + 1)h ≈ x 2 (kh ) −
hk
JL
⋅ x 1(kh ) −
hc
JL
⋅ x 2 (kh ) +
h
JL
⋅ Tm (kh )
3.5: Controllability, Estimation and Observability 73

where k = 0,1,2,.…

The estimator has the form


xˆ1[(k + 1)h ] = xˆ1(kh ) + h ⋅ xˆ 2 (kh ) + K 1 ⋅ [x1(kh ) − xˆ1(kh )]

xˆ 2 [(k + 1)h ] = xˆ 2 (kh ) − ⋅ xˆ1(kh ) − ⋅ xˆ 2 (kh ) + ⋅ Tm (kh )


hk hc h
JL JL JL
+ K 2 ⋅ [x1(kh ) − xˆ1(kh )]

The purpose of the estimator is to compute x 2 ( kh ) from the measurements


y = x 1( kh ) . The initial conditions of the real system are unknown and therefore the
estimator can start arbitrarily at zero. In the example shown in Figure 3.19, the
angular velocity of a mechanical system is varying in an unknown way. At the time
t = 5 the angular velocity changes stepwise because of a sudden increase in the
motor torque. The figure shows how the value x 2 ( kh ) approaches x 2 ( kh ) . The
real velocity x 2 ( kh ) is unknown and starts with the value 5. Even if K1 and K 2 are
0, the estimated value will at the end approach the real value, since the estimation
model is correct. If the values of K1 and K 2 are positive the estimator can
approach the true value faster. For increasing values of K1 and K 2 the estimation
becomes faster.

velocity value
true / estimated
6
5
4 true value
3
2 (c)
estimation (a)
1
0
-1
-2 jump in velocity
value at t=5
-3 (b)
-4
0 5 10
time (s)

Figure 3.19 Velocity estimation on the basis of exact position measurements for different
values of the estimator K . The real velocity value is shown in bold and the
estimations are dotted. The parameters of the estimator vector are: (a)
K1 = 0 , K 2 = 0 , (b) K1 = 3 , K 2 = 3 and (c) K1 = 3 , K 2 = 15 . The
estimates in (b) and (c) converge rapidly; their value coincides with the true
value after about 2 seconds. Note how the estimates (b) and (c) initially have
opposite sign.
74 Chapter 3: System Description and Modeling

Once the estimator has reached the true value (i.e. the estimation error has
converged to zero) the estimated and the true value remain identical, even if the
input torque Tm changes; in a sense the estimator „knows“ the input function.
In a real system the velocity could be simply obtained by taking the derivative
of the position value. However, this is often a complicated operation in practice,
since the signal is usually noisy and the derivative of a rough signal usually gives
poor information.

If the model of the physical system is not accurate, the error dynamics is no
longer governed by Equation (3.18). However, K can often be chosen in such way
that the system remains stable despite the error and the estimation error is
acceptably small, even with small errors in the process model or when disturbances
distort the measurements. These aspects will be illustrated more in detail in the next
section.

3.6 Systems with Uncertainty


A mathematical model is hardly ever a perfect representation of reality. There
are always imperfections and unclarities in a system description. In many systems
the model does not include all the phenomena that take place, and some states are
simply neglected. It can also be difficult to quantify some systems by mathematical
expressions. A semantic representation could instead represent the system better,
and in particular those systems where a person is included in the control loop. Also
many biological systems are too complex or unknown to be described in quantitative
terms. In system control the question must therefore be always be asked about what
representation is the most adequate to describe uncertainties.
Stochastic processes are used to model both process disturbances and random
errors in the sensors. A stochastic process is a sequence of stochastic - or random -
variables. In principle this means that a random variable with a certain probability
distribution is added to each process variable at every sampling interval. Similarly,
measurement noise added to a sensor signal can be modeled as a random variable.
These aspects of measurement inaccuracy will be discussed further in Section 4.2.

3.6.1 State Estimation with Stochastic Disturbances


In the previous section it was assumed that the measurement information (i.e.
the measurement data vector y ) used in the estimator was error-free. This is hardly
ever the case, since every sensor has some imperfections. Noise and disturbances
in a sensor can be considered with an additional random variable e in the state
equation. The disturbance terms for all sensors in the technical process can be
written in compact form as a vector e that is added to the process Equation (3.10).
y( kh ) = C ⋅ x( kh ) + e( kh ) (3.19)

Each component of the noise vector e( kh ) is modeled as a sequence of


stochastic variables, i.e. random numbers. If these components are independent
from each other, then the amplitude of the noise components at time kh does not
depend on the amplitudes at previous time instances. It can often be assumed that
3.6: Systems with Uncertainty 75

the amplitude of the random numbers is normally distributed, so that mean value and
standard deviation completely characterize the disturbances.
In presence of measurement noise the estimation procedure that was described
in Section 3.5.2 must be carried out with particular care. Equation (3.19) is used
instead of Equation (3.10) to calculate the error. The structure of the estimator is
changed to:

[ ] [ ]
x (k + 1)h = Φ ⋅ x (kh ) + Γ ⋅ u(kh ) + K ⋅ y(kh ) − C ⋅ x (kh ) =
(3.20)
[ ]
= Φ ⋅ x (kh ) + Γ ⋅ u(kh ) + K ⋅ C ⋅ x(kh ) + e(kh ) − C ⋅ x (kh )

In this case a compromise must be made in the choice of K . If K is large the


estimation error tends quickly to zero. However, the noise term e is also amplified,
which will amplify the error. The value of K must therefore be on the one hand
sufficiently large so that x ( kh ) converges to x( kh ) as fast as possible, on the other
hand sufficiently small so that the noise term e( kh ) does not influence the result too
much.

Example 3.19 Estimation with measurement noise

velocity value
true / estimated
6
5
4 true value
3
2
1 estimation (a)
0
(b)
-1
-2 jump in velocity
value at t=5
-3
-4
0 5 10
time (s)

Figure 3.20 Estimation of the velocity value from noisy position measurements; the
estimation is faster in (b), but also more sensitive for disturbances. The values
of the estimator vector K are the same as for the example of Figure 3.19: (a)
K1 = 3 , K 2 = 3 ; (b) K1 = 3 , K 2 = 15 .

The mechanical system of Example 3.18 is considered once more. It is now


assumed that noise is superimposed to the position measurement:
y (t ) = x 1 + e
76 Chapter 3: System Description and Modeling

The result of velocity estimation by using the same K values as for


undisturbed measurements is shown in Figure 3.20. The graphics indicate how
estimation speed and accuracy have to be weighed against each other. With small
values for K the convergence is poor, but the ultimate accuracy is quite good. A
large K allows for faster convergence, but the final accuracy is poor. It is also
obvious that estimating the velocity by differentiating the angular position would
give a very poor result.

In order to find the best values for K with noisy measurements more
sophisticated methods have to be used. The best choice of K often changes in
course of time. Typically K can be large as long as the difference between the real
measurement y( kh ) and the estimated measurement y ( kh ) = C ⋅ x ( kh ) is large
compared to e( kh ) . When the error becomes smaller, its amplitude is comparable
with the noise e( kh ) , and K has to be decreased accordingly.
The process variables themselves may contain disturbances that cannot be
modeled in any simple deterministic way. Thus, a noise term to describe the
modeling error or the influence of process noise can be added to the difference
equation (Equation 3.9). A typical application might be the measurement of the level
of the liquid surface of a large tank that is not smooth because of wind and waves,
causing random variations of the measured level. Another example is the
measurement of the torque in an electrical motor that may show small pulsations due
to the operation of the frequency converter. Such variations can be modeled as
random numbers v( kh ) that are added to the state:

x[(k + 1)h ] = Φ ⋅ x (kh ) + Γ ⋅ u(kh ) + v(kh ) (3.21)


These random variables can be treated in a similar way as the measurement
noise e . With such a description a controller can take the uncertainty into
consideration. In such a situation any controller action would however be more
„cautious“, i.e. the controller gain must be small.
There is an optimal value of K that depends on the type of disturbance. A
Kalman filter is a function with the structure of Equation (3.20) and is based on the
system descriptions in Equation (3.19) and (3.21). The value for K that is obtained
from the Kalman filter is time-varying and represents the optimal compromise
between system and sensor disturbances and the estimation error.

3.6.2 Fuzzy Systems


Many systems are not only non-linear and time-changing, but are also generally
ill defined. They cannot be easily modeled by equations, nor be represented by
straightforward logic relationships like „if-then-else“ rules. This is the background
against which the American scientist Lotfi A. Zadeh developed the fuzzy logic. The
name „fuzzy“ is actually a misnomer, since the logic is firmly grounded in
mathematical theory.
Fuzzy logic can be regarded as a discrete time control methodology that mimics
human thinking by incorporating the imprecision that is inherent in all physical
systems. In traditional logic and computing, sets of elements are distinct; either an
element belongs to a set or it does not. The conventional - binary - logic considers
only opposite states (fast/slow, open/closed, hot/cold). According to this logic a
3.6: Systems with Uncertainty 77

temperature of 25°C can be regarded as „hot“ while 24.9°C would still be „cold“, to
which a temperature controller would react consequently.
Fuzzy logic, on the contrary, works by turning sharp binary variables (hot/cold,
fast/slow, open/closed) into soft grades with varying degrees of membership
(warm/cool, moderately fast/somewhat slow). A temperature of 20°C can for example
be both „warm“ and „somewhat cool“ at the same time. Such a condition is ignored
by traditional logic but is a cornerstone of fuzzy logic. The degree of membership is
defined as the confidence or certainty - expressed as a number from 0 to 1 - that a
particular element belongs to a fuzzy set.
Fuzzy systems base their decisions on inputs in the form of linguistic variables,
i.e. common language terms such as „hot“, „slow“ and „dark“. The variables are
processed via „if-then-else“ rules, producing in this way one or more responses
depending on which rules were asserted. The response of each rule is weighed
according to the confidence or degree of membership of its inputs values.
There are some similarities between the „if-then“ rules of artificial intelligence
(AI) and fuzzy logic. Yet, artificial intelligence is a symbolic process, while fuzzy logic
is not. In artificial intelligence neural networks represent data and decisions in special
structures. Each data input is assigned a relative discrete weighing factor. The
weighed data are combined in the network in a precise way to produce decisions.
The weighing functions in fuzzy logic, on the contrary, are defined as continuously-
valued functions with their membership values.
Fuzzy logic often deals with system variables that are observed rather than
measured. Fuzzy control has however also another important difference in respect to
traditional control. In traditional control, system modeling is based on a mathematical
model of the system, where a detailed knowledge of all relevant variables is
assumed. Fuzzy modeling deals with input/output relationships, where many
parameters are lumped together. In fuzzy control a preprocessing of a large range of
values into a small number of membership grades helps reduce the number of
values that the controller has to deal with. Because fewer values have to be
evaluated, fewer rules are needed, and in many cases a fuzzy controller can solve
for the same output faster than an expert system with its set of „if-then“ rules. In
some prototyping realizations fuzzy logic has proven to be a good way of starting
with little information.
An automatic controller for the speed of a train vehicle provides a simple
illustration of the application of fuzzy set theory. The criterion for the controller is to
optimize travel time within certain constraints. The current speed, acceleration and
the distance from the destination are the input data, and the controller operates on
the motor power.
The membership functions assign linguistic variables to the measurement values
(Figure 3.21). In the present state the acceleration is „decelerating“ due to a steep
hill. The velocity belongs to the membership „slow“ (weight 0.8) and „too slow“
(weight 0.2), while the distance is „close to destination“ with a weight 0.65.
A few rules can give some flavor for the control logic:
• if speed is „too slow“ and acceleration is „decelerating“, then increase power
greatly
• if speed is „slow“ and acceleration is „decelerating“, then increase power slightly
• if distance is „close“, then decrease power slightly.
78 Chapter 3: System Description and Modeling

1
degree of
membership too slow slow optimal fast too fast

0
actual state: speed
too slow=0.2, slow = 0.8

1
degree of
membership deceleration constant speed acceleration

0
actual state: acceleration
deceleration = 1.0

1
degree of very
membership close distant
close

0
actual state: distance from
very close = 0.65; close = 0.35 destination

motor decrease decrease keep increase increase


power greatly slightly constant slightly greatly

0
controller output

Figure 3.21: Membership functions for a fuzzy speed controller

Which rule should be selected? The output has also a confidence level that
depends on the confidence level, i.e. the weights of the inputs. In this case the final
selection is to increase the power slightly. Even if the speed is almost „too slow“, the
vehicle is already close to the destination.
There is no guarantee that fuzzy logic can deal with complex systems
successfully. A controller based on fuzzy logic is in practice an estimator of the
system state that is not based on a particular model. It is very difficult to prove the
stability of such a controller.
Fuzzy logic has become extremely popular for control system design, particularly
in Japan, while it has not caught the same interest in the United States where it was
first devised, or in other Western countries. Products based on fuzzy logic, all of
them Japanese, include autofocussing cameras, air conditioners, washing machines,
vacuum cleaners, elevator controllers and controllers for the speed in subway
systems.
3.7: Combinatorial and Sequencing Networks 79

Similarly to other technical solutions, also fuzzy logic must be considered in a


wider context. Particularly important is not to consider fuzzy logic as an always valid
solution or a simple alternative to more complex control schemes. In some cases,
like the above-mentioned autofocussing cameras, the development of more accurate
sensor technology has actually led to better performance than the use of fuzzy logic.

3.7 Combinatorial and Sequencing Networks


Many industrial processes are controlled by binary signals and deliver binary
measurements; some simple examples of sequencing networks were presented in
Section 2.2. The automation of systems with binary inputs and output can be
referred to two types of systems: combinatorial networks, that can also be
considered as a collection of logical expressions, and sequencing networks.
In a combinatorial network the output condition y with a logic value true or false
depends on a number of input conditions u that must be satisfied simultaneously.
The system has no memory, i.e.

[ ]
y (t ) = f u (t ) (3.22)

This type of control network can for example be used to check if a particular
manual control action is allowed or not. During the manual start-up of a complex
process the control computer would check all logical conditions that have to be
satisfied before a certain actuator is switched on or off.
In a sequencing network the output depends on both the present and the earlier
values of process states and inputs. A sequencing system has a memory and the
concept of state is used. In a simple sequencing network the execution proceeds as:
Step 1 ⇒ Step 2 ⇒ … ⇒ Step n
When the transition from one step to the next is determined by logical conditions
the sequence is called asynchronous. In a synchronous sequence instead the state
transition is triggered by a clock pulse. In industrial applications the asynchronous
transition is more common.
Some concepts can be illustrated by a simple example, the coordination of
machines in the manufacturing of discrete parts. Two machines M1 and M 2 are
connected together in a transfer line (Figure 3.22). The buffer B between them can
contain either no parts or one part.

Machine Buffer Machine


M B M
1 2

Figure 3.22: Two machines with an intermediate buffer in a transport line

Each machine can be in one of two discrete states, „operational“ or „out-of-


service“. During a short time interval ∆t there is a probability ( f1 ⋅ ∆t or f 2 ⋅ ∆t ) that
one of the two machines will fail. There is also a probability ( r1 ⋅ ∆t or r2 ⋅ ∆t ) that a
broken machine will be repaired and reenter service during the same amount of time.
80 Chapter 3: System Description and Modeling

The buffer has two discrete states, „full“ or „empty“. An empty buffer becomes full if
the machine M1 produces some parts (with a production rate µ 1 ⋅ ∆t ). A full buffer
can only become empty if M 2 consumes for its operation the stored parts (with a
production rate µ 2 ⋅ ∆t ). Since the states are discrete, it is possible to describe them
with binary digits (0 or 1):

0 - machine broken 1 - machine operational


0 - buffer empty 1 - buffer full

The system is then defined by eight states (Table 3.1)

State Buffer M1 M2
s000 0 0 0
s001 0 0 1
s010 0 1 0
s011 0 1 1
s100 1 0 0
s101 1 0 1
s110 1 1 0
s111 1 1 1
Table 3.1: Definition of the discrete states in the transfer line

The machine M1 can complete its operation only if the buffer is empty; otherwise
it must wait. The machine M 2 can produce only if the buffer contains a part;
otherwise it also has to wait. Thus, the operation of each machine is influenced by
the state of the other. A machine is said to be „blocked“ if it is prevented from
continuation because it lacks some resource (in this example a part or free space in
the buffer).
The operation of the machines can be illustrated by a state graph or an
automaton (Figure 3.23), described by the eight states s 000 ,…, s111.
The system can be in only one state at a time. The transfer rate between the
states is defined by the probabilities that a machine will complete its operation within
a specified time, or that it fails, or that it is repaired. Let us assume for example that
the system is in state s101; in this state M1 is idle and M 2 can produce, since the
buffer is full. The system can leave this state in three ways:
• If M 2 breaks down: go to state s100
• If M1 gets repaired: go to state s111
• If M 2 works regularly: go to state s 001
By modeling the machine system in this way it is possible to simulate the
different state transitions. In fact, with this model can be estimated the probability
that a certain state will be reached. Production rates and repair rates have an effect
on the total result of how well the system as a whole can produce.
3.7: Combinatorial and Sequencing Networks 81

r
2
s 100 s 101
f2

r2
µ2
s 000 s 001
f2
f r1 f r
1 f r f r 1 1
1 1 1 1
r
2
s s
010 011
f2 µ1
µ1 r µ2
2
s 110 s
111
f2

Figure 3.23: State graph for the transfer line with two machines and a buffer

An optimal system does not let the machines be blocked or starved and will
show a small failure rate. State graph modeling of this type is a tool for the
systematic analysis of such systems and is therefore widely used in the design of
industrial applications.
A process where the transition to a different state depends only on the current
state and input signals is called a Markov process. In a sense a Markov process
resembles the differential equations in Section 3.4. There is however a fundamental
difference between time-discrete dynamic systems and sequencing systems. In the
first case, each state variable has a continuously varying amplitude (like e.g.
temperature or pressure values), but is sampled and processed only at discrete time
instances. A sequencing system like the Markov process „jumps“ instead between a
finite number of distinct states.
The state graph can be considered to be an information structure of the
automation process. It does not say anything about the practical implementation. In
Chapter 7 it will be shown how switching elements and PLCs can be used to realize
such systems.
82 Chapter 3: System Description and Modeling

3.8 Summary
Models are descriptions of the physical processes that must be controlled. In this
chapter were considered four classes of mathematical models:
• Continuous dynamic systems described by linear or non-linear differential
equations
• Time-discrete (sampled) dynamic systems represented by linear or non-linear
difference equations
• Discrete event, or sequencing systems, described by finite states
• Systems with uncertainties that are expressed either by statistical or by
linguistic methods
A dynamic system must be represented in time-discrete form to make it suitable
for computer control. This representation can be either in state-space form (internal
representation) or in input/output form (external representation). The choice of the
representation form depends on the controller structure to be designed. Linear
models are very attractive from the point of view of system analysis, but in computer
control there are no restrictions about linearity. Examples of non-linear systems have
also been presented in this Chapter. Software tools for the analysis of linear dynamic
systems are available on the market. The analysis of non-linear systems is however
very complex and can rarely be carried out analytically; simulation software provides
therefore an important support for system analysis.
In this Chapter have been described two important structural properties of
systems, controllability and observability. Controllability indicates whether the input
signals are sufficient to bring the system state anywhere in the state-space.
Observability indicates whether the set of measurement variables is adequate in
order to find all the values of the internal state of the system. If a technical process is
observable it is possible to indirectly measure the state variables that are not
collected with sensors via an estimation function. If the process or the measurements
are corrupted by noise, then the estimation procedure needs also to contain a model
of the disturbances; this model is often based on statistical properties of the
disturbances.
Many industrial processes can also be controlled without a quantitative
mathematical model. The mental models of the operators are often sufficiently
sophisticated for the control even of complex processes. When this type of control
actions are automated in a process computer, the related control schemes must be
formalized in linguistic terms. Fuzzy algebra has shown to be an adequate
methodology to describe mental models with inherent uncertainties.
Sequencing systems and discrete event descriptions are very common in
industrial process control. Some processes can be controlled by relatively simple
combinatorial networks, while others need to be controlled by systems that take in
consideration also previous states of the process. In this Chapter were shown some
ways for the systematic modeling of sequencing systems.

Further Reading
There are many books that deal with the different aspects of modeling dynamic
systems; not too difficult introductions are [Luenberger 1979] and [Ljung / Glad
1994]. The areas of process identification and parameter estimation have been
mentioned briefly in this Chapter, also on these subjects there are several good
textbooks. [Söderström / Stoica 1989] and [Ljung 1987] are recommended
3.8: Summary 83

introductions to the subject, while [Ljung / Söderström 1983] provides a


comprehensive text on recursive estimation.
Robot kinematics and dynamics is an essential part of mechanical systems;
[Craig 1989] gives a short yet excellent introduction on this argument. [Spong /
Vidyasagar 1989] and [Asada / Slotine 1986] present a more comprehensive
treatments of robot control.
Electrical systems are covered in numerous textbooks. [Fitzgerald / Kingsley /
Umans 1990] is a standard text on electrical machines, while [Mohan / Undeland /
Robbins 1995] gives a view from a power electronics perspective. The dynamic
aspects are particularly emphasized by [Leonhard 1985]. [Elgerd 1982] offers a good
introduction into electric power systems.
[Kreutzer 1986] presents an overview over mathematical methods for model
building, in the text are presented different modeling styles and the related computer
simulation methods. [Wolfram 1991] is the famous reference textbook on
Mathematica.
[Buckley 1964] is a classical book on chemical process modeling and control. An
appreciation of this subject may also be gained through [Luyben 1990], in which are
presented several illustrative applications of modeling in chemical process
technology. [Seborg / Edgar / Mellichamp 1989] provides a comprehensive treatment
of chemical process control. Some aspects on the modeling of biological wastewater
treatment plants are found in [Henze et al 1987] and in [Olsson 1985]. [Cannon
1967] discusses in detail heat transfer processes.
There are numerous good books on control theory. [Franklin / Powell / Emami
Naemi 1994] is a recommended, excellent introduction to continuous control
systems. [Kuo 1995] contains large introductory sections on the modeling of physical
systems and the necessary mathematics for their analysis. Time-discrete control
systems, both deterministic and stochastic, are thoroughly covered by [Åström /
Wittenmark 1990] and [Franklin / Powell / Workman 1990]. In both textbooks is
treated in particular detail the influence of the selection of the sampling time on the
stability properties of a system.
A good overview of fuzzy set theory is provided by [Yager / Zadeh 1987] and by
[Klir / Folger 1988]. A modern introduction to the application of fuzzy theory in control
is given by [Driankov / Hellendoorn / Reinfrank 1993]. The relations between neural
networks and fuzzy systems are well documented in [Kosko 1990].
Sequencing systems are described by [Fletcher 1980]. [Desrochers 1990]
treates modeling in the manufacturing industry and introduces Markov chains and
Markov processes as modeling tools.
The early history of control technology (i.e. from the time in which it was not yet
recognized as such) from ancient history until the Watt steam machine is presented
in [Mayr 1970]. Some of the historical notes on Watt and Maxwell are found in [Fuller
1976]; the development of the feedback amplifier is described in [Bode 1960]. Some
of the early work on state-space theory and optimization are reported in [Bellman /
Kalaba 1964].
4 Physical Process Input and Output

Aim: To give a basic understanding of the most important issues related to the
connection of a physical/technical process to a control computer, in particular to
sensor and actuator technology, signal transmission and signal conditioning

Overview
This chapter is dedicated to the interface between the physical/technical process
and the computer input and output. In order to physically connect the computer to
the process many technologies have to be applied. Without necessarily having to
become an expert in all the related fields, it is important that the process computer
engineer is aware of the different problems in signal interfacing.
The chapter begins with an introduction to the components of the process-
computer interface. Measurement and sensor technology is of vital importance for
computer control. Sensors have to accurately represent the physical variables of the
technical process under both steady-state and transient conditions. Instrumentation
technology is a vast topic in itself and a few examples are presented here to give the
flavor of the measurement problems and possibilities (Section 4.1). The general
properties that characterize the operation of sensors are described in Section 4.2.
Measurement devices that deliver only on/off signals, binary sensors, are discussed
in Section 4.3. A brief survey of different analog sensor types is made in Section 4.4.
Because of their importance in process control applications, particular emphasis is
given here to flowmeters.
The transmission of signals between the sensors, the control computer and the
actuators is another wide subject in itself. The signals that are delivered by the
sensors have to be conditioned in order to fit both the measurement device and the
computer input. It is here very important to take precautions against the many
different kinds of electrical disturbances that can influence and distort the original
measurement signal. The disturbance pattern often determines the most suitable
type of signal to carry sensor information, i.e. whether the transmission will be by a
voltage, current or optical signal. The issues related to signal transmission are
discussed in Section 4.5.
The computer output signals must be converted to mechanical movement or
other type of power output in order to control the technical process. This is the
function of actuators. This is again a very wide field, in which a particular position is
covered by electrical drive systems, integrated devices for the conversion of
electrical to mechanical energy. Binary actuators (for so-called on/off control) are
treated in Section 4.6; Section 4.7 gives an introduction to electrical drive systems
technology and finally in Section 4.8 the operation of valves is briefly described.

4.1 The Components of the Process Interface


The general structure of the process computer input/output is shown in Figure
4.1. There are many types of sensors, actuators and input/output conditioning
circuits, but the basic structure is not more complicated than shown.

84
4.1: The Components of the Process Interface 85

human user

physical/
technical process

input signal computer input


sensors conditioning interface

process
computer

output signal computer output


actuators conditioning interface

Chapter 4 Chapter 5

Figure 4.1: The general structure of the process computer input-output

The conceptual simplicity does not mean that practical realization is also simple.
As Murphy would put it, „if everything seems to be going well, you have obviously
overlooked something“.

4.1.1 Sensors
For most physical quantities there is a wide variety of measurement technologies
characterized by the produced signals as a function of the physical variables being
measured. The measuring device or sensor consists of two parts, the sensor head
and the transducer, as illustrated in Figure 4.2. These terms are sometimes
erroneously used interchangeably; in this book will be understood as sensor the
complete measuring unit built out of both sensor head and transducer.

sensor

physical variable output signal


(typically, a sensor head transducer (most often,
continuous quantity) electric)

Figure 4.2: The components of a sensor

The signal being measured is felt as the „response of the sensor head element“
and is converted by the transducer into an electrical quantity that is then transmitted
on a conductor. The output of a measuring device or sensor is therefore actually the
output signal of the transducer. In control system applications, this output is typically
- and preferably - an electrical signal, but also applications with pneumatic sensors
are not uncommon in the process industry. The principal advantage of electrical
86 Chapter 4: Physical Process Input and Output

sensors is the flexibility and multitude of ways in which the signals can be processed.
In addition, electrical signals can be transported over large distances with little
energy. In comparison to electrical sensors, pneumatic sensors are usually quite
cheap, small, simple and insensitive to disturbances. Moreover, for applications in
environments with possible fire or explosion hazards, pneumatic sensors are usually
safer than electric sensors.
Three categories of sensors can be recognized:
• analog sensors that generate continuous analog signals
• digital sensors that produce a pulse train or binary word
• binary sensors that produce digital on/off (0/1) signal levels

4.1.2 Actuators
An actuator is a device that converts electrical energy to a mechanical or
physical quantity in order to influence a technical process. In an industrial robot the
motors of the mechanical joints are the actuators. In a chemical process, the final
control elements may be valves for the control of the reagents flows. It should be
observed that actuators usually influence only indirectly the variables in the physical
process that are measured by sensors. For example, a sensor may measure such
variables as temperature, position or chemical concentration, but actuators control
directly heating, movement and chemical reagents feed flows. It depends on the
dynamics of the physical system how the measured quantities change under the
control of the actuators.
An actuator system can be divided into two elements, the transducer and the
amplifier, as shown in Figure 4.3. The transducer carries out the conversion in a
mechanical or physical quantity, for instance an electric motor converts electrical
power into a rotational movement. The amplifier portion of the actuator system
amplifies the low level control signal from the computer output interface to a level
high enough to affect the transducer. In some cases both the transducer and the
amplifier portion of the actuator system are mounted in a single unit. In this way
some of the final control elements can operate as a self-contained control system;
the computer output is the reference value (setpoint) to the final control element.

actuator device

computer output converter / physical


signal transducer /
(analog or digital) amplifier actuator quantity

Figure 4.3: The components of an actuator

The requirements for the actuators - such as operating power, motion resolution,
repeatability and operating bandwidth - can differ significantly, depending on the
particular application. Similarly as for sensors, the proper selection of actuators is of
crucial importance for the control of a process.
Compressed air is often used to position valves as final control elements. When
large forces are needed, hydraulic actuators can be used. The electrical signals from
4.1: The Components of the Process Interface 87

the computer control then the production of compressed air or oil pressure by
appropriate conversion equipment. The physical control variable can also be an
on/off value produced by electromechanical relays or electronic switches.

4.1.3 Bandwidth and Noise


Two basic factors, bandwidth and noise, determine how a computer should be
interfaced to a physical process.
The bandwidth is an important parameter in a variety of contexts, like signal
transmission, computer bus systems and feedback control, yet it has quite different
meanings. In signal transmission and feedback control the bandwidth indicates the
range of frequencies that can be amplified above a certain threshold (usually, 1 over
the square root of 2, i.e., 0.707 of the initial value). In computer bus technology
bandwidth is synonymous with data carrying capacity (see also Section 8.2.1). In the
processing of monitoring and control signals the bandwidth is defined as the useful
frequency range of a sensor or an actuator. Only those physical variables with a
significant frequency content within the bandwidth spectrum can be properly
detected and appear at the output of the sensor or the actuator. This means that the
sensor is sufficiently fast to faithfully follow the changes in the original physical
quantity, yet without corrupting the signal because of improper dynamics. Likewise,
an actuator must have an adequate bandwidth in order to produce the desired
control signal. The larger the bandwidth, the faster will be the sensor or actuator
response. This is not always a positive factor, because the larger the bandwidth, the
more susceptible the device will be to unwanted high frequency disturbances.
Any measurement signal will be corrupted by disturbances and noise during
detection and transmission. A significant part of the problem in signal transmission is
how to reduce the influence of noise. The noise sources have to be eliminated or
minimized. Noise that corrupts the information content in signals or messages is a
problem not only in process interfaces but appears in all kinds of communication
(Chapter 9). The modeling and description of noise was discussed in Section 3.6.1.
Controllers can be designed to deal with disturbances and noise in a systematic way;
in Chapter 6 it will be described how control loops can reduce their effect.

4.1.4 Measurement Signal Transmission


Analog signals generated by the measuring device must often be processed in
some way before being sampled by the computer. A voltage signal has to be
amplified in order to match the sensor voltage range to that of the computer
interface. Moreover, the voltage level may have to be moved to align the minimum
sensor output voltage with the minimum voltage for the computer input interface.
This procedure is called signal conditioning. It will be treated in this and the
following chapters.
The transmission of analog signals presents special problems because of
electrical disturbances. The sensor cabling may pick up noise from the external
environment, because of undesired electrical couplings of resistive, inductive and
capacitive nature. This electrical noise would then corrupt the original measurement
signal. A possible solution to this problem is the conversion of the measured signal in
a pulse train with rate or duration in known relation to the original signal level, and
then transmission of the converted measurement signal. This is particularly useful
when external noise is influencing the same frequency band as the original signal.
Pulse trains can be transmitted either on electrical or optical fiber conductors.
88 Chapter 4: Physical Process Input and Output

4.2 Sensor Properties


A sensor should reproduce a physical quantity as fast and as accurately as
possible. Very often sensors are selected on the basis of their reliability and
maintenance requirements, but also accuracy, operating stability and measurement
reproducibility represent important factors. The process computer can only operate
on the basis of its input data, so that precise and reliable measurements are
essential to guarantee the quality of the output from the technical process.
Most of the sensor characteristics provided by manufacturers in datasheets are
in the form of static parameters. Such parameters do not describe how fast and
accurately the sensor can measure a rapidly varying signal. The properties that
describe the sensor operation for varying input signals are called dynamic
characteristics and are essential for control applications. A sensor should ideally
react immediately to a change in the measured physical variable and give a new
value at its output. In practice, all sensors need some time to adjust and indicate a
new state. Obviously the response time of a sensor has to be sufficiently small in
order to adequately represent the true variations of the observed quantity. This
concept is not different from the real-time requirements of a process computer: the
time scale of the physical process defines the requirements on the capacity of the
computer. Often, however, a compromise must be made between sensor speed and
its sensitivity to noise.

4.2.1 Accuracy and Precision


Accuracy - or rather inaccuracy - indicates the difference between the
measured and the real value, and can be related to a sensor in general or to a
particular reading. The resolution is the smallest change in measurement value that
can be indicated and reported by a sensor. The resolution is often better than the
accuracy indicated in technical datasheets. Sensor accuracy depends not only on
the physical sensor hardware but also on the measurement environment. The
measurement error is defined as the difference between the measured value and
the true value. Because the true value is not known, in a given situation we can only
make estimates for accuracy by providing further analysis or precision
measurements.
Errors can be classified and modeled as deterministic (or systematic) and
random (or stochastic). Deterministic errors may be caused by malfunctions of the
sensor, if the sensor is not used correctly or by the measurement procedure itself;
these errors are repeated at every measurement. A typical systematic error is
reading offset or bias. In principle systematic errors can be corrected by calibration.
The case is different with random errors, that can have several causes. In many
cases ambient factors such as temperature, humidity or electrical noise contribute to
random measurement errors. When the causes for random errors are known, they
may be compensated for. Often the disturbance influence can be quantified by
parameters like the mean error, the mean quadratic error or standard deviation
and the variance.
The difference between systematic and random uncertainty is illustrated by
Figure 4.4. The center of each target represents the true measurement value and
each dot is a measurement. The measurements are primarily characterized by their
bias and variance. Both bias and variance must be small in order to have good
accuracy.
4.2: Sensor Properties 89

value

(a) time

value

(b) time

value

(c) time

value

(d) time

Figure 4.4: Illustration of bias, precision, and accuracy


The centre of each target represents the true measurement value and each shot is
a measurement. In the diagrams the right (constant) value is represented by the
straight lines, on which the measurements have been superimposed.
Measurement accuracy depends on the bias as well as on the variance.

(a) High bias + low precision (high variance) = low accuracy


(b) Low bias + low precision (high variance) = low accuracy
(c) High bias + high precision (low variance) = low accuracy
(d) Low bias + high precision (low variance) = high accuracy

The figures 4.4(a) and (c) represent biased measurements. The standard
deviation or variance between individual measurements is a measure of precision. A
90 Chapter 4: Physical Process Input and Output

sensor with good reproducibility (or small random errors) has good precision but
does not necessarily deliver the right output value, since bias may distort the result,
i.e. its accuracy is poor. The measurements in Figures 4.4 (c) and (d) are precise,
but only the measurements of Figure 4.4 (d) are also accurate.

4.2.2 Dynamic Sensor Characteristics


There are several parameters to characterize sensor dynamics, but it is
uncommon to find full information in this respect from the vendors’ datasheets. The
dynamic response of a sensor can be tested by a step response where the sensor
output is recorded for a stepwise change of the physical variable to be measured
(Figure 4.5). The parameters to describe the sensor response give indications of its
speed (e.g. rise time, delay time, peak time), of its damping characteristics (e.g.
overshoot, settling time) and of its accuracy (offset).

Mp
1.4

1.2

0.8

0.6
0.5
0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
T0 Td Tp Ts Time

Figure 4.5: The dynamic sensor response (step response)


( T0 ≡ dead time, Td ≡ delay time, Tp ≡ peak time, Ts ≡ settling time,
M p ≡ peak value)

In principle all the following parameters should be as small as possible:


• Dead time: the time between the first change of the physical value and the first
reaction of the sensor, i.e. the first change in the output signal.
• Delay time: the time it takes to reach 50% of the steady-state value for the first
time. Other definitions of the delay time are also found in the literature.
• Rise time: the time it takes to pass from 10% to 90% of the steady state
response. An alternative definition of the rise time is the reciprocal of the slope
of the step response at 50% of the steady-state value, multiplied by the steady-
state value. Other definitions can also be used. A small rise time always
indicates a fast response.
• Peak time: the time to reach the first peak or overshoot.
4.2: Sensor Properties 91

• Settling time: the time it takes for the sensor step response to settle down
within a certain percentage (e.g. ±5%) of the steady-state value.
• Percentage overshoot: the difference between the peak value and the steady-
state value, indicated as percentage of the steady-state value.
• Steady-state error: the deviation of the actual steady-state value from the
desired value or the offset. It can be corrected by calibration.
In a real situation some of the requirements are always in conflict to others, so
that all the parameters cannot be minimized simultaneously.

4.2.3 Static Sensor Characteristics


The static characteristics of a sensor indicate how correctly the sensor signal
represents the measurand some time after a change has occurred, when the output
signal has adjusted to the new value. Some important static parameters are
sensitivity, resolution, linearity, zero drift and full scale drift, measuring range,
repeatability and reproducibility.
• The sensitivity of a sensor is defined as the magnitude of the output signal
corresponding to a unit input of the measured variable (in the case of
sophisticated instruments, more elaborate definitions of sensitivity can be
found).
• The resolution is the smallest change of the input signal that can be detected
and accurately indicated by a sensor.
• Linearity is not defined analytically, but is determined by a calibration curve.
The static calibration curve shows the output signal amplitude versus the input
variable under static conditions. Its proximity to a straight line determines the
degree of linearity. The maximum deviation from the straight line is given as
percent value.
• The static gain or d.c. gain is the sensor gain at very low frequencies. A high
value of the static gain indicates a high sensitivity of the measuring device.
• The drift is defined as the deviation from the zero reading of the sensor when
the measured variable is kept constant under a long period. The drift can be
tested at zero input signal, at the maximum or also at some intermediate value.
At a zero drift test the measured value is kept at zero or a value that
corresponds to zero reading, while at a full scale drift the measured variable is
kept at its full scale value. The drift of a sensor may be caused by instability in
the amplifier, ambient changes (e.g. changes in temperature, pressure,
humidity and vibration), changes in the power supply or changes of some
parameter in the sensor itself (e.g. because of aging, wear-out, non-linearities,
etc.).
• The operating range of a sensor is determined by the allowed lower and upper
limits of its input variable or output signal level so as to maintain the required
level of measurement accuracy.
• The repeatability is characterized as the deviation between several
measurements conducted in sequence, when the tested variable is the same
and approaches its value from the same direction every time. The
measurements must be made under such a short period that long term drift is
not noticeable. The repeatability is often given as a percentage of the sensor
range.
92 Chapter 4: Physical Process Input and Output

• The reproducibility is similar to repeatability but requires a long time lapse


between the measurements. The sensor has to be in operation between the
measurements and may even be calibrated again. Reproducibility is given as a
percentage of the sensor range per unit of time (e.g. per month).

4.2.4 Non-linearities
Many sensors have a non-linear behavior. For example, when the sensors reach
their upper range limit they show saturation effects, so that their output signal is
limited even if the input value increases. Examples of non-linearities include:
• Non-linear deformation in mechanical springs
• Coulomb friction
• Magnetic saturation in transformer parts
• Flow rate measurements (e.g. in open channel measurements there is a non-
linear relation between the measured level h and the flow rate F such as
F = (constant ) ⋅ h a
• A thermistor shows a non-linear resistance change as a function of temperature
R = R 0 ⋅ e β ( 1/ T − 1/ T0 ) , where T is the temperature in Kelvin and R 0 , T0 and β
are constants.
Particular problems appear for backlash in gears and other loose components,
and for hysteresis in magnetic circuits. The output signal of sensors that operate on
these principles is a multivalued function of the input and depends on the direction of
change of the physical value to be measured.

4.2.5 Impedance Characteristics


When two or more components are interconnected, the behavior of the
individual components in the system can deviate significantly from their behavior
when they operate independently. For example, a heavy accelerometer can
introduce an additional load that will modify the actual acceleration being measured
and thus deliver a different value. Similarly a voltmeter can modify the currents and
voltages in a circuit, and a thermocouple junction can modify the temperature under
measurement. This is called loading effect. Loading errors can exceed other types of
measurement errors and must be avoided when different sensors and signal
transmission devices are connected.
The term impedance has fundamental importance in electrical systems. In
electrical systems, a device with high input impedance draws less current for a given
voltage and its power consumption is consequently low. A device with low input
impedance draws a higher current for a given voltage. As it extracts more power from
the preceding device, it can cause loading errors. A device with a high output
impedance generates a voltage signal severely susceptible to loading. A low output
impedance helps keep the output voltage signal more unaffected by the current
drained by the load. The opposite holds for current signals, a high output impedance
makes the output current signal less affected by the load. For these reasons in many
cases are required electronic conditioning circuits to step up the signal level and for
impedance matching. In the case of voltage signals, an amplifier with high input
impedance and low output impedance is used to condition and adjust the signal
between the different processing steps. This procedure is called impedance
matching and has to be done properly at each stage.
4.2: Sensor Properties 93

Consider a standard electrical quadripole with its two ports. The output
impedance Zo is defined as the ratio of the open-circuit (no-load) voltage at the
output port, i.e. with no current flowing at the output port, to the short-circuit current
at the output port. The input impedance Z i is defined as the ratio of the rated input
voltage to the corresponding current through the input terminals while the output
terminals are kept open (Figure 4.6).
G

+ Zo
v Zi v o= G · v i
i
-

Figure 4.6: Schematic representation of the input and output impedances in a quadripole.
G is the gain and v o the open-circuit voltage.

When a load is connected to the output port, the voltage across the load will be
different from v o due to the presence of a current through the output impedance. If
the quadripole is isolated, it is then possible to relate the input and output voltages
under open circuit conditions by a gain G :
vo = G ⋅vi
where v i is the input voltage.

4.2.6 Selection of the Proper Input/Output Impedances


Consider two electrical quadripoles connected in cascade (Figure 4.7). By
defining the gains G1 and G 2 respectively between the input and output voltages it is
straightforward to verify the following relations
v o1 = G1 ⋅ v i

Zi 2
vi2 = ⋅ v o1
Z o1 + Z i 2

v o2 = G2 ⋅ v i 2
The combination of the gains gives the overall gain:
Zi 2
v o 2 = G1G 2 ⋅ ⋅vi
Zo1 + Z i 2
This expression can become close to the gain G1G 2 if the output impedance of
the first quadripole is much smaller than the input impedance of the second
quadripole. In other words, the frequency characteristics of the device with the two
amplifiers in cascade will not be significantly distorted if the proper impedance
matching is done, i.e. the output impedance of the first device is much smaller than
the input impedance of the second.
94 Chapter 4: Physical Process Input and Output

In order to obtain a proper impedance matching in a sensor-transducer system


and toward the following circuitry, one or more amplifier(s) may have to be
introduced between the sensor output and the data acquisition unit input. Such
impedance matching circuits are usually based on operational amplifiers (see
Section 4.5).

G1 G2

+ Z o1 + Zo2
vi Z i1 v o1 vi2 Zo2 v o2
− −

Figure 4.7: Impedance matching of quadripoles in cascade

4.3 Binary and Digital Sensors


In sequencing control applications (see Chapter 7) the signals from the technical
process are principally of on/off type and are delivered by binary sensors. In a typical
process or manufacturing industry there are literally thousands of on/off conditions
that must be monitored. Binary sensors are used to detect the position of mechanical
parts, count discrete components in material flows, detect alarm limits of levels and
pressures, or indicate when manipulators have reached their end positions.
Binary and digital sensors can be very simple and consist only of a switch, but
they can also be very complicated. Some digital sensors are actually fully operative
microcomputers built in self-contained units and deliver either on/off limit signals or
coded digital measurements. In the following some types of sensors that deliver
binary output signals are presented, e.g. to indicate positions, alarm conditions and
levels.

4.3.1 Position Sensors


Switches have been used for decades to indicate positions. They consist of
electrical contacts that are mechanically actuated and where a contact opens or
closes when some variable (position, level) has reached a certain value. There are a
large number of different types of limit switches. Limit switches represent an
important part of many control systems, the reliability of which depends to a great
extent on these switches. They are located „where the action is“ and are often
subject to high mechanical stresses or large currents.
A normally open, make-contact switch, a normally closed, break-contact
switch and a change-over switch are shown in their normal and actuated positions
in Figure 4.8. In a circuit diagram it is common practice to draw each switch contact
the way it appears at rest, i.e. in the non-activated position.
4.3: Binary and Digital Sensors 95

Normally open Normally closed Change-over


contact, make contact, break contact
contact contact

Normal position
(non actuated)

Actuated position

Figure 4.8: Different symbols for switches

The simplest type of switch is the mechanical, single-pole single-throw


normally open contact (SPST) that is shown in Figure 4.9.a. A simple signal
conditioning can be realized with help of a „pull-up“ resistor. When the switch is
open, the resistor „pulls“ the output to +5V, which is interpreted as one logical state
by a TTL (Transistor-Transistor Logic) gate at the computer input. If the contact is
closed, the output is brought to ground potential, which is interpreted as the other
logic state.
+5 V

output
voltage vo switch
closing

vo
single-pole, 5V
single-throw
(SPST) switch

< 5 ms time
(a) (b)
bouncing

Figure 4.9: Bouncing effect on switch closing

The closure of a mechanical switch usually causes problems since the switch
bounces for a few milliseconds before closing altogether (Figure 4.9.b). When it is
important to detect only the first closure, such as in a limit switch, the subsequent
opening and closing bounces need not be monitored. The use of a circuit introducing
a brief delay in the output signal is one means of overcoming the effects of switch
bouncing.
A change over switch, also called single-pole double-throw (SPDT) can be
either of the type „break-before-make“ (BBM) or „make-before-break“ (MBB) (Figure
4.10). In the first case (BBM-type switch) both contacts are open for a short moment
during the switching operation. In a MBB-type switch a current flows briefly in both
contacts during a switch operation.
96 Chapter 4: Physical Process Input and Output

normally closed

normally open

normally open
normally closed
actuation
(a) (b) actuation

Figure 4.10: Change over switches, (a) break-before-make contact (BBM), (b) make-before-
break contact, bridging (MBB)

Contact debouncing in a switch-over SPDT contact can be realized in hardware.


The moving contact has to be grounded; when it touches either output, that output is
pulled low. The cascaded electronic circuit must be designed to latch the logic state
corresponding to the first contact closure and ignore the subsequent bounces.
There are several other methods to indicate positions by binary sensors. A few
principles are mentioned in the following.
• Mercury switches consist of small hermetically sealed glass tubes with two
contact terminals. The tube contains enough mercury to bridge the contacts.
The switch is opened or closed by tilting the tube.
• Reed switches consist of two leaf springs (the „reeds“) sealed in a small glass
tube. The two free ends overlap at a very short distance, but still do not touch
each other. When a magnet approaches the tube, the reeds assume opposite
magnetic polarity and attract each other until contact is established.
• Photoelectric sensors are built with materials that change their resistance or
generate a potential difference under the influence of light. In many applications
is it sufficient to indicate on a binary output whether light is present or not. A
photoelectric beam detector consists of a light beam source and a light-sensing
detector. Light beam detectors are available in many designs, the major
difference in design is whether the object to be detected interrupts or reflects
the light beam. The advantages of light beam detectors are simplicity, flexibility,
a low price and most of all the fact that sensing can be made without direct
physical contact. With photoelectric beam detectors it is possible to build with
little effort angular velocity meters, counters, position sensors etc.
• Ultrasonic and microwave sensors are used to sense objects in a range varying
from a few centimeters to several meters. These sensors operate either in
reflective mode (emitter and detector are built in the same unit) or as a through-
beam (the emitter and the detector are built in separate units).

4.3.2 Limit Sensors


Many types of sensors are used to indicate when a continuous variable (e.g.
level, pressure, temperature or flowrate) reaches a certain limit. For this reason they
are often called „point“ or „limit“ sensors. Limit sensors are often used as alarm
signal to give indication or even interrupt a process whenever some variable reaches
a limit value, which may be indication for a dangerous situation. For this reason limit
sensors have to be robust and reliable.
4.3: Binary and Digital Sensors 97

4.3.3 Level Switches


A level switch gives an indication whenever the level of a medium in a tank
reaches a certain height. Its operating principle depends on the medium (liquid,
slurry, granule or powder solids). A level indicator can be built in such way to indicate
either the current level, or to generate a binary signal when the level reaches a
preset limit.
A float can lie on the surface of a liquid and operate a limit switch when a certain
level is reached. Reed relays are ideal switches when the medium is a liquid, since
they are waterproof. The float has to contain a magnet to actuate the reed relay
safely. Photoelectric sensors are commonplace for the same purpose. Capacity
proximity sensors are particularly suitable for solid materials, as floats cannot be
used. As the material level rises, it displaces the air between the capacitance probe
and the vessel wall, thereby changing the dielectric value of the capacitor built by the
probe and the vessel. The capacitance can then be measured with standard electric
methods. A level can also be measured with a pressure sensor placed at the bottom
of the vessel, as the bottom pressure is proportional to the height of the material.
Also in this case the indication can be continuous or binary, when a limit value is
reached.

4.3.4 Digital Sensors, Fieldbus Sensors


Digital sensors generate discrete output signals such as pulse trains or other
type of digitally encoded data that can be directly read by a processor. Depending on
the actual type of sensor, the output can be directly available in digital form (e.g. from
a shaft encoder) or has to be processed by electronic logic circuitry that is often built
in the sensor probe itself. The sensor head of a digital measuring device is similar to
that of their analog counterparts. There are self-contained digital sensors that
incorporate microprocessors to perform numerical manipulations and conditioning
and that provide output signals in either digital or analog form.
When the output of a digital sensor is a pulse sequence, a counter can be used
to add up the pulses. Alternatively it can measure the time between two impulses.
The resulting figure is then represented as a digital word and can be directly read
and processed by a computer. In energy metering it is common to deliver readings
via pulses, each pulse representing a certain amount of energy.
A new trend is represented by the Fieldbus sensors; these sensors operate in
connection with particular types of digital networks that support two-way
communication, the Fieldbuses. Fieldbus sensors are normal sensors for
temperature, pressure, flow rate, etc. that in addition contain a microprocessor in
order to process the input data, transform it into digital form (e.g. 12-bit
representation) and handle the external communication. Fieldbus sensor messages
are transmitted on digital communication networks according to defined protocols.
These messages do not only deliver sensor readings, but for example can also
contain data for sensor identification. Fieldbus sensors can also receive messages
from the communication channel and recognize when they are polled. In some cases
the sensors can even be remotely tested and calibrated. More information about the
Fieldbuses and their operation is contained in Section 9.7.
98 Chapter 4: Physical Process Input and Output

Example 4.1 Shaft encoders


Shaft encoders are digital sensors used for measuring angular position and
velocity. They are used in all applications where rotation values must be known
with precision, like e.g. in machine tools, robotic applications, servo systems and
electric drive systems. Shaft encoders can be of incremental or absolute type.
An incremental encoder consists of a light beam detector or a magnetic
sensor, e.g. a reed relay, that generates a pulse train when an object is in rotation;
a 360° rotation can correspond to one or more pulses. The impulses are then
processed and converted in an angular position or an angular speed value.
An absolute encoder delivers binary-coded data to represent an angular
position. An optical encoder consists of a disc with engraved transparent and
opaque bit patterns, each engraving is unique and corresponds to a determined
angular position. A light source illuminates one side of the disc, while on the other
side a bank of sensors detects the light pattern so that the digital value gives
directly the angular position. Coding is usually done with a modified binary system
to minimize the effect of errors if the photoelectric sensor block is not exactly
aligned with the engravings on the disc. This technology is simple, yet it allows an
high resolution (number of engraved angular values per degree or revolution), high
accuracy and good protection against transmission disturbances, as the signals
are already in digital form and do not have to be first transmitted in analogue mode
and then converted to digital.

4.4 Analog Sensors


The sensor-transducer unit shown in Figure 4.2 delivers a signal to a processing
device, e.g. the input port of a computer. Because the characteristics of the sensor
output signal and those of the cascaded device very often differ from each other,
some conditioning circuit must be employed to interface the signal. The term
„conditioning circuitry“ is actually very general and can denote any electronic
component(s) between the sensor head and the cascaded device. The dividing line
between the sensor transducer electronics and the following signal conditioning
circuitry cannot be drawn too precisely and is sometimes open to individual
interpretation.
Most sensor-transducer devices used in process control applications generate
analog signals. Common classes of physical quantities that are measured in
computer controlled systems are the following:
• Electrical and magnetic quantities
• Motion
• Force, torque and pressure
• Temperature
• Level
• Flow rate
• Density, viscosity and consistency
• Concentration (gas, liquid, dissolved and suspended materials)
• Chemical or biochemical activity
4.4: Analog Sensors 99

Here will be presented a brief overview of analog sensor devices commonly


used in control systems. Electrical measurements - including current, voltage,
resistance, magnetic field, radiation and power - are the cornerstones of
measurement technology. For most types of measurement there are available on the
market sensor heads, sensor units that include the conditioning circuitry and even
fully integrated devices with in-built analog-digital converters (see Section 5.3.2) and
data communication logic.

4.4.1 Motion Sensors


By „motion“ are meant the four kinematic variables
• Displacement (including position, distance, proximity, size)
• Velocity (including angular velocity)
• Acceleration
• Shock or impact
Each one of these quantities is the time derivative of the preceding one. In
theory, it should be possible to measure only one of them, and then obtain the others
by differentiation or integration. In practice, however, many factors make this
approach highly unsuitable due to the nature of the signal (steady, transient, etc.),
the frequency content, noise corrupting the signal, and the available data processing
capacity.
Motion measurements are extremely common in many applications that involve
mechanical equipment such as servo systems, robots, electrical drive systems or
other manipulators. Displacement measurements are used for the positioning control
of valves. Plate thickness is continuously monitored by gauge control systems in
steel rolling mills. Strain gauges are devices that measure strains, stresses and
forces, but can be adapted to measure displacements. Accelerometers are very
common in the on-line control of machinery and in machine protection systems to
detect faults and monitor the equipment condition.
Motion sensors include the following types of devices:
• Potentiometers for the measurement of displacement; they operate as variable
resistors.
• Inductance sensors operate on the principle of electromagnetic induction, they
are e.g. differential transformers, resolvers and synchro-transformers.
• Capacitive sensors are used to measure small displacements, rotations and
fluid levels.
• Piezoelectric sensors operate on the piezoelectric effect principle. Piezoelectric
materials deform when they are subjected to a potential difference; they also
generate a potential difference when they are subjected to mechanical stress.
Piezoelectric sensors are constructed to measure pressure and strain as well
as acceleration, velocity, force and torque.
• Laser sensors can provide very accurate measurements of small
displacements.
• Ultrasonic sensors are used in many applications to measure distances,
including medical systems, ranging systems for autofocussing capability in
cameras, level and speed sensing.
100 Chapter 4: Physical Process Input and Output

Example 4.2 The resolver


Resolvers are used in those applications where very accurate measures of
angular displacement and velocity are required, like e.g. in servo and robot
systems. The output signal of a resolver is a measure of angular displacement; by
differentiating this signal the angular velocity is obtained. The resolver works on
the principle of mutual induction between coils (Figure 4.11). The rotor of the
resolver is connected with the rotating object and contains a primary coil that is fed
with an alternating voltage v ref . The stator consists of two windings separated by
90°, and the voltages induced in these windings are:
v o1 = K ⋅ v ref ⋅ sin θ

v o 2 = K ⋅ v ref ⋅ cos θ
respectively, where θ is the angular position of the rotor.

stator coils a.c. supply vref

rotor coil

stator coils

vo1

vo2
Figure 4.11: Operating principle of the resolver

It can be said that v ref is modulated by the angle value θ to produce the
output signals v o1 and v o2 . By using only one output signal, only angles between
0° and 90° can be measured unambiguously. By using both signals it is possible to
measure between 0° and 360° without ambiguity.
The resolver output is a trigonometric function of the angle. This non-linearity
is however not always a drawback. For example, in torque control in robots are
required trigonometric functions of angular values. The output signal of a resolver
can be used directly for control, without need for real-time trigonometric
conversions that would place a load on the control computer.
A resolver has usually good resolution and high accuracy. Its output signal
level is high and the output impedance low. The bandwidth of a resolver depends
on the frequency of the supply voltage source. Only the brushes connected to the
rotor may cause some problems, such as wear-out, noise and mechanical load.
Resolvers are available in solid, self-contained units.
4.4: Analog Sensors 101

The measurement of linear and angular velocity is of fundamental importance in


drive systems and robot technology. An interesting application of acceleration and
force measurement is the active suspension control in transport vehicles.

Example 4.3 The tachometer


The tachometer is a permanent magnet d.c. generator used for angular
velocity measurement. The operating principle of the d.c. tachometer is illustrated
in Figure 4.12.
The permanent magnet generates a steady and uniform magnetic field. The
relative motion of an electrical conductor in the field induces a voltage proportional
to the rotating speed of the conductor. The rotor is connected directly to the
rotating object of which the angular velocity has to be measured. The output
voltage is generated by the motion itself and is picked up via the commutator
device, that usually is made of a pair of low-resistance carbon brushes. The
tachometer usually represents a very little load for the larger machine on which it is
installed. Looking at the tachometer dynamics, its bandwidth is commonly much
higher that that of the mechanical engine and of its normal load. Therefore the
inductance and other electrical parameters of the tachometer normally have
negligible effect on the measurement.
commutator

N S

vo
Figure 4.12: Operating principle of the d.c. tachometer

4.4.2 Force, Torque, and Pressure Sensors


Many types of force/torque sensors are based on strain gauge measurements.
The change of electrical resistance in a material that is mechanically deformed under
the action of an external stress is the operating principle of such sensors
(piezoresistive effect). The relative change in resistance as function of the force
acting on the sensor depends on the used material, it is one to two orders of
magnitude larger for a semiconductor sensor than for a metallic sensor. The strain
sensor element in a semiconductor sensor is made of a single crystal of
piezoresistive material. An additional advantage in the use of semiconductor strain
gauges is that their resistivity is also higher than for metals, so that their power
consumption and heat generation is lower.
102 Chapter 4: Physical Process Input and Output

Torque and force sensing is useful in many applications, including control of fine
motions (such as manipulation and gripping in robotics) and the measurement of
transmitted mechanical power in motors and drive systems. Torque can be
measured as strain or also as actual deflection. From the twist angle of an axis
measured by an angular displacement sensor, a torque can be determined. In
Example 3.5 we have seen that the torque of a d.c. motor is proportional to the rotor
current, so the current allows an indirect measurement of torque.
Pressure can be measured by mechanical deformation, for example, by bending
a tube, or the deformation of a membrane. The membrane is connected to a quartz
crystal, to the electrode of a capacitor or to a differential transformer (Figure 4.13).
Due to the piezoelectric effect, a quartz crystal under pressure generates a potential
difference. The capacity change in the capacitor connected to the membrane can be
measured with electrical methods. The electric signal output is in both cases in
relation to the amount of stress and sensor head deformation.

v out
differential
transformer primary coil
differential
moving transformer
ferromagnetic core
v out
secundary coils

vin pressure
membrane

pressure movement

Figure 4.13: Some principles for pressure measurement

The differential transformer is a sensor used to indicate position changes. It


basically consists of a ferromagnetic core moving inside two coils of a transformer.
One coil is fed with an alternating current, the other coil delivers the output signal.
The coils are connected in such a way that when the ferromagnetic core is in the
central reference position, the transformer output voltage is zero. Every displacement
of the coil brings a change in the output voltage in relation to the amount of
displacement.
The measurement of a pressure value can be used also to determine other
quantities. For example, the pressure at the bottom of a vessel filled with liquid can
be used to determine the height of the liquid.
4.4: Analog Sensors 103

4.4.3 Proximity Sensors


The change in the electric properties of the components in oscillating circuits in
proximity of external objects can be used in the construction of proximity sensors.
These sensors can be built to deliver analog signals proportional, at least within a
certain range, to the distance of the detected object or also digital signals on
reaching a preset threshold. Electric proximity sensors function on the following
principles:
• Inductive proximity sensors operate by generating a high frequency
electromagnetic field with a coil that is part of an oscillating circuit. The
electromagnetic field induces eddy currents in a target object that must be built
of conducting metal. When the target object is in proximity of the sensor,
typically between 2 and 30 mm, the oscillations are damped. The change in the
current drawn by the oscillator can be used to actuate a solid-state switch.
• Capacitive proximity sensors contain a damped RC oscillator. The capacitance
depends on the distance between the plates of the capacitor, the area of the
plates and the dielectric material. The sensor is connected with one of the
plates or with the dielectric. When the target nears the sensor, the resulting
change in capacitance and thus in the frequency generated by the oscillator is
detected electrically and leads to the activation of a switch. A capacitive sensor
can detect objects that need not be conducting. The distance range of such
sensors lies typically between 5 and 40 mm. Capacitive sensors can also be
used for the measurement of force and pressure values.
• Magnetic proximity sensors detect objects close to the sensor by the change of
magnetic field properties and without any moving parts. The operating principle
can be based on inductivity, reluctance (i.e. magnetic „resistance“), the
magnetoresistive effect or the Hall effect. The magnetoresistive effect and the
Hall effect depend on the same physical principle, the resistance of a
conductive material can be influenced by an external magnetic field. If a
conductor carrying an electric current is under the effect of a magnetic field, its
resistance increases (magnetoresistive effect). In addition, on the sides of this
conductor is generated a potential difference that can be detected (Hall effect).
The conductor must be positioned so that the magnetic field is perpendicular to
the direction of the current flow; the potential difference develops along an axis
perpendicular to both magnetic field and current direction. The conductor can
be built geometrically in such a way to maximize either the magnetoresistive
effect or the Hall effect. Hall sensors are often built with semiconducting
materials.

4.4.4 Temperature Sensors


The temperature sensitivity of many materials is not necessarily always a
nuisance; it can also be used for temperature measurements. Temperature sensors
are built of such materials and have the appropriate shape in order to enhance the
temperature dependence of some electrical property. This dependence is often a
non-linear function of the temperature, that in addition is often also difficult to
reproduce. Three types of temperature sensors are commonly used:
• thermoelements
• resistance temperature detectors (RTDs)
• thermistors
104 Chapter 4: Physical Process Input and Output

Example 4.4 Thermoelements


The first thermoelement was constructed in 1887 by the Frenchman le
Chatelier. In the thermoelement two contact points A and B are connected via two
parallel wires made of different metals (for example, aluminum and copper). In this
way a closed circuit is formed (Figure 4.14).
As long as the temperatures in A and B are the same no current flows in the
circuit. If point A however has a different temperature than B, then an electric
current is generated and flows in the circuit. This effect is called thermoelectric or
Seebeck effect, from the name of its discoverer in 1821. This so-called „thermo-
electromotoric force“ increases as function of the temperature difference. The
generated voltage is in the range of a few millivolts, which makes necessary the
use of additional very sensitive - and thus comparatively expensive - electronic
measurement circuitry. Because of the very low signal levels, cabling and signal
transmission must be treated with great care. It must also be considered that a
thermoelement measures a temperature difference and not an absolute value, so
that the temperature at one of the junctions must be known with high precision.
Different metal combinations are used for different temperature ranges.
Thermoelements are robust, inexpensive, have a small heat capacity and operate
in a wide temperature range.
The International Electrotechnical Commission has defined some standard
types of thermoelements (standard IEC 584-1). The elements are called R, S, B,
K, J, E, T according to the different temperature ranges.

A A
T1 T1

Al Cu

Al Fe

B C
T2 T2
T2 Cu V Cu
B
Figure 4.14: Operating principle of the thermoelement
If the temperatures at the points A and B are different, a current circulates in
the closed circuit. The right drawing shows a practical circuit for the
measurement of this current. Point A is the „hot“ junction and B, C represent
the cold junction. B and C must be at the same temperature.

The resistance of metals has a positive temperature coefficient, i.e. the


resistance of an electrical conductor becomes higher with increasing temperature.
This feature is used in resistance temperature detectors.
4.4: Analog Sensors 105

Example 4.5 Resistance temperature detectors


Resistance temperature detectors (RTD) are often made of platinum wire.
The resistance R is an almost linear function of temperature T (°C) from a
reference temperature T0 = 0° . The ratio of the resistance R at temperature T to
the resistance R 0 at the reference temperature T0 can be expressed as

R / R 0 = 1 + aT + bT 2 +2
where a is the resistance temperature coefficient and b a positive or negative
constant (Figure 4.15, (a)). For platinum, typical parameter values are a = 0 .004
per °C and b = 0 .59 ⋅ 10 −6 per ° C −2 .

R/R
0
3
(b) thermistor
(a) RTD
2

0
0 20 40 60 80 100
temperature (°C)

Figure 4.15: Temperature dependence of the resistance in (a) a resistance temperature


detector (RTD); (b) a thermistor

RTDs are available for a number of standardized resistances. The most used
type of RTD has a resistance of 100 Ω at the reference temperature (0°C or 273 K)
and is so common that is has got its own name, Pt-100.
The sensitivity is very small for the RTD sensor, and any current i used to
detect the change in resistance will also heat up the sensor itself, thus changing
the measurement by an amount proportional to i 2 . The resistance output is often
measured in a bridge configuration.

Example 4.6 The thermistor


A thermistor, or „thermally sensitive resistor“ is made of semiconductor
material having negative temperature coefficient and high sensitivity. Its resistance
depends on temperature in a non-linear fashion
R = R 0 ⋅ e β ( 1/ T − 1/ T0 )
where T is the temperature in Kelvin, R 0 is the resistance at a reference
temperature T0 (usually 298 K, i.e. 25°C) and β is a constant (typically 3000-
5000 K).
106 Chapter 4: Physical Process Input and Output

The slope of the R-T curve (Figure 4.15, (b)) corresponds to the temperature
coefficient a that is itself a function of the temperature:
1 d( R / R0 ) − b
a= =
( R / R0 ) dT T2

The value of coefficient a lies typically between -0.03 and -0.06 K −1 at 25°C
(298 K).
Due to the resistance of the thermistor, a current passing through it will
generate heat. The power dissipated in the thermistor at 25°C is typically of the
order of 0.002 mW. With a dissipation constant of about 1 mW/°C the sensor
temperature will rise by 1°C (in air) for each milliwatt of power dissipated.
The thermistor is not an accurate temperature sensor. Due to its sensitivity,
however, it is used to measure small temperature changes. It is also quite robust,
both mechanically and electrically. The non-linear output voltage of the thermistor
has to be changed to a linear function of temperature. This can be done either by
analog electronics or with software. In particular with help of software it is quite
straightforward to define a calibration table or an inverted function of the thermistor
characteristic function. Linear characteristics can also be achieved with a few
electronic components connected to the thermistor. Thermistors can be used for
temperature measurements up to 500 - 600 °C.

4.4.5 Flow Rate Measurement


The measurement of flow rates is of vital importance in the process industry.
Despite the great need for accurate flow rate sensors, it is still difficult to carry out
this measurement with high accuracy. Yet, ever increasing requirements for product
quality in many areas contribute to increase the motivation for the direct and
accurate measurement of flow rates in technical processes. Also quite expensive
sensors can be justified in some applications.
The measurement of a flow rate must make use of some physical property of the
fluid in movement in relation either to its mass or to its volume. In the case of a
homogeneous, incompressible fluid the two quantities are related by the density ρ
[ kg ⋅ m −3 ]:
 [kg ⋅ s -1 ] = ρ ⋅ v [m 3 ⋅ s -1 ]
m

Many fluids of technical and economic interest, however do not have constant
density, or this density can be determined only with difficulty. An example is crude oil,
that on leaving the well is actually a mixture of petroleum (that is itself a complex
mixture of liquid and solid hydrocarbons), water, sand, other contaminating
substances and dissolved air and natural gas bubbles. Most flow rate measurement
techniques indicate the volumetric flow rate. We will briefly examine some of these in
the following, together with a method to measure mass flow rate. In many cases not
only the instantaneous flow rate value is of interest, but the integrated value of how
much fluid already passed the metering point (e.g. for billing purposes). In this case
the measuring device is called flowmeter.
4.4: Analog Sensors 107

Volumetric flow rate measurement


The volumetric flow rate may be indicated with a volume rate or flow velocity.
These quantities are directly related via the geometry of the pipe section where the
measurement takes place, so that with help of the vendors’ calibration datasheets
conversions between the respective units are trivial. For the measurement of the
volumetric flow rate the following physical principles can be used:
• Difference pressure
• Turbine rotation speed
• Movement of ultrasonic waves in the fluid
• Magnetic induction
• Vortex rate creation
Difference pressure flow rate sensors operate according to the Bernoulli
principle. A fluid moving in a pipe has a constant volume flow rate in all the points of
the pipe. If a pipe has a constriction, the mass and the volume flow rates must still
remain the same in all points. In order to satisfy energy and momentum conservation
laws, at the location of the constriction the velocity and the static pressure of the fluid
are different than in the other points of the pipe. According to the Bernoulli principle,
at the constriction the velocity will increase and the pressure decrease. From the
pressure drop ∆p = p 1 − p 2 can be obtained the fluid velocity. The flow rate is
proportional to ∆p ; the proportionality constant depends on the constriction
geometry. In the measurement for instance the pressure difference can lead to the
movement of a membrane. If the membrane is connected with the magnetic kernel of
a differential transformer, its output voltage will also be proportional to the pressure
difference and therefore also to the flow rate (Figure 4.16.a).

membranes
differential
transformer

P
1
P2

P P2
1

(a) (b)
pressure sensors

Figure 4.16: Flow rate measurement by difference pressure: (a) general principle with a pipe
constriction; principle of the Venturi pipe

In the constriction there are always some frictional losses, that can however be
minimized with a streamlined hydrodynamic design. This is done for example in the
Venturi pipe (Figure 4.16.b). Venturi pipes have a nozzle to increase the flow velocity
followed by an expanding section for recovery of kinetic energy by reducing the
formation of vortices. Venturi pipes are commonly used to measure large flow rates
108 Chapter 4: Physical Process Input and Output

in open channels; their price is however usually higher than for normal pressure
differential flowmeters.
A flow rate can be measured with a turbine and a rotational speed meter,
because the flow rate is in proportion to the rotation speed. A common application of
this principle is in flowmeters that deliver a pulse for each predefined quantity of
liquid flowing through the turbine. A turbine can only be used for clear flows because
any solid particles in the fluid would interfere with its movement.
A simple method for volumetric flow rate measurement is based on the
properties of the movement of ultrasound waves in a fluid. The result of ultrasonic
measurement is the average velocity for the fluid as determined by travelling
ultrasound waves. Under the assumption that this velocity is the same as the actual
average velocity of the fluid (the average velocity is taken because the fluid has a
velocity profile, and turbulencies change the velocity from one point to the other),
then the volumetric flow rate is obtained by simple multiplication of the obtained
velocity by the section area of the pipe.
Ultrasonic measurement is carried out by using two piezoelectric converters
placed at the opposite sides of the pipe at a distance of at least 100 mm from each
other and at an angle; they can operate in either direct mode or reflection mode
(Figure 4.17).
piezoelectric converters
(transmitter/receiver)

flow direction flow direction

piezoelectric reflector
converter (receiver)
(a) direct mode (b) reflection mode

Figure 4.17: Principle for ultrasonic flow rate measurement

There are two principal operation modes for the ultrasonic measurement, one
based on the wave travel time in the fluid, the other on the frequency shift. In the first
method is measured the difference in the travel time of a pulse train in the fluid (the
sound speed depends on the fluid; it is 344 m/s in air at room temperature and 1483
m/s in water). In an alternate fashion one piezo converter generates a pulse burst
and the other receives it, then they change function, the second converter operates
as sender and the first as receiver. In the first case, the component of fluid velocity
v ⋅ cos α is added to the travel time, in the second case it is subtracted. From the two
detected times it is possible to determine the average fluid velocity v .
A second method is based on the measurement of the frequency difference
between the radiated and the received pulse burst. The component v ⋅ cos α of the
fluid velocity influences the wavelength of the pulses, which means that their
frequency increases in one direction and decreases in the other. From the frequency
difference is derived the average fluid velocity. Both methods have the advantage
4.4: Analog Sensors 109

that the result does not depend of the particular value of the speed of sound in the
actual fluid and no special calibration is therefore necessary, as the measures in the
different directions compensate each other. However, in both cases the
measurement is influenced by irregularities in the fluid like small bubbles or particles.
Ultrasonic measurement has the advantage that the sensors can be installed
easily on the pipe (even devices for portable use are available), no modifications are
required in the pipe and the fluid dynamics characteristics are left unchanged, i.e.
there is no pressure loss after the measuring location. The precision of the
measurement is the same as for the other types of sensors, in the range of 0.5-1% of
the measured value.
Magnetic flow sensors operate according to Faraday’s law of electromagnetic
induction, which states that when a conductor is moved through a magnetic field, a
voltage is induced in it. The magnitude of the induced voltage is directly proportional
to the strength of the magnetic field and to the velocity of the conductor; its spatial
direction is perpendicular to the directions of both the magnetic field and the
conductor movement. In magnetic flow measurements, the conductor consists in the
ions of the electrically conductive liquid in movement; the flow conductivity must
therefore be at least 0.1 µS cµ . The magnetic field is generated by two coils placed
at opposite sides of the pipe and supplied with a.c. or pulsating d.c. current. The
voltage induced in the liquid is detected with two insulated electrodes; this voltage is
proportional to the flow rate. It can be shown that the voltage generated between two
opposite points on the inner pipe wall is largely independent of the velocity profile of
the liquid. Since the pipe cross section area is assumed to be constant, the output
voltage is proportional to the flow rate.
A further method for the determination of the flow rate in a pipe is based on the
von Karman effect. If a body of a determined shape is placed in a stream, vortices
are formed in its wake as the fluid separates on the sides of the body. These vortices
cause areas of fluctuating pressure that can be detected by a sensor. The frequency
of vortex generation is directly proportional to the fluid velocity. Because of the very
complicated relationship between flow rate and pressure changes and the influence
of other factors (e.g. temperature), vortex flowmeters require special processing
circuitry that is usually mounted together with the sensor.
With the exception of the magnetic flow measurement, all other volumetric flow
rate methods are based on the observation of some fluid dynamic property of the
flow. The measure is more accurate if the flow movement is laminar and not
turbulent. To avoid influence of other components in the hydraulic circuit (pumps,
bends, fittings, etc.) all methods require that before and after the sensor there must
be a compensating section of straight pipe with a length equal at least 10 times the
pipe diameter. This section should of course not contain any elements like valves,
restrictions, or the like. This pipe section is needed to allow the fluid take a more
laminar profile and compensate for turbulencies.

Mass flow rate measurement


In many applications it is important to know the mass flow rate instead of the
volumetric flow rate or fluid velocity. If the density of an incompressible fluid is
known, then the mass flow rate can be calculated directly from the volumetric flow
rate and if required considering other parameters, if they are known, like
temperature, pressure and viscosity. In practice, however, it often happens that the
density is unknown. Many attempts to measure mass flow by measuring force and
acceleration have failed. One principle, however, has been accepted for industrial
110 Chapter 4: Physical Process Input and Output

applications, the mass flow measurement using the gyrostatic principle and the
influence of the Coriolis acceleration or Coriolis force.
When a mass moves radially in a system that is under rotation about an axis, a
force is generated (Coriolis force). The direction of this force is perpendicular to both
the rotation axis of the reference system and the direction of the mass movement;
this force is proportional to the rotational speed and to the radial velocity of the mass.
Coriolis mass flow meters based on this principle work very well and deliver accurate
mass flow measurements without need for pressure and temperature compensation.
A straight pipe is excited into resonance at its natural frequency or at one of its
harmonics with help of an electromagnet. At the inlet and the outlet of the pipe,
pickups are placed symmetrically to the electromagnet in order to detect the phase of
the pipe oscillations. When no mass flows in the pipe, the two signals are in phase.
Any fluid particle that flows into the pipe will undergo a lateral acceleration. Because
of the inertia of the particle, the vibration at the inlet of the pipe will be attenuated. As
the particle passes through the pipe, it transmits the absorbed energy into the pipe
and the oscillation at the output will be intensified. The signals detected by the two
sensors at pipe inlet and outlet will therefore indicate different phases; the phase
difference is directly proportional to the mass flow rate. Coriolis flow sensors cause
very limited pressure drop in the system.
A Coriolis flowmeter can also be used to measure the density of a liquid. In this
case is determined the natural frequency of the filled test pipe; the natural frequency
is in inverse relation to the liquid density.
Coriolis flowmeters are by no means simple and need complex conditioning and
processing circuitry. This is not only a disadvantage, because flexibility is also
increased; the same device can for example be used for mass rate and density
measurements. Other advantages are that Coriolis mass flowmeters do not need
compensation pipe sections and their accuracy is high (0.5% of measured value). On
the other hand, Coriolis flowmeters are sensitive to vibrations and there are
restrictions to how they can be mounted; they are also quite expensive.

4.4.6 Chemical and Biochemical Measurements


There are several physical quantities that is very important to measure in
chemical or biochemical processes. Some measurements can be made on-line on a
routine basis, such as:
• concentration
• conductivity
• salt content
• redox potential (oxygen-reduction potential)
• pH-value
• dissolved oxygen
• suspended solids
For these types of measurements, in most cases there are commercially
available sensors with acceptable performance. As already indicated, the precision
and accuracy of measurements does not depend on the sensor itself but also on
how it is used, i.e. on its maintenance and whether it is regularly tested and
calibrated. This is especially important for chemical and bio-chemical measurements.
4.5: Signal Conditioning and Transmission 111

There are many types of sensors for the measurement of values such as the
concentration of organic carbon, of nitrogen compounds, phosphorus compounds,
etc. Many of those measurements are based on some kind of chemical laboratory
test that is carried out automatically by special-purpose equipment. Devices of this
type are usually very complex and therefore expensive. They operate offline, as the
tests may require quite some time, and make use of samples of the substance; the
results can be transferred to a computer via a data interface link. Maintenance
becomes a vital part of the operation of such equipment, and still it cannot be
counted on full satisfactory reliability.

4.5 Signal Conditioning and Transmission


The transmission of information between different parts of a control system is
both a necessary and a critical aspect. The signals produced by the sensors have
usually a very low level, so they have to be processed and amplified before they can
be transmitted on a cable. The signal levels and the impedances between the sensor
output, the cabling and the computer input have to fit together. The goal of signal
conditioning is to process the signal so that the right matching is obtained.
Another very important practical aspect is represented by disturbances. Almost
all electronic equipment contribute to the generation of electrical disturbances. If two
electrical circuits are (more or less purposely) coupled to each other, a current or
voltage change in one circuit causes a current and voltage change in the other.
Cabling in particular acts as a kind of antenna for noise and disturbances. With help
of signal grounding many problems caused by electrical noise can be managed;
some principles for grounding will be presented in this section. Also the choice of the
signal form (voltage, current or optical) depends on several factors, of which the
most important is immunity to noise and disturbances. In this section are discussed
different methods to deal with these problems.

4.5.1 Signal Conditioning with Operational Amplifiers


As we have seen in Section 4.2, in order for a signal to be transmitted faithfully
the loading effects of each system component on the others must be minimized. On
the one hand, the sensor output signal must be sufficiently high, on the other hand,
the computer input should have high impedance in comparison to the output
impedance of the sensor-transducer system. Amplifier circuits are installed between
the sensor output and the computer input in order to match impedances and signal
levels.
An impedance-matching filter has a high input impedance and a low output
impedance, the gain is approximately equal to unit. The last stage in the circuitry is
usually some stable high-gain amplifier to step up the signal level. Impedance
matching can be implemented using operational amplifiers in feedback configuration.
An operational amplifier, or op-amp, is an amplifier built on an integrated
circuit and characterized by a very large voltage gain (typically of the order of 10 6 to
10 12 ), a high input impedance (usually several MΩ) and a low output impedance
(typically smaller than 100 Ω). The output current is typically limited to 10 mA at
±10 V. The operational amplifier is a versatile building block for analog circuits
because its operating characteristics can be defined within a very wide range with
help of few and cheap electronic components. Operational amplifiers are available in
112 Chapter 4: Physical Process Input and Output

hundreds of different types. A schematic representation of an operational amplifier is


shown in Figure 4.18.
+vs (power supply)

-
vi
vo

vi+ + vo= G·(vi+- vi )

-vs

Figure 4.18: Schematic representation of an operational amplifier. In technical drawings the


power supply connections are usually not shown.

The output voltage v o is the difference between the two input voltages v i + and
vi− :
v o = G ⋅ (v i + − v i − )
where G is the gain. Even a very small difference between the two input
potentials is sufficient to cause a large change in the output voltage. In this form, the
operational amplifier is the simplest form of a comparator, because already a small
difference between the input voltages brings the amplifier output into positive or
negative saturation.
Since the voltage gain is large but unpredictable, the operational amplifier is
never used as an amplifier without some type of negative feedback. At low
frequencies (less than about 20 kHz) most of the feedback configurations can be
realized by different passive components like resistors and capacitors built around
the operational amplifier. The inverted amplifier has the simplest feedback
architecture for an operational amplifier (Figure 4.19.a). The voltage gain (i.e. the
ratio of the output to the input voltage) is:
vo R 1
=− 2⋅
vi R1 1
1+
β ⋅G
where β = R1 / ( R1 + R 2 ) and G is the gain of the operational amplifier. The
gain decreases with the signal frequency but as long as β ⋅ G >> 1 , the voltage gain
depends only on the value of the resistors in the feedback circuit. Generally, for an
ideal operational amplifier the gain can be expressed by the ratio of the feedback
impedance to the input impedance.
A voltage follower, also called impedance transformer, is realized by the
feedback coupling presented in Figure 4.19.b. The gain of the voltage follower is
about equal to 1. If a voltage follower is connected in cascade to a sensor transducer
with high output impedance, the new system will still have the same response
characteristics of the original system sensor-transducer, but its output impedance will
be low. In some cases the signal will have to be amplified before it is further
transmitted or processed.
4.5: Signal Conditioning and Transmission 113

- -
vi
+ vo + vo
vi

(a) (b)

Figure 4.19: Schematic representation of (a) an inverted amplifier and (b) a voltage follower

Another important configuration for the operational amplifier is the differential


amplifier (Figure 4.20). As the name indicates, this amplifier acts on the difference
between the input signals. The expression for the output voltage of the differential
amplifier is
R
v o = 2 ( v i 2 − v i1)
R1

R2

R1
vi1 -
vi2 + vo
R1
R2

Figure 4.20: Differential amplifier

The operational amplifier shown above represent the basic building blocks for
signal conditioning applications. Additional functionality, like e.g. the enhancement or
attenuation of specific frequencies, can easily be obtained by changing the
configuration of the passive components mounted around the amplifier. This
argument will be further treated in Chapter 5.

4.5.2 Electrical Conductors


Electrical conductors are the medium on which electrical signals move in space.
A signal that is transmitted along a conductor does not remain unchanged along the
path, but instead is influenced by the physical characteristics of the transmission line.
Therefore conductors must be considered and analyzed as a separate element of
the system sensor - conditioning electronics - control computer. The transmission of
direct current is in general a simple matter as long as the conductor impedance is
small compared to the receiver input impedance at the end of the line.
114 Chapter 4: Physical Process Input and Output

The transmission of pulses or otherwise rapidly varying signals leads however to


some problems. If the length of the line is such that the travel time of a signal
between the end points is in the same order of magnitude of the signal period or rise
time, then other effects become significant (the speed of a signal along an electrical
line is about 300 m per microsecond). One of these problems is signal reflection
(Figure 4.21).

line impedance Z0
signal termination
source impedance ZL

Figure 4.21: Signal wave reflection in case of incorrect impedance matching between a
transmission line and its termination, Z 0 ≠ Z L

In order to describe signal reflection we have to take a closer look at the


transmission line. The transmission line can be considered as built of two parallel
conductors that have a certain distributed inductance L (in series along the line) and
distributed capacitance C (in parallel between the conductors) per unit length. At
high frequencies, the total load of the distributed capacities becomes larger than the
resistive load. A signal input at a point in the line will propagate in both directions with
speed v = 1 / ( LC ) . A signal that propagates along a transmission line that at its
end has an impedance Z L will be partially reflected, with a reflection ratio ρ given
by:
Z − Z0
ρ= L
ZL + Z0

Z 0 = L / C is called the characteristic impedance of the line. Consequently, in


an ideal case the load impedance should be Z L = Z 0 in order to avoid reflection.

Example 4.7 Pulse signal in a transmission line


For a signal pulse on a transmission line the relation between voltage and
current at the time of the pulse is V = Z 0 ⋅ I . If the line is open at one end
( Z L = ∞ ), the current cannot circulate freely and must return in the line, i.e. it is
reflected back. Together with the current also the voltage must be completely
reflected since it is equal to Z 0 ⋅ I . The other extreme case is given for a short
circuit termination ( Z L = 0 ). The voltage at the line end must be equal to zero all
the time. An incoming voltage pulse has to be compensated by an equally high
voltage pulse of opposite sign. In other words, the voltage pulse is completely
reflected, but with changed sign.
Similar conditions hold also for the signal source. If the pulse source
impedance is not equal to Z 0 , then the pulse is reflected again. Pulses that are
sent over a line with incorrect impedance matching at its ends will travel back and
forth with decreasing amplitudes. In digital communication, where are normally
4.5: Signal Conditioning and Transmission 115

transmitted long pulse trains, in case of incorrect impedance matching the signals
can be reflected and mix, so that they can no longer be correctly interpreted by the
receiver. Impedance matching at end of a transmission line is realized with
termination impedances, also called termination networks. Practical examples of
termination networks will be shown in Section 8.2.3 in relation to bus systems and
in Section 9.5.4 in relation to data communication.

Example 4.8 Connection of two cables


If two cables with different characteristic impedances have to be connected,
the matching must be carried out correctly. For example, if a 50Ω cable is
connected to a 300Ω cable, a resistor network must be connected between the two
cables. The network should be dimensioned in such way that the 300Ω line
together with the resistors is „seen“ from the 50Ω line as a 50Ω load. The same
must hold also for the 50Ω line, that from the other line should be „perceived“ as a
300Ω load (Figure 4.22). In the shown example for instance the values Z1 = 0Ω ,
Z 2 = 274Ω and Z 3 = 55Ω could be selected. The impedances Z1 , Z 2 and Z 3
build a network that not only matches the impedances of both cables but also
reduces signal attenuation.

Z1 Z2

cable with impedance 50 Ω Z3 cable with impedance 300 Ω

Figure 4.22: Impedance matching in the connection of two cables

When both wires in a line carry current and the currents have the same
amplitude but are 180° out of phase, the line is said to be balanced. In an
unbalanced circuit current flows only in one wire, while the other serves as
reference ground. (The latter does not exclude that also this line is carrying a
current.)
There are basically two types of electrical conductors: twisted pair and coax
cable. As the name indicates, a twisted pair consists of two insulated copper
conductors twisted together, and represents thus a cheap and simple electric
communication medium. The wide use of twisted pair and coax cables in telephony
and television distribution has made these cables and their ancillary components
such as connectors and tools, widely available at low cost.
The electrical circuit of the twisted pair cable can be either balanced or
unbalanced. The advantage of the balanced circuit is that it is less sensitive to
external interferences; conversely this circuit irradiates less energy because the
induced electromagnetic fields have the same intensity but opposite polarity, so that
they tend to cancel out each other. On the other hand, a balanced circuit is such only
if it is properly trimmed and maintained. An unbalanced twisted pair cable is much
more sensitive to disturbances than a balanced cable but requires almost no effort to
116 Chapter 4: Physical Process Input and Output

be installed and operated. A cable with four twisted conductors is even more
insensitive to inductive disturbances (see Section 4.5.3).
Coax cables are made of an electric conductor isolated with a plastic coat and
surrounded by a conducting wire mesh, the shield. Because of their geometry, coax
cables are intrinsically unbalanced. The shield is held at ground potential and
prevents energy from irradiating from the central conductor, which at high
frequencies would represent an important disturbance factor. Conversely, the shield
hinders external interferences from reaching the central conductor. Coax cables are
denominated by the value of their distributed impedance; common values are 50Ω
(the cable is commonly known as RG-58 type) and 75Ω (RG-59). The importance of
coax cables is due to their use in high-frequency applications and communication
technology (see Section 9.3).

4.5.3 Electrical Disturbances


An electrical conductor can pick up disturbances in many ways. The most
important types of coupling between a conductor and the disturbance source are:
• resistive
• capacitive
• inductive (magnetic)
The resistive (or also galvanic) coupling between a conductor and a disturbance
source does not depend on the frequency of the disturbance signal. In a capacitive
or inductive coupling, instead, the degree of coupling depends on the frequency of
the disturbance; the higher the frequency, the more energy is received from the
disturbance source. This means in practice that electric circuits in which fast voltage
and/or current changes take place can represent more serious disturbance sources
than circuits operating at lower frequencies. In general, the coupling to a disturbance
source is seldom of only one type, but is rather a combination of the three different
types of electrical couplings. Difficult problems with disturbances arise when
conductors for low-power signals are located close to power cables. Each wire for
the connection of a sensor with the electronic signal processing circuitry is a potential
receiver of electrical disturbances.
A lot of research and development is currently going on in order to develop
environments for electronic equipment as free from noise as possible. The goal is to
achieve electromagnetic compatibility (EMC) within electrical circuits as well as
between different circuits and systems. An electrical device must on the one hand be
insensitive to external disturbances and on the other hand should not generate
disturbances that can be picked up by other equipment.

Resistive couplings
When different electronic systems are connected to a common power supply
and are also connected to a common earth ground, disturbances due to resistive
coupling may arise. Other common noise sources may be poorly shielded motors
and frequency converters with semiconductor switches. One way to avoid this type of
problem is to connect the sensitive electronic equipment to a different power supply
source than the rest of the circuits. Another possibility is the galvanic separation of
power units and devices. In this case there is no direct electrical connection between
the different power supply units and the electrical equipment.
4.5: Signal Conditioning and Transmission 117

Example 4.9 The Flying capacitor


The so-called „flying capacitor“ isolation is an example of galvanic potential
separation (Figure 4.23). A capacitor is normally connected to a voltage source via
two switches. The capacitor is therefore at the same potential of the voltage
source. With a switchover, the voltage is transferred to the output. In this way the
input voltage source is never connected electrically to the following circuit, for
example the input circuitry of a computer. It is said that the capacitor „flies“ (from
which comes the name) the input voltage to the output.

S1
+
vi vo
-
S2

Figure 4.23: Flying capacitor isolation.


The capacitor is charged from the voltage source. After the switch pair S1
and S 2 has switched over, the output voltage is equal to the source voltage.
Also the two grounds are never connected through the switches.

Capacitive couplings
Between two conductors and/or between a conductor and a disturbance source
there are almost always capacitive couplings. A capacitive coupling is characterized
by the fact that a variable voltage induces in the conductor a current i proportional
to the voltage time derivative, i = C ⋅ ( dv / dt ) , where C represents the capacitance
value. Capacitive couplings should be reduced to a minimum. They become smaller
the more the conductors (or the noise source and the influenced circuitry) are located
far from each other.
A good way to decrease capacitive couplings is to build an electrostatic shield
around the conductor to be protected in order to break the disturbance path. The
shield must be grounded so that its potential is zero. This measure provides good
protection, although there may be problems at the cable ends where the conductor is
connected on one side to the sensor and on the other side to the electronic circuitry,
e.g. a computer input board. The reason is that in those positions the shield does not
completely surround and protect the conductor. At the small, non-protected endings
there might be small capacitive couplings. It is therefore important to keep these
connections as short as possible.

Inductive (magnetic) couplings


An electric conductor generates around itself a magnetic field, with an intensity
proportional to the magnitude of the current flowing in the conductor. For this reason,
118 Chapter 4: Physical Process Input and Output

magnetic couplings represent an important problem in proximity of power cables,


where very large currents flow. A varying current generates a varying magnetic field;
due to magnetic induction the varying magnetic field generates a voltage in another
conductor that crosses the field. The induction theorem specifies that given a mutual
inductance between conductors M , the voltage V that is induced in a conductor is
V = d ( Mi ) / dt , where i is the current in the other conductor. If the conductor in
which a voltage is induced is part of a closed circuit, then a current will circulate. This
induced current is proportional to the area enclosed by the conductors and through
which that the magnetic flux is conducted.
There are several ways to eliminate the influence of inductive couplings. The
area of the circuit that encloses the magnetic flux can be decreased by twisting the
cables together; reducing this area means also reducing the induced voltage.
Furthermore, the small area „changes sign“ at each turn, so that the net magnetic
flux becomes very small. This is the reason why twisted-pair cables are built in such
a way and do not only consist of two simple conductors in parallel.
A conductor for measurement signals should be located as far away as possible
from disturbance sources. In particular, sensitive electronics should not be placed in
close proximity of transformers and inductors. Cables should be placed in such a
way that possible disturbance fields propagate in the same direction as the cable is
drawn. Two simple rules to follow are: (1) low-voltage signal cables and high-voltage
power cables should not be installed close to each other in the same conduit and (2)
signal cables and power cables should cross, when necessary, only at right angles.
A magnetic field can be reduced by shielding. A copper or aluminum shield has
very high conductivity, and because of the eddy currents generated by the magnetic
fields in the shield, the magnetic flux is reduced. Shielding can also be realized with
high permeability material such as iron. A magnetic shield is often clumsy, since it
has to be thick in order to dampen the magnetic flux. Therefore shielding is used
mostly in devices that produce large magnetic fields.

Some rules of thumb


We summarize here some of the basic rules to eliminate or reduce the influence
of electrical noise on the measurement signal environment (sensor, cabling and
electronic processing circuitry). Evidently one should first try to:
• Reduce the intensity of the noise source
This is the first and most important action, as it reduces the further efforts that
are necessary to minimize the effect of the disturbance.
Other important factors that contribute to the reception of noise and the effect of
which must be minimized are:
• Galvanic couplings
• Distance between the noise source and the influenced circuitry
• The noise frequency content
The effects of capacitive couplings can be reduced by:
• Using shielded cables
• Minimizing the length of the unshielded wires at the cable ends
The influence of magnetic couplings can be reduced if:
• The cables are twisted, so that the area of the circuit that encloses the magne-
tic flux is decreased and the field polarity orientation is continuously changed
4.5: Signal Conditioning and Transmission 119

• In case of connection to several sensors, use of one twisted pair cable for each
sensor
• Separation of power cables and signal wires; signal cables should be kept at
adequate distance from disturbance sources
• Low-voltage and high-voltage cables must cross at right angles (90°).

4.5.4 Signal Grounding


Grounding is the physical connection of several circuits to a common potential.
Signal grounding means the realization of a common reference potential for
measurement signals. In theory all the points that have to be grounded should be
connected to this reference potential without any resistance or inductance.
Unfortunately, this is not possible in practice. Problems caused by poor grounding
are among the most common in measurement technology, and are also extremely
difficult to detect. The basic problem is the same for a small electronic circuit as well
as for a whole industrial plant.
Consider a simple measurement system (Figure 4.24) with a voltage source v s
connected to a ground P1 and the measurement system itself connected to ground
P2 . Two separate grounds are seldom at the same potential, so that a leakage
current will circulate between them. The voltmeter will not show the correct voltage
v s , but instead the value v s + v g . In large, complex systems it is common to have
different grounding circuits, for the sensors, the cabling, the computer equipment, the
power units and the chassis. All the different grounds must again be connected to a
common ground, as illustrated in Figure 4.25.
A rule of thumb for grounding analog signal cables is to connect the ground as
close as possible to the signal source (i.e. the sensor). Of course this might
represent a problem in large technical systems with many long cables. The separate
grounding of computer equipment is desirable since digital systems both generate
and can easily pick up high-frequency signals. Older analog data acquisition systems
are mostly influenced by low-frequency signals, but not by high-frequency
disturbances that are filtered out by the analog circuitry.

connecting cable

+
+
v voltmeter
s
-
-
+ -

vg
P P
1 2

Figure 4.24: Simple measurement system with two grounds


120 Chapter 4: Physical Process Input and Output

signals motors and other


analog digital equipment

chassis
power supply
signal ground ground

System ground,
safety ground

Figure 4.25: Grounding connections to a common ground

A separate power unit ground is recommended for relays, motors and other
devices that draw large currents. Finally, all chassis must be connected to a separate
ground, and this again to the safety ground.
The shields of measurement signal cables are usually also connected to ground.
In order to avoid ground current loops, the shield has to be connected to ground only
at one point, either in proximity of the signal source (the sensor) or to the electronic
equipment. The first configuration gives however the best disturbance reduction
(Figure 4.26).

sensor amplifier
shielded cable

output
signal

Figure 4.26: A system with a sensor and a differential amplifier. The cable shield is
grounded in proximity of the sensor.

The problems related to signal grounding can be summed up in the following


rules:
• Think about where the currents flow. The current coming from a power supply
equipment must also return to the same device. Conductors that are connected
to the electrical equipment may be called „ground“, but can actually function as
current loops and present voltage offsets and disturbance spikes due to the
impedance of the cables. It is necessary to use wire of adequate cross section
for the power supply and for the ground connectors.
4.5: Signal Conditioning and Transmission 121

• Keep the grounds for digital and analog circuitry separate from each other.
When the digital circuits change their logic state, the „digital ground“ can carry
large voltage spikes. Since analog circuits are usually very sensitive for
disturbances, they should have separate grounds in order to reduce the effect
of resistive couplings.

4.5.5 Choice of Signal Type: Voltage vs. Current Signals


The choice of signal type for the transmission of measurement signals from a
sensor to a computer depends on several factors. The most essential of the aspects
to be considered is that the measurement signal should be as little sensitive as
possible to electrical disturbances.

Voltage signals
Every cable has a certain resistance per unit length. If the input impedance of
the last circuit block (the signal processing circuitry) is not infinite, a current will flow
in the cable and a voltage drop will result. If the signal amplitude changes, some
current will also flow between the conductors because of the distributed capacities. It
is therefore realistic to always calculate some voltage drop along the transmission
line. The requirements for a high input impedance of the signal processing circuitry
makes it very sensitive to disturbances. Consequently, voltage signals are not much
suitable for transmission in those cases where disturbances may be significant.
A different connection possibility for voltage signals is realized with three
conductors (Figure 4.27). In a wire flows a constant current to feed the sensor, the
second wire brings the measurement signal from the sensor to the electronic
conditioning and processing circuitry and the third wire represents the common
return. The advantage of this solution lies in the fact that variations in the resistance
of the measurement signal wire, e.g. because of changes in temperature, do not
influence the signal itself, as no current flows in this wire and therefore there cannot
be any voltage drop. The sensitivity to external disturbances remains however
unchanged.
amplifier with high
input impedance
measurement signal
connection

constant
measurement current constant current
resistor generator

common return

Figure 4.27: Connection of a sensor with a three-wire configuration.


In two wires flows a constant current; no current flows in the wire for the
measuring signal, so that no voltage drop takes place

The principal reason for the popularity of voltage signals lies on the one hand in
their intrinsic simplicity and on the other hand in the wide availability of devices for
122 Chapter 4: Physical Process Input and Output

amplification, filtering and other data processing. The simplicity of the operation is
reflected also in system applications: if the same signal has to be delivered to
several circuits, it is sufficient to connect these circuits in parallel (within the limits
related to the input impedances). Otherwise voltage signals are not used very much
in industrial applications, because usually long distances must be bridged and the
influence of disturbance sources may soon become significant.
The most important voltage levels for signal transmission have been
standardized (standard IEC 381):
+1 to +5 V
0 to +5 V
0 to +10 V
-10 to +10 V

Current signals
Current is a better choice than voltage for the transmission of signals over long
distances. The reason is that current remains constant along the cable while voltage
drops with the distance because of the cable resistance. At the end of the cable
circuit, the current signal can be transformed to a voltage signal with help of a high
precision shunt resistor (Figure 4.28).

voltage to current
converter R
twisted pair
+ cable
R
vi 4-20 mA -

0-10 V Rshunt + 0-10 V vo


- shunt R
resistor R

Figure 4.28: Analog signal transmission with a current loop.


The voltage to current converter is a common circuit element. The connection,
twisted pair cable can reach a length of several hundred meters. The shunt
resistor for the conversion of the current in the voltage range 0 (2) to 10 V must
have a value of 500Ω.

In current transmission, the sensor output voltage is converted in an operational


amplifier circuit to a current. The receiver (op-amp at the end of the circuit) should
ideally have zero input impedance. In reality, the impedance is determined by the
shunt resistor and is usually of the order a few hundred Ω. For a current of 20 mA
and a shunt resistance of 250Ω, the voltage drop is 5 V. If the signal source (i.e. the
voltage to current converter) has a high output impedance, then any transmission
noise will lead only to a small voltage drop over the shunt resistor, something that
normally can be accepted. Current transmission is used mostly for low frequency
signals, up to about 10 Hz.
4.6: Binary Actuators 123

At constant current and with ideal isolation, all the current generated from the
source reaches the receiver (the signal processing circuit) so that the cable
resistance has no influence. For alternating currents the influence of capacitive
effects will become more and more evident, and some current will be lost along the
cable, either to the return conductor or to ground. The international standard IEC 381
recommends a range of 4 - 20 mA for current transmission. The minimum signal
level is defined as 4 mA to have a possibility to detect if the loop is broken (0 mA).
Current transmission has the advantage that both the power supply for the
sensor and the voltage/current converter as well as the output signal can be carried
over the same two wires. This can be done under the condition that the current
drawn by the sensor and the converter remains constant, so that each change in the
loop current is clearly due to changes in the sensor output. In comparison, voltage-
based signal transmission requires three cables, as illustrated earlier.
To sum up, a measuring system based on current signals and a probe which is
galvanically isolated from the output signal has several advantages:
• It functions satisfactorily with long transmission lines
• It allows a simple operational check, since a current of 0 mA means that the
sensor is off-line or the line is interrupted
• It gives good protection from interference
• It needs only two transmission wires, thereby reducing costs.

4.5.6 Optical Signal Transmission


Signal transmission on optical fiber cables has become practical in many
measurement and communication applications. For optical transmission a quite
complex - and therefore also expensive - digital communication system is necessary.
With light-emitting diodes (LEDs or laser diodes) digital electrical signals are
converted to light pulses which are then carried over glass fibers. At the receiving
end the light pulses are converted back to electrical signals using optoelectronic
sensors.
Optical transmission is immune to magnetic and electric disturbances and
provides also total isolation. This form of transmission is suitable for long distances
(>1 km) as well as in difficult measurement environments, such as in proximity of
electric motors and frequency converters. The use of optical signal transmission in
technical environments is motivated primarily by immunity against disturbances
rather than by their high data-carrying capacity. Optical data communication systems
will be treated in more detail in Section 9.3.8.

4.6 Binary Actuators


Actuators are the interface to control a technical process. They operate by
converting a signal (that is most cases is electric) to a physical quantity. In many
situations actuators with only two operational states (binary actuators) are sufficient
for control. The operational states of a binary actuator simply correspond to the
supplied energy (on - energy applied, off - no energy applied). Examples of binary
actuators are magnetic valves, electromagnetic relays and electronic, solid-state
switches. One or two bits are sufficient for the control of a binary actuator, and these
signals can be easily generated by a process computer. The control signal can be
amplified to by a simple switching device rather than by a more complex linear
amplifier.
124 Chapter 4: Physical Process Input and Output

Binary actuators can be of two types, monostable and bistable. A monostable


actuator has only one stable position, corresponding to its de-energized state, and is
controlled by only one signal. The remote control contact for an electric motor is
often of monostable type. As long as a signal is sent to the contact the motor is
powered, but as soon as the signal is broken the motor will stop.
A bistable unit remains in its latest position until it receives a new control signal
to change it. In that sense it could be said that the actuator „remembers“ its last
position. For example, in order to move a cylinder controlled by a bistable magnet
valve, one signal is needed for the positive movement and another one for the
negative movement. Bistable actuators are controlled by pulses rather than by
continuous signals.

4.6.1 Controlled Switches


The output power level of a computer is usually very small. The voltage level of
the high output signal lies typically between +2V and +5V, and that of the low signal
at less than +1V. The maximum current depends on the connected load, but it is
generally less than 20 mA. A normal computer output port can therefore deliver only
a power of about or less than 100 mW. This means that for the control of most
actuators, the computer output signal must be amplified. This is done with controlled
switches.
The most common electrically isolated switch used in control applications has
always been the electromechanical relay. The relay is a robust switch that can
control both on direct and alternating currents. A current through the relay coil
generates a magnetic force that attracts the armature from one position to another,
and in this way open and close an electric contact. The activated contacts can carry
much larger currents that what is needed to control the coil. A typical coil may draw
something like 0.5 A at 12 V, so it cannot be directly driven from the computer
output; instead a medium-power switch, like a transistor amplifier, must be installed
between the TTL output and the relay coil. In the design of systems with relays it
should always be considered that there might be problems with the power supply for
their control, so that the position in the de-energized state should be the desired
safety position. In other words, a power supply failure for the relays should not lead
to the unwanted operation of the connected loads.
Relays are available for a wide range of power, from reed relays that switch
millivolt signals to contacts in the kilowatt range. Low-power reed relays are available
mounted on expansion boards for many computer systems and can be used for
isolated switching of low-power signals. Relays for higher power ratings are too large
to find place on computer boards and have to be installed separately, often in closed
racks. An additional advantage of relays is that their function is well understood by
maintenance personnel.
Among the disadvantages of relays is that they are relatively slow to operate (a
switching operation needs time in the order of milliseconds instead of the
microseconds that are typical for electronic switches). In addition relays, as well as
mechanical switches, suffer from contact bouncing (see Section 4.3.1); this problem
can generate electric noise, which in its turn may influence measurement signals and
the computer electronics.
Solid-state semiconductors can be used for switching of high power, as they do
not have many of the problems of the relays. A solid-state switch has a control input
which is coupled to a control unit. Solid-state power switches can be driven directly
4.6: Binary Actuators 125

from output signals of digital logic circuits. This makes their control from computers
particularly easy.
Different types of controlled switches can be used for low and medium power
switching. Integrated circuits with transistor outputs can be used up to a voltage of
about 80V and to a current of 1.5 A; they can be controlled from the computer output
signal. When the computer output is higher than +2.4V a current controlled by the
electronic switch flows through the actuator, while for outputs under +0.4V the
transistor is off and no current flows through the actuator. In this configuration, the
transistor operates as a simple saturated amplifier.
When higher powers must be controlled, the switch design can be based on
discrete power transistors or MOSFETs (metal oxide field effect transistor). Typically
such circuits can carry 5-10A and stand a potential difference of more than 100V.
Because of their internal resistance the transistors dissipate some power when a
current flows through them. They must therefore be mounted adequately for cooling,
otherwise they would overheat.
In the control of high powers (> 100 W), there should be no direct electrical
connection between the computer output port and the electronic power switch. The
switch is namely often a source of electrical noise, which could affect the operation
of the computer if there is a common electrical connection with the switch. In
addition, in case of switch failure, the high voltage to power the actuator could reach
and damage the computer via the direct electrical connection. To avoid this problem,
the control can be made via galvanic isolators, i.e. circuits that bridge the control
signal optically with a LED and phototransistor mounted in proximity and without any
direct electric connection.
Thyristors are an important class of semiconductor switches. Important
examples are Triacs (from TRIode AC semiconductor) and the silicon-controlled
rectifier (SCR). These semiconductors are also known as solid-state controlled
rectifiers.
Once a thyristor is „fired“ (switched on from a control impulse) it will remain on as
long as a current flows through it. In other words, unlike a power transistor or power
MOSFET, the thyristor does not turn itself off when the control signal is turned off.
The thyristor doesn’t even switch off when the supply voltage drops to 0 V. The
thyristor turns off only when the switched voltage changes sign (forced
commutation). Thyristors are very often used to switch alternating current because
the change of polarity at regular intervals, at most after one cycle, allows the thyristor
to shut off if no firing signal is present (natural commutation).
Thyristors can handle considerably more power than transistors or power
MOSFETs. When a thyristor is conducting, its internal resistance is virtually zero.
Consequently also the voltage drop across the thyristor and heat production are
minimal and can often be neglected for practical purposes.

4.6.2 The Switch Off of Inductive Loads


To turn off an actuator with inductive load (like e.g. an electrical motor or a
solenoid coil) by opening a normal electric switch may create problems. The voltage
across the inductor built in the actuator is v = L ⋅ ( di / dt ) , with L as inductance and
i as the current flowing in the actuator. If the current is switched off rapidly, the
voltage across the actuator can become very high during the switching phase (Figure
4.29).
126 Chapter 4: Physical Process Input and Output

The switch may be damaged by the voltage spikes, so that it is necessary to


dampen them. This can be done with a so-called „free-wheeling diode“ connected in
parallel to the load (Figure 4.30).
On opening the switch, the current from the inductive load flows through the
diode. The voltage across the actuator is limited to less than 1 V, which corresponds
to the voltage drop across the diode. The switch must stand only the original power
supply voltage, but no overvoltages. The load current flowing through the free-
wheeling diode drops exponentially; the decay rate can be increased by connecting a
resistor in series with the diode.

current through voltage across


the switch the switch

time time

Figure 4.29: Voltage spikes that can occur in an inductive actuator when a switch is opened

inductive free-wheeling
load diode
+
power
supply
-
switch

Figure 4.30: Use of a free-wheeling diode to dampen the voltage spikes generated by
switching off inductive loads

4.7 Electrical Drive Actuators


The term drive system indicates the combination of a motor with its control
electronics. The use of control enhances greatly the functionality of electrical drives,
primarily for the possibility of regulating speed and torque within a wide range and
with high precision. Most actuators used in control applications are continuous drive
systems, like d.c. motors, induction (asynchronous) motors and synchronous motors.
Also stepping motors are used widely, but their control differs widely from that of
continuous drives. Drive systems can be part of other mechanisms like valve
4.7: Electrical Drive Actuators 127

positioners, robot arms, etc. For example, a common compact disc player contains a
controlled drive system for the rotational speed of the disc and one for the
positioning of the arm carrying the laser reading sensor; both rotation velocity and
track positioning must be controlled with high precision. In this section the most
important aspects of precision control of electrical drives are treated.

4.7.1 Power Amplifiers


Computer output ports have a very low power and cannot control any physical
devices directly. The computer output signals must be amplified before they can feed
the actuators (motors or others) interacting with the physical process. Power
amplifiers for control signals may be built as separate units, but also be enclosed
together with the actuator. At power levels up to a few hundred watts it is possible to
use amplifiers not much different from those used in audio equipment; these are
known as power operational amplifiers. At higher power ratings, the amplifiers are
often called either servo amplifiers or programmable power supplies and are
usually designed to be mounted together with motors or electrical valves. The output
voltage of a programmable power supply can be controlled by an analog or digital
signal.
A common technique to control power levels in the order or kW and higher is the
pulse-width modulation (PWM). In PWM the output voltage is switched between
two constant values at a high frequency, typically in the kHz range. The average
voltage level is controlled by changing (modulating) the width of the pulses. Figure
4.31 shows an example of a PWM pattern. „Narrow“ pulses will result in a low and
„broad“ pulses in an high average voltage. A PWM unit is built around a power
control section with solid-state switches like transistors, power MOSFETs, or
thyristors. In converters for power levels up to about 300 kW, so called IGBTs
(Insulated Gate Bipolar Transistors) are used. For higher power levels thyristors of a
GTO (Gate Turn Off) type are often used.
The reason why PWM is used is that conventional power amplifiers would simply
burn at high power levels. The advantage of switching is that the solid-state devices
are not loaded all the time with high power and therefore their power dissipation is
low. This fact makes PWM amplifiers very efficient. An additional advantage of PWM
amplifiers is that the switching can be directly controlled from the digital output ports
of a computer.
PWM signals are increasingly being used to drive continuous actuators such as
a.c. and d.c. motors and hydraulic servos. If the switching frequency of the PWM
amplifier is sufficiently high in relation to the actuator time constants, then the signals
will average around some value (Figure 4.31). The input voltage is switched between
zero and a maximum, resulting in a certain effective average power. If the switching
frequency is sufficiently high in relation to the time constant of the powered system,
then the oscillations in its behavior may become negligible.
A frequency converter is a motor speed and torque controller that bases its
operation on PWM technique; it operates together with an a.c. motor. Frequency
converters can be used in new installation as well as in old systems. Since most
pump or compressor systems already have an asynchronous (induction) motor, they
are in a sense prepared for frequency converter operation. For advanced operations,
where a large operating range is to be used, the cooling of a standard motor may be
insufficient at low speed and high torque, so that extra cooling may have to be
provided.
128 Chapter 4: Physical Process Input and Output

phase-to-phase 600
voltage

400

200

-200

-400

-600
0 0.01 0.02 0.03 0.04 0.05
time in seconds

Figure 4.31: Envelope of the resulting voltage during a PWM (pulse width modulation)
cycle.
The voltage is switched between three constant levels (0, positive high, negative
low). The sinusoidal curve shown is the simulated result of the effective voltage
applied to a power load.

4.7.2 Position and Velocity Control in Drive Systems


A common problem in industrial and process automation is the control with high
precision of the position of a servomechanism, like e.g. a robot arm, a machine tool
or the magnetic head arm of a computer disc drive. In this case a feedback system
must be connected to the motor that powers the servomechanism to generate the
necessary control signals until the expected output is obtained. The structure of a
position control system is shown in Figure 4.32; this structure is the same regardless
of the actual type of the motor (a.c., d.c.) and of whether the control is realized with
analog or digital technology.
The position servo control system contains three nested loops for the control of
torque, velocity, and position in cascade configuration. The angular position is
measured with help of a sensor, e.g. of the type described in Sections 4.3 and 4.4.1,
and is compared with the reference value (setpoint) for the position. From the
position error the position controller calculates the new velocity value that will bring
the desired change in position.
In order to change the angular velocity, the motor must also change its driving
torque (see Example 3.3 in Section 3.2.1). The required torque is calculated by the
speed controller, that contains a dynamic model of the actual type of motor. The
value of the required torque is then compared with the actual torque, that for
example may be estimated by measuring the rotor current in the motor (see Example
3.5, Section 3.2.2). The difference in the torque values is used as input to the torque
controller that is equipped with the power electronics for the generation of the
desired voltage and frequency to drive the motor.
4.7: Electrical Drive Actuators 129

position speed torque


reference reference reference

motor load

position speed torque


Σ control Σ control Σ control

-1
torque value

-1
speed value

-1
position value

Figure 4.32: Schematic structure of a position servo control system

The position control system shown here could be used e.g. for the longitudinal
position control of the laser sensor arm in an compact disc drive. In many actuators it
is important to control the angular velocity instead of a position, for example in the
rotational drive of a compact disc reader. In this case the outer loop for position
control can be removed from the cascade control system. The reference angular
velocity is passed directly to the speed controller as reference value.
If the position control system is implemented with analog technology the control
computer must generate analog signals; this can be done e.g. with digital/analog
converters (Section 5.2). The velocity may be measured with a tachometer (Example
4.3, Section 4.4.1) and the position with a potentiometer.
Another approach is to combine analog and digital control techniques. In this
case the velocity control is implemented with help of analog electronics, while the
control of the position is implemented digitally in the computer (Figure 4.33). This
control structure has been used since the early 1960s.
The angular position sensor is an incremental shaft encoder (see Example 4.1 in
Section 4.3.4) which generates a fixed number of pulses per motor revolution. When
the shaft rotates, a train of pulses is generated and the pulse rate is proportional to
the angular speed. The computer sends out position pulses that are added up in the
pulse counter. The pulses from the shaft encoder are instead subtracted from the
counter. The difference in the number of pulses corresponds to the position error;
this value is sent to a digital/analog converter to produce an analog voltage signal to
be used as reference value for the velocity. The computer receives and generates
only pulse signals, as if it were to control a stepping motor and not a d.c. motor like in
reality.
The servo control loop can also be realized completely with digital technology.
The shaft encoder provides the measurement information for both position and
velocity. Circuit boards that contain the necessary digital servo loops are available for
many microcomputer systems. Controllers of this type are also available in
combination with servo amplifiers.
130 Chapter 4: Physical Process Input and Output

direction signal (polarity


computer selection in the D/A converter)
output port
angular speed
reference value
pulses to increase the d.c. motor
angular position amplifier

+ im
up/down position D/A- +
counter controller converter Σ
- -
pulses to decrease the angular
angular position speed

tachometer
position feedback position
encoder

digital analog

Figure 4.33: Combined analog and digital servo control loops

4.7.3 Stepping Motors


Stepping motors are incremental drive actuators controlled in fixed angular
increments (steps). Each step of rotation is the response of the stepping motor rotor
to an input pulse. Since each step of the motor corresponds to a determined angular
position and the movement is strictly determined by the input pulses, the control of
position and rotational speed is very simple. This is however valid under the
assumption that no steps are missed, so that the rotor position is fully defined by the
input pulses. In such case no feedback from the motor angular position is needed
(open loop control). Under transient conditions near the rated torque pulses could be
missed. If the stepping motor must operate under such conditions, then a feedback
control loop might have to be used to compensate for the motion errors.
Some of the advantages of stepping motors are:
• high motion accuracy, even under open loop control (i.e. with no sensor reading
of the angular position)
• easy integration in digital applications
• no mechanical commutator, that in other types of motors often leads to
problems.
Some of the negative aspects of stepping motors are:
• low torque capacity compared to continuous drive motors
• limited speed
• high vibration levels due to the stepwise motion
• large errors and oscillations when pulses are missed and the control takes
place in open loop mode.
4.7: Electrical Drive Actuators 131

The advantages of stepping motors prevail however in many cases over their
disadvantages, so that these motors are used in a great number of applications
where low power is sufficient.

4.7.4 Direct Current Motors


The mechanical and electrical dynamics of the d.c. motor have been described
earlier (Example 3.3, Section 3.2.1 and Example 3.5, Section 3.2.2). The d.c. motor
is very common as a servomotor, even if today also a.c. motors are used more and
more in this type of application. The presence of the commutator is the real
disadvantage that restricts the power and speed of the d.c. motor. This has been
overcome in brushless d.c. motors, i.e. d.c. motors with a permanent magnet rotor
and where the commutation is accomplished by electronic switching of the stator
current. In principle, brushless d.c. motors are somewhat similar to stepping motors
and to some types of synchronous a.c. motors.
The control of d.c. motors is accomplished by controlling the supply voltage to
the rotor and, sometimes, also to the field circuits. To use a variable resistor in series
with the power supply has many disadvantages. The resistor wastes energy and the
heat generated has to be removed promptly to avoid damage. The usual way to
control the motor supply voltage is by using solid-state devices and PWM control.
The supply voltage to the motor is therefore „chopped“ so that the average voltage
lies at the desired level. Thyristors are commonly used as switches in d.c. motor
control.

4.7.5 Asynchronous and Synchronous Motors


Alternating current motors are commonly used in heavy duty applications, they
are however also increasingly of interest in industrial automation applications, e.g. as
servomotors. Some of the advantages of a.c. motors are:
• cost-effectiveness
• robust and simple construction
• high reliability
• convenient power supply
• no commutator is needed
• virtually no electric arcing (because of no commutator)

On the minus side the a.c. motor has a lower starting torque than a d.c. motor
and needs a more complex control circuitry. However, the advantages of a.c. drive
systems are such that they can challenge the d.c. motor in robots, manipulators and
other industrial servo systems.
The wider use of a.c. motors as servomotors has been made possible by the
development of power electronics in combination with new control methods. With
microelectronic drive systems the frequency of the applied voltage can be suitably
controlled. The motor torque cannot be measured as easily as in a d.c. motor, but
can still be estimated on-line. Because of the strict time requirements, in this type of
control must be used processors with a special architecture for very fast
computations, digital signal processors (DSP).
132 Chapter 4: Physical Process Input and Output

In an induction (asynchronous) motor the stator magnetic field is not constant as


for the d.c. motor. In the simplest (two-pole) machine there are three stator windings,
separated 120° in space around the stator. When they are fed with three-phase
alternating voltage, the resulting magnetic flux from the stator will rotate with the
same frequency as the voltage. The rotor windings are not energized by an external
voltage so no commutator brush devices are needed.
The rotating field in the stator intercepts the rotor windings and generates a rotor
current due to mutual induction. The resulting rotor flux interacts with the rotating
stator flux and produces a torque in the direction of the rotation of the stator field.
This torque drives the motor. Because of frictional losses, the rotor cannot even in
idle rotation reach the so-called synchronous speed, i.e. the exact rotation speed of
the rotating magnetic field. From the relative difference in the rotor speed and the
rotating magnetic field it results a driving torque. The velocity difference is called the
slip, defined as
ω −ωm
s= s
ωs
where ω s is the stator field angular velocity and ω m the rotor (motor) speed.
Clearly, for s = 0 there is no driving torque.
The rotor of a synchronous motor runs in synchronism with a rotating magnetic
field generated by stator windings (the stator of a synchronous motor looks in
principle like that of an asynchronous motor). In contrast to the asynchronous motor,
the rotor windings of the synchronous motor are energized by an external d.c.
source. The rotor poles obtained in this manner will lock themselves with the rotating
field by the stator and will rotate at its speed; the rotational speed of the stator
magnetic field and the rotational speed of the rotor are therefore identical (slip=0).
Synchronous motors are frequently used when a constant speed has to be
maintained under variable load. With modern frequency converters synchronous
motors can be driven at variable speeds. Synchronous motors with permanent
magnet rotors are becoming more and more common. Stepping motors can be
considered a special case of synchronous motors.

4.8 Control Valves


A control valve consists of a shaped plug mounted on a stem and which moves
up and down within a usually circular seat. The stem is usually moved by air
pressure on a diaphragm opposed by a spring. The spring either opens or closes the
valve depending on the desired state in the event of air supply failure. An electric or
hydraulic actuator can be used to move the stem. The plug and seat and the valve
body design varies to achieve different performances related to the pressure drop,
the type of fluid, and the desired characteristic of the flowrate vs. stem position.
The valve body sizing is normally chosen to match the pipe size where the valve
is located. The selection of valve body type and the sizing of the plug and seat
combination requires taking the following factors into consideration:
• Pressure drop. Large pressure drops across control valves can make it difficult
to move the valve stem. Special body designs divide the flow into opposite
directions through two plug-seat combinations to cancel out the forces. Small
pressure drops require the use of different types of valves, e.g. butterfly valves.
• Maximum flowrate. This should be the maximum design flowrate plus the
maximum control action. The latter should ideally be 30-50 percent of the
4.8: Control Valves 133

design flowrate. An occasional mistake made by some control engineers is to


leave only about 10% as extra control margin, which notably hampers the
performance.
• Rangeability is the ratio of the flowrates for two different stem positions. It is
related primarily to the plug and seat design and the pressure drop vs. flowrate
characteristic, which in its turn often depends on the pump upstream of the
valve. Again, the rangeability must account for the normal range of operating
flowrates with an adequate control margin (preferably 30 to 50 percent) both
below and above that range.
• Sensitivity. This relates to the rangeability and the amount of control action
required to control to the desired accuracy. Occasionally a large valve is
required to set the nominal flowrate and a small valve in parallel is used to
achieve the desired sensitivity.
• Linearity. In a control loop, the objective is to obtain a linear relation in the
sensor output vs. controller output, i.e. in the cascade link: valve - technical
process - sensor. If this control chain does not have a linear input-output
characteristic, it may be compensated for by selection of the valve
characteristic, and occasionally of the sensor characteristic. Without linearity
control loop performance may be poor, or special control circuits may be
required.
• Hysteresis. This is a common problem with control valves due to seal friction
where the stem enters the body of the valve and due to the fluid pressure drop
across the valve. It is a common cause of small continuous oscillations in
control loops. In this case, a valve positioner may be the solution. This is a
special high-gain control loop which achieves the desired stem position by
direct control action. In this way, the process controller does not have to fine-
control the valve opening, but only need to deliver a setpoint reference to the
valve positioner.
flowrate /
maximum flowrate
1.00
0.9

0.8
square root
0.7
0.6
0.5 linear

0.4
0.3 equal
percentage
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1.0
valve opening %
(stem position)

Figure 4.34: Inherent valve characteristics


134 Chapter 4: Physical Process Input and Output

Valve rangeability can be calculated by calculating the two flowrates at values of


e.g. 0.15 and 0.85 in relation to the maximum flowrate. The function f ( x ) is the
inherent valve characteristic. The typical characteristics for commercially available
valves are:
f (x ) = x (linear)

f (x ) = x (square root)

f ( x ) = A ( x − 1) (equal percentage)
(the design constant A has typically a value equal to 20-50). These
characteristics are shown in Figure 4.34. Notice that perfect equal percentage valves
in theory do not close fully. In practice they are designed to approach linear
characteristics at low openings and hence close fully.

4.9 Summary
The measurements of physical process variables takes place with analog, digital
or binary sensors. The type of sensor output signal (analog, binary, pulse train, etc.)
must be chosen properly with respect to the application and its control. Every sensor
must satisfy different requirements, such as:
• the output should vary linearly with the measured variable
• the output signal should be of sufficiently high level
• the sensor itself should not distort the measured value
• the sensor should have small power consumption
• the sensor should be insensible to external effects and disturbances
• the output signal in relation to any given measured value should be the same
and not depend on past sensor operation; consequently, the measured value
shall be univocally determined by the sensor output signal
• the sensor must have an adequate rise time in order to faithfully represent
transients
Some examples of sensors for binary on/off states and for continuously varying
physical variables have been surveyed in this chapter.
For adequate signal transmission the impedances and signal levels along the
line have to be matched so that loading effects are avoided and the full
measurement range is accurately represented.
The principal causes for noise and disturbances on electric lines have been
described, such as
• resistive couplings
• capacitive couplings
• inductive or magnetic couplings

Different ways of eliminating or reducing their effects have been indicated, such
as:
• proper shielding and earthing
• galvanic isolation
4.8: Control Valves 135

• use of twisted cables


• separation of power and signal cables
• signal grounding.

Of the methods to transmit measurement signals, voltage transmission is more


sensitive to external noise than current transmission. The latter is used in industrial
control applications whenever long distances must be bridged. To avoid many of the
problems caused by electrical disturbances, optical signal transmission is becoming
more and more commonplace.
Actuators are the devices that mechanically act on the physical process by
converting electrical energy into the required type of control output. Similarly to
sensors, also actuators have to be adequately chosen for the desired purpose.
Actuators can be binary, digital or continuous; the actual type for a given application
is selected by considering factors such as the desired output power and operation
speed. In this chapter was also treated the electrical-mechanical energy conversion
using d.c. motors, induction (asynchronous) motors, synchronous motors and
stepping motors. Many actuators are complete control systems in themselves; some
velocity and position servomechanisms include also their control units. In other cases
the control loops can be realized in the process computer.

Further Reading
There are many good general books on measurement and instrumentation
technology. [Doebelin 1990] is an outstanding reference with detailed descriptions of
most sensor types. Other good texts are [Alloca / Stuart 1984] and [Barney 1988].
For sensor and actuator applications in computer process control [de Silva 1989]
is an excellent textbook. [Derenzo 1990] describes several introductory laboratory
exercises for computer interfacing and represents a well suited reference for a
course on this subject. [Sargent / Shoemaker 1995] has since long become a
„classic“ for the PC interface technology and is recommended for everybody who
wants to do more with a computer than just write programs.
The measurement of force is described in [Norton 1989] and the principle of
Coriolis sensors in [Vögtlin / Tschabold 1990]. [Pessen 1989] offers a good survey of
binary sensors, actuators and circuits in both electric and pneumatic technology; this
textbook also contains several further references to this area. Photoelectric sensors
are described in detail by [Juds 1988].
Also actuators represent a whole discipline in themselves. [Fitzgerald / Kingsley /
Umans 1990] is a standard book on electrical machinery. [Leonhard 1985] gives a
more specific treatment of the control of electric drive systems and [Kenjo /
Sugawara 1994] represents a key reference on stepping motors. A modern and
comprehensive treatment of power electronics and its application for motor control is
[Mohan / Undeland / Robbins 1995].
Operational amplifiers are such important circuit components that there is a large
number of specialized literature on the subject. Among others will be mentioned
[Glasford 1986], [Hufault 1986], [Irvine 1994] and [Jones 1986]. The techniques for
grounding and shielding are described further in [Morrison 1986] and [Ott 1988].
[Wilson / Hawkes 1989] gives a good survey on optoelectronics.
5 Signal Processing

Aim: Description of the basic issues in signal conversion between analog and
digital form and of the fundamentals of analog and digital signal processing

Overview
The generation of measurement signals by sensors and their transmission in
analog form on a conductor were discussed in Chapter 4. The present chapter is
dedicated to how the collected data is fed to and processed by the control computer.
The different components in the computer input and output interface are presented
in Section 5.1. The key question of this chapter is signal sampling, i.e. how to
represent analog signals, that as such cannot be processed by a computer, in a
series of values at discrete points in time. This section deals also with the
components for sampling, i.e. the sample-and-hold circuit and the multiplexer. The
conversion of analog signals to digital and of digital signals to analog form represents
the principal problem of the interface between the computer and its sensor and
actuator environment. This is the argument of Section 5.2.
Before any continuous signal can be sampled, it must be ensured that it contains
only frequencies that are relevant with the actual measurement and that all irrelevant
or undesired frequency components (like e.g. high-frequency noise) are removed or
attenuated. Analog filters are used for this purpose; they are examined in Section
5.3.
After the analog signal has been converted to digital form, digital filtering
provides a further means to extract interesting information from the signal (Section
5.4). With help of digital filtering the non-relevant components of the input signal can
be reduced. Some preliminary tests of the measurement signal after its conversion in
digital form are necessary in order to guarantee the quality and consistency in the
measurement values. The most important of such tests are drawn up in Section 5.5.

5.1 The Sampling of Analog Signals


5.1.1 Interfacing Analog Signals to a Computer
The different functional components of the computer input and output is shown
in Figure 5.1.
A signal delivered by a sensor must be filtered before it is fetched into the
process computer, in order to reject any undesirable frequency components. In
particular it is necessary to eliminate high-frequency noise (that is usually collected
by the sensor cabling) before the signal is entered to the computer for further
processing. After having been filtered, the measurement signals are concentrated to
a multiplexer. This device is used to select one out of several input signal for further
processing. The actual function of the multiplexer is to allow the following processing
units, that are quite expensive to build, to operate with several signals. This
contributes to reduce system costs. The conversion of the analog signal in a digital
value takes place in the analog to digital (A/D) converter. The sample-and-hold circuit
stores the instant value of the input signal at predefined times and keeps the output
signal constant between the sampling instances. Before a measurement value can

136
5.1: The Sampling of Analog Signals 137

be used for further processing in the computer, additional tests have to be carried
out to make sure that the value is acceptable and makes sense in relation to the
physical process.

process computer
input signal digital additional output signal
test filtering processing test

A/D- computer computer D/A-


conversion input output conversion

multiplexing

analog analog
filtering filtering

signal signal
conditioning conditioning

sensors physical / actuators


technical process

Figure 5.1: Overview of the process computer input and output

5.1.2 Multiplexers
In many situations different components have to share a limited resource like the
input interface of a computer or a long measurement cable. This is also the case
when several input signals from different sensors must be transmitted on the same
physical channel. With multiplexing, the computer selects which signal has to be
fetched and read at any time. Simply stated, the multiplexer is a switch that
connects the computer with only one sensor at any given time (Figure 5.2).
Multiplexing is not limited to measurement signals but also plays - albeit in a different
way - an important role in communication (Section 9.4.2).
A multiplexer can be either electromechanical or electronic and operates more or
less like a switch. The switching order is usually sequential, but can also follow other
principles. An electromechanical multiplexer built with reed relais is a durable,
138 Chapter 5: Signal Processing

although somewhat slow system; it can perform up to about hundred switching


operations per second. The operating life of this type of multiplexer is naturally
limited because of the moving parts, on the other hand such a system shows good
isolation properties and has a low cost. Another important factor is that the voltage
drop over the contacts is very low. In comparison, a solid-state multiplexer is much
faster (a switching operation takes no longer than a few microseconds). In
combination with an isolation amplifier (Section 4.5.1) this type of multiplexer shows
very good operating characteristics, but it is more expensive than the relay
multiplexer.
Current leakage and voltage surges at the inputs of a multiplexer can represent
a serious problem. An isolation amplifier between a sensor and the computer input
works with differential input voltages, but the signal potential can „drift“ in relation to
the ground potential. In this case the conductors to the multiplexer or to the A/D
converter must be galvanically isolated, e.g. with a flying capacitor (Example 4.9 in
Section 4.5.3).

reference
clock

input channels for


analog signals

A/D converter with digital


sample and hold output data
circuit

analog
multiplexer

Figure 5.2: Multiplexing and A/D conversion of measurement signals

5.1.3 Signal Sampling


It was already described in Section 3.4 how analog signals cannot be read
continuously into the computer and instead are fetched only at intermittent intervals.
A signal is therefore represented in the computer by a sequence of discrete values.
Sampling is the operation of reading a signal only at determined instances in time; in
the computer sampling is performed by a special circuit. Sampling includes
multiplexing and the A/D conversion; these operations must be properly
synchronized under the control of a reference clock (Figure 5.2).
Sampling itself takes only a very short time. However, during the A/D conversion
time there should not be any variations in the input signal that could affect the digital
output. This is ensured by performing a sample-and-hold operation during each
sampling period. The value of an analog signal is read at the beginning of each
sampling period and remains constant throughout the whole following conversion
time. This operation is called zero order hold (Figure 5.3). A similar „sample-and-
hold“ operation was used in the numerical simulation of non-linear systems (Section
3.3.7) and in the time discretization of continuous dynamic systems (Section 3.4).
5.1: The Sampling of Analog Signals 139

measurement output
40
value (sampled) signal

sampled values
30

input signal
20
h
sampling
10 interval

0
0 1 2 3 4 5 6 7 8 9 10 time

Figure 5.3: Sampling of a continuous signal with zero-order hold

A sample-and-hold circuit is shown in Figure 5.4. Its operation is controlled by a


switch. At the sampling instants (S) the switch is closed, so that the capacitor C is
charged to the actual value of the input signal voltage. In the hold condition (H) the
switch is opened; the output of the operational amplifier is then in the ideal case
constant and equal to its last output value at the instant when the switch was still
closed.
The sampled signal is delayed by about half a sampling period h in relation to
the continuous signal. If the sampling operation is performed as a part of a wider
control system, the sampling delay may cause a phase lag and result in smaller
stability margins for a time-discrete controller in comparison with a corresponding
continuous controller (Section 6.5.2).

H
+
-
- S
vi + vo

mode
control

Figure 5.4: Sample-and-hold circuit with unit amplification


In sample mode (S) the output signal amplitude is equal to the instant value of
the input signal, v o = v i . In hold mode (H) the output is constant and equal to
the last output value when the circuit was still operating in sample mode.
140 Chapter 5: Signal Processing

5.1.4 Selection of the Sampling Time


The selection of the correct sampling time for a continuous signal is very
important and represents a non trivial problem. The sampling interval h has to be
sufficiently short so that the continuous signal variations are truthfully described by
the sampled discrete time signal. Theoretically, the sampling frequency should be
equal to or higher than twice the highest frequency component in the signal to be
sampled (the frequency component is determined via a Fourier analysis on the
original signal). If the sampling time is too long - i.e. the sampling frequency too low -
the computer will get a wrong picture of the original signal. A too short time interval -
i.e. an high sampling frequency - is not good either, because the process computer
would have to perform unnecessarily many operations on each new sampled value.
The faster sampling units are in general also more expensive.
Since after sampling nothing can be known about the real original value of the
measurement signal between the sampling points, the sampling period has to be so
short that the original signal does not change significantly in the meantime. In other
words, the sampling frequency has to be sufficiently high so that the continuous
signal can be reconstructed from the sampled signal. The lower limit of the sampling
frequency is related to the process dynamics, i.e. how fast the measurement signal
and consequently the original physical quantity changes in time. The key issue with
sampling is therefore to collect from the original signal sufficient information to be
used in signal processing, for instance to generate the necessary output signals in
closed-loop process control.
The choice of the sampling time is illustrated here with some examples. For sake
of simplicity the discussion is limited to sinusoidal signals. The examples are
however valid for signals of any form, as long as these signals can be decomposed
in their sinusoidal terms, e.g. by Fourier analysis.

Example 5.1.a Sampling of a sinusoidal signal


Let´s consider an analog, sinusoidal signal (sine wave) with frequency f ; this
signal is sampled at the frequency f s . If the signal is sampled six times per cycle a
smooth curve through the sampling points is close to the original continuous curve
and the observed frequency fo does not differ from the true frequency f (Figure
5.5). If the signal is sampled only three times per cycle, a smooth curve through
the sampling points is a less reliable representation of the original signal, but the
observed frequency fo is still equal to the true frequency f .
If the original signal is sampled only 5/4 times per cycle (i.e. 5 times during 4
cycles), a smooth curve through the sampled points also appears to be a sine
wave (Figure 5.6), but the observed frequency fo is only f 4 , i.e. much lower than
the original frequency f . The false frequency is the difference between the
sampling frequency [ 5f 4 ] and the real frequency f . This false frequency is
known as alias frequency.
5.1: The Sampling of Analog Signals 141

0.5

-0.5

-1
0 1 2 3 4 5 6 7 8
time

0.5

-0.5

-1
0 1 2 3 4 5 6 7 8
time

Figure 5.5: If the sine wave is sampled six or three times per cycle, the observed
frequency is equal to the true frequency

reconstructed signal apparent signal


original signal (first-order hold)

0.5

-0.5

-1
0 1 2 3 4 5 6 7 8
time

Figure 5.6: If the sine wave is sampled five times in four cycles, then a sine wave at
much lower frequency than that of the original wave is observed.

We notice the following effect: if the sampling frequency is too small in relation to
the frequency components of the original signal, then a false frequency (the alias
frequency) appears in the reconstruction of the original signal, as shown in Example
5.1.a. The observed (alias) frequency fo is the difference between the sampling
frequency f s and the real frequency f :
fo = fs − f
142 Chapter 5: Signal Processing

The frequency of the reconstructed signal (observed frequency) is the same as


the original, real frequency as long as the sampling frequency is sufficiently high, i.e.
f s > 2 ⋅ f . For f s ≤ 2 ⋅ f , the observed frequency drops linearly and reaches zero at
f = f s , i.e. one sample per cycle. If the sampling frequency f s is exactly 1 sample
per 1,2,3,4,... cycles, then the original signal is obviously sampled always with the
same phase relation, and for a regular signal always the same value would be
delivered; in other words the observed frequency becomes zero. The relation
between the observed (reconstructed) and the real frequency looks like a sawtooth
curve (Figure 5.7).

observed f0 /fs
frequency
f [Nyquist frequency]
N
0.5

0.5 1 1.5 2 2.5 f/fs


true frequency

Figure 5.7: The apparent frequency fo as function of the true frequency f for a sinewave
signal sampled at the frequency f s . The apparent frequency is equal to the true
frequency only if f / fs < 0.5 , i.e. f s > 2 ⋅ f .

It appears that for a sampling frequency f s lower than twice of the original
frequency f the real frequency can no longer be reconstructed from the sampled
values. The limit frequency f = f s / 2 is called Nyqvist frequency, f N :
fN = fs / 2 (5.1)
If the continuous signal contains any frequencies above f N = f s 2 , these high
frequency components will appear in the sampled data sequence as waves of lower
(alias) frequency. Frequency aliasing is avoided only if the original signal is sampled
at a frequency at least twice as high as the highest frequency component in the
signal. This is the essence of the sampling theorem.
In practice the sampling frequency has to be higher than what the sampling
theorem states. The sampling theorem is based on the assumption that the original
signal is periodic and is sampled for an infinite time. Since this is obviously not the
case in a real control system, a higher sampling frequency is needed to collect
enough information to adequately describe the signal for its later reconstruction.
Moreover, there is no theorem that gives a lower limit for the sampling rate when the
signal is not periodic. Some practical rules for the selection of sampling frequency in
closed-loop control systems are discussed in Section 6.5.2.
Analog signals usually contain high-frequency noise components. The sampling
frequency must then be selected in relation to the highest frequency component
present in the original signal. All frequencies above the Nyqvist frequency must be
removed from the signal before sampling, otherwise they will appear as alias
frequencies in the sampled signal. This principle is sometimes stated so that all
frequencies of interest must be lower than the Nyqvist frequency. This is obviously
5.1: The Sampling of Analog Signals 143

not correct, because all frequencies above the Nyqvist frequency contribute to
aliasing, independently of whether they are of interest or not. If high-frequency noise
signal is superimposed to a low-frequency signal, sampling at a frequency that has
been defined in relation only to the low frequency signal will produce distorted values
because of the aliasing effect between the unwanted component and the sampling
signal. The higher frequency components can be attenuated or removed with an
analog low-pass filter (called anti-alias filter), as described in Section 5.3.1 and 5.3.2.

Example 5.1.b: Sampling of an analog signal


On sampling a sinusoidal signal 5/4 times per cycle (ref. Example 5.1.a), the
alias frequency f 4 and the real frequency f lie symmetrically around the Nyqvist
frequency f N = f s 2 = 5f 8 , i.e.
fN − ∆f = 5f 8 − 3f 8 = f 4 (alias frequency)

fN + ∆f = 5f 8 + 3f 8 = f (real frequency)
After sampling, there is no way to correct the collected data, so that frequency
f cannot be distinguished from its alias frequencies f + n ⋅ f s . Thus any of the alias
frequencies
f s − f , f s + f , 2 ⋅ f s − f , 2 ⋅ f s + f ,2 (5.2)
may appear, if the frequency f of the original signal is higher than the Nyqvist
frequency f N = f s 2 .

Example 5.2 Distortion due to aliasing


The distortions due to aliasing will be illustrated here with an example. A white
disc with a black spot on its border rotates at different speeds; this disc is
illuminated by a stroboscopic lamp which emits short light flashes at a given
frequency, say once per second. Thus the spot can be seen only intermittently.
If the disc rotates clockwise 10° per second, the black spot will be seen at the
positions 0°, 10°, 20°, … etc. Similarly if the disc rotates counterclockwise, the spot
can be seen at the positions 0°, 350°, 340°, … etc. If the rotation speed is
increased, the spots will be seen farther apart from each other.
If the disc rotates at 180° per second, the spot is only visible at the positions 0°
and 180° and it is no longer possible to determine the direction of rotation. If the
disc rotates clockwise at even higher speed, e.g. at 215° per second, then after the
position 0° the spot will appear at the same position as for a counterclockwise
rotation at 145° per second. This can also be expressed as 145°+ n ⋅ 360°
( n =1,2,...) per second.
The angular speed of 180° per second corresponds to the Nyqvist frequency.
The real frequencies that lie equally above or below the Nyqvist frequency
( f N ± ∆f ) appear in such way as if they were the same frequency (compare with
Figure 5.7). The observed (sampled) frequency is small near multiples of the
sampling frequency ( f s , 2 ⋅ f s , 3 ⋅ f s , etc.). Thus 10°, 350° and 370° per second
appear after sampling as to be the same frequency.
144 Chapter 5: Signal Processing

The sampling of sinusoidal signals in Example 5.1.a is analogous to the


rotating disc. The sine function is the projection of the spot on a vertical axis and
the rotation direction clockwise or counterclockwise corresponds to different
phases for the sinusoidal signal.
In old western movies wagon wheels are often seen to slowly rotate
backwards. This is an optical illusion caused by aliasing. The film „samples“ 24
times per second. If a wheel has N spokes, it appears to stand still if it rotates at
precisely 1/N (or a multiple) revolutions in 1/24 seconds. If the wheel rotates
slightly faster, then it appears to rotate slowly forward; correspondingly the wheel
seems to rotate slowly backwards if the rotational speed is slightly less than 1/N.
Also the flickering of some computer screens when shown on TV is due to a
mismatch between their screen refresh rate and the „sampling“ frequency of the
TV camera.

Example 5.3 Selection of the sampling frequency for sludge


concentration measurement in a sedimentation unit
This example illustrates how several factors can influence the choice of the
sampling rate. In the activated sludge process (Section 2.4.2) the solid
components are separated from the liquid mass in the sedimentation unit, in which
the thickened sludge falls to the bottom. Since most of the sludge will be
recirculated and re-used in the process, it is important to know its concentration.
This value usually varies quite slowly; for a significant change in the concentration
is typically necessary a time in the range from minutes to hours. Therefore a
sampling interval of about 30 minutes seems to be adequate. Some experimental
values from a sedimentation unit are shown in Figure 5.8.

relative
concentration
1.0

0.5

10 20 30 40 50 60 time,
minutes
Figure 5.8: Measured concentration values for the settled sludge in a sedimentation unit

The concentration shows significant peaks about every 12 minutes. These


peaks are not justified by anything in the physical process. They are actually
caused by a scraper that rotates on the bottom to remove the sludge through a
valve. The rotation period of the scraper is 12 minutes. Every time the scraper
passes near the bottom valve, the sludge is compressed against the sensor that
then indicates an higher concentration of suspended solids. In this case an
adequate sampling time should be in the order of few minutes, and the correct
sludge concentration would have to be calculated as the average value over a 30-
minutes interval.
5.1: The Sampling of Analog Signals 145

Example 5.4 Aliasing due to a.c. power cables


A.c. power signals at 50 Hz or 60 Hz can be picked up from power cables by
signal wires and overlap the original measurement signal (Section 4.5.3). If a
measurement signal with noise at 50 Hz is sampled at a frequency f s = 60 Hz ,
then an alias signal will appears because the Nyqvist frequency is smaller than 50
Hz. In this case the alias frequency has the value 60-50=10 Hz. A similar problem
is shown by the example in Figure 5.9.

1
original signal

0.5

0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
time

original signal with


0.5 superimposed oscillatory noise

0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
time

0.5 sampling of signal with noise

0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
time

signal reconstruction from


0.5 the sampled data vs. the
original signal (dashed)

0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
time

Figure 5.9: Sampling of a measurement signal with a noise component at higher


frequency. The sampled and reconstructed signal contain oscillations that are
not present in the original signal.
146 Chapter 5: Signal Processing

5.2 Conversion between Analog and Digital Signals


5.2.1 Digital-Analog Conversion
The conversion from a digital to an analog signal, i.e. the generation of an
analog signal with a voltage level corresponding to digital value in input is an
important step in many processes. In this way a computer can produce a control
signal for an actuator or to be used as reference value by a controller. The digital-
analog conversion is also a necessary step in the opposite operation, the analog-
digital conversion.
An ideal digital-analog converter (D/A converter, DAC) produces an analog
output signal with a value in linear relation to a n -bit digital input. In the most
common design the single bits of the input word control different potential levels
generated with a resistor ladder (Figure 5.10). The values of the resistors are
selected in such a way to produce voltages of 1/2, 1/4, …, 1 / 2 n in relation to a
reference potential. These values are added under the control of the input bits and
then amplified. A D/A converter can also be designed to produce a current output.
The switches s1, …, s n represent either a digital 0 or a 1 and are controlled by
the digital input value. The output voltage is composed by successively smaller
terms:
s s s 
v o = −v ref  1 + 2 +2+ n 
 21 2 2 2n 
In an 8-bit D/A converter the Byte 01011001 results for example in the output
voltage ( v ref = -10 V):
v o = v ref ⋅ (1 / 4 + 1 / 16 + 1 / 32 + 1 / 256) ≈ −3.48 V

It appears clearly that the D/A converter delivers only discrete output values; the
resolution is equal to v ref ⋅ 2 − n .

2R
1 n-1
2
sn 0
R
2R
1 2n-2
s 0
R n-1 R

vref = 2R -
1
s 21 + vo
R 2 0
2R
1
s 20
2R 1 0

Figure 5.10: Digital-analog (D/A) converter with a resistor ladder


5.2: Conversion between Analog and Digital Signals 147

One functional aspect to take in consideration is that if the input word changes
value and the corresponding bit switches in the D/A converter do not change state all
at the same time, an unwanted transient spike at an incorrect value may occur in the
analog output (glitch). A possibility to avoid this problem is to cascade the D/A
converter with a sample-and-hold circuit that holds the output constant until the
switches settle (deglitcher).
The most important properties of the D/A converter that should be considered in
its selection or design are the following.
• Linearity: to what extent the relation between the digital input and the output
voltage is linear, alternatively the amount of the deviation due to non-linearity.
• Offset error: the value of the output voltage when the digital input is zero. It
should always be possible to adjust this value e.g. with a potentiometer or
under software control.
• Settling time: the time necessary for the output voltage to settle to a new
constant value.
• Slew rate (expressed in V / µs ): the maximum rate of change of the output
voltage. The slew rate depends on the settling time.

5.2.2 Analog-Digital Conversion


After sampling, the analog measurement values must be transformed in digital
form in order to be processed by computers. This is done in the analog-digital
converter (A/D converter, ADC). An A/D converter generates a binary word, the
digital output, from an analog input signal. A/D converters are for example available
in boards to be installed in common computer systems.
A/D converters can function according to different principles; two widespread
operational methods are the parallel comparation and the incremental
approximation. In an A/D converter working by comparation the input voltage is
compared with different voltage levels generated from a known reference voltage
and a resistor ladder (Figure 5.11). The output of each comparation circuit is either 0
or 1 and depends on the relative levels of the input and reference voltages. The
output of the comparators are then converted digitally in binary code. The operation
of this A/D converter is fast, but its design is quite expensive because of the
comparators.
An A/D converter working by incremental approximation is built around a D/A
converter (Figure 5.12.a). The input signal range is divided into 2 n − 1 intervals, with
n the number of bits in the output word. A counter generates in quick sequence
digital numbers that are directly converted to an analog value. The counter continues
to increment the output until the difference between the analog output voltage of the
D/A converter and the analog input value is smaller than the conversion resolution
(Figure 5.12.b). The conversion by incremental approximation requires a certain time
that depends on the D/A conversion time as well as on the actual input value.
Generally speaking, the conversion time for the D/A conversion is in the nanosecond
range and for the A/D conversion instead in the microsecond range; for a typical A/D
converter the conversion time may be between 0.5 and 400 µs. The conversion
resolution is typically 10-12 bits, i.e. 1023 or 4095 voltage intervals; the input signal is
therefore discretized in the related fraction of the full input value. Some characteristic
parameters are defined in the same way as for the D/A converter: resolution, offset
error, linearity and conversion time.
148 Chapter 5: Signal Processing

- logical circuit /
+ code conversion

R
-
+
digital
output
v in R -
+
=
vref R -
+

R comparators

Figure 5.11: Schematic drawing of an A/D converter with parallel comparation circuits

+
digital counter
-
comparator
digital
output
v
in

analog output
D/A converter

(a) = vref

vref maximum input value


1010 (conversion range)
1001
input 1000
voltage vin 0111
0110 the counting is interrupted when
0101 the input value is reached
0100
0011 result = 0111
0010
(b) 0001
0000
time / output value

Figure 5.12: A/D converter operating by incremental approximation. (a) Schematic drawing;
(b) function principle.
5.2: Conversion between Analog and Digital Signals 149

In the operation of a A/D converter it is important to make sure that the


conversion resolution is fully utilized. In practical operations it seldom happens that
the converter input signal (i.e. the sensor output) varies between 0 and 100 per cent
of its full range; variations in a range of 10-20 percent represent rather the norm. If
for example a signal varies within 5 per cent of its full theoretical range and is input to
a 10-bit A/D converter, the actual input signal range would result to be 5 per cent of
1023, or about 50 voltage intervals. Thus the digital resolution would be only 1/50 of
full range, i.e. 2 per cent (Figure 5.13.a). If instead the A/D converter is made to
indicate 0 at 20% and 1023 at the 25% of its input signal, then the resolution
becomes much better, namely 1/1023, or 0.1% of the sensor range.

R2
100%

Ri
vi -
max vref
+ vo
min
R1
0%

-vref
(a) (b)

Figure 5.13: (a) The full range of the A/D converter (0-100%) should be used. (b)
Adjustment of the offset voltage with R1 and of the amplification gain with
R2 .

In order to exploit the full range of the A/D converter, both the gain and the offset
voltage of the input analog signal have to be adjusted. This can be done with an
operational amplifier (Figure 5.13.b). The offset voltage is adjusted with the variable
resistor R1 so that the d.c. amplifier output level corresponds to the minimum input
level of the converter when the input signal also is at minimum level. The variable
resistor R 2 is used to adjust the gain, so that the amplifier output level for the
maximum input signal is the same as the maximum input value for the A/D converter.
When 4-20 mA signal current transmission is used, a broken connection can be
detected by a 0 mA signal (Section 4.5.5). An A/D converter can also be used to
indicate if a sensor is out of operation. If the A/D converter is calibrated in such a
away that the maximum input signal (e.g. 20 mA) is represented by say 4000 instead
of 4095 in a 12-bit converter, then the highest values of the output word can be used
to indicate exceptional operational and error states. This requires however some
extra electronic circuitry and processing capacity.
A simple method to recognize when a sensor is disconnected is realized with a
switch and a constant voltage source. The voltage must be somewhat higher than
the maximum sensor output voltage or, in case of a current loop, higher than the
voltage level corresponding to the current value 20 mA. The switch is placed before
the multiplexer (Figure 5.14).
150 Chapter 5: Signal Processing

switch
sensor 0-1 V
channel 1
1
sensor 0-1 V
channel 2
2
multiplexer A/D
converter
sensor +1.1 V
channel n
n

= external
voltage source 1.1V

Figure 5.14: Indication of an off-line sensor:


Channel 1 switch ON: sensor connected. Channel n switch OFF: sensor
disconnected.

In the ON position the multiplexer input is connected to the sensor and the
terminal resistor, the input signal corresponds therefore to the measurement value.
In the switch OFF position the multiplexer input is connected to the external voltage
source. When the sensor is not operating (e.g. during service or calibration) the
switch is turned OFF and the A/D converter output will exceed the normal range. The
process computer can identify this situation as an indication that the sensor is off-
line.

5.3 Analog Filtering


Filtering is used to reduce certain frequency components of a signal. Filtering
can be realized analogally with help of electronic circuits as well as digitally, by
processing the sampled signal values after the A/D conversion. The most important
condition for effective filtering is that the frequency bands of the signals to be
separated are different. Most often filtering is used to eliminate noise and
disturbances and to regain a signal as close as possible to the original one. In
practice, however, filtering makes sense only when the original signal has been
protected from the very beginning against the influence of external disturbances, e.g.
with some of the methods outlined in Section 4.5.
The two fundamental parameters of analog filters are the bandwidth and the
corner frequency. The bandwidth (or passband) is the range of frequencies that can
pass the filter unchanged. The corner or cutoff frequency is the frequency at which
the signal amplitude is attenuated by a factor of 1 2 , corresponding to a power
attenuation of 1/2, compared with the bandwidth region.
A low pass filter is designed to let through frequencies below the corner
frequency and attenuate higher frequencies. This filter is used to eliminate or reduce
those frequency components that can produce the aliasing effect and is therefore
also called anti-alias filter. A high pass filter is designed to let high frequencies
though and attenuate low frequency components. Band pass filters let through only
frequency components that lie between two limit cutoff frequencies.
5.3: Analog Filtering 151

5.3.1 First Order Low Pass Filters


The simplest form of an analog low-pass filter is a passive RC circuit (see
Example 3.4, Section 3.2.2). The filter is described by the first order differential
equation:
dv
T ⋅ o = −v o + v i (5.3)
dt
where T = RC , v o is the output voltage over the capacitor and v i the input
voltage (Figure 3.4). The filter has unit static gain, i.e. v o = v i when the derivative is
zero. From the Laplace transform of Equation 5.3 can be obtained the transfer
function of the filter:
Vo (s ) 1 1
G (s ) = = = (5.4)
Vi (s ) 1 + sRC 1 + sT
In Example 3.4 it was shown that the output amplitude for a sine wave input will
1 + (ωRC) 1 + (ωT ) . The static gain is 1 as
2 2
drop by a factor of 1 / = 1/
expected. The cutoff frequency (for which the attenuation is 1 2 ) is
1 1
ωc = = (rad s -1 ) or
RC T
ωc 1 1
fc = = = (Hz) (5.5)
2π 2πRC 2πT
By inserting fc in Equation 5.4, the result is that the filter attenuates the signal
amplitude with the factor:
1 1 1
G = = =
1 + jωRC 1 + j (f / fc ) 1 + (f / fc ) 2
Considering the time domain, a stepwise change of the input voltage will result in
an exponential increase of the output voltage amplitude of the low pass filter, with the
time constant RC seconds (see Example 3.4). For sinusoidal input signals, i.e. the
attenuation above the cut-off frequency is proportional to the increase in frequency
(Figure 5.15).
corner frequency
log vo

fc log f

passband reject band

Figure 5.15: Frequency characteristic of a first-order low pass filter


152 Chapter 5: Signal Processing

An active low pass filter is realized by a RC feedback circuit around an


operational amplifier (Figure 5.16).
C

R2
vi -
R vo
1
+

Figure 5.16: Operational amplifier with RC-feedback. Under ideal conditions this circuit
operates like a first-order low pass filter.

In general the frequency dependent gain G( jω ) = v o / v i for an ideal operational


amplifier with a negative feedback network can be expressed by the ratio of the
feedback impedance to the input impedance. For the RC filter, the feedback
impedance (C in parallel with R 2 ) is R 2 / ( 1 + jωR 2C ) . This results in the following
expression for the output voltage gain:
v o ( jω ) R2 1
G( jω ) = = ⋅
v i ( jω ) R1 1 + jωR2C

The frequency dependence is the same as for the passive filter, but the
amplitude gain can be chosen by resistors R1 and R 2 . In practice, however, an
active filter based on an operational amplifier is not a perfect first order filter. The
reason is the limited slew rate of the amplifier, i.e. the maximum rate of change of
the amplifier output voltage for stepwise changes of the input voltage. This means
that very fast signals may slip through the filter, because the operational amplifier
does not react to them fast enough. A more practical solution is to filter the signal in
a passive low pass filter first (see Figure 3.4) and to amplify it later on.

Example 5.5 A passive RL low pass filter


A resistance-inductance (RL) circuit acts as a low pass filter (Figure 5.17).
Kirchoff´s voltage law applied to the circuit gives:
vi − vL − vo = 0
where the inductor voltage v L is expressed by v L = L( di / dt ) and the current
i = v o / R . By replacing v L and i , the Equation (5.3) for the low pass filter is
obtained:
dv o
T⋅ = −v o + v i
dt
with T = L/R.
5.3: Analog Filtering 153

The transfer function is similar to Equation (5.4):


Vo (s ) 1 1
G (s ) = = =
Vi (s ) 1 + s(L / R ) 1 + sT
and the cut-off frequency is fc = R / 2πL (Hz) .
The frequency dependence is similar to that of the RC filter. Those signal
components with frequencies much higher than the cut-off frequency are „choked“
by the inductance and appear at the filter output much reduced in amplitude.

vi R vo

Figure 5.17: A passive, first-order RL low pass filter

5.3.2 Higher Order Low Pass Filters


Sometimes the slope of the characteristics of an RC filter is not sufficiently high
in the high frequency region, which means that high frequencies are not efficiently
cut off. A second order low pass filter has a response slope at high frequencies that
is twice as high as that of a first order filter (Figure 5.15); the attenuation factor is the
square of the increase of the input signal frequency. This means that for a tenfold
increase of the input signal frequency, the attenuation factor would be 100 times
higher. Such a filter is therefore more efficient at removing undesired frequency
components.

Example 5.6 A second order lowpass filter


The second-order low pass filter of Figure 5.18 has two independent corner
frequencies, fc1 and fc2 .
The frequency dependent voltage gain is:
v o ( jω ) R3 / (R1 + R2 )
G( jω ) = =
v i ( jω )  1 + (f / f ) 2   1 + (f / f ) 2 
 c1   c2 

R1R2 1
where fc1 = and fc2 = . If the corner frequencies are
2π (R1 + R2 ) ⋅ C1 2πR 3 C 2
equal (fc = fc1 = fc 2 ) , then the magnitude of G is:

R3 / (R1 + R2 )
G =
1 + ( f / fc )
2
154 Chapter 5: Signal Processing

At the corner frequency fc the input signal amplitude is attenuated by a factor


of 2.
C2

R3
vi -
R1 R2 vo
+
C1
R4

Figure 5.18: A second-order active low pass filter

A Butterworth filter has a flat frequency response below a characteristic


frequency f 0 . Due to the fact that it transmits signal amplitudes faithfully, this filter is
popular as anti-alias filter. The Butterworth filter can be realized as a special case of
a filter known under the name Sallen-Key. A second order version of such a filter is
shown in Figure 5.19. For a Butterworth filter the electronic components must satisfy
the relations 2πRC1f 0 = 2 and 2πRC2 f 0 = 2 2 respectively. Higher order filters
(4,6,...) use cascaded stages of second-order filters.

C1

R R
vi -
vo
+
C2

Figure 5.19: A Sallen-Key second-order low pass filter with gain factor = 1

5.3.3 High Pass Filters


It might be guessed that by interchanging the capacitance and resistance in the
circuit of Figure 3.4 or the inductance and resistance of the circuit of Figure 5.17, the
resulting circuits would be high pass filters (Figure 5.20).
Following the same procedure as in Example 3.4 for a high pass RC filter, the
output voltage v o can be expressed as:
dv o dv
T⋅ = −v o + T ⋅ i (5.6)
dt dt
5.3: Analog Filtering 155

where T = RC. Its transfer function is:


v ( s) sRC sT
G( s ) = o = = (5.7)
v i ( s ) 1 + sRC 1 + sT
The frequency dependent voltage gain of the high pass filter is expressed by:
v o ( jω ) jωRC ωRC ωT
G ( jω ) = = = =
v i ( jω ) 1 + jωRC 1 + (ωRC)
2
1 + (ωT )
2

This circuit will block low frequencies and let through high frequencies, as shown
in the frequency diagram (Figure 5.21).

C R

vi R vo vi L vo

(a) (b)

Figure 5.20: (a) Passive RC high pass filter; (b) passive RL high pass filter

corner frequency
log vo

fc log f

reject band passband

Figure 5.21: Frequency characteristic of a first-order high pass filter

The corner frequency fco is the frequency at which the amplitude drops by a
factor 1 2 compared to the high frequency gain. The expression for fco is fco =
1 / ( 2πRC) = 1 / ( 2πT ) (Hz). The voltage gain can be written as

G =
(f / fco )
(5.8)
1 + ( f fco )
2
156 Chapter 5: Signal Processing

In the same way as for the active low pass filter, also an active high pass filter
can be realized by feedback around an operational amplifier (Figure 5.22).

C R2
vi -
R vo
1
+

Figure 5.22: Active first-order high pass filter

The frequency-dependent voltage amplification ratio of the active high pass filter
is the ratio between the feedback and the input impedance:
− jω ⋅ R 2 C ω ⋅ R 2C
G = =
1 + jω ⋅ R1C
1 + (ω ⋅ R1C)
2

All operational amplifiers have a limited bandwidth, resulting in a gain decrease


at high frequencies. Strictly speaking, all active high pass filters are actually band-
pass filters, as they amplify signals within a central frequency band and dampen
signals that lie in the high and low reject bands.

Example 5.7 A passive RL high pass filter


The passive high pass filter shown in Figure 5.20.b is defined by its differential
equation derived from the Kirchoff voltage law:
dv o dv
T⋅ = −v o + T ⋅ i
dt dt
which is identical with Equation (5.6), if T is defined as T = L/R. The transfer
function is:
v ( s) sL sT
G( s ) = o = =
v i ( s ) R + sL 1 + sT
and the frequency dependent gain:
Vo ( jω ) jωL ω ( L R) ωT
G ( jω ) = = = =
Vi ( jω ) R + jωL
1 + ( ω ( L R )) 1 + (ωT )
2 2

The corner frequency is fco = R ( 2πL) = 1 2πT (Hz). By using this definition of
fco , the voltage gain can be written as Equation (5.8).
5.4: Digital Filtering 157

5.4 Digital Filtering


After analog filtering, A/D conversion and data input in the computer, digital
filtering offers further possibilities for signal processing. Digital filtering provides a
great deal of flexibility, since the filter characteristics can easily be changed by
setting a few parameters in the computer. Unlike their analog counterparts, digital
filters can operate very well also with long time constants.

5.4.1 General Structure of Digital Filters


A digital filter has the general form:

[ ] [ ] [ ]
y (kh ) = −a1 ⋅ y (k − 1)h − a2 ⋅ y (k − 2)h −2−an ⋅ y (k − n )h +
(5.9)
[
+ b0 ⋅ y (kh )+2+ bm ⋅ y (k − m )h ]
where h is the sampling interval, y the filtered output and y the input
measurement value. Note that the argument kh is a time value but can also be
considered as a simple integer pointer ( k ) to the input value sequence. If all the
coefficients a i are equal to zero, the filter is called Moving Average (MA) with a
finite impulse response. This means that if a whole y -sequence is equal to zero, and
only one y is different from zero at a certain time interval, then the filter output will
be different from zero only during m time intervals. If some or all of the coefficients
a i are nonzero, the filter is called autoregressive (AR) and has an infinite impulse
response. In other words, an input that is always zero and different from zero only at
one time interval will produce an output different from zero for a very long time
(infinite time). The general filter of Equation (5.9) is called Auto-regressive Moving
Average (ARMA).
Filters can be causal or non-causal. A causal filter calculates an output value
based on earlier input data (at any time t 0 can only be considered input values for
t ≤ t 0 . For this reason all on-line filters are causal. The filtered, output time series
will lag somewhat in time if compared with the original time series. If the data is
processed off-line, for instance in the analysis of a measurement data series that has
already been collected, a non-causal filter can be used. In this way in the calculation
a measurement value for time t can be processed together with both past ( t ≤ t 0 )
and future ( t > t 0 ) values.

5.4.2 Digital Low Pass Filters


In order to examine a slowly changing input signal, it is necessary to remove
from the measurement data sporadic spikes and high frequency disturbances that do
not contain any relevant information. This can be done with a digital low pass filter.
The design of a digital filter that effectively removes fast signal changes and at the
same time does not affect slow variations is always a compromise, because the
frequency bands of the original and the undesired signals almost always overlap. As
for the analog filters, a higher order filter dynamics is more efficient in removing
undesirable high frequencies.
158 Chapter 5: Signal Processing

The two most important types of low pass filters are the Moving Average (MA)
and the exponential smoothing. Low pass filters used in the process industry are
almost always implemented following one of these types of simple filters.

Example 5.8 Moving Average - The simplest low-pass filter


A simple Moving Average filter is obtained by setting all the a i parameters in
Equation (5.9) equal to zero. If a simple averaging should take place, then all the
weighting coefficients b i must be equal and their sum be =1. For example, a
Moving Average filter with five inputs is:
1
( [
y (kh ) = ⋅ y (kh )++ y (k − 4)h
5
])
If the filtering operation is performed offline, a non-causal Moving Average can
be calculated using measurements both before and after the current time kh . In
this way the filtered value is not lagged in time in relation to the input values. A
non-causal simple Moving Average for five values is:
1
([ ]
y (kh ) = ⋅ y (k − 2)h + 2 + y (k + 2)h
5
[ ])
If the filter output is the average of the input over the last n samples, it is
shifted 1 + n 2 cycles. For higher values of n , the filter output becomes smoother
but also more delayed in time. The impulse response of a Moving Average filter is
finite. For an input impulse at time t = 0 the Moving Average output after time
t = n is zero.
The Moving Average is a simple method but has certain limitations. If equal
coefficients are used, the filter can be unnecessarily sluggish and not react fast
enough to real changes in the input signal. On the other hand, if the coefficients
are different and decrease for higher values of the index n , it is difficult to analyze
the filter properties.

An exponential filter is a first-order ARMA filter defined by the following


equation:

[ ]
y (kh ) = α ⋅ y (k − 1)h + (1 − α ) ⋅ y (kh ) (5.10)

The filtered value y ( kh ) is computed by adding a weighted version of the earlier


[ ]
value of the filtered signal y (k − 1)h to the latest measurement value y ( kh ) . The
coefficient α has a value between 0 and 1. Equation (5.10) can also be rewritten in
the form:

[ ] ( [
y (kh ) = y (k − 1)h + (1 − α ) ⋅ y (kh ) − y (k − 1)h ])
This representation leads to another interpretation. The exponential filter
corrects the filtered output value as soon as a new input measurement is available.
The effect of the correction is small and becomes smaller for values of α close to 1;
in this case the filter acts sluggish. This will reduce the noise components of the
output signal but at the cost of poor agreement with real changes in the input signal.
If α is close to 0, the correction gain is large. Consequently there will be less
5.4: Digital Filtering 159

reduction of the noise level but the filter will track real signal changes more correctly.
For α = 0 the filter output is identical with the signal input. The effect of the selection
of α is illustrated by the different responses to an input step signal superimposed
with noise (Figure 5.23).

Example 5.9 Interpretation of the exponential filter as a Moving Average


filter
The exponential filter can be interpreted as a Moving Average filter with an
infinite number of b i coefficients and no a i coefficients in Equation (5.9). The b i
coefficients become gradually smaller for older values in the input sequence. This
result is obtained by rewriting Equation (5.10) as:

[ ]
y (kh ) = α ⋅ y (k − 1)h + (1 − α ) ⋅ y (kh ) =

[ ] [
= (1 − α ) ⋅ y (kh ) + α ⋅ (1 − α ) ⋅ y (k − 1)h + α 2 ⋅ y (k − 2)h = ]
= (1 − α ) ⋅ y (kh ) + α ⋅ (1 − α ) ⋅ y [(k − 1)h ] + α 2 ⋅ y [(k − 2)h ] + α 3 ⋅ y [(k − 3)h ] =2 =

= (1 − α ) ⋅ y (kh ) + α ⋅ (1 − α ) ⋅ y [(k − 1)h ] + 2 + α n ⋅ (1 − α ) ⋅ y [(k − n )h ]+2

with b 0 = 1 − α , b1 = α (1 − α ) , b 2 = α 2 (1 − α ) , and so on. Since 0 ≤ α ≤ 1, the


coefficients decrease in an exponential fashion for older values. For example, for
α = 0 .5 the coefficients become 0.5, 0.25, 0.125, 0.0625,… while for α = 0 .9 they
are 0.1, 0.09, 0.081, 0,072, … In other words, if α is close to 1 the filter has a
longer „memory“ and is more efficient in smoothing out the input signal. The
exponential decay of the size of the coefficients has given the filter its name.

The exponential filter is actually the time-discrete form of an analog first-order


low pass filter with a unit static gain (see Section 5.3.1) and with a transfer function
like in Equation (5.4):
Y ( s ) 1
Gf ( s) = =
Y( s) 1 + sT
The time constant T is equal to RC or L / R in the corresponding first-order
analog filter. The differential equation for the digital filter is:
dy (t )
T⋅ = − y + y (5.11)
dt
When the derivative is approximated by backward differences, the result is:
y (t ) − y (t − h ) 1  1
≈− ⋅ y (t ) + ⋅ y (t )
h T T
which is a valid approximation for small values of h . The equation can be also
simplified as follows:
1 hT
y (t ) = ⋅ y (t − h ) + ⋅ y (t )
1+ h T 1+ h T
160 Chapter 5: Signal Processing

y
1.0

0.5 α=0

0 50 100 150 200


y
1.0

0.5 α=0.5

0 50 100 150 200


y
1.0

0.5 α=0.9

0 50 100 150 200


y
1.0

0.5 α=0.95

0 50 100 150 200


y
1.0

0.5 α=0.98

0 50 100 150 200

Figure 5.23: Effect of a first-order exponential smoothing filter.


The parameter α has the values 0, 0.5, 0.9, 0.95 and 0.98. For small values of
α the filter output follows quite precisely the variations in the input signal but
the noise level is high. For higher values of α the filter becomes slower, but the
noise is clearly reduced. For α = 0 the filter output is identical to the input.
5.4: Digital Filtering 161

which is identical with Equation (5.10) if:


1 α ⋅h
α= or T =
1+ h T 1− α
Since it was assumed that h T is small, the approximation is valid only if α is
close to 1. In this case α can be expressed by the following approximation:
h h
α ≈ 1− ⇒T≈ (5.12)
T 1− α
In fact, the exact solution to the differential Equation (5.11) is Equation (5.10)
with:
h
α = e−h T ⇒ T ≈ − (5.13)
ln( a )
for which Equation (5.12) is a good approximation for small values of h T .
The filter response to the step change in Figure 5.23 can illustrate the relation
between α and T . After one time constant T has elapsed the output reaches about
63 per cent of the final value. For α = 0 .95 , T is about 20 sampling intervals and for
α = 0 .98 , T is about 50 sampling intervals.

Example 5.10 Program code for the exponential filter


A digital exponential filter (Equation 5.10) can be realized very easily on a
computer. It follows here an example of the related program code. The instructions
AD_input and DA_output are used to indicate the data input and output. The
variable delta_time contains the sampling interval, and next_time is used for the
synchronization of the program execution with the sampling instances (the use of
the program instruction wait_until is explained in Section 10.6.5).

program exponential_filter
var in_signal, alpha: real;
y_filtered, y_old: real;
next_time, delta_time: real;

begin
next_time := 0;
while true do (* repeat forever *)
begin
wait_until(next_time);
in_signal := AD_input (ch#1);
y_filtered := alpha*y_old + (1-alpha)*in_signal;
y_old := y_filtered;
DA_output (ch#2, y_filtered);
next_time := next_time + delta_time;
end; (* while true loop *)

end; (* exponential_filter *)
162 Chapter 5: Signal Processing

5.4.3 Digital Low Pass Filters of Higher Order


A second-order analog filter is more efficient for eliminating high frequency
components than a first-order filter (see Section 5.3.2). A digital filter with the
structure expressed by Equation (5.9) where n = m = 2 corresponds to an analog
filter of higher order. By placing two similar digital first-order exponential filters in
series the result is a second order filter with two equal corner frequencies:

[ ]
y 1(kh ) = α ⋅ y 1 (k − 1)h + (1 − α ) ⋅ y (kh )

y 2 (kh ) = α ⋅ y 2 [(k − 1)h ] + (1 − α ) ⋅ y 1(kh )

where y is the real measurement value, y 1 the output of the first filter and y 2
the output of the second filter. The filter operation can be defined by setting the
parameter α . The second-order digital filter can also be written in the following form
without the term y 1( kh ) :

[ ] [ ]
y 2 (kh ) = 2α ⋅ y 2 (k − 1)h − α 2 ⋅ y 2 (k − 2)h + (1 − α ) ⋅ y (kh )
2

The effect of the second order filter on the same signal as in Figure 5.23 is
shown in Figure 5.24. The second order filter is more efficient for attenuating high
frequencies, so that a smaller value of α can be selected. The output of this filter
follows the real signal changes better than the first order filter.
With a higher order filter (Equation 5.9) the operation can be further improved.
The price to be paid lies in a greater complexity for the filter, but data processing is
not expensive. Moreover, while in analog filters the addition of passive electronic
components to a filter circuit would mean additional energy losses in the signal, this
problem does not exist with data processing.

5.4.4 Digital High Pass Filters


In some cases it is needed to highlight the higher frequency components of a
measuring signal instead of the slow variations. The signal must therefore be
processed with a high pass filter. A difference builder is a simple example of a
digital high pass filter:
y (kh ) = ∆y (kh ) = y (kh ) − y (k − 1)h [ ]
The output differs from zero only when there is a change in the input signal.
A digital high pass filter can also be derived by discretization of an analog high
pass filter (Section 5.3.3). The related differential equation is similar to Equation
(5.6):
dy (t ) dy (t )
T⋅ = − y (t ) + T ⋅ (5.14)
dt dt
where y is the filter input and y the filter output. By taking forward differences a
digital high pass filter is obtained:
 h
y (t + h ) =  1 −  ⋅ y (t ) + y (t + h ) − y (t ) = α ⋅ y (t ) + y (t + h ) − y (t ) (5.15)
 T
5.4: Digital Filtering 163

y
1.0

0.5 α=0

0 50 100 150 200


y
1.0

0.5 α=0.5

0 50 100 150 200


y
1.0

0.5 α=0.9

0 50 100 150 200


y
1.0

0.5 α=0.95

0 50 100 150 200


y
1.0

0.5 α=0.98

0 50 100 150 200

Figure 5.24: Effect of a second-order exponential low pass filter for different values of the
parameter α
164 Chapter 5: Signal Processing

y y
1.0 1.0
0.5
0.5 0
-0.5
0 -1.0

0 50 100 150 200 0 50 100 150 200

y y
1.0 0.5

α=0 0 α=0
0.5

0 -0.5

0 50 100 150 200 0 50 100 150 200

y y
1.0 0.5

α = 0.95 0 α = 0.95
0.5

0 -0.5

0 50 100 150 200 0 50 100 150 200

Figure 5.25: Effect of a first-order high pass filter on a input signal. Figure 5.26: Effect of a high pass filter on a sinusoidal signal with
The upper diagram shown unfiltered data. The diagram in overlying noise.
the middle shows the output for α = 0 and the lower The filter output (middle diagram) retains only the high
diagram for α = 0 .95 . frequency variations. In the lower diagram is shown the
output for α = 0 .95 , where the low frequency
component is let through with attenuation.
5.5: Basic Measurement Data Processing 165

with α defined as in Equation (5.12). The discrete filter equation can also be
derived analytically from Equation (5.14); the result is that α is given by Equation
(5.13) and its value must lie between 0 and 1. With α = 0 , the filter is a pure
difference builder. It should be noted again that h T has to be small for the
difference approximation and Equation (5.12) to hold.
The filter sensitivity at higher frequencies is determined by the value of α . A
small α leads to a greater sensitivity, which corresponds to a high corner frequency
for the high pass filter.
The operation of an high pass filter will be illustrated here with help of some
examples. The same step input signal superimposed with noise of Figure 5.23 shall
be used again as input in Figure 5.25. The middle diagram shows the output of a
pure difference builder ( α = 0 ). It contains a spike at t = 50 , as the filter detects the
sudden change in the input signal. With α = 0 .95 , the spike at t = 50 becomes
wider as shown in the lower diagram.
In Figure 5.26 the filter input is a sinusoidal wave with superimposed high
frequency noise. The output of the high pass filter retains the high frequency
variations, while the slower sinusoidal oscillations have been reduced or eliminated.
If a step change is added to the sine wave with noise, the high pass filter output
displays a peak that results from the step change (Figure 5.27).

y
2.0
1.5
1.0
0.5
0

0 50 100 150 200


y
1.0

0.5

0 50 100 150 200


Figure 5.27: Effect of a high pass filter on a sinusoidal signal with overlying noise and a step
change for t = 50 ( α = 0 ).
The filter output in the lower diagram shows a peak at time t = 50 , but
contains otherwise no low frequency oscillations.

5.5 Basic Measurement Data Processing


After a measurement signal has been converted to digital form, several tests
must be performed before the data can be used for further processing. After the A/D
conversion, but before digital filtering, the following operations must be performed:
• Compensation for drift
• Storage of the raw measurement value
166 Chapter 5: Signal Processing

• Test of the validity of the raw measurement value with respect to the allowed
minimum and maximum values for the sensor range and rate of change of the
sensor signal. If the value lies outside the foreseen range, then alarm
messages or other indications for the operator should be generated.
• Calculation of an average value from the raw measurement signals (values
„outliers“ that differ too much from the other measurements should possibly be
rejected)
• Digital filtering
• Storage of the filtered measurement value.

After digital filtering, the following operations can be performed:


• Scaling to suitable units
• Linearization
• Other types of data processing, e.g. statistical analysis of the measurement
data.
• In automated systems, control of whether the new input data should be
followed by any automatic action, e.g. the generation of new control or setpoint
signals.
Commercial data acquisition software packages usually perform all these
preliminary tests.

5.5.1 Tests and Alarms


There are many ways to test whether a measurement value is valid. Such tests
are very important, because in automated systems it must be avoided that erroneous
measurement values lead to incorrect control actions. A first test is the verification
that the magnitude of the input signal lies within the sensor range, for which a
minimum and maximum signal limits are defined. We have seen earlier that extreme
values can also indicate particular situations, e.g. that the sensor is not operative.
The test on the limit values should not be a simple comparison operation with a
preset threshold, because in this case even small oscillations around the limit can
generate many alarms. A hysteresis band around the alarm limit is usually defined in
order to avoid an unnecessary number of alarms (Figure 5.28). An alarm is
generated only when the signal passes the second threshold limit. The signal then
must then cross again the first threshold limit before the old alarm is reset. A new
alarm can now be generated when the second limit is reached again.
Also the rate of change of a signal is often tested, because it can help detect
sensor errors. If the change in the sensor output during the last few sampling
intervals exceeds a predetermined value, then an alarm is generated. The rate of
change check must be performed before the digital filtering, otherwise signal
changes might be cancelled out and the test would lose its relevance.
5.5: Basic Measurement Data Processing 167

signal
1 2
hysteresis
band

second alarm limits first alarm limits

hysteresis
band

time

Figure 5.28: Hysteresis band near the alarm limits.


An alarm is generated when the signal reaches and passes point (1). The signal
must return below the first alarm limit before the old alarm is reset and a new
alarm is generated at point (2).

Example 5.11 Testing of a Probe for dissolved oxygen


The dissolved oxygen (DO) concentration in aeration tanks for activated
sludge systems is measured with a probe that has a settling time of less than a
minute. If the probe is taken out of the water for calibration and cleaning, the
sensor output will increase within a minute from the normal range of about 2-5 mg/l
to the saturation value of about 10 mg/l. A real DO concentration increase in the
tank cannot occur faster than 10-20 minutes. Such a significant signal change
within a minute can therefore be detected as an outlier. The control system can
use it as indication that a calibration is being performed and reset the internal
scaling.

5.5.2 Scaling and Linearization


The collected measurement values must be represented in suitable engineering
units in order to reduce the risk for misunderstandings and errors. The conversion
from an internal representation y to one in engineering units z can often take place
with a simple linear relationship such as z = k 1 ⋅ y + k 2 , where k 1 and k 2 are
constants. For non-linear sensors the relationship is expressed as a more complex
function or with a conversion table. The relationship becomes more complex if the
sensor characteristics show dead bands or hystereses, in the last case even the
direction of change of the measurement signal must be known.
In Section 5.2.2 it was discussed how the full range of the analog-digital
converter ought to be utilized in order to retain good accuracy. If the measurement
signal exceeds the A/D converter range, then it must be checked that the converter
output does not „turn over“ and begin again by counting from zero (10.1 V could for
instance be represented as 0.1 V if the converter input range is limited to 10 V). This
control possibility is already incorporated as a standard feature in many data
acquisition systems and components, but to double-check helps defend oneself
against surprises.
168 Chapter 5: Signal Processing

5.5.3 Advanced Data Processing

Averaging
Erroneous measurement values can be reduced from the very beginning by
using simple averaging. For example the A/D converter might be programmed to
sample the measurement signal 10 times faster than needed and the „raw“
measurement value could then be obtained by averaging those values. In addition,
one or two extreme measurement values, at too high or too low value, could be
discarded. This method is useful in those cases where the input signal remains
constant during the time interval in which the averaging operation takes place and
the variations in the input signal are caused by noise with zero average value.

Calibration and Drift Compensation


Measurement signals often need to be compensated for drift or calibration errors
in sensors or in the electronic circuitry. To this purpose the input amplifiers and the
A/D converters should be tested and - if necessary - calibrated with known and
precise reference voltages. In some cases the full calibration procedure can be
carried out automatically under software control.

Plotting
With simple plots of signals as functions of time or as cross-functions of other
signals can be revealed interesting details, such as:
• Exceptional and unusual disturbances
• Missing measurement values
• Periodic oscillations
For this reason, plot facilities for signals in different timescales and in cross
relation with other data are an essential utility in any process computer system.

Analysis Software
There are many software packages to perform data series analysis and filtering.
One package widely used in academic as well as scientific environments is
MATLAB®. MATLAB is a technical software package for numeric computation and
visualization that integrates into a common environment routines for numerical
analysis, matrix computation, signal processing and graphical representation.
MATLAB can be extended with optional toolboxes to provide application-specific
capabilities. Some of these toolboxes can for example be used for filtering. The
signal processing toolbox adds commands for digital signal processing (time series
analysis) and includes functions for the design and analysis of digital filters. The
system identification toolbox adds commands for parametric modeling and system
identification. Among many model structures, also the ARMA models are available in
MATLAB.

5.5.4 A Data Structure for Measurement Signals


A number of parameters are associated with each input measuring signal; these
parameters are used by the programs that read and process the measurement
values. The storage of these parameters must be organized systematically so that
access to the data can easily take place by different routines. The most important
parameters used in measurement data processing include the following:
5.6: Summary 169

• Pointers to the measurement data


• Address (input channel and/or multiplexer port) for the measurement signal
• Sampling time (when multiple sampling times are used)
• Scaling constants
• Sensor limit values
• Limit values for the physical process (hysteresis band with first and second
alarm limits)
• Rate of change limits
• Filter constants a i , b i , α
• The measurement value itself („raw“ and after processing)
• Logical variables to indicate the necessary processing operations, e.g.
linearization, scaling, filtering and reaction to alarms.
The above-listed parameters have different data formats: some are integers,
others are real numbers, logical variables or alphanumeric strings. Their
implementation depends on the actual computer system and programming language.
Some principles for database organization to store and process measurement data
are further treated in Section 12.4.

5.6 Summary
The sampling rate for continuous signals is of fundamental importance for the
processing of measurement data in computer control systems. Ideally, this rate
should be at least twice as high as the highest frequency component of the original
measurement signal; in practice the sampling rate must be higher to allow for the
correct signal reconstruction in a finite time. In addition, if the sampling rate is not
sufficiently high and high-frequency noise is superimposed to the original signal, alias
frequency distortion will take place and false frequencies will appear in the sampled
signal. After sampling it is impossible to separate this false information from the
original, „correct“ data.
For the conversion of the analog signal to digital form it must be ensured that the
converters are sufficiently fast, that the accuracy is relevant for the envisioned
application and that the conversion range is used to full capacity.
High frequency components in a signal are usually due to noise and
disturbances and should be eliminated or dampened before sampling. Analog low
pass (anti-alias) filters are used to remove all frequency components above half of
the sampling rate.
Analog filters can be designed to attenuate either high frequencies (low pass
filters) or low frequencies (high pass filters). Very often these filters are implemented
with operational amplifiers, they have therefore to be used with precaution since the
operational amplifiers have only finite bandwidth and do not respond to very high
frequencies, either to filter them out or to let them pass unfiltered.
Digital filtering is an useful method to extract the needed information from a
signal. In this chapter we have seen how to implement low pass and high pass filters
of lower order. In practice simple Moving Average and digital exponential (low pass)
filters of first order are commonly used. Higher order filters can easily be
implemented on a digital computer. Finally, several basic tests should be performed
170 Chapter 5: Signal Processing

on a measurement signal before it is accepted for further processing. The most


important such tests have been illustrated in this chapter.

Further Reading
Analog filters are treated in detail in [Glasford 1986], [Irvine 1994] and [Jones
1986]. [Derenzo 1990] describes many practical aspects of multiplexing,
analog/digital conversion and filtering. More details on A/D and D/A conversion are
contained in [Sheingold 1986].
The sampling theorem is explained in [Åström / Wittenmark 1990]. This book
also presents in detail time-discrete dynamic systems, of which digital filters are a
special case. Digital filtering is further treated by [Stearns / David 1988]. For the
analytical description of noise and disturbances are recommended the two works
[Bendat / Piersol 1986, 1993] as well as [Ljung 1987] and [Söderström / Stoica
1989].
6 Control Structures

Aim: Presentation of the most common controller structures and their analog and
digital implementations for process control applications

Overview
This chapter deals with controllers in both continuous and discrete time
description. The reader should become familiar with different control structures, so as
to be able to understand and estimate their properties, their performance and
therefore their practical use. It is outside the scope of this textbook to go into the
details of controller analysis and design or into the different methods for controller
tuning. The reader should already be acquainted with the basics of control theory and
understand how controllers can improve some of the systems’ properties, like e.g.
system stability. The classical textbooks of control theory deal in detail with the
mathematical methods for control circuit analysis but tend often to be weaker in the
practical aspects, how controllers are actually designed, built and operated. This
chapter will focus not only on the theory but also on the practical aspects of the
design of controller structures and their implementation on digital computers in order
to reach the desired control goal.
Controllers can be realized on the basis of either continuous or time-discrete
process models, and the design principles are presented in Section 6.1. On/off
controllers are quite common in the process industry and are briefly discussed in
Section 6.2. In Section 6.3 it is shown how simple continuous controllers can be used
in feedforward and feedback configurations to reach particular system performance.
The proportional-integral-derivative (PID) controller is the dominating controller
type in process applications and will therefore be treated in depth in several sections
of this chapter. Its basic properties are discussed in Section 6.4. The time-
discretization of the PID controller and other aspects related to its implementation on
a digital computer are the subject of Section 6.5. Different controller structures on the
basis of PID controllers are described in Section 6.6. Despite their wide acceptance,
PID controllers are not suitable for all types of control problems, for example they
cannot be used satisfactorily in processes with delays and dead times. The limits of
the application of PID controllers are discussed in Section 6.7.
The general discrete linear controller is presented in Section 6.8. This type of
controller is particularly important for two reasons: on the one hand, it can be
immediately realized on a digital computer, on the other hand many other controller
types (e.g. the PID controller) can be considered as special cases of the general
controller. The practical realization of the general controller is treated in Section 6.9.
Dynamical system models can also be defined in state-space form. A state-space
model is for example useful to describe multi-input, multi-output linear processes.
When a process model in state-space form is available, then a controller structure
based on state feedback can be used. Its properties are briefly described in Section
6.10.

171
172 Chapter 6: Control Structures

6.1 Continuous vs. Time-discrete Controllers


Controllers can be realized with analog as well as with digital technology. The
difference in the implementation reflects also differences in the approach, because
analog and digital process analysis and controller design are done with different
mathematical methods. Although a digital computer can simulate very well the
function of an analog control loop, and thus implement in digital form a controller that
was actually thought in analog terms, it can also achieve much more than what would
be possible by using analog technology only. For example, on a digital computer
non-linear and self-tuning controllers can be realized, which would not be possible by
using only analog technology. The principal problem in digital control is to find the
appropriate controller structure and the related parameters. Once the controller
parameters are known, the implementation of the control algorithms is usually quite
straightforward. In addition, every practical controller implementation should also
contain safety procedures, so that a controller does not endanger the operation of a
process in unforeseen situations.
Many industrial processes are characterized by several inputs and outputs
(Section 2.2.7). In most cases the internal couplings and interactions of the related
signals are not particularly significant and the processes can be controlled by many
simple controllers, where each control loop operates on one input/output signal pair.
This is for example the controller structure in direct digital control (DDC) systems.

6.1.1 Sampled Signals


In the practical realization of digital control, the sensor signal (if it is continuous)
must be sampled and then converted with a A/D-circuit into a digital value. The digital
controller can then calculate the related control value, that is passed to the D/A
converter. The output signal from the converter, i.e. the control signal u (t ) is then
sent to the actuator (this procedure is described in detail in Chapter 4 and 5). The
control signal u (t ) usually remains constant during the sampling interval (Section 5.1
and 5.2). In some cases the output of the digital controller does not consist in an
analog signal but in a sequence of pulses for the control of particular actuators, like
e.g. stepping motors (Section 4.7.2 and 4.7.3).
The execution of control algorithms on the computer is normally driven by a
clock, so that the controller algorithm is started periodically. This is different from the
asynchronous execution of sequencing control described in Chapter 7. If several
controllers are implemented on the same computer, they cannot operate absolutely
at the same time, as they will be processed sequentially. It is important to consider
this aspect if the output of some controller is input to others. In distributed systems
with several CPUs the synchronous execution of different control routines is usually
not required.

6.1.2 Continuous vs. Time-discrete Control Design


A controller implemented in a digital control system is by definition digital and
time-discrete. Traditionally, however, most dynamic systems are described by
ordinary differential equations derived from physical laws such as those about mass
and energy conservation (Chapter 3). An analog controller can be designed on the
basis of a countinuous system description as transfer function or in state-space form;
these design methods are well known from control theory. The analog controller must
then be discretized in order to be implemented on a digital computer. With digital
6.2: On-off Control 173

control it is also possible to follow a different way, namely to start with a discrete
dynamical model for the technical process (Section 3.4) and then design the
controller directly on the basis of this model.
In general, if a controller is first designed in analog form and discretized
afterwards, this usually leads to shorter sampling interval (which means a higher
computing load) than if it were directly developed in digital form. The discretization of
analog controllers is therefore not to be particularly recommended, but since most
PID controller design takes place in this way, it will also be treated in this chapter.
Digital controllers developed directly from a time-discrete process description
look similar to the analog controllers after their discretization, but have different
coefficients. This means that also the computer code looks similar. This means also
that a general controller can be programmed on the process computer, leaving to a
later time the selection and the tuning of the controller parameters. This approach will
be shown in Section 6.8 and 6.9.
The analysis of time-continuous and time-discrete linear systems is quite similar.
Many concepts can also be explained from a continuous as well as from a discrete
point of view. Simple controller structures will be treated in the following from a
continuous standpoint, later on the same concepts will be transferred to the time-
discrete case.
In this chapter it is assumed that all linear discrete controllers with one input and
one output signal can be represented in the following general form:
u (kh ) = −r1 ⋅ u [(k − 1)h ] −  − rn ⋅ u [(k − n )h ] +

+ t 0 ⋅ u c (kh ) + t 1 ⋅ u c [(k − 1)h ] +  + t n ⋅ u c [(k − n )h ] −

− s 0 ⋅ y (kh ) − s1 ⋅ y [(k − 1)h ] −  − s n ⋅ y [(k − n )h ]


where u is the controller output (the control variable) of the physical / technical
process, u c is the reference value and y the output signal of the physical process
(the controlled value). The parameter n represents the order of the controller. A
normal PID controller can be considered as special case of the general discrete
controller with n = 2 . In this chapter it will not be dealt too much how the coefficients
ri , s i and t i must be selected. The emphasis will be on the practical use of this
controller and its implementation on a computer. And finally it should not be forgotten
that most processes are actually non linear (Section 3.3). Still, linear controllers can
successfully deal with a majority of these systems.

6.2 On/off Control


On/off controllers are simple and inexpensive feedback controllers commonly
used for simple applications such as thermostats in heating systems and domestic
refrigerators. These controllers are also used in simple industrial processes such as
level control systems or simple dosage controllers for mixers. The on/off control is
also sometimes referred to as two-position or bang-bang control.
The output of an ideal on/off controller (Figure 6.1.a) has only two possible
values:
u = u max if e > 0
u = u min if e < 0
174 Chapter 6: Control Structures

uc e u y max
Σ technical
process

min

-1
-e 0 0 e0 error
(a) (b)

Figure 6.1: (a) Use of the on/off controller; (b) function of the on/off controller with
deadband

where e represents the output error:


e (t ) = u c (t ) − y (t ) (6.1)
The error is therefore the difference between the reference value u c (t ) and the
output signal y (t ) .
On/off controllers react quite sharply to disturbances in the output signal (in
particular if the signal oscillates around the zero reference). By introducing a
deadband (Figure 6.1.b) for the input signal, the controller can be made less
sensitive to this type of disturbances:
u = u max for e > e 0

u = u min for e < −e 0


e 0 represents the magnitude of the deadband. If e lies between −e 0 and e 0 ,
then the output signal u remains unchanged.
An on/off controller causes an oscillation about a constant setpoint, since the
control variable jumps between the two possible values. This may bring excessive
wear on the final control element. If for instance the actuator is a valve, it might wear
out after a short time, while for other types of actuators (e.g. solenoid switches) this
aspect does not represent a particular problem.
A more advanced type of on/off control is used for motor control (Section 4.7.1
and 4.7.2). Here are used different types of modulation, e.g. pulse width modulation
(PWM) to transform the on/off control signal to the supply power for the motor.

6.3 Continuous Controllers


In Chapter 3 were presented different models for the description of dynamic
systems, like internal or external, time continuous or time-discrete, descriptions etc.
Different possibilities for the construction of dynamic models were shown. These
models for the representation of physical processes provide the basis for the design
of controllers. In this section the functional properties of analog control circuits will be
illustrated on the basis of linear systems.
6.3: Continuous Controllers 175

The transfer function G( s ) of a linear dynamic system was defined in Section


3.3.4. The use of this system description is appropriate for the design of some
controller types, e.g. the PID controller, as long as the process has only one input
and one output and therefore one simple transfer function; only such systems are
considered in the following description. In other cases it might be better to describe
the system in state-space form (Section 3.3.2) and define the controller on the basis
of this model. This procedure is described in Section 6.10.
The physical process as well as the controller are dynamic systems and can
therefore be described via differential equations or transfer functions. From a
mathematical point of view, the process and its controller look similar. There is
however an important practical difference among them. In a physical process the
transfer function G( s ) or the state-space equations are considered fixed and
unchangeable, i.e. the coefficients of Equations (3.1) and (3.3) cannot be changed
because they depend from the very nature of the process. On the other hand the
transfer function and the state-space equations of the controller contain coefficients
that can be defined and programmed at wish. An important aspect of controller
design is exactly how to find these parameters.
It should also be clear that in general it is complicated to find the transfer function
G( s ) for an industrial process. Fortunately many control strategies can be realized
also without an all too detailed and precise process model.

6.3.1 Simple Controllers


A continuous controller can be described with a transfer function of the same
type as for the physical process. In the simplest case the input signal to the controller
consists in the output error of the physical process (Equation 6.1). In working with
transfer functions Laplace transforms are used. The Laplace transform of the error
(Equation 6.1) is
E(s ) = Uc (s ) − Y (s ) (6.2)
The transfer function GREG ( s ) of the controller is defined as the ratio between
the controller output U ( s ) and the error input E ( s ):
U ( s ) = GREG ( s ) ⋅ E ( s ) = GREG ( s ) ⋅ [U c ( s ) − Y ( s )]
This is the simplest type of feedback control and is represented by the block
diagram in Figure 6.2. The controller has two inputs, the measurement (actual) value
Y and the reference (setpoint) value U c and one output, the control signal U . In this
simple case, however, the controller uses only the difference between the two inputs.
From a mathematical point of view, the transfer function GREG ( s ) is treated in
exactly the same way as any process transfer function G( s ) . As already mentioned,
the fundamental difference is that the coefficients of the controller transfer function
GREG ( s ) are not fixed, but can be changed (tuned). The control engineer has to
adjust these parameters until the closed loop system (i.e. the physical process
together with the controller) operates in the desired way. The closed loop system of
Figure 6.2 has the following transfer function
Y (s ) GREG ( s ) ⋅ G( s )
Gc ( s ) = = (6.3)
U c ( s ) 1 + GREG ( s ) ⋅ G( s )
176 Chapter 6: Control Structures

external
disturbances

Uc E U Y
technical
Σ GREG
process

-1

controller

Figure 6.2: The simplest controller structure

It is reasonable to think that the more parameters a complex controller GREG (s)
contains, the more degrees of freedom it has. With help of these parameters that can
be changed at wish, the behaviour of the closed loop transfer function can also be
changed more arbitrarily. In the following it will be illustrated how complex a controller
needs to be in order to achieve the desired performance.

6.3.2 Feedforward from the Reference Value


The simple control structure shown in Figure 6.2 reacts only on the error e (t ) (or
E (s ) ) and does not use the separate information from the two input signals
(reference value and process output). Yet an error can have two causes, one is a
change of the reference value (or command signal) u c (t ) and the other a load
change or some other disturbance to the system, that will cause a change of the
output signal y (t ) . A change in the reference value is a known disturbance. If the
controller can take advantage of the related information, then the closed loop system
(physical process and controller) would probably have a better performance. This is
what is done in feedforward control.
Let us now consider a particular controller (Equation 6.4) that contains two parts.
The feedback part G FB ( s ) is the previous simple controller that operates on the error
e . The so-called feedforward part G FF ( s ) follows the changes in the reference value
and adds to the control signal a correction term, so that the total system can react
more readily to a change of the reference signal (Figure 6.3). The control signal to
the process U ( s ) is therefore the sum of two signals:
U (s ) = GFF (s ) ⋅ Uc (s ) + GFB (s ) [Uc (s ) - Y (s )]
The expression for the controller can be rewritten in the form
U (s ) = [GFF (s ) + GFB (s )] ⋅ Uc (s ) - GFB (s ) ⋅ Y (s ) =
(6.4)
= GF1 (s ) ⋅ Uc (s ) - GR (s ) ⋅ Y (s ) = U F1(s ) - U FB (s )
6.3: Continuous Controllers 177

where U F1 is the feedforward part of the control signal and U FB the feedback
part. The controller has two inputs Uc (s ) and Y (s ) and can thus be represented by
the two transfer functions GF1 (s ) and GR (s ) (Figure 6.4).

G FF

Uc E U
Σ G FB Σ

Y
-1

Figure 6.3: A regulator made up by a feedforward loop from the command signal and a
feedback loop from the process output

technical
controller process
Uc UF1 U Y
GF1 Σ G

-UFB
-GR

Figure 6.4: Structure of a linear feedforward-feedback controller

Since the controller of Equation (6.4) has more coefficients that can be tuned
than the simple controller of Equation (6.3) it is reasonable to assume that the closed
loop system can work better. The transfer function of the total control loop can be
obtained from Figure 6.4:
[G F1( s ) ⋅ U c ( s ) − GR ( s ) ⋅ Y ( s )] ⋅ G( s ) = Y ( s )
This can be simplified as follows:
Y (s ) G F1 ( s ) ⋅ G ( s )
Gc ( s ) = = (6.5)
U c ( s ) 1 + G ( s ) ⋅ GR ( s )
The poles of the feedback system can be changed with the controller GR ( s ) ,
while the feedforward controller G F1( s ) adds new zeros to the system. It follows that
the total system can react quickly to reference value changes if GF1 (s ) is properly
chosen.
178 Chapter 6: Control Structures

6.3.3 The General Form of the Feedforward Controller


Due to the fact that in feedforward control the reference value is continuously
followed by the controller, on this basis it is possible to design good control (servo)
systems, that for example can be used successfully in the control of electric drives,
robots or machine tools. In these applications it is crucial that the process output
always reacts quickly and accurately to any change of the reference value.
The controller description can be further generalized. If the transfer functions
GR (s) and G F1(s) of Equation (6.4) are expressed with their numerator and
denominator polynomials in s , then the controller can be written in the following
form:
T (s ) S (s )
U (s ) = GF1 (s ) ⋅ Uc (s ) - GR (s ) ⋅ Y (s ) = 1 ⋅ Uc ( s ) - 1 ⋅ Y (s ) = U F1(s ) - U FB (s )
R1(s ) R2 (s )
where the two parts of the control signal are shown in Figure 6.4. Expressing the
transfer functions with a common denominator we get:
T (s ) S( s )
U (s ) = ⋅ Uc ( s ) - ⋅ Y (s ) = U F1(s ) - U FB (s ) (6.6)
R( s ) R( s )
where R (s ) = R1 ⋅ R2 , T (s ) = T1 ⋅ R2 and S (s ) = S1 ⋅ R1 . This can be formulated
as follows:
t ⋅ s n + t 1 ⋅ s n − 1 ++t n s ⋅ s n + s1 ⋅ s n − 1 ++ s n
U (s ) = 0 ⋅ Uc ( s ) + 0 ⋅ Y (s )
s n + r1 ⋅ s n − 1 ++ rn s n + r1 ⋅ s n − 1 +...+ rn
where ri , s i and t i are the transfer function parameters, and s the complex
Laplace variable.
The controller of Equation (6.6) can then be rewritten in the following form
(general controller):
R ( s ) ⋅ U ( s ) = T ( s ) ⋅ Uc ( s ) - S ( s ) ⋅ Y ( s ) (6.7)
The transfer function of the physical process can also be explicitly expressed by
its numerator and denominator, i.e.
b0 s n + b1s n − 1 ++ bn B(s )
G (s ) = = (6.8)
s n + a1s n − 1 ++an A(s )
The closed loop system is illustrated by Figure 6.5 and corresponds to that of
Figure 6.4.
With the expression (6.6) for the controller and (6.8) for the physical process, the
closed loop transfer function can be written in the following form:
T (s ) B(s )

Y (s ) R (s ) A(s ) T (s ) ⋅ B(s )
Gc (s ) = = = (6.9)
Uc ( s ) B(s ) S(s ) A(s ) ⋅ R(s ) + B(s ) ⋅ S(s )
1+ ⋅
A(s ) R(s )
6.3: Continuous Controllers 179

technical
controller process
Uc (s) T(s) UF1 U(s) B(s) Y(s)
Σ
R(s) A(s)

-UFB
S(s)
R(s)

Figure 6.5: Controller built with a feedforward and a feedback control part (this controller
corresponds to that of Figure 6.4)

The closed loop transfer function has many degrees of freedom. The coefficients
of the polynomials A and B are fixed by the process design and therefore cannot be
changed. These coefficients could be in part unknown and their estimation might also
be quite difficult. It is not at all a trivial task to obtain an accurate model of the
system! On the other hand, all the parameters in the polynomials R , S and T can
be tuned. The coefficients in T and R belong to the feedforward part of the
controller. The setting of these parameters influences the closed loop system
response to a change of the reference (setpoint) value. Similarly, the S and R
coefficients are related to feedback performance. By tuning S and R the
performance of the controller system can be changed to react after a load change or
some other disturbance that has influenced the output signal y (t ) .
In order to compute the regulator parameters, the transfer function (Equation 6.8)
is usually compared with the desired transfer function G m ( s ) :
Y (s ) B (s )
Gm (s ) = = m
Uc (s ) Am (s )

The parameters of the polynomes R , S and T can then be chosen so that:


Bm (s ) = T (s ) ⋅ B(s )

Am (s ) = A(s ) ⋅ R (s ) + B(s ) ⋅ S (s )
If the order of R , S and T is sufficiently high, i.e. if there are enough „knobs“ to
turn, the closed loop transfer function (Equation 6.9) can be changed within wide
limits. The order n of the controller must be the same as that of the original physical
process. In particular, by changing R and S the denominator of the closed loop
system transfer function can be changed arbitrarily. Theoretically, this means that the
poles of the closed system can be moved to any location of their complex plane
representation. In practice, the maximum amplitude and rate of change of the control
signal limit the extent to which the poles can actually be changed. In Section 3.3.4 it
was shown how the poles determine the type of transient response of the system, so
that its dynamics can be chosen arbitrarily. In particular a physical system that is
instable because of a pole with positive real part can be stabilized by a control
system.
180 Chapter 6: Control Structures

Example 6.1 Control of the position of a vertical bar


A bar placed in vertical position can not stand by itself and would fall if no
outside forces act on it; the bar is an unstable system. If the lower end of the bar is
continuously moved on the horizontal plane so that the bar is kept in the vertical
position, then the total system is stable. In control language this means that the bar
has a pole with a positive real part. The (human or automatic) controller has a
dynamics GR ( s ) = S( s ) / R( s ) , so that all poles in the total system (bar and
controller) have negative real parts.

In Section 3.3.4 it was also described how the zeros determine the relative size
of the different terms in the transient response. There is no possibility to change the
values of the zeros. It is however possible to insert new zeros or to remove a zero by
cancellation, i.e. by placing a pole in the same location so that a zero and a pole
would cancel out each other.
The zeros of the numerator in Equation (6.9) are the same as the zeros of the
polynomials T and B . New zeros can be added by the T polynomial. The zeros of
B , however, are fixed and cannot be moved. Only if a pole is placed in the same
location, the zero will be cancelled. Such an operation has to be made with great
caution. For example, if a zero of the polynom B is located in the right half plane (in
what is called a non-minimum phase system), then the pole for the cancellation
must also be placed in the right half plane. The result is an unstable system, but with
the zero exactly chosen to cancel the unstable mode. If the cancellation is not exact
(which it rarely is!) the closed loop system will be truly unstable. (This is an example
that not every theoretically correct mathematical manipulation also leads to the
desired result in practice.) In other words, if the physical system has a zero in the
right half plane, this zero represents a system property that cannot be removed by a
controller. Its influence can however be minimized by appropriate selection of the
control structure.
Non-minimum phase systems are characterized by a behavior that in some
sense goes against expectations, often due to some kind of delay in the answer. An
example of non-minimum phase system is given by the economic life cycle of a
product. In Figure 6.6 is shown the profit curve for a product during its whole life
cycle. In the early phase, before any products are sold, investments and
development costs cause a negative profit. After some time the product – hopefully –
will generate a profit. This property lies in the nature of the thing and cannot be
changed. However, a product manager acting as a very simple controller could just
look at the momentary value of the profit and make the decision to stop the
development right at the beginning because the profit is negative. From this example
it can be seen how some future prediction of the success of the product is necessary
in order to continue the operation. A regulator in control of a non-minimum phase
system requires the same type of feature, as it needs in some way to predict the
future behavior of the system and act accordingly.
The polynomials R( s ) , S( s ) and T ( s ) cannot be chosen arbitrarily. All the
controller transfer functions (see Figure 6.5) must be physically realizable. This
means in practice that the order of the denominator polynomial must be larger than
that of the numerator, i.e. the order of R( s ) has to be larger than that of both S( s )
and T ( s ) , otherwise the controller cannot be physically built. The physical process
itself must be controllable (Section 3.5.1). This means that A( s ) and B( s ) cannot
have any common factors.
6.3: Continuous Controllers 181

1.0

0.5

-0.5

-1.0

0 1 2 3 4 5 6 7 8 9 10
time

Figure 6.6: Profits during the life cycle of a product. At the beginning, development costs
cause a negative profit. Any control action taken on the basis of momentary
values and without consideration of the full curve would probably be incorrect.

There are also other limitations related to how far the controller parameters can
be changed. If the „control knobs“ are turned too much, e.g. by reducing the process
response time by a large factor, then the control signals would probably saturate and
the system would no longer be linear. In other words, since the signal amplitudes are
limited, the closed loop system response cannot be changed arbitrarily.

6.3.4 Feedforward from Load Changes and Process Disturbances


If the disturbances that act on a process are known and can be measured, it is in
principle possible to correct for them before they can actually influence the process
output. This principle is called feedforward from process disturbances and can
bring a notable improvement in control performance. Some examples will illustrate
the idea.

Example 6.2: Room conditioning


In temperature control systems for buildings there is often a sensor installed to
measure the outdoor temperature. When the outdoor temperature (that is
considered as „disturbance“) changes, a control signal can be given to the valve for
hot water circulation in the building, before the outside temperature could influence
the indoor room temperature (feedforward). The temperature in each room is also
continuously detected by the local thermostats and used for the final and more
precise temperature adjustment (feedback).

Example 6.3: Chemical process control


In chemical process control feed flows and concentration values of the reagent
inflow into a process are often measured. This allows corrective actions to be
performed before any change has taken place in the output.
182 Chapter 6: Control Structures

Example 6.4: Car driving


A trained car driver uses often a kind of feedforward. If he wants to keep the
speed constant while the car approaches a hill, then he gives a bit more gas before
the climb, so that the speed does not change despite the gradient change.

All types of feedforward are based on some assumptions about the future
behavior of a system and must therefore have so-called predictive capabilities. In
other words, the feedforward controller must contain a model of the technical system
dynamics. How this can be achieved will be shown in the following.
The use of feedforward requires that the load change and/or the disturbances
are measured. In many cases this is however not possible or feasible. If the
disturbance cannot be measured directly, its value must be either estimated or a
different indirect measurement must be used.

Example 6.5: Phosphorus removal by chemical precipitation


In wastewater treatment phosphorus is commonly removed by chemical
precipitation. In order to decide the right chemical dosage for the reagents, the
phosphorus content of the wastewater inflow must be known. In practice it is
difficult and expensive to measure phosphorus concentrations on-line. Therefore
the inflow phosphorus concentration is estimated based on the flowrate and on the
basis of historic records of normal daily or hourly variations. Even this rough type of
feedforward can contribute to improve the total control system behaviour.

The typical aspect of a complex control structure with feedforward from both
disturbance and setpoint change and feedback is shown in Figure 6.7. In principle
the feedforward controller must produce a control signal that will act on the actuator
in such a way so that the disturbance will not influence the process.
The disturbance W ( s ) influences the process via the transfer function GW ( s ) ,
i.e. there is a dynamic relationship between the disturbance and the output Y ( s ) :

Y ( s ) = GW ( s ) ⋅ W ( s )

GW ( s ) must be known. This function depends on the process properties and


cannot be changed. The idea of the feedforward is to correct the control signal
following the indications of the sensor Gt ( s ) and the feedforward controller G F2 ( s ) .
In this way the effect of the disturbance on the technical process is cancelled out in
the process output Y by the corrective action of the feedforward controller generated
as function of the disturbance itself. The formal relationship is expressed in the
following way:
−Gt ( s ) ⋅ G F 2 ( s ) ⋅ Gv ( s ) ⋅ G P ( s ) ⋅ W ( s ) + Gw ( s ) ⋅ W ( s ) = 0
Solving for G F2 , this gives the ideal feedforward controller:
GW
GF 2 ( s) = (6.10)
Gt ⋅ Gv ⋅ G P
6.3: Continuous Controllers 183

disturbance feedforward
control sensor W

-GF2 Gt
-UF2

G
W
setpoint feedforward technical
control actuator process
Uc UF1 U Y
G F1 Σ Gv GP Σ

sensor
-UFB
-GR Gm

feedback control

Figure 6.7: Block diagram of the general controller structure with feedforward from the
setpoint, feedforward from a disturbance and feedback control

All the transfer functions on the right hand side of the equation are fixed by the
process design, so that there are no parameters that can be changed. In other
words, the feedforward signal is completely determined by the system model. If the
model is inaccurate, then also the feedforward signal will not be able to completely
cancel out the effect of a disturbance. In practice, however, the feedforward controller
may do a good job, even if the disturbances cannot be cancelled out completely.
In the transfer function of a real physical system the degree of the numerator is
smaller than the degree of the denominator. For GF2 (s ) in Equation (6.10),
however, the numerator usually has a larger order than the denominator. This means
that the disturbance signal has to be differentiated one or more times.
The differentiation of the disturbance value means qualitatively that its slope is
calculated, so that its future value can be extrapolated. The effect of the disturbance
on the technical process can therefore be computed with some precision in advance,
as it has been shown in the earlier examples. Because the precise differentiation of a
continuous signal cannot be done in practice, also feedforward control must be
approximated. In the computer, derivatives can be approximated by finite differences,
so that the control signal to cancel out a disturbance becomes a function of both the
present and the previous values of the disturbance value.
The feedforward part of the control signal can be written in the form:
V (s )
U F 2 ( s ) = - G F 2 ( s ) ⋅ Gt ( s ) ⋅ W ( s ) = - 1 ⋅ W (s )
R3 (s )
where V1( s ) and R 3 ( s ) are the numerator and denominator polynomials of the
feedforward transfer function from the disturbance to the control signal. It should be
noted that in this case the sensor dynamics is considered as part of the sensor.
184 Chapter 6: Control Structures

6.3.5 Summary of the Principal Control Structures


The quality of the feedforward control depends strongly on the accuracy to which
the disturbance measurements are collected and the precision of the process model.
Any practical implementation of a controller has to combine feedforward control from
the reference value and the disturbances with feedback control. The feedforward
action carries out fast corrections of process output errors that are due to changes in
the reference value or in the disturbance. Feedback provides corrective action on a
slower timescale. The real advantage of feedback is that it compensates for
inaccuracies in the process model, for measurement errors and compensates also for
output errors caused by unknown disturbances. The properties of feedback and
feedforward control are briefly summarized in the following.

Feedback has some limitations, that can be compensated for by feedforward,


such as:
• No feedback correction can take place until a deviation occurs in the controlled
process output variable. Therefore „perfect“ control, in which the controlled
variable follows setpoint changes with no deviation, or is not influenced by
changes in the process characteristics, is theoretically impossible.
• Feedback cannot in a predictive way compensate for known disturbances.
• In systems with long time constants or long time delays, feedback does not
operate satisfactorily. In presence of large and frequent disturbances, the
process may end up operating continually in a transient state and never reach
the desired steady-state condition.
• If the proper output variable cannot be measured, feedback is not possible.

The advantage of feedforward is:


• A fast predictive correction can be made, if the disturbance can be measured.

Difficulties with the realization of feedforward may take place because:


• The disturbance variables must be measured on-line, which in many
applications is not feasible.
• A model of the physical process is needed. The quality of the feedforward
control depends on the accuracy of the process model.
• In many cases the feedforward controller should contain pure differentiation
functions that cannot be realized in practice. Fortunately, practical
approximations of these ideal controllers often operate satisfactorily.

Feedback is a necessary complement to any feedforward scheme, because:


• Corrective action is initiated as soon as the controlled variable deviates from the
setpoint, regardless of the reason for the deviation.
• Feedback requires minimal knowledge of the dynamics of the controlled
process, i.e. the process model does not need to be known too much in detail.

A controller can be structured in such a way to include both feedforward from the
reference value and from process disturbances and feedback information from the
process output. Since all the partial systems can be considered to be linear, their
6.3: Continuous Controllers 185

signals can simply be added (Section 3.3.3). Referring to Figure 6.7, the control
signal for the physical process U is composed of three terms, the feedforward signal
from the reference value U F1 , the feedforward from the measured disturbance U F2
and the feedback from the output value U FB :
U ( s ) = U F 1 ( s ) - U FB ( s ) - U F 2 ( s )

= GF 1 ( s ) ⋅ U c ( s ) - GR ( s ) ⋅ Gm (s ) ⋅ Y ( s ) - GF 2 ( s ) ⋅ Gt ( s ) ⋅ W ( s )

T1 ( s ) S ( s) V ( s)
= ⋅ U c ( s) - 1 ⋅ Y ( s) - 1 ⋅ W ( s)
R1 ( s) R2 ( s ) R3 ( s )
The transfer functions can also be expressed with a common denominator:
T (s ) S( s ) V (s )
U (s ) = ⋅ Uc ( s ) - ⋅ Y (s ) - ⋅ W (s ) (6.11)
R( s ) R( s ) R( s )
where R (s ) = R1 ⋅ R2 ⋅ R3 , T (s ) = T1 ⋅ R2 ⋅ R3 , S (s ) = S1 ⋅ R1 ⋅ R3 and
V (s ) = V1 ⋅ R1 ⋅ R2 . In analogy to Equation (6.7), this can also be expressed in the
form:
R( s ) ⋅ U( s ) = T ( s ) ⋅ U c ( s ) − S( s ) ⋅ Y ( s ) − V ( s ) ⋅ W ( s )
where V ( s ) is defined by the process dynamics. The transfer function of the
feedback system in Figure 6.7 can be computed in a simple way. Without showing
the argument s , it is obtained:
[GF1 ⋅ Uc − Gm ⋅ GR ⋅ Y − GF 2 ⋅ Gt ⋅ W ] ⋅ Gv ⋅ GP + Gw ⋅ W =Y

and after rearranging the terms:


G F1 ⋅ Gv ⋅ G P ⋅ U c + [ −G F 2 ⋅ Gt ⋅ Gv ⋅ G P + Gw ] ⋅ W = [1 + Gv ⋅ G P ⋅ G m ⋅ GR ] ⋅ Y
From Equation (6.10) it can be seen that in case of an ideal feedforward to
compensate for disturbances the second term is equal to zero, so that the feedback
system has the following transfer function:
Y( s) G F1( s ) ⋅ Gv ⋅ G P
Gc ( s ) = =
Uc ( s) 1 + Gv ⋅ G P ⋅ G m ⋅ GR

The signal W ( s ) was cancelled and does not appear in the transfer function
anymore. For this reason a disturbance w(t ) would not have any influence on the
process output value y (t ) .
There is a similarity with the controller of Equation (6.5). In the equation
presented here the actuator dynamics Gv was modeled in separated components,
so that Gv ⋅ G P corresponds to G in Equation (6.5). Similarly the sensor dynamics
G m is presented here so that G m ⋅ GR corresponds to GR in (6.5).
186 Chapter 6: Control Structures

6.4 Continuous PID Controllers


6.4.1 The Basic Form of the PID Controller
The PID controller represents the most common controller structure in process
control and in many realisations of servo equipment. Because of its widespread
acceptance, this type of controller will be dealt with in detail in some of the next
sections.
The PID controller produces an output signal that is the sum of three parts. The
first part u P (t ) is proportional to the process output error, i.e. the difference of the
process output and the reference (setpoint) value (Equation 6.1); the second part
u I (t ) to the time integral of the output error and the third part u D (t ) is proportional to
the derivative of the error.
The equation of the classic, „textbook“ PID controller is:
 1
t
de (t ) 
u (t ) = u 0 + K ⋅ e(t ) + ∫ e (t ) dt + Td ⋅ 
 Ti
0
dt 

(6.12)
= u 0 + u P (t ) + u I (t ) + u D (t )
The parameter K is the controller gain, Ti the integral time constant and Td
the derivative time constant. The value u 0 is a correction value, or bias, to adjust
the average signal output level of the controller. The parameters K , Ti and Td are
available for setting, most often with knobs on the controller front panel. The
controller gain K may be dimensionless, but in many applications it is expressed in
engineering units. For example, if the measurement value represents a flow rate
[ m 3 / s ] and the control signal is expressed in volts, then the controller gain has
dimension [ V ⋅ s ⋅ m −3 ].
Some controllers, especially older models, have a proportional band setting
instead of the controller gain. The proportional band PB is defined as PB = 100 / K
and in general is expressed in percent units. This definition applies only if K is
dimensionless.
A textbook controller is a theoretical construct that cannot be exactly realized in
practice. For example, from a mathematical standpoint the output signal of such a
controller is unlimited. The output u of a real controller, instead, would saturate when
it reaches its limits u min or u max . In practice, the output of a proportional controller
looks like in Figure 6.8. If the proportional controller has a very high gain it behaves
like an on/off controller (Section 6.2).
The integral part of the controller is used to eliminate stationary (steady-state)
errors. Its function can be explained in an intuitive way. If the closed loop system, i.e.
the complete system consisting of the physical process together with the regulator,
has reached its stationary state, all its signals are constant, particularly e(t ) and
u (t ) . The stationary state can only be conserved if the integral part u I (t ) is constant,
otherwise u (t ) would change. Consequently, the integral part remains constant only
if e(t ) is zero.
6.4: Continuous PID Controllers 187

up
max

slope K
min

0 e

Figure 6.8: Proportional control

The integral time coefficient Ti appears in the denominator of Equation (6.12). In


this way the dimensions of the terms in the controller equation are consistent. This
appears also clearly in practice by considering the step response to the error signal
e(t ) in a PI controller. Immediately after the step change, the controller output is
K ⋅ e . After the time Ti the controller output has become twice as large (Figure 6.9).
A PI controller is often symbolically represented by its step response.

e u

K⋅e

t0 time t0 time
(a) (b) (c)

Figure 6.9: Step response of a continuous PI controller. (a) A stepwise change of the error
value takes place at the time t 0 . (b) The integral part of the controller increases
linearly with time as long as the error remains constant. (c) Symbol of the PI
controller in process diagrams

The controller can also be described by its Laplace transform. By Laplace-


transformation of the three terms in Equation (6.12) it is obtained:
U (s ) - U 0 (s ) = dU (s ) = U P (s ) + U I (s ) + U D (s )

 1 
= K ⋅ 1 + + Td ⋅ s  E (s ) (6.13)
 Ti ⋅ s 

1 + Ti ⋅ s + Ti ⋅ Td ⋅ s 2
= K E (s )
Ti ⋅ s
188 Chapter 6: Control Structures

where E (s ) is given from Equation (6.2), and U P (s ) , U I (s ) and U D (s ) are the


transforms of the control signal components u P (t ) , u I (t ) and u D (t ) respectively.
The degree of the numerator is higher than that of the denominator and the controller
gain tends therefore to grow to infinity for high frequencies. This is a consequence of
the derivative term. In practice the derivation cannot be realized exactly, but is
approximated by a first-order system with a time constant Tf , so the PID controller
becomes:
 1 T ⋅s 
δU (s ) = U P (s ) + U I (s ) + U D (s ) = K ⋅ 1 + + δ  E (s ) (6.14)
 Ti ⋅ s 1 + Tf ⋅ s 
Often the filter time constant is normalized in relation to the derivative time
constant:
Td
Tf = (6.15)
N
where N is a number of the order of 5-10. The gain of the derivative part of the
controller (Equation 6.14) is then limited to K ⋅ N for high frequencies.
The PID controller is a special case of the general controller (Equation 6.7), and
can be expressed in the R , S and T polynomials. Equation (6.14) can be rewritten
in the form:

[ ]
Ti ⋅ s (1 + Tf ⋅ s ) dU (s ) = K ⋅ Ti ⋅ s ⋅ (1 + Tf ⋅ s ) + 1 + Tf ⋅ s + Ti ⋅ Td ⋅ s 2 ⋅ E (s )

If this expression is divided by Ti ⋅ Tf , the result is a PID controller in the form of


Equation (6.7), for which holds:
1
R( s ) = s 2 + ⋅s
Tf

 T  1 1 K
S( s ) = T ( s ) = K ⋅ 1 + d  ⋅ s 2 + K ⋅  +  ⋅ s +
 Tf  Tf Ti  Ti ⋅ Tf
As already mentioned, a controller like the one of Equation (6.7) can move all
system poles and therefore change the dynamic properties of a closed system. Due
to the fact that the PID controller is a second-order system, it can successfully
change the dynamics of second-order systems as desired.
To be sure, most industrial processes are of higher order than two, but PID
controllers can in most cases still be used successfully also with these processes.
The reason is that many processes, although they actually have a higher order
dynamics, behave approximately like second-order systems. In systems that cannot
be approximated by second-order equations the use of PID controllers is not
appropriate. Examples of such systems are for instance mechanical systems with
several oscillation modi.

6.4.2 Differentiation of the Measurement Signal


In some process control applications the setpoint value changes abruptly once in
a while and remains constant in the time in between. A step change in the setpoint
value usually results in a large variation of the controller output signal; this effect is
sometimes called „derivative kick“. This is illustrated in the step response of the PID
6.4: Continuous PID Controllers 189

controller, that also suggests the symbol often used in process control schemes
(Figure 6.10).

e u

K⋅e

t0 time t0 time
(a) (b) (c)

Figure 6.10: Step response of a PID controller. (a) A stepwise change of the error value
takes place at the time t 0 . (b) The derivative part of the controller is the cause
for the large impulse in the output signal value. (c) Symbol of the PID
controller in process diagrams

In order to avoid the derivative kick in the PID controller, the derivative term can
be computed on the base only of the process output measurement y (t ) . The
derivative of the error is written:
de du c dy
= -
dt dt dt
Changes in the setpoint value are therefore not considered by the derivative part
of the controller. The ideal PID controller then becomes:
 1
τ
δy 
δu (τ ) = K ⋅ e( τ ) + ∫ e( τ )δτ − Tδ
  (6.16)
 Ti
0
δτ 

The derivative is again approximated by a first-order system with time constant
Tf :

 1  Tδ s
δU ( s ) = K ⋅ 1 +  ⋅ E(s ) - K ⋅ ⋅ Y (s ) (6.17)
 Ti s  1 + Tf s
This method for eliminating the derivative kick has become a standard feature in
most commercial controllers.

6.4.3 Series Representation of the PID controller


Since the PID transfer functions (Equations 6.14 and 6.17) consist of the sum of
three terms, they can be considered as a parallel connection of proportional, integral
and derivative actions. The controller can however also be written in series form, i.e.
as the serial connection of a PI controller with a PD- (proportional-derivative)
controller. A PI controller (Equation 6.14) has the form:
190 Chapter 6: Control Structures

δU( s )  1 
GPI ( s ) = = K1 ⋅ 1 + 
E( s )  Ti ⋅ s 
while a PD controller is represented as follows:
dU( s )  T ⋅s  1 + (Tf + Td ) ⋅ s
GPD ( s ) = = K 2 ⋅ 1 + d  = K2 ⋅
E( s )  1 + Tf ⋅ s  1 + Tf ⋅ s
The PID controller in serial form then becomes:
dU( s )  1  1 + (Tf + Td ) ⋅ s
GPID ( s ) = = K1 ⋅ K 2 ⋅ 1 + ⋅
E( s )  Ti ⋅ s  1 + Tf ⋅ s
The transformation from the parallel to the series form is possible only if:
Tf << Td << Ti
The controller gain as function of frequency is shown in Figure 6.11. At high
frequencies the gain approaches the value
K1 ⋅ K 2 ⋅ (Tf + Td )
.
Tf

|G |
PID

1/T'i 1/T'd 1/T f ω

Figure 6.11: Bode plot of the gain of a PID controller in series form as function of the
frequency

From the graph of Figure 6.11 it appears that the PID controller can be
considered as a combination of a low pass filter in series with a high pass filter (see
Section 5.3). This configuration is also called lead-lag filter.

6.4.4 The PIPI Controller


If a low pass filter is connected serially with a PI controller, or if two PI controllers
are connected in cascade, the resulting structure is a controller known as PIPI
controller. PIPI controllers are sometimes used in electrical drive systems; the low
pass filter attenuates the level of high frequency signals. Also in mechanical drive
systems resonance oscillations could arise, that are suitably dampened by such a
filter. The transfer function of the PIPI controller is:
1 + Ti s 1 + T3 s
GPIPI ( s ) = K ⋅ ⋅
Ti s 1 + T2 s
6.4: Continuous PID Controllers 191

where Ti is the integral time constant and Ti > T2 > T3 . The value of T3 is
usually selected to be equal to the resonance period (i.e. the inverse of the
resonance frequency) of the physical process to control. The gain as function of
frequency is shown in Figure 6.12.

|G |
PID

1/Ti 1/T2 1/T3 ω

Figure 6.12: Bode plot of the PIPI controller gain as function of the frequency

6.4.5 Other Parametrizations of the PID controller


In many cases a PID controller is parameterized by the following equation:
τ
δe
δu (τ ) = KP ⋅ e (τ ) + KI ⋅ ∫ e( τ )δτ + KD ⋅ (6.18)
δτ
0
This parametrization is equivalent to the form of Equation (6.12). There is
however an important practical reason, why Equation (6.18) is not universally
applicable. In the „classic“ PID controller (Equation 6.12) the gain of the whole
controller can be changed by only one parameter K , which is very convenient in
particular during the start-up or tuning of a technical process. This effect is also
evident in the Bode diagram of Figure 6.11. In the controller of Equation 6.12 the
entire Bode plot moves vertically, but its shape is preserved when K is changed. In
other words, the gain is altered equally for all frequencies. In the parametric form of
Equation (6.18) not only the gain factor will change for any parameter modification,
but also the break points of the different sections in the Bode diagram.
In the ideal controller the three parameters K , Ti and Td can be tuned
independently, but in practice there are always some interactions between the control
modes if the controller is realized with analog technology. The effect might be so
large that the actual parameter values could differ by as much as 30 per cent from
their nominal values. In digital control systems instead the controller settings can be
specified as accurately as desired, without any interaction between the terms.
192 Chapter 6: Control Structures

6.5 The Practical Realization of the PID Controller


Many different aspects must be taken in consideration in the practical
implementation of a controller. To begin with, the controller must be represented in
time discrete form, so that an appropriate sampling rate has to be selected. The
amplitude of the controller output signal has to be „realistic“, i.e. stay within the
minimum and maximum output limits. This limitation brings other practical problems
in the realization as well as in practical operation. In many applications not only the
output signal has to be limited, but also its rate of change in order to match physical
limitations of the actuators or to avoid unnecessary wearout. The change of
parameter settings and the switchover from automatic to hand operation - or the
other way around - should not lead to disturbances in process control. All these
questions are dealt with in this section.
Controllers can be realized with analog electronic technology on the base of
operational amplifiers and, increasingly commonly, with digital technology
implemented around a microprocessor. The external aspect is more or less similar,
the controller is included in a small sturdy box to be installed in industrial
environments. As we will see in this section, digital technology brings many
advantages, but the analog approach should still be kept present, as it provides a
reference foundation on which part of the digital solutions are based. Digital
controllers have the obvious advantage that they can be connected via
communication links to other control computers and therefore exchange process data
and receive remote settings. An example of program code for a digital PID controller
will be presented later in this section.

6.5.1 Discretization of the PID Controller


An analog controller must be discretized in order to be implemented on a
computer. The discretization is carried out with the same method as that used in
Section 5.4 for the discretization of analog low pass and high pass filters into digital
filters.
If the controller is first designed on the basis of an analog system description and
is discretized later, given sufficiently short sampling intervals, the time derivatives can
be approximated by finite differences and the integral by a summation. This approach
will be used also here (see also Section 3.4).
The process output error (Equation 6.1) is calculated at each sampling instant:
e ( kh ) = u c ( kh ) - y ( kh ) (6.19)
It is assumed that the sampling period h is constant. Any signal variations that
might take place during the sampling interval are neglected (see Section 5.1.3 and
5.1.4).
The controller algorithm can have two aspects: the position form and the
incremental form. In the position form the output control signal represents an
absolute value for the state of the actuator. In the incremental form the output
consists instead in position increments of the actuator in the one or the other
direction.
6.5: The Practical Realization of the PID Controller 193

The position form of the controller algorithm


The time-discrete form of the PID controller is:
u (kh ) = u 0 + u P (kh ) + u I (kh ) + u D (kh ) (6.20)
This algorithm is also called the position form since u ( kh ) represents the
absolute value of the output control signal. Even for zero control error the output
control signal may be non-zero. The offset signal u 0 is used to define the controller
output for zero control error.
According to Equation (6.14) the proportional part of the controller is:
u P ( kh ) = K ⋅ e ( kh ) (6.21)
The integral is approximated by finite differences and is equal to:

[ ]
u I (kh ) = u I (k - 1)h + K ⋅
h
Ti
⋅ e(kh ) = u I [(k - 1)h ] + K ⋅ α ⋅ e (kh ) (6.22)

with the constant α :


h
α = (6.23)
Ti
The integral part of the digital controller forms a recursive expression, i.e. its
value is updated at every sampling instance. The last term may become very small
for a small h and a large Ti . The word length in the computer has therefore to be
sufficiently large, so that the term K ⋅ α can be represented with sufficient precision.
The derivative part of the PID controller is obtained from (6.17) with (6.15)
inserted:
Td s
U D (s ) = −K ⋅ ⋅ Y (s ) (6.24)
Td
1+ s
N
The corresponding differential equation relation between u D (t ) and y (t ) is
dx D N
dt
=
Td
[ − x D (t ) + y (t )] (6.25)

u D (t ) = K ⋅ N [ − y (t ) + x D (t )] (6.26)

where x D (t ) is introduced as a state variable (this can be verified by taking the


Laplace transform of Equations (6.25) and (6.26) and by eliminating x D (t ) ).
The derivative in Equation (6.25) is approximated by a backward difference:
x D (kh ) = β ⋅ x D [(k − 1)h ] + (1 − β ) ⋅ y (kh ) (6.27)

where
−1
 hN  Td
β = 1 +  = (6.28)
 Td  Td + hN
194 Chapter 6: Control Structures

Note that the backward difference approximation is numerically stable for all Td .
Using Equation (6.27) together with (6.26) the derivative part of the PID controller
can be expressed as

u D (kh ) = β ⋅ u D [(k − 1)h ] − K ⋅ d ⋅ (1 − β )( y (kh ) − y [(k − 1)h ])


T
(6.29)
h
Further it holds that 0 ≤ β < 1. If the time constant of the differential term Tf (see
Equation 6.15) becomes equal to zero (i.e. N → ∞ ), then β = 0 and the derivative
action is described by a simple difference approximation of the output signal dy dt
(compare with Equation 6.16). Also, Td = 0 leads to β = 0 , which results in
u D (kh ) = 0 , i.e. no derivative action for the controller.

The incremental form of the controller algorithm


An alternative approach is the use of the so-called incremental form (or velocity
form) of the PID controller algorithm, to calculate only the actual change in the control
output. The incremental form of the PID controller is appropriate when the actuator is
some kind of integrator, like e.g. a stepping motor. Another such type of actuator is
for example or a valve controlled by pulses for opening and closing and that stays in
the last position when no input signals are given.
In the incremental algorithm only the change of the control output signal from the
time (k − 1) ⋅ h until the time k ⋅ h is considered. The controller is written in the form:

∆u (kh ) = u (kh ) - u[(k - 1) ⋅ h ] = ∆u P (kh ) + ∆u I (kh ) + ∆u ∆ (kh ) (6.30)


The proportional part in the incremental form algorithm is calculated from
Equation (6.21):
∆u P (kh ) = u P (kh ) - u P [(k - 1) ⋅ h ] = K ⋅ [e(kh ) - e[(k - 1)h ]] = K ⋅ ∆e(kh )
(6.31)
and the integral part from Equation (6.22):
∆u I (kh ) = u I (kh ) - u I [(k - 1) ⋅ h ] = K ⋅ α ⋅ e(kh ) (6.32)
The filtered derivative part is computed from Equation (6.29):
T
[ [
∆u ∆ (kh ) = β ⋅ ∆u ∆ [(k - 1) ⋅ h ] - K ⋅ d ⋅ (1 - β ) ∆y (kh ) - ∆y (k - 1) ⋅ h
h
]] (6.33)

where
∆y (kh ) = y (kh ) - y [(k - 1) ⋅ h ]
From a computing point of view, the calculations are quite simple. Floating-point
operations in single precision are normally sufficient for these operations. With the
incremental form of the controller there are also no problems due to windup (see
Section 6.5.4). In switching from manual to automatic mode the incremental
controller does not require any initialization of the control signal ( u 0 in the position
form, Equation 6.20). The actuator can be placed in the desired setting during the
start-up of a process under either manual or automatic control.
A minor disadvantage of the incremental form of the algorithm is that the integral
term must be included. The setpoint value is cancelled out in both the proportional
and derivative terms, starting from the second sampling interval following a setpoint
6.5: The Practical Realization of the PID Controller 195

change. Therefore, if the incremental form of the controller is used without the
integral term it is likely that the controlled process will drift away from the setpoint.

6.5.2 Selection of the Sampling Rate in Control Systems


The sampling of analog signals and the selection of the necessary sampling
rates were discussed in Section 5.1.3 and 5.1.4. The choice of a suitable sampling
rate for process control is not trivial and can actually be considered more like an art
than a science. A too low sampling rate can reduce the effectiveness of control,
especially its possibility to compensate for disturbances. In an extreme case, if the
sampling period is longer than the process response time, a disturbance could affect
the process and disappear again before the controller can initiate a corrective action.
It is therefore important to take both the process dynamics and the disturbance
characteristics into consideration in the selection of the sampling rate.
On the other hand the sampling rate should also not be too high, because this
means an increased computer load and actuator wear-out. The selection of the
sampling rate is therefore a compromise between the requirements of the process
dynamics and the available computer capacity as well as the process hardware.
Common commercial digital controllers which handle a small number of control loops
(e.g. between 8 and 16) use in general a fixed sampling rate in the order of a fraction
of a second.
Also the signal-to-noise (S/N) ratio influences the selection of the sampling rate.
For low S/N-values, i.e. when disturbances are comparatively high, high sampling
rates should be avoided because changes in the measured variable would mainly be
due to high frequency noise rather than to the real changes in the physical process.
In basic signal processing the main problem is to sample a signal and to recover
it later from the sequence of time-discrete values. The sampling theorem (Section
5.1.3) does not take into consideration the computational time that is needed for the
reconstruction of the original signal from the sampled values, so that in theory this
time could be infinite. Moreover, the signal analyzed by the sampling theorem is
assumed to be periodic, while in control applications the signals are usually not
periodic. These factors also influence the selection of the sampling rate.
It is reasonable to assume that a suitable sampling rate is related to the
bandwidth or the rise time of the closed-loop system. Some rules of thumb indicate
that the sampling rate should be about 6-10 times higher than the bandwidth, or also
that the rise time should correspond to at least to five sampling periods.
In the previous discussions the controller design was based on a continuous
(analog) system description. One way to calculate a suitable sampling rate is to
consider the closed-loop control system as a continuous system connected to a zero-
order sample-and-hold circuit (Section 5.1). Such a circuit can be approximated by a
time delay of half a sampling interval, which corresponds to a phase lag of 0.5 ⋅ h ⋅ ω c
radians, where ω c is the bandwidth (the 3dB crossover frequency) and h the
sampling period of the system. In the case that an additional phase delay of about 5°-
15° (i.e. 0.09-0.26 rad) can be accepted because of the hold circuit, the following rule
results:
h ⋅ ω c ≈ 0.15 − 0.5
Usually this rule leads to quite high sampling rates, so that the Nyqvist frequency
turns to be to be significantly larger than the closed-loop system bandwidth
frequency. This rule is used in many commercial digital single or multi-loop PID
196 Chapter 6: Control Structures

controllers. Other rules for the selection of the sampling rate are reported in the
specialized literature.

6.5.3 Limitation of the Control Signal


The controller output signal should be limited in amplitude, for at least two
reasons. First, the amplitude of the output signal must not exceed the range of the
D/A converter at the computer output; secondly, the operational range of the actuator
is usually limited. A valve cannot be more than 100 per cent open, a motor cannot
accept unlimited currents and voltages. The control algorithm must therefore include
some function to limit the output signal.
In several cases a neutral range (deadband) must be defined. If a controller with
an algorithm in incremental form is used, the incremental changes of the control
signal could be so small that the actuator cannot actually process them. Also, if the
control signal is strong enough to influence the actuator, it is of interest to avoid small
but frequent control actions that would contribute to its wearout. A simple solution is
to add up small changes of the control variable, and only after a certain threshold
value has been reached to transmit the resulting control signal to the actuator.
Naturally the deadband makes sense only if it is larger than the resolution of the D/A
converter at the computer output.

6.5.4 Prevention of Integral Windup


The integral windup is an effect that takes place when a PI or a PID controller
must compensate for a longer time for an error that lies outside the range of the
control variable. Because of the limitation in the controller output, it is difficult to bring
the error to zero.
If the control error has the same sign for a long time, the value of the integral part
of the PID controller becomes very large. This is particularly true if the control signal
is limited so that the required controller output is different from the actual output of
the actuator. Since the integral part can become zero only some time after the error
value has changed sign, the integral windup may cause large overshoots. Integral
windup is therefore the result of non-linearities resulting from limitations in the control
output signal and can actually never occur in a truly linear system.
An example will better illustrate the problem. A PI controller described in position
form is used to control a servomotor. The reference value for the angular position of
the motor axis is changed so much that there will be a saturation - and therefore
limitation - effect in the control signal, i.e. the voltage input to the motor. In practice,
the acceleration of the motor is limited. The step response of the angular position of
the motor axis is shown in Figure 6.13.
The value of the integral part of the PI controller is proportional to the area
between the step response y and the reference value u c . If the error term
u c (t ) - y (t ) is positive, the integral term will increase, otherwise it will decrease. As
long as the control signal is not limited, there is no windup. When the control signal is
limited (Figure 6.13.b) the response becomes slower and the integral part increases
until the error changes sign at t = t 1 . But even when the control error changes sign,
the control signal u remains large and positive for a long time, which results in the
large overshoot of y (t ) .
6.5: The Practical Realization of the PID Controller 197

1.5 y
uc
1.0

0.5

0 u

-0.5

(a) 0 50 100 150 200

1.5 y
uc
1.0

0.5

0 u

-0.5

(b) 0 50 100 t1 150 200

1.5
uc
1.0
y
0.5

0 u

-0.5

(c) 0 50 100 150 200

Figure 6.13: Illustration of integral windup problems for a position servo with PI control.
In Figure (a) is shown the step response in the case without control signal
limitation, so that no windup takes place. The control parameters are K = 0.4,
h*K/Ti = 0.04. In Figure (b) the control signal is limited to 0.1; the parameters
K and Ti are the same as for the first controller; no integral windup prevention
mechanism. In (c) is shown the effect of windup prevention according to
Equation (6.35); the added parameter Tt is = 5.
From this figure also appears clearly the difference between the time-
continuous measurement signals and the discrete control signals of the
regulator.

One way to limit the action of the integral part is by conditional integration.
Basically, when the error is sufficiently large the integral part is not needed in the
formation of the control signal. The proportional part is sufficient for control. The
integral part, that is used to remove stationary errors, is needed for control only when
the error is relatively small. With conditional integration the integral part is considered
in the final sum only if the error value is smaller than a predefined threshold. For
198 Chapter 6: Control Structures

large errors the PI controller acts like a proportional controller. The choice of the
threshold for the activation of the integral term is by far not a trivial matter. In analog
controllers the conditional integration can be realized with a Zener diode. This diode
is coupled in parallel to the capacitor in the feedback loop of the operational amplifier
in the integration part of the controller. With this circuit the contribution from the
integral signal will be limited.
In digital PID controllers there is a better way to avoid integral windup. The
integral part can be adjusted at each sampling time so that the controller output
signal does not exceed its limits. The procedure is straightforward. The desired
control signal u d is first computed with a PI controller algorithm and then it is verified
whether or not the actual controller output u exceeds the defined limits:
u = u min if u d < u min

u = u d if u min ≤ u d < u max (6.34)

u = u max if u d ≥ u max
After the limitation of the output signal the integral part in the controller is reset.
An example of PI controller with an anti-windup feature can be described by the
following Pascal code. As long as the control signal remains within the preset limits,
the last statements in the program code will not affect the integral part.

(*initial calculation*)
c1:=K*h/Ti;
...
(*controller*)

e:=uc-y;
Ipart:=Ipart+c1*e;
ud :=K*e + Ipart; (*calculation of the desired control signal*)
if (ud < umin) then u:= umin (* limiting function *)
else if (ud < umax) then u := ud
else ud := umax;
Ipart:=u-K*e; (*anti-windup correction of the integral part*)

To implement anti-windup action in a PID controller the described method has to


be slightly modified. The integral part is updated with the value e s = u − u d that
represents the difference between the real, current actuator output u and the desired
controller output u d . The actuator output can either be measured directly, if feasible,
or calculated from a model. The error term e s is obviously zero if the actuator
produces the required control signal and no saturation takes place. For the reset of
the integral part the signal e s is multiplied with a factor 1/ Tt ( Tt is a coefficient
called tracking time constant). In the PI controller algorithm shown above, this time
constant is equal to h , i.e. the update of the controller output takes place already at
the next sampling instance. When the regulator algorithm contains also a derivative
part, it is advisable to update the integral more slowly. An appropriate value for the
tracking time constant Tt is to set it equal to the integral time constant Ti . The output
of the PI controller then becomes:
6.5: The Practical Realization of the PID Controller 199

 1
t  1
t
u d (t ) = u P + u I = K ⋅ e(t ) + ∫ e(t )dt +
 
Tt ∫
[u (t ) − u d (t )] dt
 Ti
0

 0

where u is the limited value of u d (Equation 6.34). If the control signal is


saturated, then the difference u − u d will cause a change of the integral part until the
saturation effect disappears. Consequently windup is avoided. This is actually the
method shown in the example of the PI controller with prevention of integral windup
(Figure 6.13.c).
By taking the derivative of the integral part, it is obtained:
du I K 1
= ⋅e + ⋅ (u − u d )
dt Ti Tt
which can be discretized as follows:

u I [(k + 1)h ] = u I (kh ) + h ⋅


K
Ti
⋅ e(kh ) +
h
Tt
[u (kh ) − u d (kh )] (6.35)

Then the PI controller becomes:


u d (kh ) = K ⋅ e(kh ) + u I (kh ) (6.36)
where u I ( kh ) is given by Equation (6.35). The integration has been
approximated by forward differences instead of backward differences. This is
necessary since u d (kh ) must be known before the integral part is calculated. This
modified and improved routine for prevention of integral windup (Equations 6.35,
6.36) is contained in the algorithm for the PID controller in Section 6.5.8.

6.5.5 Bumpless Transfer in the Change of the Controller Operational Mode


When a controller is switched from manual to automatic mode the controller
output signal may suddenly jump to a different value, even if the control error is zero.
The reason is that the integral part of the controller algorithm is not necessarily also
equal to zero. The controller is a dynamic system and the integral part represents
one internal state that must be known when its operational mode is changed. The
sudden jump of the controller output can be avoided, and the transfer is then called
bumpless. Here we can consider two situations:
• Shift between manual and automatic mode
• Change of regulator parameters
The bumpless change from manual to automatic mode of an analog controller is
achieved by manually bringing the process to a point so that the output measurement
value is identical to the setpoint. The process is then kept in this state until the
controller output signal is equal to zero. At this point the integral part is also equal to
zero, and since the error is zero a bumpless transfer is obtained. The same
procedure can also be used for digital controllers.
Another method is to slowly bring the setpoint value toward its target value.
Initially the setpoint value is set equal to the actual measurement value, and is later
gradually manually adjusted to its desired value. If this operation is performed slowly
enough, the integral part in the controller will remain so small that the operation mode
200 Chapter 6: Control Structures

transfer will take place smoothly. The obvious drawback of this method is that it may
require too long time, depending on the process.
The PID controller in incremental form (Equation 6.30) does not need to be
initialized as described here when its operation mode is changed. The operator sets
the actuator to a position corresponding to the setpoint before switching from manual
to automatic mode. Then the controller does not generate any output signal for the
actuator until there will be an error between setpoint value and process output. It is
often important to store the actual control signal also when the controller in
incremental form is used, as these values might have later to be checked.
In digital PID controllers there is still another way to perform bumpless transfer.
The control algorithm is executed even when the controller is in manual mode. The
process output measurement y is read into the computer and the control error is
calculated, but without the controller output actually influencing the process. In this
way the integral part is constantly updated. If the controller is then switched into
automatic mode, and provided that the setpoint value is equal to the actual process
output, the operation mode transfer will be bumpless.
The main feature in all bumpless transfer procedures is the update of the integral
part of the controller to such a value, that the control signal remains the same
immediately before and after the mode switching.
A further problem arises in case of parameter changes in the PID controller.
Immediately before the change the regulator output signal can be written as follows
(compare with Equation 6.20):
u (t -) = u 0 + u P (t -) + u I (t -) + u D (t -)
and immediately after the parameter change the output is:
u (t +) = u 0 + u P (t +) + u I (t +) + u D (t +)
The change of one or a few parameter will influence all of the regulator terms.
The bumpless transfer from one set of parameters to another will only take place if
the controller output does not change, u (t -) = u (t +) , where t denotes the time for
the parameter change. The value of either the integral part or of the derivative part
must be changed, so that at the transfer time no abrupt change of the controller
output will take place. For example the change of the integral part has the following
form:
u I (t +) = u P (t -) + u I (t -) + u D (t -) - u P (t +) - u D (t +)
A bumpless transfer is achieved if the difference u (t +) - u (t -) is equal to zero.

6.5.6 Limitation of the Rate-of-Change of the Control Signal


In many systems it is necessary to limit the amplitude or the rate of change of the
control signal, and for this special circuits can be used. A protection circuit can be
connected after the manual setpoint input u c (t ) to deliver to the controller a filtered
reference signal u L (t ) , so that the process actually „sees“ this control signal instead
of the original setpoint. This is common practice in the operation of electric drive
systems. The limitation of the rate of change of a signal can be realized by a simple
feedback circuit (Figure 6.14). The response to a setpoint signal with sudden
changes is also shown in the figure.
6.5: The Practical Realization of the PID Controller 201

Uc
Uc E lim 1 UL
Σ
s

UL

-1
time
(a) (b)

Figure 6.14: (a) Circuit for the limitation of the rate-of-change of a signal. In (b) is shown
the typical response to a sudden change of the reference (set-point) value.

The manual control signal that should act as setpoint value u c (t ) is compared
with the allowed control signal u L (t ) . The difference is first limited between the
values uemin and uemax . The resulting value is then integrated, where the integral is
approximated as a finite sum. The algorithm of the rate-of-change limiter can be
written as follows:


ue(kh) = uc(kh) -uL(kh);
if (ue < uemin) then uelim:= uemin (* Limiting function *)
else if (ue < uemax) then uelim := ue
else uelim := uemax;
uL(kh) = uL((k-1)h) + h*uelim(kh);

6.5.7 Computational Aspects


In the practical discrete realization of the PID controller, the sequential nature of
the computation brings delays that do not exist if the controller is realized with analog
technology. In addition several practical solutions like the anti-windup and bumpless
transfer schemes require that the controller output and the actuator action take place
simultaneously. The computational delays must therefore be as small as possible.
For example, some terms in the digital controller could be computed before the
actual sampling instance. For example, in a controller with anti-windup function
(Equation 6.35) the integral part can be written as follows:
u I [(k + 1)h ] = u I (kh ) + c1 ⋅ e(kh ) + c 2 ⋅ [u (kh ) - u d (kh )] (6.37)

where
K ⋅h h
c1 = ; c2 = (6.38)
Ti Tt
The integral term can be computed in advance with forward differences. The
derivative term (Equation 6.29) can be written as:
202 Chapter 6: Control Structures

T
[ [ ]]
u D ( kh ) = β ⋅ u D [ ( k - 1)h ] - K ⋅ d ⋅ (1 - β ) ⋅ y ( kh ) - y ( k - 1)h =
h
T T
= - K ⋅ d ⋅ (1 - β ) y ( kh ) + β ⋅ u D [( k - 1) h ] + K ⋅ d ⋅ (1 - β ) y [( k - 1) h ]
h h
which can also be expressed in the form:
u D (kh ) = - c 3 ⋅ y (kh ) + x[(k - 1)h ] (6.39)

where
T
c 3 = K ⋅ d ⋅ (1 − β ) (6.40)
h
and
T
x[ (k − 1)h ] = β ⋅ u D [ (k − 1)h ] + K ⋅ d ⋅ (1 − β ) ⋅ y [ (k − 1)h ] =
h
= β ⋅ u D [ (k − 1)h ] + c 3 ⋅ y [ (k − 1)h ]

The state x can be updated immediately after the time kh :


x (kh ) = β ⋅ u D (kh ) + c 3 ⋅ y (kh ) =

[ ]
= β ⋅ -c 3 ⋅ y (kh ) + x[ (k - 1)h ] + c 3 ⋅ y (kh ) = (6.41)

= β ⋅ x[ (k - 1)h ] + c 3 ⋅ (1 - β ) ⋅ y (kh )

Thus u D [ (k + 1)h ] can be calculated from Equation (6.39) once the


measurement y [ (k + 1)h ] has been obtained.
Considering the computational capabilities of modern computers it might appear
strange to dedicate such efforts to optimize the calculations. It must however be
considered that a digital controller might have to perform some thousands of control
operations in a second; in such a case it does make a difference whether certain
coefficients are immediately available or must be computed anew each time. It
should also be considered that industrial controllers build for field use are not
necessarily built with the fastest processors available on the market. For these
reasons the order and the type of computations do make a difference in the control
operations rate.
The temporary parameters c1 , c 2 and c 3 have no obvious physical
interpretation. Instead the basic PID parameters K , Ti , Td and Tf must be used in
the operator interface.
Also the precision of the calculations should be considered. In the incremental
form of the PID algorithm most of the computations represent only incremental terms,
so that even a short word length is adequate. Rounding inaccuracies in the integral
part can instead lead to problems, as already commented in Section 6.5.1.

6.5.8 Algorithm of the PID Controller


In the following it is presented an example of software code in Pascal for the PID
controller. The computation of the controller coefficients c1 , c 2 and c 3 need to be
6.5: The Practical Realization of the PID Controller 203

done only when some of the controller parameters K , Ti , Td and Tf are changed.
The control algorithm is executed at each sampling time; the code also contains an
anti-windup feature in the integral term. The core instructions of the PID algorithm
have the following aspect:

(* Preliminary parameter calculation *)


c1:= K*h/Ti; (* Equation 6.38*)
c2:= h/Tt; (* Equation 6.38*)
beta:= Td/(Td + h*N); (* Equation 6.28*)
c3:= K*Td*(1-beta)/h; (* Equation 6.40*)
c4:= c3*(1-beta); (* local constant *)
ipart:= 0
x:= 0
(* control algorithm *)
uc := AD_input(ch1); (* read setpoint value, analog input *)
y := AD_input(ch2); (* read measurement, analog input *)
e:= uc-y; (* control error calculation *)
ppart:= K*e; (* proportional part calculation *)
dpart:= x-(c3*y); (* derivative part calculation, Equation 6.39*)
ud:= u0+ppart+ipart+dpart; (* controller output before signal limitation *)
if (ud < umin) then u:= umin (* limitation function *)
else if (ud < umax) then u := ud
else u := umax;
DA_output(ch1, u); (* analog output u, output channel #1*)
ipart:=ipart + c1*e + c2*(u-ud);
(* integral part with anti-windup, Equation 6.35 *)
x:= beta*x + c4*y; (* state update, Equation 6.41;
c4 is computed in advance *)

A commercial digital PID controller is shown in Figure 6.15. On the front panel of
the controller the reference and the current process output values are displayed. The
pushbuttons allow the simple switching between manual and automatic mode. Other
keys are used for increasing/decreasing the setpoint value and setting other
controller parameters.

6.5.9 Implementation with Application-Oriented Block Language


The algorithms for the realization of a controller can be coded in any sequential
programming language. However, in practical implementations process-oriented
high-level languages are mostly used, so-called block languages. As for
programmable logical controllers (PLCs, Section 7.3) it is common practice to
represent the controller functions in blocks, where only the input and output signals
are marked but the algorithm itself is hidden. The control parameters can of course
be changed by the process computer. Figure 6.16 shows a typical presentation form
of PID controllers in block language. The programmer, with special software at
disposal, needs only to label the inputs and outputs of each controller block with
proper variable names and then to connect the controllers among themselves and to
other circuit elements. The whole activity takes place at the computer terminal.
204 Chapter 6: Control Structures

Alfa Laval

ECA60 ISP L
t/h

100

90

80

70
100

60
80
50

40 60

30
40

20

20
10

0 0
PV SP OUT

Figure 6.15: An industrial PID controller (courtesy Alfa Laval Automation, Sweden)

PID 20

R.21 ON AUTO
UEXT
R.22 REF
R.23 R.29
FB U
R.68
R.24 HI AO 30
R.25 LO K SW 50
Ti Td
S1
0.2 2.0 0.3
R.59 output
R
S2
PID 40
ON AUTO max min CH
R.41 UEXT
1.0 0.0 4
R.42 REF
R.43 R.49
FB U

R.44 HI
R.45 LO K Ti Td
0.1 3.0 0.4

Figure 6.16: Block diagram symbol of two PID controllers connected to a selection switch
and an analog output unit
6.6: Control Structures Based on PID Controllers 205

The diagram shows two PID controllers connected to a switch. One of the two
regulator outputs is selected via a binary signal to the switch; this output value is then
sent to the analog output unit. The AUTO-input is a binary variable for the selection
between manual and automatic mode. The reference setpoint value is fed to the
input REF and the measurement value from the process output is connected to the
point FB, feedback. The limits for the control signal are marked by the two
parameters HI(gh) and LO(w). The controller tuning parameters K , Ti and Td
(denoting controller gain, integral time constant and derivative time constant) are
displayed below each controller symbol. The analog output circuit is defined by its
channel number and operating range.
In addition to sequential control functions many software packages for industrial
process control also contain programmed controller blocks. Complete blocks for
standard solutions can be contained in program libraries, either ready to be called as
subroutines or in source-code form to be further modified by the user. In addition, the
user may define own blocks with special algorithms. Some of the most common
software packages allow more flexibility than what PID controllers alone can offer. In
this way quite complicated software structures can also be developed at
comparatively little expense.

6.6 Control Structures Based on PID Controllers


6.6.1 Cascade Control
A limitation of conventional feedback control is that the correction for
disturbances cannot begin until after the process output deviates from the setpoint.
As discussed in Section 6.3, feedforward control brings considerable improvements
in the control of processes with large time constants or time delays. However,
feedforward control requires that the disturbances be measured explicitly and a
precise process model be available for calculating the effect of the disturbances on
the process.
In the previous treatment, the value of the setpoint u c was always indicated
explicitly. The setpoint can either be typed in by the operator via the keyboard, read
from the computer internal memory or entered in the system in other ways. For
example, the output of one controller can represent a setpoint for another controller;
this is the case in cascade control.
By using a second measurement point and an additional feedback controller the
dynamic response of the process to load changes may be greatly improved. The
secondary measurement point is located so that it recognizes the influencing
condition earlier than this appears at the process output; the disturbances are not
necessarily measured. This is the essence of cascade control. It is particularly useful
when the upset condition is related to the reference variable or when the actuator is
non-linear (e.g. a valve or a motor with non-linear electrodynamic behavior).

Example 6.6 Control of an electric drive system


A system for the control of position and velocity of an electrical drive system
was presented in Section 4.7.2. The cascade structure (see Figure 4.32) has
become the standard solution for the control of electric drive systems. In principle
the velocity could be controlled by just one regulator in standard feedback
configuration. This unit would measure the velocity, calculate the error from the
206 Chapter 6: Control Structures

setpoint value and then generate the appropriate voltage for the correction of the
motor velocity. Such a controller, however, would have to take a large number of
factors in consideration and would therefore be extremely complex and impractical.
A cascade structure for the solution of this control problem is shown in Figure
6.17. The velocity controller GR1 computes an output signal corresponding to the
torque needed to accelerate the motor to the desired speed. The current I ref that
is necessary for the motor to produce this torque is calculated from a mathematical
model of the motor. This model is represented here simply by a gain factor KT ,
which is adequate for d.c. motors.

speed Ω ref
reference

speed
Σ G R1 control

torque T
reference ref

current-torque
KT model

current I current power motor


reference ref control electronics
V I Ω
Σ G
R2
G
A
G
M1
G
M2

rotor current
-1

angular velocity (speed)


-1

Figure 6.17: Block diagram for cascade control of the angular velocity in an electrical
drive system

The inner control loop controls the current needed to produce the torque. The
output of the controller GR2 is the control signal for the power electronics unit to
produce the necessary supply voltage for the motor.
Let us calculate the transfer function from the rotor current setpoint I ref to the
actual rotor current I . The power electronics and the electrical circuitry in the
motor are represented by the transfer functions G A and GM1 respectively (the real
system is actually not linear, but these more simple functions are sufficient for a
qualitative illustration of the principle). The transfer function G I of the inner loop is:
I (s ) GR 2 ⋅ G A ⋅ GM1
GI (s ) = =
I ref (s ) 1 + GR 2 ⋅ G A ⋅ GM1
If the gain of GR2 is large, then the transfer function G I will approach the
value 1 and will therefore become quite insensitive to variations in the transfer
6.6: Control Structures Based on PID Controllers 207

functions of the power electronics or of the motor. A non-linear behaviour of the


motor or of the power electronics can for example be modelled by transfer
functions with variable coefficients.
Three quite simple sub-systems are connected in series to the output of the
speed controller: a linear amplifier with gain factor KT , the current control loop G I
(with G I close to unity) and the mechanical part of the motor, GM 2 . The cascade
structure eliminates many of the inherent complexities in the power electronics and
the motor dynamics. In addition, the rotor current feedback control serves yet
another purpose. Since the rotor current must be limited, the inner loop also
performs the limiting function.

The cascade structure is suitable also for the commissioning (i.e. first startup) of
a control system. The inner control loop is tuned first. Since the inner loop simplifies
the dynamic behavior of the outer loop, also this tuning can be performed more
easily. The inner loop parameters do not need to be changed when the outer loop is
tuned. In some cases, like e.g. the position control of a motor axis, another loop is
added outside the velocity control loop (see Figure 4.32). The tuning of this position
loop can then proceed in the same manner.
In summary, the cascade structure has two distinctive features:
• The output signal of the primary (master) controller serves as a setpoint for the
secondary (slave) controller.
• The two feedback loops are nested, with the secondary loop located inside the
primary control loop. The dynamics of the secondary loop has to be significantly
faster than that of the primary loop.
The windup effect requires special attention in cascade control systems. The
anti-windup for the secondary (internal, slave) controller can be realized as shown in
Section 6.5.4. To avoid integral windup in the primary controller, however, one has to
know when the secondary controller saturates. In some systems, when the
secondary controller saturates the primary controller is set to manual mode. Because
of their different speeds, the control loops can work with different sampling rates,
where the sampling rate for the secondary controller could be much higher than that
of the primary control loop. The program code for the primary regulator will deliver an
updated setpoint value for the secondary controller. The primary (outer) loop
controller can receive its setpoint from the operator or from another program.

6.6.2 Selective Control


In many process control problems there are more measurements or output
values than control variables. It is therefore impossible at the same time to eliminate
the errors in all the controlled values for arbitrary setpoint changes or disturbances
by using only simple single-input-single-output controllers. Selective control is a
control method in which two or more controllers can operate on a common actuator
and where one out of several measurement values is taken as the controlled
variable. The selector is used to choose the most appropriate measurement variable
from among a number of available measurements. Selectors are non-linear elements
that enhance the function of control loops and can be simply realized in digital
systems. With the use of selectors the system operations are not only improved, but
the system is also protected from unsafe operation.
208 Chapter 6: Control Structures

One type of selector device delivers as output the highest, or lowest, of two or
more input signals (on instrumentation diagrams the high selector is denoted by HS
and the low selector by LS ). This type of selector can for instance be used to
choose the maximum out of several temperature measurements as input to a
controller or for representation in an alarm display. Another type of selector
calculates the average from several input signals. In this way a temperature could be
not only indicated by one single sensor, but calculated as average from several
signals, thereby increasing the quality and reliability of the measurement.
One example of selective control operation is found in district heating networks.
A control principle is to regulate the speed of the feeder pumps so that the pressure
difference from the pump output to the network periphery is always above a certain
minimum value. The location in the district heating network where at any given time
the pressure difference is lowest is taken as reference for control. Because this point
can shift in space depending on the time and the operating conditions, signals are
collected from several locations in the network periphery. A selector then connects
the pressure sensor that is delivering the lowest differential value to the pump speed
controller.
The use of high or low limits for process variables is another type of selective
control, called override. When a signal reaches any of these limits, the normal
controller operation is turned off and alarm procedures are carried out instead. The
anti-windup feature in controllers is in a certain sense a particular type of override.

6.7 The Performance Limits of PID Controllers


PID controllers are applied successfully for the solution of most control problems
in industrial processes. The most important reason for this wide application range is
that the dynamical properties of most technical processes can be adequately
approximated by second-order dynamical models. The PID controller is instead
inadequate to control processes with additional complexity factors, such as:
• time delays
• significant oscillatory behavior (complex poles with small damping)
• parameter variations, both predictable and unpredictable
• multiple-input multiple-output systems.
These performance limits will be examined in the present section.

6.7.1 Time Delays


Time delays, also called dead times, often appear in industrial processes; they
are the result of long paths, different feedback loops or even of the time that may be
required for carrying out product analyses and deliver the related results as
measurement data. In all these cases the information from the technical process
reaches the controller later than desired. Generally speaking, all information that is
too old causes problems („the right data too late is wrong data“). Delays limit the
performance of the control system and may lead to instability of the technical
process.
In the PID control of a system with time delays the gain must be kept quite small
in order not to risk instabilities. For this reason processes with delays that are
controlled by PID controllers usually show a sluggish behavior. The following
example will illustrate this point.
6.7: The Performance Limits of PID Controllers 209

Example 6.7 Control of a system with time delays


A system consists in two chemical mixing tanks that are connected in series
(see also Example 3.7 and Figure 3.10). The concentration c of the effluent
chemical is measured (variable y ), but the measurement procedure takes a time
T . The influence of the delay time is illustrated by PI control of the concentration
(Figure 6.18).

y
concentration
1.6
process with
1.4 time delay

1.2 reference
concentration
1

0.8

0.6

0.4 process without


time delay
0.2

0
0 T=3 5 10 15 20 25 30
time

Figure 6.18: PI control of a chemical process with and without time delay (3 time units).
The controller parameters are the same in both cases.

A PI controller has been tuned to produce a good control result, as if there


were no time delay. The transfer function of the closed-loop system is:

Y (s ) GR ⋅ G P ⋅ e − sT
=
Uc (s ) 1 + GR ⋅ G P ⋅ e − sT
where GR is the regulator transfer function, G P the process transfer function
and e − sT the transfer function of the measurement time delay.
It is difficult to control the system with a simple controller. In the shown
example, the concentration is found to be too low at time t = 0 . The controller then
increases the dosage to correct the concentration. Any change due to the control
action at time t = 0 will not be seen until time t = 3 . Since the controller for t < 3
does not record any change in the concentration value, it further increases the
dosage. The result of the change made at t = 0 is first observed at time t = 3 . If
the gain of the controller is large, the change of the concentration in the meantime
may also become very large. Consequently, the controller will decrease the
dosage, but the result of this change will be observed only at time t = 6 , so that
the control action between t = 3 and t = 6 may further deteriorate.
210 Chapter 6: Control Structures

The difficulty with system delays is that necessary information comes too late
and creates stability problems. The problem of controlling systems with time delays
was solved as early as 1957 by Prof. Otto Smith in Berkeley. He suggested a
controller that includes a model of the system (Figure 6.19). This controller is
consequently called a Smith predictor.

technical
controller process
Uc E U Y
Σ Σ GR e-sT GP

process
model

-1+e- sT GPM

-1

Figure 6.19: Block diagram of the Smith controller

The controller contains a model of both the process and the time delay. The
transfer function of the predictor G PM is a model of the technical system and is not
necessarily the same as the process transfer function G P . If G PM were a perfect
model of the technical process, so to be identical with G P , straightforward
calculations show that the transfer function of the closed loop system would become:

Y (s ) GR ⋅ G P ⋅ e − sT
=
Uc (s ) 1 + GR ⋅ G P
where GR is assumed to be a regular PID controller, G P the process model and
e − sT the time delay. With the Smith predictor, the denominator of the closed loop
system is the same as if the time delay did not exist. In other words, with the
predictor the closed loop system transient response looks exactly the same as
without the time delay, but is delayed by time T .
The controller equation can be written explicitly. Without the predictor, the
control signal is:
U ( s ) = GR ( s ) ⋅ E ( s )

With the predictor we obtain (in the following the argument s will not be shown)
(Figure 6.19):
[
U = GR ⋅ E + GPM ⋅ e − sT ⋅ U − GPM ⋅ U ]
The first term is the normal controller output signal that is computed as function
of the control error. The second term is a correction factor related to a previous
control signal u (t - T ) multiplied with a model G PM of the process. The last term is
based on the actual control signal. It follows from this structure that old control values
6.7: The Performance Limits of PID Controllers 211

have to be stored. The implementation of the predictor was difficult at the time when
Smith suggested the idea, since only analog technology was available and it was
therefore not possible to store analog values for a long time. In a digital computer,
however, storing old values is trivial.
The necessity for storage of old control signals can be understood also from an
intuitive point of view. Again, consider the example of Figure 6.18. If the controller
stores the control signal at time t = 0 and „knows“ that the result will appear only at
a time t = 3 , it is then plausible that u ( 3 ) should be also a function of u ( 0 ) . With a
Smith controller and without changing the controller tuning, the same process as in
Figure 6.18 will perform considerably better. The transient answer of the feedback
system is the same as if there were no time delay; it is only delayed by the time T
(Figure 6.20). The Smith predictor can also be included in a more general discrete
regulator (Section 6.8).

6.7.2 Complex Dynamics


Because of its limited number of parameters, a PID controller can not arbitrarily
influence a process with higher order dynamics. Especially in systems that show
significant oscillations the use of higher order controllers is needed in order to
achieve better control performance. Such an example was shown with the PIPI
controller applied to electrical drive systems (Section 6.4.4), where the order of the
controller was increased by a low pass filter. The general analog controller (Equation
6.7) gives the necessary freedom to adjust for complex dynamics; its time-discrete
form is the subject of Section 6.8.

concentration
1.2 reference
concentration
1

0.8
process with time
delay; actual
0.6 concentration
0.4

0.2

0
0 T=3 5 10 15 20 25 30 time

Figure 6.20: Control of chemical dosage with the Smith predictor. The controller parameters
are the same as in Figure 6.18.
If the predictor model reproduces exactly the real technical process, then the
controlled output is identical to that for the process without delay, but with a
time shift. In practice, the predictor model is always approximate to some extent
and consequently also the controlled output may not follow the same envelope
as for a controlled system without delays.
212 Chapter 6: Control Structures

6.7.3 Predictable Parameter Variations - Gain-Scheduling Control


In many situations the parameters of the technical process change with the
operating conditions. A typical example is taken from a wastewater treatment plant.

Example 6.8 Control of dissolved oxygen concentration


The dynamics of dissolved oxygen in an aerator is non-linear (Section 3.2.3,
Example 3.8). The transfer rate from oxygen in gaseous state to dissolved oxygen
was modelled in Example 3.8 as k L a = a ⋅ u , with α as a constant parameter and
u the air flow rate. However, the term k L a is a non-linear function of the air flow
rate (Figure 6.21) and can be considered linear only for small air flow variations.

oxygen
transfer rate

air flow rate

Figure 6.21: Typical behavior of the oxygen transfer rate (from gaseous to dissolved
oxygen) as function of the air flow rate

The sensitivity of the term k L a to air flow changes is high for small air flow
rates and decreases if the air flow rate is increased. Consequently the controller
gain needs to be higher for high air flow rates. In addition, the oxygen saturation
represents a further non-linearity. Since both the air flow rate and the dissolved
oxygen concentration can be measured, the process gain for different operating
conditions can be modelled and stored in a table. The controller gain for a
particular operation is then immediately at disposal.

If the value of the process gain is known at different operating points, the
controller parameters can be calculated in advance and stored in a table. This
procedure is called gain-scheduling and is commonly used for many applications,
for example in steam boiler control (the control settings change at different power
levels) or in aircraft control (the aircraft behaves differently depending on the
altitude), etc.

6.7.4 Unknown Parameter Variations - Self-Tuning Control


Many systems exhibit a process dynamics with parameters that are unknown but
are constant in time. In other systems the parameters change slowly with time,
because of many possible reasons. Pipes may be gradually clogged, and this
influences flow rates or heat transfer properties. In the air-fuel ratio control of a
combustion engine the sensor changes its sensitivity and bias in an unknown way
6.7: The Performance Limits of PID Controllers 213

over time. In a biological fermentor or a wastewater treatment plant new organisms


may appear and change the pattern of the oxygen uptake rate.
Systems with a simple, low order dynamics are simple to control if their
parameters are known and constant. A PID controller is adequate in most cases.
However, if the process parameters slowly change in time, the tuning will be quite
poor most of the time. One solution to this problem is the automatic parameter tuning
in the PID controller, in the so-called auto-tuner. The tuning operation is first initiated
by the operator. The auto-tuner then induces some small disturbances to the
process in order to detect its dynamics. The controller then computes the PID
parameters from the process response. The identified parameters are stored and
used for control until the process engineer initiates a new tuning operation.
One logical step further, the controller parameters may be continuously updated
at the same time that process control takes place. When the controller parameters
are automatically tuned the whole time, the procedure is called adaptive control.
Adaptive controllers contain two distinct subsystems, one for estimation and the
other for control, as shown in Figure 6.22.

design parameter
calculations estimation

regulator
parameters

technical
reference regulator process
signal controlu output y
signal signal

Figure 6.22: The main components of an adaptive controller

In the estimation part of the controller the process input and output signals are
continuously measured. From these data, an algorithm for regulator design
computes and updates the controller parameters. In fact the adaptive controller
consists of two control loops: one fast control loop for the actual control function and
a slower loop with the parameter update procedures.
There are several variants of this general scheme. Instead of updating the
process parameters, the controller parameters could be updated directly. Even if the
basic algorithms are quite simple from a programming point of view, an adaptive
control system requires a large safety network of rules to avoid misuse. It is
commonly believed - but is not true - that the adaptive controller solves all difficult
control problems. However, if the adaptive controller is used with caution and
knowledge, it offers wide possibilities for solving complex control tasks. The
controller part of the adaptive controller can be a general discrete controller, as
described in next section. Several types of adaptive controllers are available on the
commercial market.
214 Chapter 6: Control Structures

6.7.5 Systems with Several Inputs and Outputs


Some systems have many inputs and outputs, and the couplings between them
may become very significant. The control task cannot obviously be solved by simple
controller with only one input and one output connected to any process input-output
pair. Instead every control signal must be a function of several measurement signals.
One way to realize this type of controller is with state variable feedback (Section
6.10).

6.8 The General Linear Discrete Controller


The general linear discrete controller is an algorithm that allows the realization
of several digital control structures and principles. This section is dedicated to the
study of its properties.
It is often most convenient to describe a technical process with one input and
one output by the direct relation of the input u to the output y . In such a case also
the controller can be written in the same form, with the control signal explicitly
indicated as function of the process output signal. The general discrete controller is
written in such form:
u ( kh ) = - r1 ⋅ u[ ( k - 1) h ] -  - rn ⋅ u[ ( k - n ) h ]

+ t 0 ⋅ u c ( kh ) + t 1 ⋅ u c [ ( k - 1) h ] +  + t n ⋅ u c [ ( k - n ) h ] (6.42)

- s 0 ⋅ y ( kh ) - s1 ⋅ y [ ( k - 1) h ] -  - s n ⋅ y [ ( k - n ) h ]

where u is the controller output, u c the reference value and y the process
output. y ( kh ) represents a discrete measurement data sequence delivered by a
sampling unit. The parameters ri , s i and t i must be found in order to reach the
desired regulation performance.
This controller corresponds to the general analog controller of Equation (6.7). In
the same way that an analog controller of order n can change all poles of a system
of the same order, a time-discrete controller can change at will the dynamics of a n -
order discrete system. And again similarly as for the analog controller, also the
general discrete controller can be extended to include a feedforward control
component.

6.8.1 Description of the General Controller Using the Shift Operator


The analysis of the discrete equations can be handled quite easily by using the
shift operator q introduced in Section 3.4.2. With help of the shift operator q the
notation of the discrete controller can be made more compact. Equation (6.42) can
be written in the form:
u ( kh ) = - r1 ⋅ q -1 ⋅ u ( kh ) -  - rn ⋅ q - n ⋅ u ( kh )

+ t 0 ⋅ u c ( kh ) + t 1 ⋅ q -1 ⋅ u c ( kh ) +  + t n ⋅ q - n ⋅ u c ( kh ) (6.43)

- s 0 ⋅ y ( kh ) - s1 ⋅ q -1 ⋅ y ( kh ) -  - s n ⋅ q - n ⋅ y ( kh )
6.8: The General Linear Discrete Controller 215

By rearranging the terms, it is obtained:

[1 + r1 ⋅ q -1 +  + rn ⋅ q - n ] u (kh) =
= [ t 0 + t 1 ⋅ q -1 +  + t n ⋅ q - n ] u c (kh ) - [ s 0 + s1 ⋅ q -1 +  + s n ⋅ q - n ] y (kh )

With the introduction of the polynomials R , S and T the notation is even more
simplified:

( )
R * q −1 = 1 + r1 ⋅ q −1 +  + rn ⋅ q − n

S * (q −1) = s 0 + s1 ⋅ q −1 +  + s n ⋅ q − n (6.44)

T * (q −1) = t 0 + t 1 ⋅ q −1 +  + t n ⋅ q − n

By multiplying with q n , it is obtained:

( )
R(q ) = q n ⋅ R * q −1 = q n + r1 ⋅ q n − 1 +  + rn

S(q ) = q n ⋅ S * (q −1 ) = s 0 ⋅ q n + s1 ⋅ q n − 1 +  + s n (6.45)

T (q ) = q n ⋅ T * (q −1 ) = t 0 ⋅ q n + t 1 ⋅ q n − 1 +  + t n

The controller can then be written in the polynomial form:


R(q ) ⋅ u ( kh ) = T (q ) ⋅ u c ( kh ) − S(q ) ⋅ y ( kh ) (6.46)

and also:
T (q ) S(q )
u ( kh ) = ⋅ u c ( kh ) − ⋅ y ( kh ) = u F1( kh ) − u FB ( kh ) (6.47)
R(q ) R(q )

The multiplication with q n simply means that the time argument in Equation
(6.42) is shifted for n sampling periods:
u[ ( k + n ) h ] = - r1 ⋅ u[ ( k + n - 1) h ] -  - rn ⋅ u ( kh )

+ t 0 ⋅ u c [ ( k + n ) h ] + t 1 ⋅ u c [ ( k + n - 1) h ] +  + t n ⋅ u c ( kh ) -

- s 0 ⋅ y [ ( k + n ) h ] - s1 ⋅ y [ ( k + n - 1) h ] -  - s n ⋅ y ( kh )
There is a formal similarity between the Equation (6.47) and the continuous
controller (Equation 6.6). Both controllers contain two terms, the feedforward parts
U F1( s ) and u F1( kh ) and the feedback parts U FB ( s ) and u FB ( kh ) respectively. The
transfer function is T R for the feedforward part and S R for the feedback part.

6.8.2 The Properties of the General Controller


The closed control loop with the general time discrete controller is represented
with a block diagram in Figure 6.23 (compare also with Figure 6.5).
216 Chapter 6: Control Structures

The process is described with the time-discrete process transfer operator H(q )
(see Section 3.4.2):
y ( kh ) B(q )
= H (q ) =
u ( kh ) A(q )
where the polynomials A and B are defined as:

A(q ) = q n + a1 ⋅ q n − 1 + ... + a n

B(q ) = b 0 ⋅ q n + b1 ⋅ q n − 1 + ... + b n

w(kh)
technical
controller process
u c (kh) T(q) u(kh) B(q) y(kh)
Σ Σ
R(q) A(q)

S(q)
R(q)

Figure 6.23: The general time-discrete controller with feedforward control and feedback
from the process output

With the general controller of Equation (6.46) the input/output relationship for the
total closed loop control system in Figure 6.23 can be expressed as follows:
TB AR
y ( kh ) = ⋅ u c ( kh ) + ⋅ w( kh ) (6.48)
AR + BS AR + BS
In this equation the first term denotes the transfer operator from the setpoint
value to the output y (via the feedforward and feedback loops) and the second term
the transfer operator from the disturbance w also to the output y (via the feedback
loop, compare with the continuous case of Equation 6.9).
The parameters A and B depend on the technical process and are therefore
considered fixed, while the R , S and T parameters can be tuned as in the
continuous case. By changing the R and S parameters the poles of the closed loop
system can be changed arbitrarily, provided that the process is controllable, i.e. that
the polynomials A and B have no common factor. This means among other aspects
that an unstable, but controllable, system can be stabilized with a controller.
We have seen that the poles can be changed arbitrarily in both the continuous
and the discrete cases. The condition, however, is that the control signal amplitude is
not limited. Therefore, in a physical system there is a practical limit how much the
poles can be relocated. The poles determine the modes (i.e. the time constants) of
the system response. The zeros determine the relative weight between these modes.
From Equation (6.48) we see that the B polynomial still remains in the nominator, so
the zeros are not changed. However, by the T polynomial new zeros can be added
in the closed control loop.
6.8: The General Linear Discrete Controller 217

The discrete controller can be extended by a term for the cancellation of any
measured disturbance. The structure presented in Figure 6.7 can be related also to
the time-discrete case (Figure 6.24). Contrary to the continuous case, the variables
are here time functions and not their Laplace transforms. The transfer operator H(q )
indicate the discrete version of the transfer function G( s ) in Figure 6.7.

disturbance feedforward
control sensor w

-HF2 Ht
-u F2

H
w
setpoint feedforward technical
control actuator process
uc T(q) u F1 u y
Σ Hv HP Σ
R(q)

sensor
-u
FB
S(q)
Hm
R(q)

feedback control

Figure 6.24: Block diagram of the general discrete controller. The structure is similar to that
of the general continuous controller (Figure 6.7)

In order to compensate for the effect of the disturbance w on the process output
y , the time discrete controller for feedforward cancellation of disturbances must
have the following form:
H w (q )
H F 2 (q ) =
H t ( q ) ⋅ Hv ( q ) ⋅ H P ( q )
which represents an analogy to equation (6.10). The direct part of the control
signal for feedforward compensation can be expressed as follows:
u F 2 ( kh ) = H F 2 (q ) ⋅ H t (q ) ⋅ w( kh )

or also be written explicitly with its nominator and denominator:


V (q )
u F2 ( kh ) = ⋅ w( kh )
R(q )

The dynamic response of the disturbance sensor H t (q ) is included in the


transfer function of the controller. Similarly as in the continuous case, the degree of
the polynomial V (q ) is higher than that of R(q ) . In the continuous case the
feedforward controller includes time-derivatives of the measured signal; in the time-
218 Chapter 6: Control Structures

discrete case this corresponds to the differentiation of the measurement signal. In


this way it is indicated that the tendency of the signal and its effect on the process
output y must be known in order to eliminate their effect from the beginning.
In analogy with the continuous case (Equation 6.11) the general discrete
controller can be expressed by three terms, the feedforward from the reference
value, the feedback from the process output and the feedforward from the measured
disturbance (Figure 6.25):
u ( kh ) = u F1( kh ) − u FB ( kh ) − u F 2 ( kh ) =
(6.49)
T (q ) S( q ) V (q )
= ⋅ u c ( kh ) − ⋅ y ( kh ) − ⋅ w( kh )
R(q ) R(q ) R(q )

The feedback operator S R contains the sensor dynamics H m , while the


feedforward operator for the compensation of the disturbances V R includes the
sensor dynamics H t . The expression of Equation (6.49) is interpreted as follows:
u (kh ) = - r1 ⋅ u[(k - 1)h ] -  - rn ⋅ u[(k - n )h ]

+ t 0 ⋅ u c (kh ) + t 1 ⋅ u c [(k - 1)h ] +  + t n ⋅ u c [(k - n )h ] -


(6.50)
- s 0 ⋅ y (kh ) - s1 ⋅ y [(k - 1)h ] -  - s n ⋅ y [(k - n )h ] -

- v 0 ⋅ w(kh ) - v 1 ⋅ w[(k - 1)h ] -  - v m ⋅ w[(k - m )h ]


where m ≥ n . This is the same as Equation (6.42), with the addition of the terms
v i for the feedforward cancellation of the measured disturbance(s).

disturbance feedforward
control w(kh)
V(q)
R(q)
-uF2 (kh)

setpoint feedforward technical


control process
u c (kh) T(q) u F1(kh) u(kh) B(q) y(kh)
Σ Σ
R(q) A(q)

-u FB (kh)
S(q)
R(q)

feedback control

Figure 6.25: General digital controller with feedforward control of setpoint and disturbances
6.8: The General Linear Discrete Controller 219

6.8.3 Special Cases of the General Discrete Controller


If the controller (Equation 6.46) takes only the output error e( kh ) into
consideration (compare with Figure 6.2), then the polynomials T and S are equal:

[ ]
R ⋅ u ( kh ) = T ⋅ u c ( kh ) − y ( kh ) = T ⋅ e( kh ) (6.51)

This should be exemplified with the PID controller, and in fact the discrete PID
controller is a special case of the general discrete controller. Another important case
is the compensation for delays; also the Smith controller can be realized in the form
of a general discrete controller.

The Time-Discrete PID controller


A proportional (P) controller (Equation 6.21) is a simple special case of the
general controller. Its expression can be formulated as follows:
u ( kh ) = K ⋅ e( kh ) = K ⋅ u c ( kh ) − K ⋅ y ( kh )

i.e., R(q ) = 1, s 0 = K , t 0 = K .
A PID controller can be written in the following form:
u (kh ) = - r1 ⋅ u [ (k - 1)h ] - r2 ⋅ u [ (k - 2)h ]

+ t 0 ⋅ u c (kh ) + t 1 ⋅ u c [ (k - 1)h ] + t 2 ⋅ u c [ (k - 2)h ] - (6.52)

- s 0 ⋅ y (kh ) - s1 ⋅ y [ (k - 1)h ] - s 2 ⋅ y [ (k - 2)h ]


This is equivalent to Equation (6.42), with n = 2 . The equivalence between
Equation (6.52) and a PID controller in discrete form can be demonstrated if the PID
controller is written in compact form with the q operator. The integral term (Equation
6.22) can be written as follows:
u I ( kh ) = q −1 ⋅ u I ( kh ) + K ⋅ α ⋅ e ( kh )

where α is defined in Equation (6.23). Solving for u I ( kh ) , we get:

K ⋅α ⋅ q
u I ( kh ) = ⋅ e ( kh )
q −1
In a similar way, the derivative action (Equation 6.29) can be written as follows:
T
u D ( kh ) = β ⋅ q -1u D ( kh ) - K ⋅ d (1 - β ) (1 - q -1) y ( kh )
h
where β is as defined in Equation (6.28). Solving for u D ( kh ) , we get:
T (1 - β )(q - 1)
u D ( kh ) = -K ⋅ d ⋅ ⋅ y ( kh )
h q-β
Since 0 ≤ β < 1 , the system is always stable. Thus the complete PID controller
can be formed from the proportional part (Equation 6.21), the integral and the
derivative parts that have just been calculated:
 q  T (1 - β )(q - 1)
u (kh ) = K ⋅ 1 + α  ⋅ e (kh ) - K ⋅ d ⋅ ⋅ y (kh )
 q - 1 h q-β
220 Chapter 6: Control Structures

By eliminating the denominator, the PID controller can also be written in the
following form:
T
(q - 1) (q - β ) ⋅ u ( kh ) = K (q - β ) (q - 1 + αq ) ⋅ e ( kh ) - K ⋅ d (1 - β ) (q - 1) 2 y ( kh )
h
with
e( kh ) = u c ( kh ) − y ( kh )

A simple reorganization of the terms leads to

[q 2 − (1 + β ) ⋅ q + β ] ⋅ u (kh) =
= [ K ⋅ (1 + α ) ⋅ q 2 − K ⋅ (1 + β + αβ ) ⋅ q + K ⋅ β ] ⋅ u c (kh ) −

− [ K ⋅ (1 + α + γ ) ⋅ q 2 − K ⋅ (1 + β + αβ + 2γ ) ⋅ q + K ⋅ ( β + γ )] ⋅ y (kh )

with
Td
γ = (1 − β ) (6.53)
h

The polynomials R , S and T can now be computed as follows:


RPID (q ) = q 2 − (1 + β ) ⋅ q + β

TPID (q ) = K ⋅ (1 + α ) ⋅ q 2 − K ⋅ (1 + β + αβ ) ⋅ q + K ⋅ β (6.54)

SPID (q ) = K ⋅ (1 + α + γ ) ⋅ q 2 − K ⋅ (1 + β + αβ + 2γ ) ⋅ q + K ⋅ ( β + γ )

From the definition of q , this can be interpreted as:


u[(k + 2)h ] - (1+ β ) ⋅ u [(k + 1)h ] + β ⋅ u (kh ) =

= K ⋅ (1 + α ) ⋅ u c [(k + 2)h ] - K ⋅ (1+ β + αβ ) ⋅ u c [(k + 1)h ] + K ⋅ β ⋅ u c (kh ) -

[ ]
- K ⋅ (1+ α + γ ) ⋅ y (k + 2)h + K ⋅ (1+ β + αβ + 2γ ) ⋅ y [( k + 1)h ] - K ⋅ ( β + γ ) ⋅ y (kh )

By shifting the time two sampling intervals backwards, the expression for the PID
controller can be rewritten in the following form:

[
u (kh ) − (1+ β ) ⋅ u[(k − 1)h ] − β ⋅ u (k − 2)h = ]
[
= K ⋅ (1+ α ) ⋅ u c (kh ) − K ⋅ (1+ β + αβ ) ⋅ u c [(k − 1)h ] + K ⋅ β ⋅ u c (k − 2)h − ]
[
− K ⋅ (1+ α + γ ) ⋅ y (kh ) + K ⋅ (1+ β + αβ + 2γ ) ⋅ y [(k − 1)h ] − K ⋅ ( β + γ ) ⋅ y (k − 2)h ]
(6.55)
With regard to computer implementation, it is clear that the controller has to
store old control signals as well as old setpoint and measurement values.
6.8: The General Linear Discrete Controller 221

The function of a PI controller is obtained by setting Td = 0 , which means that


β = 0 and γ = 0 :
u (kh ) = u[ (k − 1)h ] + K ⋅ (1 + α ) ⋅ u c (kh ) − K ⋅ u c [ (k − 1)h ] −

[ ]
− K ⋅ (1 + α ) ⋅ y (kh ) + K ⋅ y (k − 1)h = (6.56)

= u[ (k − 1)h ] + K ⋅ (1 + α ) ⋅ e (kh ) − K ⋅ e[ (k − 1)h ]


When the derivative part is computed of the basis of the control error, then the
polynomial R remains the same, while the polynomial T becomes identical with S
(compare with the continuous case in Section 6.4.1). In relation to Equation (6.48) it
can be seen that the different realizations of the PID controller add more or less
zeros to the transfer function of the feedforward loop. This influences the closed loop
behavior.
There is quite a complex relationship between the parameters R , S and T and
the original parameters of the PID controller. The parameters in the polynomial do
not have an immediate physical meaning, but the user does not have to know them
either. The user can work with PID parameters and tune the controller on their basis.
The computer must convert these parameters to the R , S and T parameters in the
controller according to Equation (6.54).

Compensation for time delays


The Smith predictor controller (Section 6.7.1) can be considered as a special
case of the general discrete controller. In the Smith controller the control signal does
not only depend on the current measurement and reference values, but also on the
evolution of the control signal during a time period that corresponds to the time delay
in the technical process.
Put in relation to the structure of Equation (6.45), the polynomial R must be of
sufficient degree to include a time shift at least equal to the process time delay
Tdelay . In other words, the sum of n R sampling intervals (with n R as degree of the
polynomial R ) must be higher than the process time delay Tdelay . The sampled
measured values and the periodically generated control signals are shifted in time in
the internal computer registers and must be available at least during a time Tdelay .
In general, in industrial applications the sampling time is selected so that the
process time delay Tdelay is not longer than about five sampling intervals. This
means that the polynomial R is of degree lower or equal to 5.
The influence of internal computation delays in the discrete controller are similar
to those for the PID controller (Section 6.5.7). These delays should correspond to
only a fraction of the sampling time.

6.8.4 Different Criteria for the Quality of the Discrete Controller


The discrete controller in its general form can satisfy different qualitative and
quantitative criteria. If for example the closed loop performance is stated in advance,
it can be used as reference criterion for the system behavior. Yet this criterion does
not explicitly describe the disturbances that influence the process. The „classical“
criterion for process control is that the output measurement values must be kept as
222 Chapter 6: Control Structures

close as possible to the reference value. This criterion may be mathematically


formulated as:
1 N
J mv = ∑
N k =1
[ ]
u c (kh ) − y (kh )
2

with N → ∞ . The method is known as minimum variance criterion. A similar


procedure, where no division by N is performed, is called quadratic control area. In
both methods the goal is to tune the parameters in the controller (Equation 6.45) in
such a way that J mv or the value of the quadratic summation is minimized.
The minimum variance or other summation criteria can lead to (mathematically)
unlimited control signals u . It was however already pointed out that in most practical
situations u must be limited to avoid problems like e.g. actuator wearout. The
attenuation of the controller behavior can be influenced with a weighing factor ρ ; the
related quadratic control quality criterion is then:

1 N
J lq = ∑ 
N k = 1
[ ]
u c (kh ) − y (kh ) + ρu 2 (kh )
2


If the control signals are large, the quadratic cost function J lq quickly reaches
high values. The control law that minimizes J lq is called a linear quadratic control
law; the related controller can be expressed in the terms of the general controller.
In principle, all the regulators that have been mentioned here, including adaptive
controllers, can be formulated in the general controller form of Equation (6.45). From
a software structure point of view, the general controller remains the same
independently of the chosen control strategy and controller complexity. First a control
strategy and its quality criterion must be selected, and from these the parameters for
the general controller are defined.

6.9 The Practical Realization of the General Discrete Controller


The implementation problems for the PID controller have been treated in Section
6.5. Some of these problems are specific for the PID controller, while others are of
general nature and must be solved in each practical controller realization. Among the
general problems are the selection of the sampling time, the limitation of the control
signal and of its rate of change, integral windup and the realization of bumpless
transfer from hand to automatic control. All these problems are treated here again in
relation to the general controller.
In this section is also presented a practical example of program code for the
general controller with feedforward control from the reference value and from
measurable disturbances. This code was developed to explain the different concepts
and is therefore far from optimal. It is assumed that the parameters in R , S , T and
V are already known. From the code it is shown that the realization of the shift
operator q on the computer is not more difficult than storing the value of a signal.
Due to the fact that the parameters of the polynomials R , S and T are unfamiliar to
many engineers, also the conversion of the PID parameters in the polynomial
coefficients is explained.
6.9: The Practical Realization of the General Discrete Controller 223

6.9.1 Parameter Update


The conversion of the PID parameters in R , S and T polynomials is
summarized in the following. The polynomials for the PID controller are given as
follows:
RPID (q ) = q 2 − (1 + β ) ⋅ q + β

TPID (q ) = K ⋅ (1 + α ) ⋅ q 2 − K ⋅ (1 + β + αβ ) ⋅ q + K ⋅ β (=6.54)

SPID (q ) = K ⋅ (1 + α + γ ) ⋅ q 2 − K ⋅ (1 + β + αβ + 2γ ) ⋅ q + K ⋅ ( β + γ )
where
−1
h  hN  Td Td
α= , β = 1 +  = , γ = (1 − β )
Ti  Td  Td + hN h
(=6.23, 6.28, 6.53)
The parameters for the general discrete controller are computed from the
following polynomials:
r1 = −(1 + β ) r2 = β
s0 = K ⋅ (1 + α + γ ) s1 = −K ⋅ (1 + β + αβ + 2γ ) s 2 = K ⋅ (β + γ )
t 0 = K ⋅ (1 + α ) t1 = −K ⋅ (1 + β + αβ ) t2 = K ⋅ β

6.9.2 Prevention of Integral Windup in the General Discrete Controller


As already pointed out, a limitation of the control signal leads to problems in
control (see Section 6.5.4). The saturation of the control signal must therefore be
considered in the controller routine.
The first general solution to avoid integral windup was reported by [Åström /
Wittenmark 1990]. The output signal before the limitation is computed from the
following equation, that corresponds to Equation (6.46) with its terms somewhat
rearranged:

( ) ( ) [ ( )]
u d (kh ) = T * q −1 ⋅ u c (kh ) − S * q −1 ⋅ y (kh ) + 1 − R * q −1 ⋅ u (kh ) (6.57)

u d is then limited according to Equation (6.34). In Equation (6.57) the amplitude


of the control signal is immediately corrected so as to remain within the given limits.
For the special case of a PI controller this limitation procedure is the same as shown
earlier. However, for a PI controller it was shown in Equation (6.35) that the
correction for the windup takes longer than one sampling interval, which makes the
controller action smoother. This also applies to the general controller.
The terms of the controller of Equation (6.45) are rearranged as follows:

( ) ( ) ( ) [ ( ) ( )]
A0* q −1 ⋅ u (kh ) = T * q −1 ⋅ u c (kh ) − S * q −1 ⋅ y (kh ) + A0* q −1 − R * q −1 ⋅ u (kh )

A0* (q −1) is a polynomial called observer that defines how fast the integral
windup is corrected. The general controller with a compensation for windup is then
written in the following form:
224 Chapter 6: Control Structures

( ) ( ) ( ) [ ( )
A0* q −1 ⋅ u d (kh ) = T * q −1 ⋅ u c (kh ) − S * q −1 ⋅ y (kh ) + A0* q −1 − R * q −1 ⋅ u (kh )( )]
(6.58)
This can be interpreted as follows:
u d (kh ) = - a01 ⋅ q -1 ⋅ u d (kh ) -  - a0 n ⋅ q - n ⋅ u d (kh ) +

+ t 0 ⋅ u c (kh ) + t 1 ⋅ q -1 ⋅ u c (kh ) +  + t n ⋅ q - n ⋅ u c (kh ) -


(6.59)
- s 0 ⋅ y (kh ) - s1 ⋅ q -1 ⋅ y (kh ) -  - sn ⋅ q -n ⋅ y (kh ) +

+ [a01 - r1] ⋅ q -1 ⋅ u (kh ) +  + [a0 n - rn ] ⋅ q - n ⋅ u (kh )


The signal u d (kh ) is then limited according to Equation (6.34).

6.9.3 Bumpless Transfer between Manual and Automatic Control Mode


The general problem of bumpless transfer between the manual and automatic
control mode was treated in Section 6.5.5. In principle, when a switchover between
the control modes takes place, the control signal value must be set manually. The
general solution for this problem is the setting of the internal state parameters in the
controller, so that the controller output signal at each mode switchover must take the
same value as the manual process input signal (that normally is the output signal
from the controller). The internal state of the controller is automatically set via its
internal limiting function.

6.9.4 Computational Aspects


Let us now look in detail at how u (kh ) is computed. At the time kh the computer
reads the signal values u c (kh ) , y (kh ) and w (kh ) ; the other terms of the discrete
controller (Equation 6.50) are already known. The discrete controller can be written in
the following form:
u (kh ) = t 0 ⋅ u c (kh ) - s 0 ⋅ y (kh ) - v 0 ⋅ w (kh ) + x[ (k - 1)h ] (6.60)

where
x[(k - 1)h ] = - r1 ⋅ u[(k - 1)h ] -  - rn ⋅ u[(k - n )h ]

+ t 1 ⋅ u c [(k - 1)h ] +  + t n ⋅ u c [(k - n )h ] -

- s1 ⋅ y [(k - 1)h ] -  - s n ⋅ y [(k - n )h ] -

- v 1 ⋅ w[(k - 1)h ] -  - v m ⋅ w[(k - m )h ]

[
The value x (k − 1)h ] was computed already before the time kh , so that
processing delays in the computation can be minimized. As soon the control signal
u (kh ) is computed it is also possible to update the value of x . In this way its new
value is already available for the computation of a new control signal at the following
sampling time instance (Figure 6.26).
6.9: The Practical Realization of the General Discrete Controller 225

data input actualization data input actualization data input actualization


y[(k-1)h] x[(k-1)h] y[kh] x[kh] y[(k+1)h] x[(k+1)h]

computation computation computation


u[(k-1)h] u[kh] u[(k+1)h]

(k-1)h kh (k+1)h time

Figure 6.26: Processing sequence for the general controller

6.9.5 Algorithm for the General Controller


The following algorithm is based on Equation (6.60) and contains instructions for
avoidance of integral windup. The controller parameters have already been
converted from the normal form into the internal controller representation. In this
Pascal code are also considered real-time aspects like resource protection and task
synchronization.

program general_controller (* example for a general controller *)


const n = 5; (* degree of the controller polynomial *)

var vect_protect: semaphore;


next_time, delta_time: time (real);
i, j: integer;
out_signal: real;
u, uc, y, w: array[0..n] of real;
R_vect, S_vect, T_vect, V_vect: array[0..n] of real;

begin
vect_protect := 1;

( * initialization of the state vectors *)


for i = 0 to n do
begin
u[i] :=.0;
uc[i] := 0;
y[i] := 0;
w[i] := 0;
end

while true do (*main program loop (no end) *)


begin
(* read actual values *)
wait_until(next_time);
uc[0] := AD_input (ch#1); (* reference value input *)
y[0] := AD_input (ch#2); (* measurement value input *)
w[0] := AD_input (ch#3); (* disturbance value input *)
226 Chapter 6: Control Structures

(* control signal computation *)


wait(vect_protect); (* access protection for the controller polynomials *)
out_signal := 0;
out_signal := t0 * uc[0] - s0 * y[0] - v0 * w[0] + x;
signal(vect_protect); (* release of the controller polynomials *)
DA_output (out_signal, ch#10); (* control signal output *)

(*state vector update *)


u[0] := out_signal;
for i = 1 to n do
begin
j := i-1;
u[i] := u[j];
uc[i] := uc[j];
y[i] := y[j];
end;

for i = 1 to m do w[i] := w[j];


for i = 0 to n do
begin
x := x - R_vect[i] * u[i];
x := x + T_vect[i] * uc[i];
x := x - S_vect[i] * y[i];
end;
for i = 1 to m do x := x - V_vect[i] * w[i];

next_time := next_time + delta_time;

end; (* main program loop *)


end; (* general controller *)

The program instructions wait and signal (Section 10.4.1) protect the vectors
R_vect, S_vect, T_vect and V_vect, which as common variables are system
resources. In general, only the controller routine has access to these variables, so
that in practice there should be no processing delays. Should a different process
access the controller coefficients, as is the case to update them, then the controller
routine must wait to avoid conflicts. In multitasking operations the controller task gets
higher priority than the task for parameter update. The variable next_time is used to
avoid timing and synchronization errors (Section 10.6.5).
As already mentioned several times, the polynomial coefficients in the general
controller do not have any immediate relation to the physical properties of a control
loop. In some simple cases, however the relation between the coefficients and the
loop physical properties has apparent meaning.
In a P-type controller all coefficients are equal to zero with the exception of s 0
and t 0 . The number of coefficients s i and t i that are different from zero gives the
order of the discrete equation. A PID controller is of second order, therefore the first
three coefficients in the polynomials R , S and T are non-zero, while all the others
are zero (Equation 6.52). In the feedforward from disturbances to the process some
6.9: The Practical Realization of the General Discrete Controller 227

of the coefficients of the polynomial V are non-zero, the same holds for the
feedforward from the reference signal and the polynomial T .
In the case of the Smith controller for the compensation of time delays in the
technical process the coefficients of the R polynomial vector differ from zero, so that
older control signals are stored a number of intervals that corresponds to the delay
time Tdelay of the process plus the order n of the system.

If the sampling time is changed, then also the dimension of the polynomial
vectors R , S , T and V must be changed, so that the sampled data in course of
time are regularly shifted backwards and are later available for the computation of a
new control signal.
A program for the input of new PID parameters, their conversion in R , S and T
polynomial coefficients and their online update, i.e. without interruption of the
controller operation, can have the aspect indicated here. In the procedure
„parameter_input“ only the local variables are defined. For the other variables hold
the definitions from the program „general_controller“.

procedure parameter_input
(* online input of the controller parameters in PID form
and conversion to parameters for the polynomials R, S and T *)

const n = 5; (* degree of the controller polynomial*)


var K, Ti, Td, N, sample_h: real;
C_alfa, C_beta, C_gamma: real;
R_vect, S_vect, T-vect: array[0..n] of real;

begin
while true do (* program loop with no end *)
begin
writeln („Please input the following values“);
input „Gain K ?“, K;
input „Integration time Ti ?“, Ti;
input „Derivative time Td ?“, Td;
input „Filter factor N ?“, N; (* Equation 6.15 *)
input „Sampling interval h“, sample_h;

(* computation of the new coefficients in discrete form *)


C_alfa := sample_h / Ti; (* Equation 6.23 *)
C_beta := Td / (Td + sample_h * N); (* Equation 6.28 *)
C_gamma := Td * (1 - C_beta)/sample_h; (* Equation 6.53 *)

(* assignment of the new coefficients to the controller parameters *)


wait(vect_protect); (* access protection for the controller polynomials *)
R_vect[0] := 0;
R_vect[1] := -1 - C_beta;
R_vect[2] := C_beta;
T_vect[0] := K * (1 * C_alfa);
T_vect[1] := -K * (1 + C_beta + C_alfa * C_beta);
228 Chapter 6: Control Structures

T_vect[2] := K * C_beta;
S_vect[0] := T_vect[0] + K * C_gamma;
S_vect[1] := T_vect[1] - 2 * K * C_gamma;
S_vect[2] := T_vect[2] + K * C_gamma;
signal(vect_protect); (* release of the controller polynomials *)
end; (* while true loop *)

end; (* parameter_input *)

In the procedure „parameter_input“ other values can of course be input via a


different interface, or even the parameters of the polynomials R , S , T and V . The
control properties can therefore be considerably changed without having to write the
code anew. The code can also be used as part of an adaptive controller. In this case
a different routine must continuously compute new parameters for the polynomials
R , S , and T from the data sequences u ( kh ) and y ( kh ) and update the vectors
accordingly.

6.10 State Feedback


So far in this chapter dynamic systems have been described by their transfer
functions or transfer operators in continuous or discrete time. This means that only
the relations between input and output were indicated and similarly also the
controllers were formulated in input/output form. The internal couplings of the
process were hidden and not explicitly formulated.
In many cases it is however more advantageous to describe the process by its
state-space model. This internal model description leads to a different control
structure than can be designed on the basis of input/output relations. This control
structure is known as state feedback.
A linear time-discrete state-space description was shown in Section 3.4.1,
Equation (3.9), and can represent a system with several inputs and outputs. The
system parameters have usually a physical interpretation since the equations are
mostly derived from equations for force, momentum, mass or energy balance.
The state model represents the basis for the development of a multi-input, multi-
output state feedback design in the following form:
u(t ) = M ⋅ u c (t ) - L ⋅ x (t ) (6.61)
where M and L are matrices and u c represents the reference signal (Figure
6.27). In case of a single control variable, the control law takes the following
structure:
u (t ) = m ⋅ u c (t ) - l 1 ⋅ x 1(t ) - l 2 ⋅ x 2 (t ) + 2 - l n ⋅ x n (t )

where m , l 1,…, l n are constants. In principle, state feedback consists of the


sum of the output signals from proportional controllers, one signal for each state
variable.
If a state variable is not known, or cannot be measured directly, then it has to be
indirectly computed or estimated (Section 3.5.2). The state controller retains the
same form, and the non-measurable state variable is replaced by its estimated value.
6.11: Summary 229

controller
uc u
M Σ technical
process

x
-L

Figure 6.27: Structure of the state feedback controller

Assuming that all states are measurable and known, the closed loop system with
state feedback is described by the following equation:
x[ (k + 1)h ] = Φ ⋅ x(kh ) + Γ ⋅ [M ⋅ uc (kh ) − L ⋅ x(kh )] =
(6.62)
= (Φ − Γ ⋅ L ) ⋅ x(kh ) + Γ ⋅ M ⋅ uc (kh )

The matrices Φ and Γ depend on the technical process and cannot be


changed, while it is possible to tune M and L . The controller output is constant
between the sampling instances and is computed by matrix and vector operations
based on the available measurement values at the time kh .
The dynamics of the closed loop system (Equation 6.62) is described by the
matrix Φ − Γ ⋅ L . The eigenvalues of this matrix determine the dynamic behavior of
the system with feedback. As long as the system is controllable, the closed loop
system eigenvalues can be changed in arbitrary fashion by acting on the controller
parameters L (poles and eigenvalues are closely related concepts). And in the same
way as for the controller in input-output description, the system dynamics of the
closed loop system can be changed arbitrarily, provided the control signal is not
limited. There are, however, practical limits as to how much the system dynamics
can be changed with state feedback.
The eigenvalues (poles) of the controlled technical system can be changed with
state feedback, just as an input-output controller could do. The difference by using
state feedback is that the internal system description sometimes gives insight into
the system, on which an appropriate controller structure can be defined.

6.11 Summary
Feedback is of fundamental importance in any type of process control. All the
principal related issues are the same for continuous and time-discrete systems. The
structures of the continuous and time-discrete linear controllers are similar and differ
only in the parameter values. From the point of view of the computer implementation,
many different linear controller types can be realized as particular cases of a single
general controller.
A controller to be implemented on a computer can be designed in two different
ways:
• The controller is first designed in continuous form and discretized afterwards; or
230 Chapter 6: Control Structures

• a time-discrete model of the technical process is first obtained. The discrete


controller is then designed on the basis of this model.

The first method was the main approach of this chapter. It has the drawback that
the obtained sampling intervals generally tend to be smaller than if the design were
performed in discrete form directly.
Feedforward is an important concept. This control structure helps to expand and
improve the properties of a controller. For example, in high-performance servos the
reference value can be followed more precisely with a feedforward control design. In
process control it is very important to compensate as early as possible for
measurable disturbances and load changes. In principle the transfer function from
the setpoint to the output value should have a high gain for all relevant frequencies,
while the transfer function from a disturbance to the plant output should have as low
a gain as possible.
The PID controller is the dominating controller structure in industrial process
control. The reason why this controller type is so successful is that a majority of
processes can be approximated by low-order dynamics. The PID controller with its
second order dynamics represents a practical and inexpensive solution, yet allows
wide flexibility in the definition of closed loop performance. A time-discrete version of
the PID controller, that can even be more versatile than the continuous version, has
also been shown. For example, in the discrete controller it is easier to include
features for anti-windup and bumpless transfer, and to obtain adequate filtering for
the derivative action. The control signal and its rate of change can also be easily
limited in the digital controller, if it is necessary. PID controllers can be used in
cascade when several variables interact in complex form.
In systems with more complex dynamic properties, PID controllers are no longer
adequate. The most apparent problems arise in systems with dead times and delays,
with highly oscillatory behavior or with parameters that change in course of time. The
general discrete controller can handle these problems and even satisfy higher
requirements. The code for the general discrete controller can be programmed
straightforwardly; the actual control problem lies rather in finding the necessary
parameters. The general discrete controller can include both feedback from the
process output and feedforward from the reference value and the measurable
disturbances that influence the process.
When the parameter variations in the process are known in advance, it is
possible to use gain-scheduling techniques. Adaptive controllers are in many cases
adequate for the control of processes with unknown parameter variations. If the
system dynamics is of low order, auto-tuning PID controllers can be employed
successfully.

Further Reading
A complete introduction to control theory with particular attention to the state-
space description and digital sampling is given in [Kuo 1995]. Chemical process
control and the application of control structures is discussed in detail in [Seborg /
Edgar / Mellichamp 1989] and [Stephanopoulos 1984]. [Shinskey 1996] describes
process control problems from a more practically-oriented point of view.
Time-discrete control is extensively described in [Åström / Wittenmark 1990] and
in [Franklin / Powell / Workman 1990]. These books contain practical guidelines and
6.11: Summary 231

suggestions for the selection of sampling rates in PID controllers. The controller with
dead-time compensation was first described in [Smith 1957].
Adaptive control has been the focus of extensive research during recent
decades. [Åström / Wittenmark 1995] presents a comprehensive description of the
theory and applications of adaptive controllers. [Åström / Hägglund 1988] is a
practical and well understandable description of the function of autotuners.
7 Combinatorial and Sequencing Control

Aim: To describe combinatorial and sequencing networks and their


implementation in software, with particular attention to structured functional diagrams
for control purposes

Overview
Binary combinatorial and sequencing control is the object of this chapter. In the
process industry and in industrial automation there is a wealth of applications of
switching circuits for combinatorial and sequencing control. This type of control was
already mentioned in other sections of this book. For example, simple sequencing
networks were shown in Chapter 2, and in Section 3.7 were discussed some
modeling principles with help of sequencing control. Switching theory, that provides
the foundation for binary control, is used not only in automation technology but is
also of fundamental importance in many other fields. This theory provides the very
principle on which the function of digital computers is based. In general, binary
combinatorial and sequencing control is simpler than conventional feedback (analog
and digital) control, because both the measurement values and the control signals
are binary. However, also binary control has its specific properties that have to be
considered in more detail.
Logical circuits have traditionally been implemented with different techniques;
until the mid of the 1970s most circuits were built with electromechanical relays and
pneumatic components. During the 1970s programmable logical controllers (PLCs)
became more and more commonplace, and today sequencing control is almost
exclusively implemented in software. Despite the change in technology, the symbols
for the description of switching operations, known as ladder diagrams that derive
from earlier relay technology are still used to describe and document sequencing
control operations implemented in software. Another important type of description
language that can be used not only for programming but also as documentation tool
are function charts.
The fundamentals of switching theory and the basic logical gates are presented
in Section 7.1. Ladder diagrams as a means for description of combinatorial and
sequencing control operations are discussed in Section 7.2. Section 7.3 is dedicated
to the use and technology of PLCs. In Section 7.4 are introduced function languages
and function charts, as they provide an important notation to describe binary
sequences. Function languages and function charts can also be used for the
description of concurrent (i.e. parallel) processes. The chapter is concluded with a
practical example about the application of function charts in the solution of an
industrial control problem.

7.1 Elementary Switching Theory


7.1.1 Notations
In this section is described the elementary switching theory that is relevant for
process control applications. Both combinatorial (without memory) and sequencing
(with memory capability) switching circuits will be treated.

232
7.1: Elementary Switching Theory 233

Switching theory provides a model for the operations of binary elements, i.e.
those that can be only in one of two possible states. There are several examples of
binary components. Binary circuit components like switches, relays and two-position
valves to be used in logic circuits are designed to operate in two states only. A
transistor is a linear, i.e. not binary, component, but it can also operate as a binary
element, if only the states „conducting“ and „not conducting“ are considered. Binary
sensors and actuators have been described in Chapter 4.
The state of a binary element is indicated by a binary variable that can
consequently only take two values, conventionally indicated as „0 “or „1“. For a
switch contact, relay contact or a transistor (in the following all labeled X) the
statement X=0 means that the element is open (does not conduct current) and X=1
means closed (it conducts a current). For a push button or a limit switch, X=0 means
that the switch is not being actuated, while X=1 indicates actuation.
A binary variable can also correspond to a voltage level in a practical circuit
implementation. In the so-called „positive logic“ the higher voltage level corresponds
to a logical „1“ and the lower level to logical „0“. In TTL (transistor-transistor logic),
binary „0“ is usually defined by a voltage level between 0 and 0.8 V and binary „1“ by
any voltage higher than 2 V. Similarly, in pneumatic systems X=0 may mean that a
line is at atmospheric pressure and X=1 that the line is at higher pressure.
For the representation of logic (combinatorial and/or sequencing) circuits are
used standardized symbols that are independent of the practical implementation
(with electric or pneumatic components). This type of representation is called
function block. In this chapter are used for the logic symbols the international
standards IEC 113-7 and IEC 617; many other national standards are also defined
on their basis.

7.1.2 Basic Combinatorial Theory


Here follows a brief recapitulation of Boolean algebra. The simplest logical
(Boolean) operation is the negation, or inversion, of a binary variable, the NOT
function. The inversion is a function with only one input and one output. If the input
value is I=0, then the output value O=1. The negation of X is denoted by X . The
logic symbol and the function table for the NOT function are shown in Figure 7.1. In
connection with other logical elements, the inversion is indicated only with a small
circle at the input or output lines of other functional elements.
Two normally open switches A and B that are connected in parallel build an OR-
type gate. The operation they perform is called Boolean addition and is expressed as
follows:
X=A+B
The result X=1 is obtained if either A or B or both are =1, otherwise the result is
X=0 (Figure 7.2). An OR gate can have more that two inputs, as in principle any
number of switches can be connected in parallel. The extension with a third switch
results in X=A+B+C. The indication „≥1“ inside the OR symbol means that gate
output is „high“ if the number of „high“ input signals is equal to or greater than 1.
234 Chapter 7: Combinatorial and Sequencing Control

I O
I 1 O
0 1
1 0

Figure 7.1: Logic symbol and function table (truth table) for the NOT function (inversion,
negation)

I1

I1 I2 O
I1
≥1
1 O O 0 0 0
I2 0 1 1
I2 1 0 1
1 1 1

Figure 7.2: Switch connection, logic symbol and function table (truth table) for the OR
function

A common operation is the logical OR connection between two bytes (masking).


The OR operation is performed on each pair of bits (Figure 7.3). OR masking is used
in order to set one or several bits to logical „1“ irrespectively of their original value.

Input Byte 11011000


Masking Byte 01101101

Output 11111101

Figure 7.3: Masking of two Bytes via an OR operation

If the two normally open switch contacts A and B are connected in series, the
operation is called Boolean multiplication and the function is an AND operation. In
this case the output is X=1 only if both A and B are equal to 1, otherwise X=0. The
operation is expressed as follows:
X = A·B
The multiplication sign in the Boolean expression is often omitted, just as in
ordinary algebra. Similarly as for the OR function, also the AND gate can have more
than two inputs, since any number of switches can be connected in series. Adding a
third switch results thus in X=ABC. The logic symbol and the function table for the
AND gate are shown in Figure 7.4.
7.1: Elementary Switching Theory 235

I1 I2 I1 I2 O
I1
&
1 O O 0 0 0
0 1 0
I2 1 0 0
1 1 1

Figure 7.4: Switch connection, logic symbol and function table (truth table) for the AND
function

Also the logical AND operation between two bytes is carried out on each pair of
bytes and also this function is called masking (Figure 7.5). One byte is given as input
while the other is used to select the bits of interest. Only where the masking byte
contains „1“s the original bit of the input byte is passed to the output, otherwise the
corresponding bit takes the value „0“.

Input Byte 11011000


Masking Byte 01101101

Output 01001000

Figure 7.5: Masking of two Bytes via an AND operation

Some important theorems hold for Boolean functions of a single binary variable,
such as for example:
X+X= X
X⋅X=X
X + X =1
X⋅ X=0

Likewise for two variables it can be formulated and easily verified:


X+Y=Y+X
X⋅Y=Y⋅X
X + XY = X
X ⋅ (X + Y) = X
(X + Y) ⋅ Y = X ⋅ Y
X⋅Y + Y = X + Y
XY + Y = X + Y

The De Morgan theorems are useful in manipulating Boolean expressions:

( X ⋅ Y ⋅ Z ⋅ ⋅ ⋅) = X + Y + Z +⋅⋅⋅ (1st De Morgan theorem)

( X + Y + Z + ⋅ ⋅ ⋅) = X ⋅ Y ⋅ Z ⋅⋅⋅ (2nd De Morgan theorem)


236 Chapter 7: Combinatorial and Sequencing Control

The theorems indicated above can be used for simplifying complex binary
expressions, which in turn can help save some components in the practical
implementation. Another advantage in reducing the complexity of a circuit is that it
becomes less sensitive for malfunctions, because the number of components that
could fail is smaller.

7.1.3 Additional Gates


Two normally closed gates in series build a NOR gate, i.e. the circuit is closed
and carries a current if neither the first nor the second switch is actuated. According
to De Morgan’s theorem this condition can be expressed as:
X = A ⋅ B = ( A + B)

This shows that the NOR gate can be constructed from the combination of an
OR and a NOT gate (Figure 7.6); the circle at an input or output line of the symbol
represents Boolean inversion.

I1 I2 I1 I2 O
I1
≥1
1 O O 0 0 1
0 1 0
I2 1 0 0
1 1 0

Figure 7.6: Switch connection, logic symbol and function table (truth table) for the NOR
function

A NOR gate can be easily implemented with electronic or pneumatic


components. An important consideration in this respect is that any Boolean function
can be realized by using only NOR gates, so that the NOR is regarded as universal
gate. For example, a NOT gate is a NOR gate with a single input. An OR gate can be
obtained by connecting a NOT gate serially to the output of a NOR gate. An AND
gate can be built by using two NOT gates and one NOR gate (Figure 7.7); this
combinatorial circuit is written as:

X = A + B = A ⋅B = A ⋅B

A ≥1
0 A
≥1
O
B ≥1
0 B

Figure 7.7: Three NOR gates acting as an AND gate


7.1: Elementary Switching Theory 237

A NAND gate is defined by:


X = ( A ⋅ B) = A + B

The related circuit does not conduct if both A and B are actuated; if only one
switch is actuated the circuit remains closed via the other switch (Figure 7.8).
Similarly to the NOR gate, also the NAND gate is universal, i.e. with this gate all the
other logical functions can be realized.

I1

I1 I2 O
I1
&
1 O O 0 0 1
I2 0 1 1
I2 1 0 1
1 1 0

Figure 7.8: Switch connection, logic symbol and function table (truth table) for the NAND
function

The NAND and NOR operations are called complete operations, because all
other logical functions can be formulated by using - if one so wishes - exclusively
either of those types of gates. No other gate or operation has the same property.
In Figure 7.9 is shown a circuit built with two switches, each with double contacts
(one contact is normally open and the other normally closed). This function is called
exclusive OR (XOR), and its output is defined by:
X = A ⋅ B + A ⋅B

I1 I2

I1 I2 O
I1
=1
1 O O 0 0 0
0 1 1
I2 1 0 1
1 1 0

Figure 7.9: Switch connection, logic symbol and function table (truth table) for the XOR
function

The circuit conducts a current only if either A=1 or B=1, but if both A and B have
the same value „0“ or „1“, then the output is X=0. For example, such a logical circuit
can be used to control the light in a room from two different switch locations A and B.
In digital computers XOR circuits are important for performing binary addition.
An exclusive OR (XOR) operation between one input byte and one masking byte
will copy the „1“s of the input to the output only in correspondence to those bits
238 Chapter 7: Combinatorial and Sequencing Control

where the masking byte contains „0“. Where the mask bit is „1“, the bit of the first
operand is inverted. In other words, in the positions where the operand bits are equal
the result is „0“, while in those cases where the operands are not equal, the result is
a „1“ (Figure 7.10). This operation can be used to check whether two bytes are
equal; the XOR operation of a byte with itself must namely produce a „0“ in output.

Input Byte 11011000


Masking Byte 01101101

Output 10110101

Figure 7.10: Masking of two Bytes via an XOR operation

Example 7.1 Simple combinatorial network


A simple example of a combinatorial circuit is shown in Figure 7.11.
I1 &
O3
I12

& O4 ≥1
I2
O2
I1

Figure 7.11: Simple combinatorial circuit

The related logical expressions are the following:


O3 = I1⋅ I12
O4 = I2 ⋅ O2
O2 = O4 + I1

There is still no worldwide accepted standard for the representation of logical


and switching elements. The ISO, IEC and DIN symbols are important in Europe, but
for example in the USA alone are commonly used at least three different sets of
symbols. Different standards for the representation of logical gates are shown in
Figure 7.12.
Combinatorial circuits consist in several logical connections, in which the output
value X depends only on the current combination of the input signals U=(A, B, …) :
X(t ) = f [U(t )]
A table reporting the combination of all possible input values to a switching
circuit and the corresponding output values is called truth table. In principle, all
switching networks can be tested with the help of truth tables. Unfortunately the
number of Boolean functions grows rapidly with the number of variables n , since the
7.1: Elementary Switching Theory 239

number of combinations becomes 2 n . There are different methods for the


simplification of Boolean functions, in which the number of the variable relations is
reduced. It is however outside the scope of this text to discuss in detail the different
simplification methods for Boolean functions. A method known as Karnaugh map
may be used if the number of variables is small. For systems with many variables
(about more than 10) there are numerical methods to analyze the switching network.
The method by Quine-McCluskey is probably the best known among these methods
and is described in standard textbooks on switching theory.

DIN/IEC 113-7, US Boolean expression


DIN/IEC 617-12

NOT I 1 O I O
O=I

I1 I1
OR ≥1 O O O = I1 + I 2
I2 I2

I1 I1
AND & O O O = I1⋅ I 2
I2 I2

I1 I1
NOR ≥1 O O O = I1 + I 2
I2 I2

I1 I1
NAND & O O O = I1⋅ I 2
I2 I2

I1 I1
XOR =1 O O O = I1⋅ I 2 + I1⋅ I 2
I2 I2

I I
Lock & O O O = I1⋅ I 2 ⋅ S

Figure 7.12: Different, commonly used logical gate symbols

7.1.4 Flip-flops
Hitherto we have described combinatorial networks, i.e. where the output X
depends only on the present combination of input signals. Combinatorial networks
have so to say no memory and represent static systems. In a sequencing network
instead it is possible to store signal values and states and to use them later in the
course of another operation. The memory function can be realized with flip-flop
240 Chapter 7: Combinatorial and Sequencing Control

elements, or bistable switches. The flip-flop has two stable output states (from which
the term bistable) that depend not only on the present state of the inputs but also on
the previous state of the flip-flop output.
The basic type of flip-flop is the SR (Set-Reset) flip-flop. The two inputs S and R
can be either logical 0 or 1, they are however not allowed to be both 0 or 1 at the
same time. The output is called y, and usually also the inverted output y is available
on integrated circuits. If S=1, the output changes to y=1 ( y = 0) and the flip-flop
becomes set. If S returns to 0 then the flip-flop „remembers“ that S had previously
taken the value 1 and keeps the output y=1. If R now takes the value 1, and
assuming that S=0, the flip-flop is reset, and y=0 ( y =1). Similarly as before, R can
return to 0 and y remains 0 until a new signal S=1 is given. If the states at
consecutive times are denoted y n and y n+1, the operation can be written as:

y n + 1.= R ⋅ (S + y n )
A SR flip-flop can be realized by two logical elements (Figure 7.13).

R
≥1 Y
≥1
S
& Y
R

≥1 Y
S

S
≥1 Y
R
&
S Y
R Y

Figure 7.13: Three different realizations of a flip-flop gate; IEC symbol for the flip-flop
circuit

There are other important types of flip-flop circuits. The delay (D) flip-flop or latch
has two inputs, one for data (D) and one for clock pulses (CP). For each clock pulse
the output y takes the value that the D input had before the clock pulse. The D input
is therefore delayed by one clock pulse in the output. The new state y n+1 is always
independent of the old state.
By introducing a feedback with a time delay from the flip-flop output to the input,
the resulting circuit is a trigger or toggle (T) flip-flop. The T flip-flop has only one
input, T. For each new input pulse on the port T, the output y changes to the other
state. The T flip-flop is often used in counting and timing circuits as a frequency
divider.
All three types of flip-flops are integrated in the JK (Master-Slave) flip-flop, with J
being the set signal and K the reset signal. This flip-flop has also an input for a timing
7.1: Elementary Switching Theory 241

(clock) signal. Depending on the input signals the JK flip-flop can operate like a SR
flip-flop, a latch or a trigger and represents therefore a kind of universal flip-flop
circuit.

7.1.5 Realization of Switching Circuits


Electronic logic gates, e.g. of AND and OR type can be implemented in a
straightforward way with diodes. The cascade connection of several diode gates in
series brings however about problems, among other because the signals are strongly
attenuated at each step (diodes are passive elements), so that this solution is not
particularly attractive. A common way to implement gate circuits to avoid this problem
is by using transistor logic, since the output signals at each step are amplified back
to the full logical level.
Today gates realized on integrated circuits (IC), also known as „chips“ are mostly
used. There are several types of integrated circuits for the realization of logical
operations; each type is characterized by particular power consumption and speed.
Conventional, simple TTL (transistor-transistor logic) circuits have been used for long
time but are now being replaced by other product families.
The LS-TTL (low-power Schottky TTL) elements contain so-called Schottky
diodes, that in comparison to conventional diodes are faster and in addition use
considerably less power than the older TTL types. Largely used are also the CMOS
(complementary metal-oxide semiconductor) integrated circuits that are based on
FETs (field-effect transistors) rather than on bipolar transistors. The power
consumption of a CMOS circuit is about of three orders of magnitude less than for a
corresponding TTL element. In addition, the CMOS circuits are less sensitive to
electrical noise and variations in the supply voltage. On the other hand CMOS
circuits are more sensitive for static electricity and are also slower than
corresponding TTL circuits. A solution will be probably represented by a new
generation of CMOS circuits, the high speed CMOS logic (HC).
Complex circuits can also be manufactured as medium (MSI) or large-scale (LSI)
integrated circuits; this type of production is however economically justifiable only for
large quantities (i.e. a minimum of some thousands of components). An alternative is
the use of so-called programmable logic devices (PLD) that allow the inexpensive
production of semicustomized integrated circuits. PLDs mostly belong to the LS-TTL
family. They contain a large array of gates that are interconnected by microscopic
fuses. By using special programming equipment these fuses can be selectively
blown, so that the result is an integrated circuit with the desired logical properties.
There are several types of integrated circuits in the PLD family: the
programmable array logic (PAL), the field-programmable logic arrays (FPLA) and the
programmable read-only memory (PROM). A PAL circuit is built with a
programmable AND-gate array, where the AND gates are connected to an OR-gate.
A FPLA circuit has a similar structure, with the difference that both the AND and the
OR gates are programmable. Special PAL and FPLA chips with other gates like
NOR, XOR and D-flip-flops are available, so that a complete sequencing control
system can be realized by the user with one or few chips (Figure 7.14).
The programming of PLDs is made easier by using software packages that are
also available for personal computers. These programs convert the description of a
control sequence in form of Boolean relations into the data for the programming unit.
Also the testing of the programmed chips is usually carried out by this software.
242 Chapter 7: Combinatorial and Sequencing Control

I I I I
1 2 3 4
1 1 1 1 Input buffer with inversion

OR matrix

&

&

&

&

&

&

&

&

AND matrix
≥1 ≥1 ≥1 ≥1

O O O O
1 2 3 4

Figure 7.14: Functional structure of PAL, FPLA and PROM circuits


The function of a programmable logic device (PLD) circuit can be freely
defined by the user. The basic structure of the PLD consists in a AND and in an
OR matrix, programming takes place by „burning“ fast connections in the AND
and in the OR matrices.
In a programmable array logic (PAL) circuit the AND matrix is programmable,
while the connections between the AND and the OR gates are fixed. In a
programmable read-only memory (PROM) the AND-matrix is fixed and the OR
matrix is programmable. In this case for example each combination of the input
bits (the „address“) leads to the activation of a single AND gate, and the
programmable state of the cell in the OR matrix reflects the stored logical value.
In a Field-Programmable Logic Array (FPLA) the AND as well as the OR
matrix can be freely programmed.
7.2: Representation of Logical Functions with Help of Ladder Diagrams 243

7.2 Representation of Logical Functions with Help of Ladder


Diagrams
7.2.1 Principal Characteristics
Nowadays most logical circuits are built by using solid state gates, yet the
technology of electromechanical relays has not entirely been forgotten. The share of
electromechanical relays in relation to the total number of gates in use is surely
decreasing, as they are replaced by electronic logic. This however does not mean
that their importance is dwindling as the relays remain, in fact, a necessary interface
between the control electronics and the controlled devices.
Relay circuits are usually drawn in the form of wiring diagrams that show the
power source and the physical arrangement of the various components of the circuit
(switches, relays, motors, etc.) as well as their interconnections. The wiring diagrams
are used by technicians to do the actual wiring of a control panel.
A widely used representation form for logical circuits is the ladder diagram
(Figure 7.15). A ladder diagram represents a conventional wiring diagram in
schematic form and without showing each electrical connection explicitly. In a ladder
diagram each branch of the control circuit is shown on separate horizontal rows (the
„rungs“ of the „ladder“). Each branch reflects one particular function and the related
sequence of operations. In this drawing frame it is implicitly assumed that one of the
vertical lines is connected to a voltage source and the other to ground.

Power supply Ground

Figure 7.15: The framework of a ladder diagram

The representation by ladder diagrams is very popular for the description of


combinatorial control circuits and sequencing networks. Ladder diagrams also serve
as a basis for the programming of digital controllers.
In the ladder diagram are shown relay contacts that can be either of normally
open or normally closed type (the normal state is the one in which the coil is not
energized). The output consists in a relay (a coil), that could also symbolize a more
complex circuit or a flip-flop. The drawing symbols for the switches and an actuator
(relay) are shown in Figure 7.16.
244 Chapter 7: Combinatorial and Sequencing Control

Standard DIN 19239 US symbols

(a)

(b)

(c)

Figure 7.16: Symbols for (a) a normally open contact, (b) a normally closed contact and (c) a
relay coil in the ladder diagram

Example 7.2 Combinatorial circuit


The combinatorial circuit of Figure 7.11 can also be represented by a ladder
diagram (Figure 7.17). The series connection of the switches represents a logical
AND and the parallel connection a logical OR. I1, I2 indicate the input contacts and
O2, O3 and O4 the output relais. All the input conditions, i.e. the activation of the
switches, must be satisfied simultaneously.

Normally open contact


Normally closed contact

I1 I12 O3

Relais
I2 O2 O4 outputs

I1 O2

O4

Figure 7.17: The combinatorial circuit of Figure 7.11 in form of ladder diagram

The input switch contacts have usually negligible resistance and can be for
instance pushbuttons, limit switches, pressure or temperature sensors. The output
element (the ring) could be any resistive load (e.g. a relay coil) or a lamp, motor or
any other device that can be electrically actuated. Each „rung“ of the ladder diagram
must contain at least one output element, otherwise a short circuit between power
supply and ground would take place.
7.2: Representation of Logical Functions with Help of Ladder Diagrams 245

Example 7.3 A flip-flop in form of a ladder diagram


A flip-flop (Figure 7.13) can also be described by a ladder diagram (Figure
7.18). When a set signal S is given (i.e. a set switch is pressed), the S switch
conducts a current that reaches the relay coil Y; the input R is so far not activated.
The energization of the relay coil leads to the closure of the relay contact y in the
second line. If the S switch is now released, a current continues anyway to flow to
coil Y via the contact y and the flip-flop remains set. The y contact acts as the
„memory“ of the flip-flop. By pressing the reset switch R, the circuit to the coil Y is
broken and the flip-flop returns to its former reset state. In industrial practice such
a relay is called bistable, self-holding or latched.

S R Y

Figure 7.18: A SR flip-flop, represented in form of a ladder diagram (self-holding or


latched relay)

7.2.2 Sequencing Circuits


In Section 3.7 have been described sequencing systems in which the outputs
depend not only on the momentary values of the inputs (as in combinatorial
networks) but on earlier inputs and states of the system. The related graphical
representation of the operation must therefore contain recordings and states at
different times. Many sequence operations could for example be described by ladder
diagrams and be defined by a number of states, where each state would be
associated with a certain control action.
In a ladder diagram different states or steps can be represented, but only one
state at a time can be active. Therefore some kind of execution control signal is
necessary in order to change from one state to another. This type of control signal
can be given when a condition is satisfied (the condition could of course also be a
complex combination of control signals). The conditional order acts at the same time
as reset (R) signal for one step and as set signal for the following step (compare with
Figure 7.18). The sequencing control execution can therefore be described as a
series of SR flip-flops, where each step corresponds to a rung of the ladder (Figure
7.19). At each execution control signal, the next flip-flop is set. The execution
proceeds one step at a time and after the last step returns to the beginning of the
sequence (Step 1).
246 Chapter 7: Combinatorial and Sequencing Control

Step 1 :
condition last step step 2 step 1

step 1

(self-holding)

Start

Step n :

condition step (n-1) step (n+1) step n

step n

(self-holding)

Figure 7.19: Sequencing execution described in ladder diagram notation

In practical execution, Step 1 is initiated with a start button or, in case of a closed
execution loop, automatically after execution of the last step. When the last step is
active and the condition for the jump to the first step is satisfied, then the Step 1 coil
is activated, and the self-holding relay keeps it set also after the first condition no
longer holds. The output of the first step activates also the input contact „Step 1“ that
is connected in series with the contact for the condition for Step 2. As soon as this
condition is satisfied, the relay Step 2 latches Circuit 2 and at the same time opens
the Circuit for Step 1. The following steps are carried out in the same fashion.
Obviously, in order to ensure a repetitive sequence, the last step has to be
connected to Step 1 again.
This type of execution is called asynchronous. In switching theory is also
considered the synchronous execution, in which the state changes are controlled by
a time clock. An asynchronous system is thus known as event-based, while a
synchronous system is time-based. In industrial automation applications,
asynchronous control is much more common, since the operation of most machines
and equipment (and thus their state changes) depends rather on a set of conditions
than on a stiff time plan. In the design of control sequences it is also important to
consider that the conditional input signals must keep their logical level for the full
duration of the corresponding operation. If this is not the case, then it must be
provided for their buffering or intermediate storage.
7.3: Programmable Logic Controllers (PLC) 247

7.3 Programmable Logic Controllers (PLC)


7.3.1 Basic Structure
Programmable logical controllers (PLC) are particular microcomputers designed
to carry out Boolean switching operations in industrial environments. The name is
actually a misnomer, because PLCs can today perform much more than simple logic
operations. The abbreviation has however been retained in order to avoid confusion
between the more general term Programmable Controller and Personal Computer
(both PC). A PLC generates on/off signal outputs for the control of actuators like
electric motors, valves, lights, etc. that can be found in all industrial branches as vital
parts of automation equipment.
The basic operations of a PLC correspond to the combinatorial control of a
logical circuit. In addition, a modern PLC can also carry out other operations such as
counting, the processing of signal delays and wait for defined time intervals. The
major advantage of a PLC is that a single circuit with its compact construction can
replace hundreds of relais. Another advantage is of course that the PLC is
programmable and not hard-wired, so that its operation can be changed with limited
effort. PLCs can on the other hand be slower than hard-wired relay logic. An optimal
solution for each specific application can be realized when both technologies are
installed in the same system, so that the advantages of each can come to use.
The first PLC was developed by a group of engineers at General Motors in 1968.
The initial specification called for ease of programming, the possibility for program
changes without having to work on the hardware, the new device should be smaller
than its relay or semiconductor-built equivalent and that finally it should be easy to
maintain and repaired. In addition the new device should also be cost-competitive
with the solid-state and relay panels then in use. These requirements should be
considered in the light that at the end of the 1960s and beginning of the 1970s there
still were no small-size programmable computers (the microprocessor was invented
in 1971). The initial requirements provoked a great interest from engineers of all
disciplines in how the PLC could be used for industrial control. A microprocessor-
based PLC was introduced in 1977 by Allan-Bradley Corporation in USA. It
contained an Intel 8080 microprocessor and additional circuits allowed processing of
logical bit operations at high speed.
The early PLCs were designed only for simple sequencing jobs with binary
signals. Today there are hundreds of different PLC models on the market, that differ
not only by their memory size and number of I/O channels (from a few dozens to
some hundreds), but mostly in the features they offer. The smaller PLCs are
designed principally to replace relays and have some additional counting and timing
functions. More complex PLCs process analog signals, perform mathematic
calculations and even contain feedback control circuits (like e.g. PID controllers,
described in Chapter 6).
The PLC hardware is usually built in order to fit a typical industrial environment,
especially in consideration to signal levels, heat, humidity, unreliable power supply
and mechanical shocks and vibrations. PLCs also contain particular interfaces for
conditioning and pre-processing of different signal types and levels. PLC functionality
is also more and more offered in process Input/Output units which are connected to
larger integrated control systems (see also Section 9.6). In Figure 7.20 is shown an
example of this type of equipment.
248 Chapter 7: Combinatorial and Sequencing Control

PWR
NC A1 A1
INPUT Alfa Laval NC A2 A2
NC A3 A3
NC A4 A4
00 00 40 40
Transistor outputs 41
01 01 12-48V 0.8A 41
02 02 42 42
03 03 43 43
04 04 44 44
05 05 45 45
06 06 46 46
07 07 47 47
08 08 C + (C40-47) 48 48
09 09 0V(00-07) 0V (C40-47) 49 49
10 10 50 50
11 11 51 51
12 12 52 52
13 13 53 53
14 14 54 54
15 15 55 55
16 16 56 56
17 17 57 57
18 18 C + (C50-57) 58 58
19 19 0V(10-17) 0V (C50-57) 59 59
20 20 60 60
21 21 61 61
22 22 62 62
23 23 63 63
24 24 64 64
25 25 65 65
26 26 66 66
27 27 67 67
28 28 C + (C60-67) 68 68
SD24D
29 29 0V(20-27) SattCon05-Slimline 0V (C60-67) 69 69

OUTPUT

Figure 7.20: Example of compact PLC for industrial use. The I/O cables are connected
directly to the unit (courtesy Alfa Laval Automation, Sweden).

PLCs can be programmed in different ways: with Assembler-like program


instructions, in higher, problem-oriented languages or with the direct description of
the sequencing control operations in function charts (Section 7.4). In Europe the use
of function blocks with the graphical symbols for logical gates is the most common,
while in the United States ladder diagrams are still quite widespread. Both
programming methods are being however progressively replaced by BASIC-type
programming languages.
In Figure 7.21 is shown the basic structure of a Programmable Logic Controller.
The input signals are first read into a buffer memory register. This function is always
included in the PLC system software and does not need to be explicitly programmed
by the user. An input register could consist in only a bit, but in some cases also in a
full byte, so that one read instruction would give simultaneously the values of eight
different input bits.
With help of program instructions an input value can be fetched from the input
register and then processed, alone or together with other data. The central
processing unit produces a result that can either be stored for further processing or
be directly transferred to the output.

7.3.2 Basic Instructions and Execution


In order to be useful in industrial automation applications, a PLC must operate in
real time, i.e. to be able to react quickly to external events. The input and processing
of external signals can take place in two ways in a PLC: by polling (repeated
requests) or via interrupt signals (Section 10.6). Polling has the drawback that some
external event(s) may be missed if the PLC is not sufficiently fast. On the other hand
such a system is simple to program. An interrupt-driven system is more difficult to
program but the risk of missing some external event is much smaller. In simpler
7.3: Programmable Logic Controllers (PLC) 249

automation systems polling is usually more than adequate while interrupt-driven


control is used in more complex control situations.

Phase 1: Phase 2: Phase 3:


Data input Processing Signal output

00 Program 20
01 memory 21
02 22
03 23
04 24
05 25
06 26
07 27
Processor
10 30
11 31
12 32
13 33
14 34
15 35
16 Data 36
memory
17 37

Input Input Output Output


signals register register signals

Figure 7.21: Basic structure of a Programmable Logic Controller (the figures indicate
different input and output channels)

The programming of a PLC consists mainly of the definition of control


sequences. The input and output functions are already implemented in the PLC
basis software. The program instructions, that may be given in form of Boolean
expressions, with Assembler-like instructions, in ladder diagrams or function blocks
are translated in the PLC to machine code. At execution time the program is run
through cyclically in an infinite loop. Every full scan may take about 15-30 ms in a
small PLC, whereby this time is approximately proportional to the program size in
memory.
The response time of the PLC depends of course on the time that is necessary
for processing the program code. During program execution, the PLC processor
cannot read any new input signals or output new control signals. Usually this is not a
big problem, since most signals in industrial automation are comparatively slow to
change or last for a relatively long time.
A small number of basic machine instructions can solve most sequencing
problems. A program that contains these instructions is called instruction list. Some
of the fundamental instructions are listed here in the following; usually they can
operate on bits as well as on bytes.
250 Chapter 7: Combinatorial and Sequencing Control

ld, ldi Loading of a value from one input port into the accumulator,
direct (ld) or inverted (ldi)
and, ani AND or inverted AND instruction between the value in the
accumulator and the value of a input channel; the result is stored in the accumulator
or, ori An OR or inverted OR instruction between the value in the
accumulator and the value of a input channel; the result is stored in the accumulator
out The content of the accumulator is copied to the output port and
controls the output signals. The value is retained also in the accumulator so that it
can be further processed or sent to other output ports.

Example 7.4 PLC Programming with ladder diagram and instruction list
The logical control instructions for the PLC can be expressed in form of a
ladder diagram as well as with an instruction list (Figure 7.22). The gate y11 is
used to give memory capability to the relay A11 (self-holding capability).

I11 I12 I13 O11


LD I11
OR O11
AND I12
O11 O12 AND I13
OUT O11
OUT O12
LDI I12
I12 O13 OUT O13

Figure 7.22: PLC control instructions in form of ladder diagram and as instruction list

A logical sequence or ladder diagram is often branched, which makes it


necessary to store intermediate data for later processing. In hard-wired logic this can
be done with special relays (self-holding); in a PLC there are instructions like orb
(OR Block) or anb (AND Block) to this purpose. These instructions store the result of
their operation in a memory stack area in the PLC.

Example 7.5 Using a ladder diagram and the PLC-internal stack memory
(1)
In Figure 7.23 is shown a ladder diagram. The related operations can also be
coded with the following program instructions:

ld x1 The value from channel 1 is read into the accumulator (A)


and x2 The result of the AND operation is stored in A
ld x3 The content of A is stored on the stack. The value from channel 3 is
read into A.
7.3: Programmable Logic Controllers (PLC) 251

and x4 AND-operation of the values from channel 3 and 4; result stored in


A
orb OR operation between the accumulator (main register) A and the
last value stored on the stack. The result remains in the
accumulator A, while the temporary element of the stack is
eliminated.
out y1 Output of the value in A on Channel 1

I1 I2 O1

I3 I4

Figure 7.23: Example of the use of a stack memory in form of a ladder diagram

Example 7.6 Using function blocks and the PLC-internal stack memory
(2)
In Figure 7.24 is represented a logical circuit in form of function block. Also in
this case the corresponding operations can be described in form of an instruction
list:
ld x1 The value from channel 1 is read into the accumulator (main
register, A)
and x2 The result of the AND operation is stored in A
ld x3 The content of A is stored on the stack. The value from channel 3 is
read into A.
and x4 AND-operation of the values from channel 3 and 4; the result is
stored in A
ld x5 The content of A is stored on the stack. The value from channel 5 is
read into A.
and x6 AND-operation of the values from channel 5 and 6; the result is
stored in A
orb OR operation between the accumulator A and the last value stored
on the stack. The result remains in the accumulator A, while the
temporary element of the stack is eliminated.
anb Operates on the last element in the stack (i.e. the result of the AND
operation between the inputs of channel 1 and 2) and the content of
the accumulator A. The result is stored in A. The last element of the
stack is removed.
out Y1 Output of the value in A on Channel 1
252 Chapter 7: Combinatorial and Sequencing Control

I1 &
I2

I3 & &
O1
I4
≥1

I5 &
I6

Figure 7.24: Example of a logical circuit in function block form

7.3.3 Additional PLC Instructions


The basic operations of programmable logic controllers can also be extended by
other logic operations such as XOR, NAND and NOR that were described earlier in
this chapter. Modern PLC devices have also instructions for the processing of
alphanumeric data and for the communication with external equipment as well as
advanced functions such as counter operations, timers and pulse generation. Pulse
signals could for instance be used to reset an external counter. With help of delay
modules, input and output signals can be shifted in time. More complex PLCs can
even generate different signals, such as rectangular pulses and ramp functions; they
can also contain some signal filtering and feedback control algorithms.

7.3.4 PLC Programming


PLCs are usually programmed via external units. These units as a rule are not
needed for the PLC on-line operation and may be removed when the PLC is in
operation. Programming units are typically small hand-held portable units or portable
personal computers.
A manual PLC programmer looks like a large pocket calculator, with a certain
number of keys and a simple display. Each logic element of the ladder diagram or
program instruction is entered with specific keys or key combinations.
A more sophisticated, and increasingly popular, PLC programmer consists of a
personal computer with a graphical display. The display typically shows several
ladder diagram lines at a time. To make debugging and testing simpler the computer
can also indicate the power flow within each line during operation, so that the effect
of the input over the output is immediately recognizable. In some cases programming
can take place by drawing on the display a function block diagram with logical gates.
The gate symbols are input with key combinations and/or with the mouse, by
choosing from a predefined table.
An increasing number of PLCs are programmed in higher level languages,
because functions that with time become increasingly complex, like e.g. the
processing of analog signals or the definition of special regulation algorithms, can be
represented only unsatisfactorily with a limited number of pre-defined symbols. The
7.4: PLC Programming with Help of Function Charts 253

demand for high-level language programming becomes more and more important as
the complexity of the PLC operations increase.
The new standard IEC 1131-3 (earlier called IEC 65A (SEC) 67) defines five
language possibilities for PLC programming:
• Instruction List (IL)
• Function Block Diagram (FBD)
• Ladder Diagram (LD)
• Sequential Function Chart (SFC)
• In addition the language type „Structured Text“, with a syntax similar to that of
the programming language Pascal has been defined.

The structured text and the instruction list represent algorithmic formulations in
clear text. The function block diagram, the ladder diagram and the sequential
function chart are instead graphical representations of the function and the structure
of logical circuits. The international standard IEC 1131-3 should therefore guarantee
a wide application spectrum for PLC programming.

7.4 PLC Programming with Help of Function Charts


7.4.1 The Representation of Complex Control Sequences in Form of Function
Charts
The need for structuring a sequencing process problem may not be immediately
apparent for small applications, but as the complexity of the control action increases,
also the need for better functional descriptions becomes more important. Logical
expressions in form of ladder diagrams and function blocks are not sufficiently
powerful to allow for a structured description of logical expressions. As a tool for a
more appropriate „top-down“ analysis and the representation of control sequences,
the function charts have been introduced. Today, function charts are offered as
programming tools by several PLC producers, like e.g. Grafcet (by the company
Telemecanique), GRAPH-5 (Siemens), HI-FLOW (Hitachi) and others. The basic
ideas at the basis of these languages are similar and the differences are only of
secondary importance.
A function chart can be considered as a special purpose language for the
description of control sequences in form of a graphical scheme. Toward the late
1970s the first function chart language, Grafcet (GRAphe de Commande Etape-
Transition, „Function chart - step transition“) was developed in France and has later
provided the basis for the definition of the international standard IEC 848
(“Preparation of function charts for control systems”).
Function charts describe control sequences with help of pre-defined rules for:
• the controls that must be carried out and in what order
• the execution details of each instruction.

The function diagram is correspondingly divided in two parts (Figure 7.25). The
„sequence“ part describes the order between the major control steps (left part of
Figure 7.25, with the five boxes). The sequence part does not describe the internals
of the actions to be executed. These are described by the „object“ or „control“ part of
the diagram that consists of the boxes to the right of the sequence steps. Every
254 Chapter 7: Combinatorial and Sequencing Control

action has to be connected to a step and can be described either by a ladder


diagram, logical circuit or Boolean expressions.
The sequence part of the function chart according to IEC 848 consists of a
column of numbered boxes to represent the single steps. The vertical lines that
connect together each box with the following one represent active connections
(directed links). Each transition from a step to the following one is connected with a
logical condition known as transition condition or receptivity. The Boolean expression
for the transition condition is written in proximity of a small horizontal line that
intersects the link from one box to the next. When the logical condition is satisfied,
i.e. the related Boolean expression is true, the transition takes place, and the system
proceeds with the following step.

Function Comment

1 Tank empty

Empty * Start This expression is true if the sensor


for the low level indicates empty=1
and a start command is given

2 Discharge valve closed Start of filling operation


Pump on

Full The level has reached the upper limit


value

3 Pump off End of filling operation and start of


heating time
Heater on

Temp The desired temperature has been reached

4 Heater off
Wait time = „time out“ The waiting time is „time out“

Wait time The waiting time is over

5 Open discharge valve

Empty The tank is empty

Figure 7.25: Function chart for the control of a batch tank process
7.4: PLC Programming with Help of Function Charts 255

The use of function charts will be illustrated with the example of control of a
batch process (Figure 7.25). A tank is to be filled with a liquid. When the tank is full,
its content must be heated up to a predefined temperature. After a specified time the
tank is then emptied, and the process starts all over again.
The indication „Empty“ signals that the tank is empty and can be filled again.
This indication is connected to the „Start“ signal, so that the sequence can be
initiated. In Step 2 the bottom valve of the tank is closed and the filling pump is
activated. The indication „Full“ signals when the highest level has been reached. The
program flow proceeds with Step 3 (transition), so that the pump is switched off and
the heater turned on. The heater remains active until the preset temperature has
been reached (indication „Temp“). At this point there is a jump to Step 4. The heater
is then switched off and a timer starts counting. When the waiting time has elapsed
(„time_out“) there is a transition to Step 5, where a command is given to open the
outlet valve. The full sequence can then be repeated from the beginning.
In the function charts syntax a step at any given time can be either active or
inactive. „Active“ means that this step is currently being executed. The initial step is
represented in the function chart by a double-framed box. An „action“ is a description
of the commands that have to be executed at each step. A logical condition can be
associated with a step, so that the related commands are executed only when the
step is active and the condition is fulfilled. The association with a condition
represents therefore a security control.
Several commands can be associated with a step. These commands can be
simple controls but also represent more complex functions like timer, counters,
regulators, filtering procedures or commands for the external communication. As we
have already seen, in the function chart there is also a function for transition, i.e. a
kind of obstacle between two steps to which only a new active step can follow. After
a transition a new step becomes active and the earlier one inactive. The transition is
controlled by a logical condition and takes place only when the condition is satisfied.
The function chart syntax allows much more than just the iterative execution of
the same control instructions. The three functional blocks initial step, step(s) and
transitions can be interconnected in many different ways, thus allowing the
description of a large number of complex functions.
Three types of combinations are possible:
• simple sequences
• execution branching (alternative parallel sequence)
• execution splitting (simultaneous parallel sequence)

In the simple sequence there is only one transition after a step and only one step
after a transition. No branching takes place. In the alternative parallel sequence
(Figure 7.26) there are two or more transitions after one step. In this way the
execution flow can take alternative ways depending on external conditions. Often this
is an if-then-else condition and is useful to describe e.g. alarm situations.
In the alternative parallel sequence it is very important to verify that the condition
for the selection of one of the program execution branches is consistent and
unambiguous; in other words the alternative branches should not be allowed to start
simultaneously. Each branch of an alternative parallel sequence must always start
and end with logical conditions for a transition.
256 Chapter 7: Combinatorial and Sequencing Control

if...then else

(condition) NOT (condition)

6 8

7 9

10

Figure 7.26: Alternative parallel paths. Selection of one out of two alternative execution
paths; only one of the paths is executed.

In the simultaneous parallel sequence (Figure 7.27) two or more steps are
foreseen after a transition, and these steps can be simultaneously active. The
simultaneous parallel sequence represents therefore the concurrent (parallel)
execution of several actions.
The double horizontal lines indicate the parallel processing. When the condition
for the transition is satisfied, both branches become simultaneously active and are
executed separately and concurrently. The transition to the step below the lower
double horizontal line can take place only after the execution of all concurrent
processes is terminated. This corresponds to the simultaneous execution of control
instructions and is comparable with the notation cobegin-coend (Section 10.1.3).
The three types of sequence processing can be also used together, only one
should act carefully in order to avoid potential conflicts. For example, if two branches
of an alternative execution sequence are terminated with the graphic symbol for the
end of parallel execution (the two horizontal bars) then the further execution is
locked, since the computer waits for both branches to terminate their execution,
while only one branch was started because of the alternative condition. Also the
opposite error is possible. If parallel branches that have to be executed
simultaneously are terminated with an alternative ending (one horizontal bar), then
many different steps may remain active, so that further process execution might no
longer take place in a controlled way.
7.4: PLC Programming with Help of Function Charts 257

11

12 14

13 15

16

Figure 7.27: Simultaneous parallel paths. Begin of two time concurrent execution paths. This
function is similar to the instruction cobegin...coend (see Figure 10.3).

Of course a compiler would recognize such mismatch of beginning and end


clauses and would thus alarm the user before the code is executed. But even with
the best compiler around, many errors remain tricky and undetectable. A structured
and methodic approach on the part of the programmer is always an important
requirement.

7.4.2 Computer Implementations of Function Charts


Programs written with the help of functions charts operate under real-time
conditions, so each implementation must exhibit real-time capabilities (the related
implications are discussed in more detail in Chapter 10). Usually, the realization of
real-time systems requires intensive efforts with considerable investments in time
and personnel. However, in this specific case most of the burden is carried by the
designer of the function chart language compiler, while the user can describe
complex control sequences in a comparatively simple way. The aspects of real-time
programming treated in Chapter 10 are valid also for the design of programmable
logic controllers, but concern the final user only indirectly and in a limited way.
Compilers for function charts are available for many different industrial control
computers. The programming and program compilation on PCs is commonplace.
After compilation the code in form of control instructions is transferred to the PLC for
execution. The PC is then no longer necessary during the real-time PLC operation.
Some compilers can also operate as simulation tools and show the execution flow on
the computer screen without need to be connected to the object PLC. There are also
PLCs with the compiler already built in their software.
258 Chapter 7: Combinatorial and Sequencing Control

The obvious advantage of abstract descriptions in form of function charts is their


independence from any specific hardware and their orientation to the task to be
performed rather than to the computer. Unfortunately it must be said that high level
languages like function charts do not yet enjoy the success they deserve. It seems
odd that so many programmers start all the time anew with programming in
Assembler or C code, also for those applications that would be much easier to solve
with function chart description languages.
As in any complex system description the diagram or the code has to be
structured suitably. A function chart implementation should allow to division of the
code into smaller parts. For example, each machine of a complex line to be
controlled may have its own graph, and the graphs for several machines could then
be assembled together. Such hierarchical structuring is of fundamental importance
when programming the operation of large, complex systems (see also Chapter 12).
Function charts are not only suitable for complex operations, but can be very
useful also for simpler tasks. A function chart is easier for the non-specialist to
understand than for example a ladder diagram. An accepted standard for the
description of automated operations has also the advantage that more computer
code can be maintained and re-utilized and does not need to be written anew each
time, as it would be the case with incompatibles devices and languages.
The translation of function charts to computer code depends on the specific PLC
and its tools, as not all devices have such compilers. Still, even if the function charts
cannot be transformed in programming code, the diagrams are very useful, since
they provide the user with a tool to analyze and structure the problem. Some
companies use function charts to describe the function and use of their equipment.
Of course, it would be much simpler if function charts would be used all the way from
functional description to actual programming.

7.4.3 Application of Function Charts in a Practical Industrial Control Example


The use of function charts for sequencing programming is here demonstrated for
a manufacturing cell in a flexible manufacturing system. The cell consists of three NC
(numerical control) machines, e.g. a drill, a lathe and a mill, a robot for material
handling and a buffer storage (Figure 7.28).

Buffer Robot

Machine 3

Machine 1

Machine 2

Figure 7.28: Layout of the manufacturing cell


7.4: PLC Programming with Help of Function Charts 259

At the cell level are not considered the specific control loops of the machines or
of the robot; they are handled by separate control systems. The focus lies instead on
the coordination of their operations. A cell computer sends control signals to the
machines; its task is the control of the operations of each machine and of the robot
and the synchronization of the activity of the machines and the robot. The control
task is a combination of sequencing control and real-time synchronization of the kind
described in Chapter 10. Here it will be shown how these operations can be
expressed in function chart form. The actual implementation of the function chart
operation is left to the process computer and its compiler.
The part to be processed must be handled in the three machines in a predefined
order, like on an assembly line. The task of the robot is to deliver new parts to each
machine and to move semi-processed parts between the machines.
The synchronization of the machines is done by a „scheduler“ graph with the
structure shown in Figure 7.29.

Scheduler

Machine 1 Machine 2 Machine 3 Robot Buffer

Figure 7.29: Communication structure for the production cell

The scheduler communicates with each machine and with the robot and
determines when they can start their operation or when the robot must move a part.
The function of the scheduler is similar to that of the scheduler in a real-time
operating system (Chapter 10), although they are actually different things. Also the
scheduler for the manufacturing cell operation must divide a common resource, in
this case the robot, as efficiently as possible among the machines in the cell. The
scheduler must guarantee that the robot does not block any operations. If for
example the robot has picked up a finished part from a machine and has nowhere to
place it, then the operation of the cell will stop. Consequently, the scheduler has to
match the requests from the machines with the available resources (robot and buffer
capacity).
The scheduler graph for the control of the manufacturing cell contains different
parallel branches, one for each machine, for the robot and for the buffer. Since all
the devices are operating simultaneously, the scheduler has to control all of them
concurrently by exchanging synchronization signals of the type „Start“ and „Ready“.
When a machine receives a start command from the scheduler, it must perform the
task described in its function chart. When the machine has terminated the execution,
it sends a „Ready“ signal to the scheduler.
In Figure 7.29 it is shown that no machine communicates directly with the robot.
Instead all the communication signals are transmitted via the scheduler. The signals
operate as conditions for transition in each branch of the function chart. By
structuring the function chart in this way, it is possible for example to add new
260 Chapter 7: Combinatorial and Sequencing Control

machines to the cell without having to reprogram any of the sequences of the other
machines. Only the control sequence for the robot has to be modified with the
operations required to serve the new machine.
A good function chart implementation supports the hierarchical structuring of the
control problem. The total operation for the manufacturing cell consists in the
operations for the control of the single machines, and also these operations can be
divided again in more detailed parts.
The sequencing control for each machine can be defined in a separate function
chart. The sequence for the drill is indicated for example in Figure 7.30.

21 Drill in up position

Drill Start (from Scheduler)

22 Set acknowledge time=tim 1

Drill Ready & NOT tim 1 & work piece

23 Set start rotation


Set drill to work piece
Set max time

Drill at work piece & NOT max time Drill at work piece & max time

24 Show drill at work piece 30 Alarm

Figure 7.30: Beginning of the function chart sequence for the drill

The start_drill condition is a global variable and represents a signal from the
scheduler. If the drill has not acknowledged the start order within the time tim_1, then
an alarm is activated and the graph is directed into an alternative parallel branch.
Likewise, if the drill has not reached the workpiece within a given time another alarm
is activated. The graph for the individual drill machine may seem to be lengthy, but it
7.5: Summary 261

contains the necessary number of safety tests and alternative routes as


consequence of alarms. At the end of the machine operation the variable drill_ready
becomes true. This variable acts as a logical condition for transition in the function
graph of the scheduler. The scheduler can now be activated to signal the robot to
pick up the part from the drill.
The robot can perform a number of tasks, described in the function chart as
alternative parallel branches, like for example:
• Pick up a part from one machine
• Place a part in the buffer
• Pick up a part from the buffer and place it in a machine

The importance of structuring is obvious. The sequencing operations of the cell


could have been written in machine code or as a ladder diagram. However, long
codes in low level languages are not meant for people to read, understand, debug or
maintain. For high-level language such as function charts, the code itself is a good
documentation.

7.5 Summary
Binary control is a fundamental part of many automation applications. It is based
on switching theory. An important practical aspect demonstrated by this theory is that
with few fundamental gates (NOR, NAND) all other combinatorial networks can be
realized.
There are two classes of sequencing systems, combinatorial and sequencing
networks. Combinatorial networks have no memory and the output is a logical
function of the current input values. Sequencing networks instead have memory
capabilities, so that it is possible to carry out a sequence of steps in time. The control
of the sequence execution can be either synchronous or asynchronous. In most
industrial automation applications, the control systems operate asynchronously, i.e.
the execution flow is controlled by external events and conditions and not by periodic
clock signals.
Logic elements can be realized with different technologies: hard-wired
components, integrated circuits, programmable array logic (PAL) or in software by
programming process computers or programmable logic computers (PLC). PALs and
PLCs are gaining more and more importance for the implementation of logical
networks or control sequences.
The description of a sequencing network can be done with either logical circuit
drawings at gate level or ladder diagrams. However, these methods are not suited for
the representation of complex control sequences, so that for the structured
description of complex systems should be used more powerful tools. A good
description language must allow for the hierarchical structuring of the code. In this
chapter has been used the function chart description according to the IEC 848
standard in order to demonstrate some principles in sequencing control.

Further Reading
Switching theory is described in numerous specialized textbooks; [Lee 1978] and
[Fletcher 1980] are suitable introductions to the subject. [Pessen 1989] contains a
good overview of sensors, actuators and switching elements in both electric and
262 Chapter 7: Combinatorial and Sequencing Control

pneumatic control technology. [Warnock 1988] presents a lot of practical information


on Programmable logic computers (PLC), their construction, use and applications.
Also the manuals from the different PLC manufacturers provide good information
source about PLCs, their programming and practical use.
Several articles on components, PLCs and market reviews appear regularly in
the journals Control Engineering, Instrument & Control Systems, Machine and
Design as well as Product Engineering.
8 Bus Systems

Aim: To present bus systems as open computer architectures, define their basic
operations and describe some current types in order to provide the necessary
background to evaluate, select and configure bus applications

Overview
Bus systems are in common use in automation applications; they allow the
selection of the optimal hardware combination for any given control task. The
approach to the study and the application of bus systems is quite different than to
usual computer systems. In the latter, the central processing unit is at the center of
the design and of the operations. In bus systems, the way the data is exchanged, i.e.
the bus itself, is in the center and the internal processing details for the single boards
connected to the bus bear less importance.
About a dozen or so of bus systems are commonly used in industrial
applications. These buses cannot be compared with each other directly without
qualifications as each bus reflects the technology and expectations of the time it was
designed. A few designs are proprietary of some company, others are supported by
standardization organizations and open for everybody to use. The importance of
having few bus architectures, independent of a specific processor model and under
the control not of a particular manufacturer but of recognized standards
organizations is generally agreed upon.
This chapter begins with a general background introduction to the bus concept
and operations (Section 8.1). Bus operations are described in more detail in Section
8.2, in which some practical indications about the construction of bus systems are
also included. The most important bus types in industrial automation are the VMEbus
and PCI; in particular a more in-depth description of VMEbus (Section 8.3) has been
included as reference and as extension of the general bus description in the earlier
section. This material is principally of interest when actually using this type of bus
and may be omitted without loss of continuity. Finally, in Section 8.4 is presented a
brief overview over other important bus systems, such as EISA, PCI and others.

8.1 From Centralized to Distributed System Architectures


A major breakthrough in system design for computers process control
applications took place in 1965, when Digital Equipment Corporation (DEC)
introduced the cabinet-mounted PDP-8 processor, later followed by the PDP-11 in
1970. The success of the PDP computers was due not only to their price (at that time
they cost more than US$ 100,000 per unit, yet were still much cheaper than the other
computers then available), but also on the fact that they were based on „open“ bus
architectures. Customers could select the most appropriate hardware for their needs
and design their own interface cards on the basis of the open (i.e. published) bus
specifications. The PDP minicomputers became very popular in industry and gave
sway to OEM 1 companies, each specialized in particular minicomputer applications.

1 Original equipment manufacturers, companies that build complete system applications, e.g. test
units, using basic components delivered by other manufacturers.

263
264 Chapter 8: Bus Systems

Other manufacturers followed later the example of the company DEC with its
PDP computers and defined new bus standards. The possibility of selecting and
configuring the most appropriate hardware for control applications was instrumental
in the success of bus systems.
To appreciate the innovation brought by open bus systems, one should begin by
taking a look at the basic computer structure. A computer system is normally built
around a central processing unit (CPU) to which are connected peripheral units to
perform different functions: keyboard, video interface, disk driver and input/output
(I/O) boards (Figure 8.1). In this configuration, the peripheral units may communicate
directly only with the CPU and only one peripheral unit at a time may be active
exchanging data.

disk drive I/O port

RAM memory CPU terminal

printer

mass memory, clock unit


CD-ROM drive

Figure 8.1: The basic organization of computer systems

The CPU-centered configuration is inherently inefficient because all data has to


pass through the CPU, even when the CPU does not need it. If the CPU operates
much faster than the connected peripherals, the additional load for peripheral control
and data exchange is not much of a problem. This was the case for the first thirty
years of computer history, but today the situation has changed as peripherals have
gained very much in speed. Data transfer between disk and central memory, a very
frequent operation, requires that the CPU copy data one byte at the time from one
unit to the other. If the peripherals produce or consume data at a speed comparable
to that of the CPU, they will generate a large fraction of the CPU load. Obviously it
would be more convenient if the peripheral units could communicate directly with
each other.
Bus-based architectures represent a solution to this problem. The peripheral
units are connected together with a bus by which each unit can communicate with all
the others (Figure 8.2). On the bus, only one data exchange operation can take
place at any given time and appropriate coordination rules must be followed. At the
center of attention is no longer the CPU but the protocol, that is, the way data is
exchanged among the boards connected to the bus. The specific details on how the
data is processed by the boards, including the CPU, is instead not relevant. Bus
architectures present many advantages over centralized ones. A computer system
8.1: From Centralized to Distributed System Architectures 265

design where the peripheral units have added computing capacity and are more
independent from each other is generally more effective.

RAM memory I/O port clock unit mass memory,


CPU CD-ROM drive
printer terminal
disk drive

bus

Figure 8.2: Principle of bus organization

Bus-based architectures can be considered to be a particular kind of distributed


systems, in which independent computers connected by communication links work
together. The most important aspect in distributed architectures is how
communication among the subsystems takes place. In bus systems are exchanged
memory words transmitted in parallel. In distributed, network-oriented systems the
connected computers usually exchange higher-level messages constructed as bit
sequences and transmitted serially. The transfer speed is much higher for parallel
buses; the physical length of these buses is however limited to a few decimeters.
Serial data communication lines have lower throughput, but can span the whole
world. This Chapter is dedicated to the operation of bus systems and the next one
will deal with serial communication networks. The principal issues related to
programming in multiprocessor and distributed environments are discussed in
Chapter 10.
The development of bus system architectures has been strongly influenced not
only by technical but also by economical forces. The major technical aspect is the
continuous progress in the miniaturization of electronic circuits, so that in course of
time functions that were earlier realized by several integrated circuits mounted on a
board can be found today in one or a few chips. The economical forces had
principally to do with the market created by the introduction of personal computers
(PC) and their interface devices. The introduction and diffusion of personal
computers has in fact strongly influenced the development of bus systems. The
availability of very high computing power at affordable prices has also had positive
reflections on industrial automation applications.
The requirements of typical industrial multiprocessing systems are quite different
from those for home and office personal computers. In typical bus systems for
process control applications there are several boards, and each one is connected to
part of the technical process. These boards usually generate each similar amounts
of data that has to be exchanged with the other boards. In comparison, PC buses for
home and office were thought in first place for the control of advanced graphics for
multimedia and interactive videogames. In typical personal computer applications
few boards generate very large amounts of data, for example for multimedia
presentations with advanced graphics and sound.
The development of bus systems for the PC market has in first hand been
influenced by the latter type of applications than those of process control. A „clean“
master arbitration principle or an efficient and priority-controlled interrupt
mechanisms were not considered essential for typical PC applications for home and
266 Chapter 8: Bus Systems

office. In practice this means that PC technology may be used in many cases also for
industrial control application, often at sensible cost advantages, but it must be kept in
mind that it was not optimized and thought for that purpose. Strange as it might
seem, today the industrial market can hardly compete with the home and office PC
user market (there is still more money to be made with videogames and multimedia
than with process control).
The first buses were designed around specific processors and their lines were
basically extensions of the processors’ pins, appropriately buffered in order to
increase their power output. The CPU controlled directly data exchange operations
and timing. More modern buses are instead designed to be processor independent:
their data and address formats and their communication protocols, i.e. particular sets
of rules to on how data exchange must take place, do not depend on a particular
processor architecture. In order to modify a system it is not necessary to explicitly
design it anew, but it is sufficient to change or add components with the new desired
functionality, provided the new components follow the same protocol as the rest of
the system. The design of any subsystem interface is not made toward other system
components but toward its electrical interface and its protocol. This concept will be
illustrated in this and the following chapters.
In defining a new bus standard, there is much compromising on the physical
dimension of the circuit boards. The dimension of the card implicitly defines the
amount of logic circuitry that will fit on it. Thanks to the integrated circuits able to
execute more and more functions with smaller components, the size of function
boards for industrial applications has progressively been reduced down to typical
board dimensions of about 15x30 cm. Larger boards may contain more functions,
but they will also be more expensive. Smaller boards facilitate the selection of the
right mix for a specific application and will be cheaper, but will use up slot space
faster; in addition they will load the bus with more frequent data transfer requests. As
CPU power is becoming more affordable, it is economically feasible to build
intelligent boards each with its own dedicated processor and local memory. The bus
structure represents therefore a rational and modular frame for the joint operation of
different CPUs and peripherals.
Buses support modularity, which in turn gives greater flexibility for new
applications. This is a key feature, especially when considering how often partial
changes are required during the development of a new design. A bus allows
resource sharing: several independent processors might, for instance, use the same
memory or other units such as disks or printers. In this way a system is used more
efficiently and its operation becomes therefore more economic.
In the theory of bus operation, data communication, operating systems and
distributed system operations there are a few common basic concepts. Particularly
important is resource protection: the resource can be thought in a wide sense, as a
computer bus, CPU time, occupation of a communication channel, a variable in
memory, etc. The methods to solve the problem of resource protection present
notable similarities. The fundamental problem will be examined in detail in Section
10.3.1, while in the present Chapter are presented those issues directly related to the
technology and operation of parallel bus systems.
8.2: Bus Structure and Operation 267

8.2 Bus Structure and Operation


8.2.1 General
A system bus is both a physical and a logical concept. Physically, a bus consists
of about 50 to 100 conductors carrying electric signals in parallel (i.e. related signals
are present on the conductors at the same time) between different boards with
electronic circuits. The bus wires may be soldered to the boards, but the most
common method is to insert the boards in connectors that are joined together via the
bus.
The logical concept of a bus is reflected in the data exchange protocol, which in
this case specifically means the rules and formats for data exchange,
synchronization, handshaking and timing. Any board physically and logically
compatible with a bus can operate on it and work together with other compatible
boards.
A bus carries information in all directions. All boards receive the same data and
must therefore recognize autonomously when they are addressed. Typical data
exchange rates are of the order of some tens of MByte/s. Because of delays for the
propagation of electrical signals along the bus wires, the extension of a bus is limited
to a length of a few decimeters. The bus and connected boards are usually mounted
in a metal cage containing a set of connectors installed on a backplane and including
also, in some cases, a power supply unit and a cooling fan.
The most important parameters to describe a bus system are:
• mechanical and electrical data: board dimension, type of connector, power
consumption, cooling requirements
• whether the bus is oriented to a particular type of processor or processor-
independent
• address width or addressable memory space
• data width
• data transfer rate, typical and maximum
• data transfer type synchronous or asynchronous
• clock frequency (for synchronous buses)
• number of interrupt signals and interrupt handling procedure
• possibility to use different master units, i.e. units that coordinate the data
transfer, or whether coordination must be always carried out by the same unit
• additional features, such as auto-configuration (so-called “plug-and-play”).

It is not possible to compare different bus systems only in the light of these
parameters. A bus is a system solution and its analysis makes sense only if its many
aspects are considered together.
The most important parameters to describe a bus are the address and data
width and the data transfer rate. The latter is usually given in MByte/s and shows
the maximum rate, that is the physical limit of a bus operating under extreme
conditions. The actual data transfer rate, or throughput, of a system may be much
lower, as it depends on many other factors. It must be considered under which
assumptions the given figures are valid. A high data transfer rate could be a „burst
rate“, reached using special test programs under particular conditions, while in
normal operation fetching single data items could turn out to be much slower.
268 Chapter 8: Bus Systems

When the data transfer rate is indicated in words it must be considered that the
word does not have a fixed length in bits, but it is usually considered as the bus data
path width. The data transfer rate is also sometimes called the bandwidth of the data
bus. However, this definition is not consistent with the meaning of bandwidth, as for
example in measurement technology and in communication (see also Section 4.1.3
and 9.3.1). In the following, the term data transfer rate will be used.

8.2.2 Mechanical Construction


The trend toward standardization in bus architectures has imposed solutions for
aspect of the basic hardware, for instance, board sizes and connector types. The
most common format is the 19“ rack (Section 12.2.2), which has space for up to 21
boards in parallel (Figure 8.3).

Figure 8.3: 19“ VMEbus rack with 21 slots (courtesy of Schroff, Germany)

The most popular type of board size is known as the „Eurocard“ or „euroboard“
format (the name has to do with the fact that this board type was initially used
extensively in Europe). This board size is now normed in the United States as IEEE
1101 standard, in Europe as IEC 297-3 and in Germany as DIN 41494, Part 2. The
smallest commonly used board, „single height Eurocard“, has dimensions (height x
width) 100 x 160 mm. The board height may increase in 133.35 mm steps and the
width in 60 mm steps. For example, the „double height Eurocard“ board has
dimensions 233.35 x 160 mm. The 19" and the Eurocard formats are used for
different bus systems, as for example VMEbus and Compact PCI.
The actual bus electrical conductors are realized on printed circuit paths on a
backplane, shown in Figure 8.4, on which are also mounted the connectors for the
insertion of the boards containing the electronic circuitry.
8.2: Bus Structure and Operation 269

Figure 8.4: 19“ VMEbus backplane (courtesy of Schroff, Germany)

Two types of connectors are used for the connection of boards to buses: the
edge connector and the plug-in connector. The edge connector (Figure 8.5) was
used in earlier bus standards and is popular today particularly for personal computer
applications due to its simplicity and low cost. However, edge connectors have a risk
of poor electrical contact, which may lead to errors.

edge connector

Figure 8.5: Edge connector

Better performance is offered by the plug-in connector, which guarantees higher


electrical and mechanical stability than the edge connector. A very common type of
plug-in connector is the DIN 41612 (Figure 8.6). This connector is available in
different versions with varying number of pins (Model A has 32 pins, B 64 pins and C
96 pins). Model C allows enough signals to be carried so that apart from address,
data and signaling more advanced applications can be realized. The connectors are
usually installed at the end of the electronic circuit boards to allow their connection at
a right angle with the backplane. The high-performance bus VMEbus uses this type
of connector. Compact PCI uses a 2-mm plug-in connector, described in the IEC-
1076-4-101 specification.
270 Chapter 8: Bus Systems

Figure 8.6: 96-pin plug-in connector of type DIN 41612-C installed on a termination
network for the VMEbus (courtesy of Schroff, Germany)

8.2.3 Bus Interface Electronics


In order to understand how a bus operates it is important to take a look at the
electronic components in the interface and how they function.
Each bus wire connects together different circuits, so that their signal and
impedance characteristics must match. For the electrical connection of the boards to
the bus three different interface types can be used: TTL totem pole, open collector,
and tristate logic. The different electrical characteristics of the interfaces are reflected
in the different modes of operation for the bus.
The totem pole interface is the normal output in TTL (transistor-transistor logic)
integrated circuits (Figure 8.7). In this output type either transistor Q1 or Q2 - but not
both - is closed and conducting. The output voltage is either equal to the power
supply level minus 1.1 V (i.e., the voltage drop for Q1 and D1) or to the ground level
plus 0.4 V (the Q2 voltage drop). Because of the voltage drops in the output
transistors, in TTL „low level“ is defined as between 0 and 0.8 V and „high level“ as
anything above 2 V.
If a load is connected to the totem pole output, current will circulate in Q1 or Q2
depending on the logical output state and on whether the load is connected to the
power source or to the ground. In case of a load connected to the ground, Q1 must
be able to source the current required by the load when the output is a logical „1“
(high). Conversely, if the load is connected to power supply, Q2 must be able to sink
the load current when the output is in low state. In the other states it is not required
to either source or sink any current.
8.2: Bus Structure and Operation 271

+ Vcc

Q1
inputs
Q4 D1
Q3 output

Q2

0V
ground

Figure 8.7: Internal structure of a TTL NAND gate. The transistors Q1 and Q2 and the
diode D1 form the totem-pole output.

Figure 8.7 also shows the typical TTL input. In order to input a logical „0“, the
input pin must be held at a voltage level of 0-0.5 V with respect to ground, but to do
this it is required that some current circulates out of the input and to the ground. A
TTL input is therefore equivalent to a load connected to the power source; the TTL
output transistor Q2 must be able to sink this current from the cascaded inputs. For
this reason the TTL logic is also called current sinking logic. A typical sink current
value is 1.6 mA at a power supply voltage of +5 V. The TTL output circuits are
usually designed to drive up to ten other TTL gates, that is, the output transistor Q2
must be able to sink at least 16 mA.
Two totem pole outputs should never be connected together directly, otherwise if
one output is high and the other is low at the same time, the power source is short-
circuited to ground via the two gates (Figure 8.8). The gates may be damaged and
the power spikes can induce noise and lead to erratic operations in the electronic
logic.
A different type of TTL output is the open collector. This output is obtained by
cascading the TTL output with a transistor, the emitter of which is connected at
ground level, while the collector represents the new output (Figure 8.9.a). When the
transistor is closed and conducts, the output is at ground potential. In the other state
the output level is indefinite, as it is insulated from the ground via a high impedance.
To insure that the output voltage is at power supply level when the transistor is in
open state, a pull-up resistor is connected to the output (Figure 8.9.b).
Several open collector outputs can be connected together in the wired OR
configuration (Figure 8.10). The line level is high only if all transistors are open, i.e.
they do not conduct any current. When one or more outputs are at a low level, the
common line is also at low level. The wired OR configuration is used when the
boards must communicate something general to be understood by all the others, e.g.
that all the boards are ready to operate. Every board may pull the line low, for
example to indicate that it is not yet ready for an operation. All boards also constantly
272 Chapter 8: Bus Systems

monitor the line. It is sufficient for one board to pull the line low so that the others can
detect it. Due to its simple operating principle, open collector logic in wired OR
configuration was widely used in earlier bus systems.
The wired OR configuration has a drawback in high-speed operations because it
is sensitive to the capacitive load of the line. The pull-up resistor R to drive the high
state forms a serial RC circuit with the distributed line capacitance C. The
consequence is that the transition from the low to the high state tends to be
somewhat slow and is limited by the time constant that results from the parameters R
of the pull-up resistor and C, which is fixed. R cannot however be reduced at will in
order to limit the rise time, because the higher currents would overload the interface
transistors.

+ Vcc

Q1

Q1

D1 D1
Q2

Q2

0V

Figure 8.8: Short-circuit connection of two totem pole outputs. One output is at logic level
„1“ (Q1 and D1 conducting) and the other output at logic level „0“ (Q1 closed,
Q2 conducting).

+Vcc
(a) (b)

pull-up resistor

output output
TTL-level TTL-level
input input

0V 0V

Figure 8.9: Open collector output. (a) The output voltage is either 0 V or undefined; (b) use
of a „pull-up“ resistor to get a defined output voltage in both states (0-1).
8.2: Bus Structure and Operation 273

+Vcc

pull-up resistor

wired OR line

Q1 Q2 Q3 Qn

0V

Figure 8.10: Example of wired OR connection. If at least one transistor is closed and
conducting, the common line is set at ground potential.

Open collector also has a problem when more than one transistor is conducting
in a wired OR configuration. When the transistor that is conducting most of the
current is turned off a glitch propagates down the signal line until another transistor
starts conducting. This effect is called “wired OR glitch”.
Modern bus systems are based on tristate logic, see Figure 8.11. Two states
are the logic „high“ and „low“, the third state is a high-impedance output. In the third
state the interface circuitry does not influence the bus lines, but the state of the lines
is reported to the internal circuitry of the boards.

logic data amplifier


output

board control line


electronic to the bus
circuitry

logic data
input

amplifier

Figure 8.11: Tristate logic interface

Tristate logic is used mainly for the exchange of data and the indication of
addresses. One board drives the bus with the usual high/low levels and all other
units keep their output in the high impedance state, while at the same time
monitoring the bus signals. Tristate logic outputs can be connected together without
any risk. The basic state is the high impedance input, and only with explicit assertion
274 Chapter 8: Bus Systems

the tristate interface will take one of the output states. Such assertion is given only
when the board is enabled to control the bus lines.
Modern buses combine tristate logic interfaces to exchange data and addresses
and wired OR interfaces to indicate readiness to send or accept data, coordinate
operations and send interrupt requests. In high-speed buses tristate logic is used
also instead of the wired OR interface in order to overcome the limitations of the
latter with the signal rise time.
At the high frequencies at which a bus operates, each conductor behaves as a
transmission line with distributed impedance. As shown in the description of electrical
conductors in Section 4.5.2, the characteristic impedance of all connected units and
at both ends of each line must match, otherwise the signals might be reflected back.
If the level of the reflected signals is high, they can interfere with normal operations.
To avoid signal reflections, termination networks with impedance equal to the
line impedance are connected at both ends of a bus conductor (Figure 8.12). The
termination networks dampen out spurious oscillations caused by fast transients.
Termination networks can either be built directly on the bus backplane or installed on
boards that are inserted in connectors at both bus ends (Figure 8.6).

+Vcc
+Vcc

330Ω 0.1µF

to the bus 470Ω for each


lines bus line
0V

0V

Figure 8.12: Bus termination network

8.2.4 The Bus Electrical Interface


The conductors of a bus can be divided in the following groups:
• address lines
• data lines
• control lines: handshake, interrupt, clock
• power lines
• spare lines.
The address lines carry the source or destination address of the data on the
bus. The typical address size has increased since the first buses, when it used to be
16-20 bits, to today’s typical 32 or 64 bits. Each connected board operates within a
unique address range (i.e. a subset of the full addressable space) and must
autonomously recognize when the address on the bus is within its range.
8.2: Bus Structure and Operation 275

Data lines carry data to and from the addressed locations. Similar to address
lines, their number has increased from 8 in earlier buses to 32 or 64 in more modern
applications.
Control lines are used to carry service signals, as for example the type of
operation read / write, indication of readiness to send or receive data, or interrupts to
request special handling by one of the processing units. Normally, one line carries a
clock signal at a defined frequency to be used as general synchronization reference.
Most boards do not have autonomous power supply and draw their power from
the bus. Power lines are then used to carry voltages typically at ±5 V and ±12 V
levels. Power and ground are normally connected to several pins in order to
distribute the current load of multiple boards among several conductors.
Spare lines are not connected at all; they are reserved for additional functions in
future revisions of the bus standard. They might also be explicitly left free for the
user’s own applications.
Not all types of lines are present on all buses. Address and data sizes vary, the
number of handshake lines depends on the data exchange protocol, and interrupts
are supported differently from one bus to the other. Some of the bus lines carry their
original meaning when they are at a high voltage level (active high) and some when
they are at ground level (active low). To avoid confusion, a line is said to be either
asserted or negated, independently of whether the asserted state is at a high or low
logical level. Active low lines are indicated in bus data sheets with an asterisk (*)
following the name or with a line above the name, for instance NACK* or NACK .
Active low lines often operate according to the wired OR principle; they are used
when all boards must indicate readiness for an operation at the same time. If a board
is not ready for operation, it just pulls the common line low so that the other boards
can detect it.

8.2.5 Bus Operations


The protocol is the set of rules for the coordination of data exchange and other
operations in a bus. These rules are as important as the meaning of the conductors
in order to ensure compatibility and to make data exchange possible among the
connected boards. All bus operations have to be exactly defined in relation to the
used lines and the required timing. In order to be compatible with a bus and thus with
the devices connected to it, a board must follow the bus protocol.
The board that at any moment sets the address and indicates what operation is
to be performed is indicated as bus master. The bus slave is the unit addressed by
the master and must react to its commands. For example, in a data transfer
operation between CPU and memory, the CPU acts as master, sets the address and
indicates whether the operation is read or write. The memory board, acting as slave,
recognizes its address and reacts by reading or putting the requested data on the
bus. In some buses only one board can act as master, in other systems master right
can be passed among boards. If there is no clearly identified master and several
boards tried to access the bus at the same time; the combination of the conflicting
signals might lock the bus (bus contention). Special purpose bus arbitration circuits
are used to address this problem.
Buses can be synchronous or asynchronous. Synchronous buses operate
following the timing of a reference clock signal, a rectangular wave at 10-20 MHz that
is generated by one of the boards. A reference clock period is called a bus cycle. In
synchronous buses, all operations must be carried out in a precise number of bus
276 Chapter 8: Bus Systems

cycles. Asynchronous buses operate according to the principle of cause and effect.
An operation may be carried out only after the previous operation is terminated. In
asynchronous buses there is no synchronization clock and some handshake lines
are used to carry different acknowledgments and indicate readiness for operation. In
synchronous buses readiness is implied by the clock: at a certain bus cycle all
boards must be ready for operation.
There are trade-offs between the two techniques. Synchronous buses are
somewhat less complex, but are defined on the basis of the technology available at a
certain time and offer comparatively little room for improvement. Asynchronous
buses allow for greater flexibility due to the fact that boards operating at different
speeds can be installed on the same bus and operate together. If a board built with
new components can operate at higher speed, it can nevertheless be immediately
integrated in an asynchronous bus. The more complicated circuitry required by
asynchronous buses is usually not perceived as a problem since large scale
integration allows the costs for the interface logic to be kept low.

8.2.6 Synchronous Data Transfer


The most common bus operation is data exchange between two boards. This
operation also exemplifies clearly the difference between synchronous and
asynchronous operation. In data exchange, the board acting as master sets the bus
address and asserts one or more control lines to indicate that the address is valid
and whether the operation is read or write.
In a synchronous read operation the addressed device (slave) must put the data
on the bus for a fixed number of bus cycles (Figure 8.13). In the example shown, all
connected boards „know“ that the address is valid for 5 cycles after the beginning of
the operation and that the data on the bus is valid only the 3rd, 4th, and 5th cycle after
assertion of the data read request. The synchronous write operation is very similar,
the only difference is that the master is also responsible for putting the data on the
bus. The slave board must read the data from the bus within a few cycles.
The synchronous timing is always referenced to the polarity change of the clock
pulse. The actual protocols specify when all the signals must be set. For example, if
the clock rate is 10 MHz, the interval between successive positive (or negative)
edges is 100 ns. The interface logic on a board must be able to react within that
time.
It may happen that the addressed board is not able to decode the address and
process the requested data in time. In such a case, the board asserts a WAIT line to
indicate to the other boards that the bus operation is delayed. When the slow board
is ready to continue, it negates WAIT and normal operations are resumed. This
action is called insertion of wait cycles.

8.2.7 Asynchronous Data Transfer


In asynchronous buses there is no clock line. Instead, several handshaking lines
indicate when the sender and the receiver are ready for the information transfer,
when address and data are valid, and when the destination device has received the
data. Asynchronous transfer builds on the cause-effect principle: a new operation
may take place only after the previous operation is terminated.
8.2: Bus Structure and Operation 277

address address
(from master)

address valid
(from master)

data read request


(from master)

data
(from slave) valid data

clock
(from master) 1 2 3 4 5 6 7 8 9 10 11 12

Figure 8.13: Synchronous data read operation.


At each clock pulse determined signals must be on the bus. In this example the
address must be on the bus during the clock signals 2 through 7; the validity of
the address is confirmed with a different signal. The „data read“ request must be
present between the clock periods 4 and 7. The slave replies with the requested
data between the periods 6 and 8. The address and data signals must already be
present on the line during the rising edge of the respective clock periods.

In a data read operation (Figure 8.14) the master unit begins by putting the
destination address on the bus and shortly thereafter confirms the address by
asserting the ADDRESS VALID line. An additional line indicates that the operation is
a data READ. With ADDRESS VALID asserted, all boards decode the address. The
addressed board puts the requested data on the bus and confirms the operation by
asserting the DATA READY line. The master unit acknowledges data reception with
the DATA ACKnowledge line. Now the slave may negate the DATA READY line and
reset the bus drivers; in reply the master negates its DATA ACKnowledge line. The
data read operation is completed.
In some types of asynchronous buses the lines for address validation and for
operation control are organized in a different way. For example, MEMORY WRITE
asserted indicates at the same time that the address is also valid. With this
organization, one line is needed for each one of the possible operations.
The data write operation is similar to data read. In this case the master unit
writes on the bus the destination address and the data. After the correct bus signal
levels have been reached, the necessary lines are asserted to indicate that the
operation is WRITE and that address and data are VALID. At this time all boards
read and decode the address; the addressed board also reads the data and when
the storage operation is terminated, it signals this by asserting the DATA
ACKnowledge line. The master board can then release the DATA READY line to
indicate that data and addresses are no longer valid. The slave unit releases its
DATA ACKnowledge line and the operation is terminated.
278 Chapter 8: Bus Systems

address (data accepted, address no longer valid)


(from master) address

data read request (data accepted)


(from master)

data (data no longer valid)


(from slave) valid data

data valid confirmation (data no longer valid)


(from slave)

time

Figure 8.14: Asynchronous data read operation.


The master places an address on the bus and confirms its validity by asserting a
line (in this example: „data read“). The slave board answers by writing the
requested data on the bus and confirming with the „data valid“ line. The master
then negates „data read“ to confirm the reception of data and the slave answers
by cancelling the data and negating the „data valid“ line as final
acknowledgement.

8.2.8 Block Transfer


Data transfers between central memory and peripherals such as disk drives and
video screen interface occur frequently in computer systems. Such transfers typically
take place in blocks of hundreds or even thousands of bytes at the time. Other
common memory transfers include copying block-organized data, like for instance
program code, data vectors and character strings. A relevant aspect for this type of
data is that its content is located at consecutive memory addresses.
In block transfer the length of the block is passed along with the start address
for the transfer. The data is then written out in succession by the addressed board
following the bus clock when the transfer is synchronous, or after each handshake
acknowledgment in asynchronous operations. In block transfer, there is no need to
pass and acknowledge an address for each byte transfer because the read and write
addresses for each byte transfer are automatically incremented at source and
destination.
The block transfer technique requires some additional logic in the boards for the
automatic generation of new addresses. Due to the fact that it strongly improves
transfer speed and system throughput, block transfer is becoming a standard feature
in new bus systems.

8.2.9 Interrupt Handling


An interrupt is a signal that a peripheral board sends to the central processor
(or to another board) in order to request attention. In response to an interrupt, the
processor stops what it is currently doing and executes a service routine. When the
8.2: Bus Structure and Operation 279

execution of the service routine is terminated, the original process may resume its
previous operations (see also Section 10.6.4).
An interrupt indicates that an event asynchronous (i.e. not related in time) to the
current program flow has taken place. It might be that new data is present on a
communication channel, a button is pressed or an operation is completed and the
interrupting device requires processor attention. By their very nature, interrupts can
take place at any time.
In bus systems interrupts are used principally as indication that a board needs
service. A board generates an interrupt by asserting an interrupt request line; most
times the interrupt is directed to the current master unit. When the bus master is
ready to service the interrupt, it signals this on the interrupt acknowledge line. The
generating board then negates its interrupt request.
When several boards request interrupts it is necessary to differentiate between
them according to some precedence order, as only one board at a time may receive
attention. Most bus systems have therefore several interrupt request lines and every
line has a predefined priority. Interrupts are serviced according to the priority of the
line on which the request is made. The board servicing the interrupt writes the
interrupt number on the bus so that the requesting board can recognize when its
request is being answered. This requires that only one line be used for the
acknowledgement of the interrupt request, as the data lines are used for the
differentiation.
Another approach is represented by shared interrupts, where each interrupt
line is shared by several boards. As each interrupt line may be asserted by more
than one board, the service board must find where an interrupt originated by polling
all the boards connected to the same line. The first board that acknowledges the
request is then serviced. Note that with this methods potential conflicts cannot be
avoided when several board generate the same interrupt at the same time.
A different method for the sharing of interrupt lines is known as daisy-chain
connection, Figure 8.15. A common “daisy-chain” interrupt line passes through all
boards that can act as possible interrupt sources. Each board can halt the
propagation of a signal with an electronic switch.

board 1 board 2 board n interrupt request


jumper from this board

to the to the other


master unit other bus lines bus boards

decreasing interrupt
servicing priority

Figure 8.15: Daisy-chain connection


280 Chapter 8: Bus Systems

Normally, each board keeps the connection closed. When a board requests
attention, at the same time its logic circuitry prevents the acknowledge signal to be
carried further to the following boards in the case they also requested an interrupt at
the same time. On receiving an acknowledgment from the interrupt handler, the
board writes an identification code on the bus. Two pins are needed on the bus
connector for each daisy-chain line. When no board is inserted, the pins related to
daisy-chain conductors must be short-circuited with a jumper.
With daisy-chaining the boards installed closer to the master servicing unit have
an advantage because they control whether or not an acknowledgment signal is
carried further. A disadvantage of daisy-chaining is that it takes time to transfer the
acknowledgment signal along the chain.
Interrupt handling becomes complicated when several CPUs are installed in a
system and not only the source but also the destination of an interrupt has to be
determined. Because of this, in the most recent bus designs interrupts are
considered as messages and sent from the source to the destination board like any
other data.

8.2.10 Bus Allocation and Master Arbitration


On a bus, only one unit at the time may act as master. When several boards are
able to become master, some method is needed to define which one should
currently be master and when another has to take over. The selection of the bus
master is known as bus arbitration.
There are two basic approaches to bus arbitration. In one solution, one of the
units is designated as arbiter (a kind of „super master“). A board wishing to get
control of the bus indicates this to the arbiter via an interrupt on a BUS REQUEST
line. The arbiter checks the relative priorities of the current master (i.e. of the arbiter,
but it could also be another board) and of the requesting unit and decides when
master control has to be transferred.
In a different approach there is no arbiter as such. A board that intends to
become master makes a request via a bus allocation line common to all boards
(several lines might be used to distinguish between different levels of priorities). The
current master identifies the requesting unit and compares its priority with that of the
current master. If the requester has higher priority, bus control is transferred. All units
that are able to become master contain the bus arbitration logic.
Two selection principles may be followed to choose the master unit: round-robin
and priority allocation. With round-robin, bus control is passed in an ordered fashion
among all the modules requesting it (this principle is also known as „fairness“ mode).
No difference is made among priority levels and master control is rotated among the
boards according to a predefined order.
With priority allocation, control is passed to the module with the highest priority.
The priorities may be changed in time in order to prevent modules with high priority
and high activity to indefinitely hold control of the bus.
In some systems, bus arbitration is handled with dedicated lines and takes place
concurrently with data transfers, while in other systems data transfer and arbitration
cannot be done at the same time. If there is a high arbitration activity, the way
arbitration is handled influences total system performance.
Bus allocation is an aspect of a more general problem known as resource
protection. This is a general problem that is encountered in many situations in
multiprogramming, multiprocessing, distributed systems and communication,
8.3: The VME Bus (IEEE 1014) 281

independent of whether the resource is hardware or software. In this particular case


the bus represents a common resource that must be protected from the
simultaneous access by several masters. Also the solution principles for resource
protection are similar independently on the actual type of resource. These principles
are described in more detail in Section 9.5 and 10.3.

8.2.11 Construction of a Bus System


Setting up a bus system does not need to be more complicated than just
inserting all the boards in their slots in the bus rack. Some attention, however, is
required in order to configure a system so that it can operate at maximum efficiency.
The boards should be ordered according to the importance of the interrupts that
they generate and, in multiprocessor systems, to their relative importance as bus
master. It was already shown how with daisy-chaining the boards closest to the
central processor or to the bus arbiter are the first to receive attention. In that set-up,
the boards will be inserted on the bus in order of their priority. In some cases, the
interrupt and bus grant lines are selected on the board with jumpers or DIP-switches.
Other jumpers may be used to configure other operational parameters such as the
default name for a drive or the type of input/output signals. If one or more slots
between daisy-chained boards are free, they have to be short-circuited with help of
jumpers on the bus.
Depending on the used operating system, the connected boards and some
operational parameters might have to be defined in software in some system or start-
up file. System configuration consists in several steps that can be successfully
carried out only after the exact functional requirements of each board have been
defined. Other important aspects are the insertion of termination networks at both
ends of a bus and of pull-up resistors on open collector, wired OR lines.
Finally, before all the boards are inserted in their cage, it should be considered
whether:
• the power supply is adequate to support the total load of all boards
• the ventilation is sufficient to carry away the generated heat
• all the screenings and isolations have been properly done.
These suggestions are very general and not oriented to a particular type of bus.
For all technical details, one should refer to the bus documentation and follow the
indications reported there. Do not forget the close interaction between the hardware
(the bus) and the software (the operating system and application programs). If the
functional goals are clear (what the system is supposed to do), it is easier to tailor
the bus and the operating system parameters accordingly. On the other hand, even
the most sophisticated self-configuration procedures cannot make up for poor
system planning.

8.3 The VME Bus (ANSI/VITA 1-1994)


8.3.1 General Features
VME means VERSA Module Eurocard. VERSA is the name of an earlier bus
designed at Motorola for operation with the 68000 processor and Eurocard is a
standard board format (see Section 8.2.2). The VMEbus was designed by a group of
companies lead by Motorola; it is now defined as standard ANSI/VITA 1-1994 (earlier
282 Chapter 8: Bus Systems

the bus was normed as IEEE 1014). The VMEbus has several features that make it
a powerful and flexible system bus for industrial applications. Its main features are:
• address length 16/24/32/64 bits
• data word length 16/32/64 bits
• data transfer rate: theoretical maximum: 80 MByte/s, practical 60-70 MByte/s
• seven interrupt levels, daisy-chained
• support for multiprocessor systems, four priority levels for bus allocation
• data block transfer, maximum block length 2048 Bytes.
The VMEbus is available in single and double height backplane formats, with
one and two DIN connectors, respectively (in the VMEbus standard the connectors
are called J1 and J2). The single-height format supports 32 bit data transfer and 40
bit addresses ( 2 40 Byte, i.e. 1 TByte address space), and the double-height format
supports 64 bit data and 64 bit address ( 16 ⋅ 10 6 TByte address space). Single and
double height cards can be mixed in the same system and data transfers may take
place alternatively with 8, 16, 32 and 64 bits, depending on which boards are
currently addressed.
VMEbus has a maximum length of 500 mm, so that the maximum signal
propagation delay allows up to 21 boards to be inserted on the bus by considering
the place taken by each slot and the signal propagation delay along the bus.
Particularly important in a VMEbus system is the card in the first slot, which must
perform some system-wide functions, e.g. master arbitration in multiprocessing
operations. The VMEbus consists of four sub-buses for data, arbitration, priority
interrupt and general utility (Figure 8.16).

VMEbus device

address and data

interrupt

arbitration

utility signals

Figure 8.16: Organization of the VMEbus

8.3.2 Data Transfer


The read/write operation is carried out asynchronously and with no need for
multiplexing. Five address ranges are defined: short (16 bit), standard (24 bit),
extended (32 bit), A40 (40 bit) and A64 (64 bit). Addressing with 32, 40 and 64 bit is
8.3: The VME Bus (IEEE 1014) 283

possible only via the additional pins of the connector J2 of the double-height
backplane. Data words of 8, 16, 24, 32 and 64 bit length can be transferred on the
bus; the data length is dynamic, which means that it can be changed at any time.
Data transfer on the VMEbus is oriented to the support of a multiprocessor
environment. VMEbus includes six „address modifier“ lines (AM0 to AM5) which are
set in parallel to the address. The bus uses these lines to indicate whether the data
transfer takes place in „supervisor“ (=privileged) or non-privileged mode, whether the
addressed location corresponds to data or programs and the number of address bits.
These indications can be used by the operating system and application software as
an additional protection feature, for instance to lock a protected data section from
unauthorized access via the bus. Some of the address modifier codes are free to be
defined by the user.
VMEbus supports data transfer in blocks of up to 256 cycles (block or burst
transfer mode). In block transfer, master and slave units automatically increment the
addresses and transfer the new data word; the address placed on the bus is not
changed during the process. A block transfer operation cannot be interrupted. Any
unit wishing to get bus control has to wait until the transfer is completed. In one
mode of block transfer operation the address lines are used to increase the data
width to 64 bits.
In the VMEbus is defined a read-modify-write cycle in order to prevent data
from being written over by an unit while it is used by another unit. The read-modify-
write cycle is similar to the function of the test_and_set bit that prevents
modification of data being accessed by several programs in a multitasking
environment (see Section 10.3.2). In the read-modify-write cycle the operations of
read and write by the master occur in immediate succession and no other unit is
allowed to access the data item being processed.

8.3.3 Priority Interrupt


The VMEbus supports seven interrupt request lines. Each line is of wired OR
type and can therefore be used by several boards concurrently. The interrupts have
different priority levels. The VMEbus protocol does not specify how the interrupts are
to be serviced by the addressed boards.
Interrupts may be serviced by a handler, which does not have to be the current
bus master. In this case, the interrupt handler must first get control of the bus and
become master using the normal arbitration procedure.

8.3.4 Bus Master Arbitration


The mechanism of bus arbitration resembles quite closely the operation of
interrupt request and granting. Each master can request control of the bus via one of
four bus request lines at different priority levels. These lines are of wired OR type so
that several requests can be made concurrently.
The principle for selecting the next board to become master when several
requests are made at the same time is left to the arbiter. It is not explicitly part of the
VMEbus specifications. The VMEbus master allocation scheme is not exempt from
drawbacks. The boards closest to the arbiter might get a higher share of bus access.
If many boards are daisy-chained, passing a grant signal takes time and may
contribute to slow down the bus. It is important to consider these factors in choosing
284 Chapter 8: Bus Systems

the disposition of the boards on the bus and the master selection principle with
related parameters in the operating system.

8.3.5 Utility Signals


The VMEbus includes some utility lines to indicate wrong or erratic conditions.
All utility lines are of open collector wired OR type and can be asserted by any
module. If a slave unit detects an error during a bus transfer cycle, it indicates this by
asserting BERR*. The ACFAIL* line is set by a module monitoring the a.c. power
supply and signals when power is about to be lost. Some generic system failure may
be indicated by SYSFAIL*; it is up to the user to define in which situations the signal
has to be used. SYSRESET* indicates that a system reset is in progress or was
initiated. On the VMEbus racks there is a push-button to manually assert
SYSRESET*.
The board inserted in slot #1 generates also a 16 MHz reference frequency
signal (SYS CLK). This signal is provided for convenience only and does not have
any synchronization function for the bus operation.

8.3.6 VMEbus Extensions


Despite the high data throughput rate of the VMEbus, at times a higher capacity
may be needed. To avoid data transfer delays, different types of bus extensions
operating in parallel and independently from the original VMEbus have been defined.
The physical connection to VMEbus remains the same; the bus extensions use the
free pins on the second connector J2. Bus extensions also provide a safety backup
in case of failure of the primary VMEbus.
The VSBbus (VME subsystem bus) uses the 64 user-defined pins of connector
J2 in the double-height module; it supports features such as interrupt handling and
multiprocessing.
The VXIbus (VME extended instrumentation bus) is an extension of VMEbus to
support fast instrument boards producing high quantities of data. The sizes of the
VXIbus boards may be up to „three-Eurocard“ size with three connectors (including
the original VMEbus connectors). The specifications of VXIbus not only encompass
the electrical interface to the bus, but also other specific functional requirements.
Among other things, a board must be able to identify itself on request and send
replies using standard codes.
VMEbus has been designed to efficiently support multitasking and
multiprocessor environments. The defined features are the distinction of different
data types on the bus, block data transfer, the read-modify-write cycle and a bus
master arbitration mechanism. VMEbus still offers expansion possibilities that make
it interesting for customers wishing to customize it by adding special features.

8.4 Other Bus Standards


8.4.1 The IBM PC Bus
The early 1980s can be considered as the beginning of the personal computer
era, when the whole computer producer and user community was waiting for IBM to
show a direction in personal computer design, whatever it might be, to take as a
reference. The company finally introduced its personal computer (IBM PC) in 1981.
8.4: Other Bus Standards 285

Although technically the IBM PC was no better than other machines then already
present on the market, it immediately enjoyed large success thanks to the size and
strength of the company producing it, as well as the widespread expectations that
made of the IBM PC a self-fulfilling prophecy.
The first IBM PC and its following model XT were based on the Intel 8086/8088
CPU and had up to 640 kByte usable RAM memory. The CPU was connected to the
bus and controlled it directly (no multiple bus masters were allowed); on the
motherboard were installed eight edge connectors to insert peripheral cards. The
IBM PC bus was built around the control signals of the 8086 CPU. It had 62 parallel
lines, the data path was 8 bits and the address path 20 bits wide, which allowed the
direct addressing of 1 MByte. The interfaces for floppy and hard disk, screen and
external printer were built on boards that occupied a few slots; in the end about five
slots remained free for the user.
The IBM PC bus had six interrupt lines each with different priorities. The users
quickly learned the hard way how the TTL-type interrupt signals could not be used for
several boards at the same time. Two cards generating the same interrupt could not
be used together on the bus, and the reconfiguration of the controller interrupts not
always was possible. Many a board was purchased and installed not thinking about
the hard-coded interrupts on the other boards.
Despite what its importance might lead to believe, the IBM PC bus does not
have an official standard. The bus is described in the IBM-PC Technical Manual, but
there has never been an official commitment by IBM to abide to it.

8.4.2 ISA
In 1984 the personal computer IBM AT (Advanced Technology) was introduced.
This PC was based on the Intel 80286 CPU with word length of 16 bits and address
width of 24 bits (16 MByte addressable). The IBM AT bus used the same connector
as the PC together with an additional 36-pin connector. Other interrupt and
handshaking lines had also been added. Boards designed for the IBM PC bus could
also be used in the AT bus, but they would not offer the extended addressing and
data transfer capabilities.
Also for this bus there is no official and published standard. The IBM AT bus is
also known as the Industry Standard Architecture (ISA). The name „ISA“ was defined
by a group of companies, other than IBM, to indicate what they meant by „IBM
standard“.
In later years the more powerful processors Intel 80386 and 80486 have
replaced the older types 8086 and 80286 in a new generation of personal
computers. When a reference is made to a „80386 computer“ or a „80486 computer“,
if the bus type is not explicitly mentioned, then ISA (i.e. IBM AT) is intended.
Because of its low flexibility and low speed, an IBM PC-based system is hardly
of interest for industrial applications. However, the PC should not be written off
entirely. Its main asset is the low cost of both central unit and peripherals together
with a wide choice of interface cards, not to mention the huge amount of available
software. For data collection applications with no special speed requirements, the
IBM PC bus may be the most cost-effective solution.
The advanced performance of the 80386 and 80486 processors makes them
much more interesting for demanding applications. The increasing performance of
interface cards and the availability of new control software will push computers
based on these processors more and more toward the factory-floor for applications
286 Chapter 8: Bus Systems

like machine control, data collection and communication, at least when no strict
multiprocessing by heterogeneous boards is required.

8.4.3 EISA
The EISA (Extended Industry Standard Architecture) standard was defined by a
company consortium which included Compaq, Intel, Hewlett-Packard, Olivetti and
others. The stated goal of EISA is to have a well specified, high-performance bus
standard for advanced PC systems which is independent of the control of only one
company (read: IBM).
EISA is based on the existing ISA architecture. Physically the EISA connector is
similar to the ISA, with the pins for the new EISA functions and extended data and
address paths placed between the pins of the ISA connector. EISA is therefore
downward compatible to ISA, which means that an ISA board can operate on an
EISA bus (the opposite is obviously not true).
EISA is a synchronous bus with a 32-bit word length (word lengths of 8 and 16
bits for the older PC and AT boards are supported) and a 32-bit address length
(4 Gbyte addressable). The maximum data exchange rate is 33 MByte/s in burst
data transfers.
The hybrid nature of EISA appears clearly from the interrupt handling scheme.
EISA uses the same interrupt lines as ISA, but defines them as open collector,
shareable lines. The consequence is that EISA boards can share interrupt lines,
while ISA boards connected on the same bus cannot because of their TTL-type
interface. Consistently with modern bus specifications, EISA supports multimaster
functions, board identification with hard-coded information and bus auto-
configuration.

8.4.4 PCI
PCI (Peripheral Component Interconnect) is a new standard for high-
performance personal computers designed by several computer manufacturers
under the leadership of Intel. The PCI bus is synchronous and processor-
independent. Its normal transfer rate is defined as 132 MByte/s with a word length of
32 bit and a 33 MHz bus cycle. The bus can also operate with a 64-bit word and at
66 MHz speed, bringing the maximum data transfer rate to 528 MByte/s.
As it is the case for other bus systems from the PC world, PCI is not optimized
for use in industrial systems with their typical requirements in interrupt handling and
multimaster operation. It is therefore necessary to analyze beforehand whether a
PCI-based solution really fulfills the envisioned process control requirements,
especially in consideration of the fact that any increase in technological performance
always leads to higher requirements by the users.

8.5 Summary
Bus systems are fundamental in control system applications most of all because
they allow for flexibility and modularity. The most appropriate hardware for a specific
application can be selected and assembled together. The evolution in the structure
of bus systems is due to increasingly sophisticated requests by the customers and to
the decline in the cost of computing power.
8.5: Summary 287

Bus systems are first designed and proposed by one or maybe a few
cooperating industries. If the customers react positively to their market introduction
and the number of manufacturers for bus-related components increases, there
comes a time when an established and independent organization assesses and
produces specific bus description documents, i.e. the bus standards. The role of
standardization committees is not to invent anything new, but rather to structure and
define without ambiguity existing bus know-how.
To integrate and get a bus system to work satisfactorily may be quite easy but
also turn out to be a major effort. In practice, every board may have to be configured
with help of jumpers or switches and more often than not some system software
parameters have to be adjusted. Therefore, to get an application running usually
requires several trial-and-error steps.
The current trend in bus architectures is to hard-code basic identification
information on each board. At start-up time, the system software polls all connected
boards and configures itself accordingly without direct programmer intervention. This
is the case of PCI and EISA. The trade-off lies in the higher complexity of the
additional control logic that must be installed on each board; the most capable
systems not surprisingly lie on the high-cost side of the bus spectrum. Moreover,
smaller boards in a sense mean more flexibility since it is easier to select the right
mix for an application; with larger boards there is always a risk that many of the
provided functions are not used.
The most important industrial bus systems have been described in this chapter.
It is important to point out again that there is no „best“ system and that different
buses only have different degrees of functionality. The real challenge lies in the
selection of the right bus for a specific application, taking into consideration technical
as well as economical constraints.
Other aspects of buses that are widely accepted today are address and data
fields lengths of at least 32 bits and standard norms such as Eurocard for form factor
and board dimension, and DIN 41612 for the electrical connectors. Important bus
standards for industrial applications are VMEbus and Compact PCI.

Further Reading
[Lawrence / Mauch 1987] is an excellent introduction to board and bus system
applications. It strongly emphasizes system thinking and the relationship between
hardware and software. [Tanenbaum 1990] is dedicated to the structure of digital
design all the way up from gates to complex computers. Relatively little space is
dedicated to bus operations, but the book is recommended for a broader view on the
operations of bus-based systems. [Peterson 1989] gives a comprehensive
description of the VMEbus operations, balancing theory with practical examples.
Basic information about bus systems is found in the original documentation from
the manufacturers and of the standards organizations. IEEE for example distributes
the specification of all its normed systems. As mentioned, the various IBM buses and
the EISA standard are not in the control of a public interest organization and are
therefore not published for free use. An alternative for the missing official
documentation is however offered by the numerous articles appearing in the
specialized press on the operations and performance of bus systems. Also many
books are available on the subject. Also many manufacturers produce and distribute
qualitative information to support their bus products, which are often based on
standard designs.
9 Digital Communication in Process Control

Aim: To introduce the principal concepts in the communication process and


describe practical industrial applications and technology with reference to the most
important standards

Overview
Communication - or information transfer - is fundamental to the function of any
organized system; process control also relies heavily on it. This chapter is dedicated
to the technology of communication by means of electrical signals. It does not
pretend to be exhaustive. The issues related to communication are so many, the
standards so numerous and the equipment so manifold that a somewhat
comprehensive approach would require hundreds and hundreds of pages. Instead, in
the beginning the focus will be on basic concepts and later some of the most
commonplace technologies and solutions of interest in process control will be
described more in detail.
Communication in industrial applications can deal with very simple technology
and protocols (data transfer rates of 50 bit per second are still used in some cases)
up to the most sophisticated equipment available, operating at speeds of about 100
Mbit/s, a range of 2 million times (!) The industrial automation engineer will therefore
probably face more heterogeneous applications and devices than his colleagues
working on „pure“ communication technology like office internetworking and
distributed computing systems. A basic understanding of the basic physical principles
of communication is therefore particularly important to work with industrial
applications.
Section 9.1 presents a general physical model for communication. The open
system interconnection (OSI) scheme, which serves as a reference for the
development of standards in communication, is introduced in Section 9.2. The OSI
framework is then taken as a reference throughout the chapter to examine other
standards. Section 9.3 is dedicated to the physical channels, Section 9.4 to
communication protocols and Section 9.5 to local area networks (LAN). In these
sections the reader will recognize some known standards, e.g. the ubiquitous
computer interface EIA-232. Section 9.6 deals with the information flows in process
control and among other aspects treats interconnectivity (i.e. openness) in industrial
communication. Section 9.7 is dedicated to the Fieldbuses, a type of local networks
for communication in process environments. Public data networks are included in this
chapter (Section 9.8) because some knowledge of the related concepts is useful also
in industrial applications.

9.1 Information and Communication


9.1.1 What is Information?
Information is a concept for which we have a more or less intuitive
understanding. It is a fundamental quantity that cannot be expressed by other
fundamental quantities in the same way as, for example, speed can be expressed by

288
9.1: Information and Communication 289

the ratio of length and time 1. Information is an intrinsic property (any structure
contains information about itself), and can be transmitted at little energy expense: the
drawings of a house contain as much structural information as the house itself, but
are easier to carry around. A remarkable and very important property of information is
that it can be duplicated at will without degrading.
Mathematically, information is defined as the measure of the state of order of a
set composed of different entities. A symbol can represent the state of an entity in
abstract form. For example, a figure 0-9 represents ten different entities. If an entity
can assume any of a certain number of states, learning its current state is equivalent
to getting some information about it. The more states an entity can assume, the more
information we get by learning its current state.
The information I associated with the knowledge of one out of N possible states
that a variable can take is the logarithm of N . If the logarithm is calculated in base 2,
the resulting measure is in bits:
I = log 2 N bits (9.1)
If an entity, or a variable can assume only two states, its information content is
I = log2 (2) = 1 bit . The information content of a decimal figure 0-9 is
I = log2 (10) = 3.32 bits . The logarithms can be expressed also in other bases. For
logarithms in base e the information unit is the nit and for logarithms in base 10 the
dit or Hartley. Logarithm bases different than base 2 are however seldom used in
practice. Equation (9.1) holds under the assumption that the probabilities for the
different states are equal.
The bit as a unit of information is very practical in digital logic, where it is easily
represented by two different power levels in an electric circuit. To transport or store
the information related to a variable, a number of elementary circuits, or switches,
equal to or greater than the associated information is necessary. In the case of a
figure 0-9 with an information content of 3.32 bits, at least four such switches are
required. With four switches it is possible to represent 2 4 = 16 different states; three
switches would be sufficient only for 2 3 = 8 states.
According to the above definition a continuous variable, i.e. a variable that can
assume infinite values in a given range, has an infinite information content. In digital
applications only quantized values are used; the related loss of information, like for
instance in the sampling and digital conversion of an analog signal (see Section 5.1.
and 5.2), is accepted. For example, in the digital representation of a voltage level
varying between 0 and 10 V, an approximation to 0.1 V means that 7 bits are
sufficient for the description of the 100 resulting states ( 2 7 = 128 ).
The use of the logarithm as a metric for information is justified by a number of
reasons:
• it is an increasing function of the number of possible states
• when only one state is possible, the value of the logarithm is zero, i.e. the
information content of a constant is zero

1
The basic units in the CGS system (absolute measure system) are length [cm], mass [g] and
time [s]. The international measurement system SI (in French: Système Internationale) that covers all
fields of physics and engineering is based on seven basic dimensions: length [m], mass [kg], time [s],
current intensity [A], temperature [K], quantity of a chemical substance [mol] and light intensity [cd].
Information is still not considered to be a basic dimension.
290 Chapter 9: Digital Communication in Process Control

• the logarithm makes information an additive measure. In comparison, the


combination of the states of independent variables is the product of the states
that each variable can assume.
Otherwise stated, the number of possible states for each symbol is v and
therefore the number of combinations for n symbols is v n . If the information content
of every symbol is I , n symbols must have a total information content n ⋅ I . The
function log( n ) satisfies this property. An important consequence of the logarithmic
measure of information is that information is always positive.

9.1.2 Communication
Communication takes place when information is moved in space.
Communication plays a fundamental role in all organized systems. As a basic natural
process, communication takes place within living entities via chemical and electrical
signals. External communication through speech and vision helps sustain life in the
surrounding environment. In developed societies communication is supported by a
developed technological infrastructure with the telephone network, the press and
television.
Communication theory is an important tool in many fields. The marketing expert
who tries to convince a large number of people to buy a certain product uses
concepts similar to those of the communication engineer who designs radio links.
And of course, communication is a central issue also in control systems: information
about the state of a system continuously moves from the sensors to a central
processor and control signals move from the processor out to the actuators.
Communication theory was first born as an engineering topic to solve
transmission problems, but moved later to other non-technical fields such as
psychology and linguistics. Here new results were found, to be later fed back to
engineering. The basic issues and results are quite similar and led to generalized
models. For a long time, engineers were more interested in „low level“ information
transfer while linguists and psychologists paid more attention to the purpose of the
communication process, i.e. how to reach a goal. Now, the different aspects are
gradually converging so that in engineering also the semantic (meaning-related) and
pragmatical (purpose-related) aspects of communication are no longer overlooked.
Data transmission is then designed not as a goal in itself, but a means of achieving
specific purposes.

9.1.3 A Model for the Communication Process


A general model for the communication process is shown in Figure 9.1. This
model is not restricted to engineering applications but can be related to other types of
communication, provided that its elements are appropriately identified.
All communication processes involve a sender and a receiver. The sender
transmits a message, consisting of a sequence of symbols, to the receiver along a
channel or medium, which is shared by both sender and receiver. The message is
about some external object, and the total amount of carried information is the sum of
the information content of each one of the symbols composing the message. Due to
the fact that information is dimensionless, the sender has to change some physical
properties of the channel according to a code in order to convey the message and
the receiver uses the same code to reconstruct the message from the changes that
are detected in the channel. The channel is usually subjected to noise that distorts
9.1: Information and Communication 291

the message and makes it difficult for the receiver to detect the changes and
understand the message correctly.
Noise

Object Object

Message
Code Code
Channel
Sender Receiver

Figure 9.1: The general model for communication

In most cases the message deals with something external to the communication
process, but sometimes it can be related to some of the communication entities. A
familiar example is the „hello“ of phone conversations, which is in fact a message
about the channel itself. Its purpose is to test whether the channel is open and
operating correctly and indicate to the receiver that a conversation is about to begin.
The basic issue in data communication is to move in a given time a message
from a location A to a location B and minimize the influence of noise, or alternatively
recover and reconstruct a message corrupted by noise. The question may be also
put another way: how to let the receiver at B fulfill the purpose for which A is sending
the message (this concept was mutuated from advertising, where it is obviously has
its importance). In automation systems an unit A either wants to pass information to
another unit B, or A wants B to do something.

Example 9.1 Printed information


The writer (sender) conveys information to a reader (receiver) on paper
(medium, channel). The message is the content, the code is the language, the
symbols are the letters and the words. The reader can decode (understand) the
message only by using the same language as the sender.

Example 9.2 Data transmission


Here the medium is an electric cable and the information to transmit is digital
data. The coding is straightforward: 0 and 1 correspond to different voltage levels
in the cable.

Example 9.3 Electrical text transmission


A text is coded (written) in some language, the symbols are the words and the
letters. The text may be stored on an electronic medium, where each symbol has to
be coded again, for example with different magnetization patterns. Frequently used
is the ASCII (American Standard Code for Information Interchange) code, where
each character (letter, figure, other symbol) is coded with a unique 7-bit or 8-bit
pattern.
292 Chapter 9: Digital Communication in Process Control

In electrical text transmission, each bit leads to changes in some physical


parameter of the channel and the text appears as a sequence of zeros and ones with
no apparent meaning. At an high abstraction level, the meaning is understandable if
the same language is used, e.g. English or French. From this standpoint it does not
matter if the lower level, internal machine coding is done in ASCII or in another code
like EBCDIC (Extended Binary-Coded Decimal Interchange Code), with bit patterns
different from ASCII.

Example 9.4 Transmission of printed text


A sheet of paper (the channel) may contain 2000 letters; if each letter is coded
in 7-bit ASCII, the total amount of information carried by the sheet is 14 000 bits. If
the paper is sent through the mail and reaches its destination in one day, the
equivalent channel capacity is 14 000 / (24*3600), about 0.16 bit/s. A 200-page
book counting approximately 300 000 letters and travelling at the same speed, has
a capacity 150 times greater, i.e. 24.3 bit/s.

Note that in Example 9.4 the distance between the source and the destination is
not relevant, assuming that the mail service requires the same time to deliver the
correspondence independent of the destination. In fact, in communication distance
plays a role only in those cases where the propagation delay is of the same
magnitude order as the time constant of the technical process. The real issue of
communication is not the length but the width, i.e. the capacity, of a channel. In Local
Area Networks, however, the length of the physical connection has an indirect effect
over channel capacity due to the temporal coordination of access to the
communication medium by different units, because in this case the propagation
speed and the attenuation of electrical signals along the channel must also be taken
into consideration.

9.2 The Open Systems Interconnection (OSI) Model


9.2.1 Changing Requirements for Data Communication
When the first attempts to transfer digital data along existing telephone lines
were made, attention was concentrated on the lowest communication level, the
physical link. At that time, in the 1950s, programming was done in Assembler code
and programmers worked at the bit level, so that more abstract data representations
were not needed. The programmers could as well deal with the technical details of
the communication channel. Today’s technology offers the means for transmitting
large amounts of data at low cost, and attention tends to focus more and more on the
applications: databases, process control, computer-aided production systems. There
is no way for the application engineers to concentrate their full attention to all the
many details of data communication, yet connectivity among systems must be
ensured at several levels, from the digital bits to the data and functions they
represent. Increasingly powerful communication devices and generally accepted
standards are the key to interconnectivity.
To overcome the difficulties of having to deal with a large number of incompatible
standards, the International Organization for Standardization (ISO) has defined the
open systems interconnection (OSI) scheme. OSI itself is not just one more standard,
but also a framework and development aid for new standards. The OSI reference
9.2: The Open Systems Interconnection (OSI) Model 293

model, examined more in detail in the next Section, offers a structure to identify and
separate between the different parts of the communication process. In addition, OSI
comprises some hundreds of standards defined in strict accordance to the basic
scheme. OSI is strictly independent from the actual implementation and refers to the
communication process only in abstract terms.
In practice, the basic OSI scheme does not indicate what voltage levels, which
transfer speeds or which protocols need to be used to achieve compatibility between
systems. It says that there has to be compatibility for voltage levels, speed and
protocols as well as for a large number of other factors. The practical goals of OSI
are interoperability and interchangeability. Interoperability means that data can be
exchanged between different points without disproportionate expense for data
conversions. Interchangeability indicates that devices produced by different
manufacturers to fulfill the same communication function must be able to be
exchanged without any problems, provided of course that they operate according to
the same principles and rules.
The conceptual simplicity of OSI does not mean that its description is also
simple: the related documents are several thousands (!) pages long. OSI was initially
published by the International Standards Organization (ISO) in 1984, in a document
set called ISO 7498. The other major international standards organization, the ITU-T
(International Telecommunication Union), formerly called CCITT (Comité Consultif
International de Télégraphie et Téléphonie), published in the same year a
comparable recommendation called X.200. The recommendation was redefined, with
only minor changes, in 1988 and is scheduled for revisions every four years.

9.2.2 Open Systems Interconnection Basics


OSI introduces a conceptual model for communication similar to the different
levels of operating systems, with operations carried out at different abstraction levels.
The multilayered structure of the operating systems is fundamental in the realization
of functional interfaces by providing services to higher data processing levels, yet at
the same time hiding their implementation details. The case of the OSI protocol and
service structure is similar.
In OSI are defined seven functional layers (Figure 9.2). Each layer
communicates directly only with the layer above and the layer below it, requesting
services from the layer below and providing services to the layer above. OSI service
calls are similar to operating system calls or to the client-server operating principle in
distributed systems: the requesting layer passes data and parameters to the layer
below it and waits for an answer, but ignores the details of how the request is carried
out. Modules that are located at the same layer and at different points of the
communication link or network (i.e. running on different machines) are called peers;
they communicate via protocols that define message formats and the rules for data
exchange.
OSI defines the services each layer must put at disposal of a higher level. The
services (what to do) are strictly separated from the protocols (the actual
implementation). Interconnectivity builds on the fact that different systems are
structured around similar services and that at each layer the protocols are the same.
Following OSI rules, only peers are allowed to communicate with each other. The
basic approach of OSI can be summarized in „do not mix up unrelated entities“ and
„let related entities communicate with each other“.
294 Chapter 9: Digital Communication in Process Control

Computer #1 Computer #2
Layer #
7 Application Message Application

6 Presentation Presentation

5 Session Session

4 Transport Transport

3 Network Network

2 Data link Data link

1 Physical Physical
Physical channel

Figure 9.2: The Open Systems Interconnection (OSI) model

The layers defined in OSI are the following:


1. Physical Link Layer - This is the electrical/optical communication medium with
the related interfaces to the communicating units/computer equipment (also called
stations or nodes). All details about transmission medium, signal levels, frequencies
and the like are handled at this level. The physical layer is the only real connection
between two nodes.
2. Data Link Layer - This level provides for the verification that bit sequences are
passed correctly between two nodes. If errors occur, for example because of line
disturbances, the retransmission of a corrupted bit sequence may be requested at
the data link layer. As a result, the data link layer presents to the higher layers an
error-free data link between the nodes. When several units are connected to and
must share the same channel, the selection for access precedence is also handled at
the data link layer.
3. Network Layer - This layer sets up a complete communication path and
oversees that messages travel all the way from the source to the destination node,
even when the path is not direct but consists of different segments that join several
nodes in a complex network.
4. Transport Layer - End-to-end communication control. This layer is the
interface between the application software that requests data communication and the
physical network represented by the first three layers. The transport layer has the
responsibility of verifying that the data is transmitted and received correctly from a
machine to another and that the data is available for application programs.
9.2: The Open Systems Interconnection (OSI) Model 295

5. Session Layer - It enhances the transport layer by adding services to support


full sessions between different machines. One example is the network login in a
remote computer.
6. Presentation Layer - Data encoding and conversion, in which the raw binary
data is related to its meaning: messages, texts, figures or other.
7. Application Layer - The highest layer deals with application management tasks
such as file transfer, distributed database operations and remote control.
The physical layer is the only one with physical appearance. All other layers are
sets of rules and descriptions of functional calls and are therefore implemented in
software. The lower three layers are called network or communication layers,
because they deal with the communication path. The three highest layers are
implemented in the computer application software and are concerned with the
contents of the messages. Layer four, the transport layer, is the link between the
communication-oriented and the application-oriented layers.
The basic principle of OSI operation is not difficult to understand. Two peer
entities are connected via a virtual (logical) link. To the peers, the virtual link appears
to be a real communication channel, although only at the first layer virtual and
physical link are the same. The peers exchange data according to a protocol
specified for their level. In practice, the entities request the services of the layer
immediately below via procedure calls (Figure 9.3). The internal details of each layer
are not visible to the entity requesting the service and can be changed at any time
without the requesting entity knowing about it. There is no direct link, real or virtual,
between modules on the same machine at a distance of more than one layer from
each other or between modules running on different machines and that are not at the
same layer. For example, a module at layer 4 on a machine can communicate only
with layer 3 and 5 on the same machine and with layer 4 on a remote computer.
Computer #1 Computer #2

Service Service
Virtual connection
Layer n Layer n

Procedure Procedure
call Service call Service
Virtual connections
(intermediate layers) (intermediate layers)

Procedure Procedure
call Service call Service
Physical connection
Layer 1 Layer 1

Figure 9.3: The principle for virtual peer-to-peer communication in OSI

A protocol is a set of rules on how to initiate, carry on and terminate a


communication process. In OSI, protocols are used for communication among peers.
In most cases the peers exchange messages that contain the user data, in some
cases they must exchange coordination messages. The information exchanged
between peers is appended in the front of the message received from the upper layer
296 Chapter 9: Digital Communication in Process Control

before it is passed to the lower layer, all according to the protocol used at that
particular level. Each layer has its own communication protocol and adds therefore
the related data to the original message. The result looks somewhat like Russian
„matrjoshka“ dolls, each one placed inside a larger one (Figure 9.4). The smallest
doll corresponds to the original message, i.e. the application data; the largest doll
represents what is actually transmitted on the physical link. The protocols and the
procedure calls are described in the OSI documents and the related standards with a
particular syntax for each function and its corresponding parameters.
Other protocol data may be exchanged between peers at different layers for
operational signaling, for instance to establish or bring down a link. Signaling
information is transmitted separately from application messages.
Not all layers require direct exchange of data. Figure 9.4 gives an indication of
the basic concept, but reality need not be this complicated. Protocols that require
active data exchange are needed only for some of the peer layers and
interconnectivity can function even if some of the layers are bypassed - of course
provided that all the communicating partners do the same.

Layer Headers

Original data data

7 - Application #7 data

6 - Presentation #6 #7 data

5 - Session #5 #6 #7 data

4 - Transport #4 #5 #6 #7 data

3 - Network #3 #4 #5 #6 #7 data

2 - Data link #2 #3 #4 #5 #6 #7 data CRC

1 - Physical #2 #3 #4 #5 #6 #7 data CRC

Figure 9.4: General aspect of layered communication protocols. CRC is the Cyclic
Redundancy Check or checksum.

For each of the OSI layers there are one or more sets of standards issued by the
major standardization organizations (see Appendix „Standards and Standardization
Organizations“). At the physical and data link level some earlier standards were
incorporated in OSI. For the other levels new protocols have been defined following
the indications of the OSI model.
The full OSI compatibility between the different layers suggests that, in principle,
it should be possible to put together a working application by mixing products from
different sources. As usual, reality looks rather different. OSI intermediate levels are
not sold as separate software products, and manufacturers and software developers
offer instead complete packages for layers 3-4 to 6-7. The internal interfaces do not
need to follow the OSI requirements, and in practice that is not very important either.
9.2: The Open Systems Interconnection (OSI) Model 297

Instead of supporting all layered OSI protocols, software is designed to run as


efficiently as possible.
The OSI model is not exempt from criticism. It has been observed that it lacks
some important functions such as data encryption (which should be part of layer 6)
and that the structuring and division of the layers 4 to 7 has a somewhat academic
flavor. As the layered software runs on the same machine anyway, its internal
structure could be left to the program developers as well. The protocol definition at
the higher levels is also inefficient. For these reasons, OSI is usually not
implemented in its entirety, but computer manufacturers sell products making use
only of the necessary layers, avoiding all features that are not needed for a specific
application. Not without reason the presently most used protocol worldwide for
communication on local as well as on long-distance data networks is TCP/IP, which
is a much more straightforward product (Section 9.4.9).
The OSI model is not only of interest in long-distance data communication but
also in automation applications. Effective automation requires that different
computers, running different applications, may be interconnected with no major effort
and OSI provides the framework for such interconnection. The newest
communication standards in industrial and office environments, the Manufacturing
Automation Protocol (MAP) and the Technical and Office Protocol (TOP), both
described in Section 9.6, are based on the layered OSI model.
A future perspective is the integration of local control systems in major,
geographically distributed, constellations. OSI will guarantee that applications such
as warehousing, production and statistics, in plants and offices shall run together
exchanging data in a general approach to factory automation, logistics and planning,
regardless of where the plants and offices are located. OSI provides the framework
to set up a rational structure for data communication.
In the rest of the Chapter the OSI layers 1 (physical), 2 (data link) and 7
(application) will be examined in more detail, paying attention to the current
implementations and trends for communication in factory environments and process
control applications.

9.2.3 Virtual Devices


Virtual device is a concept frequently referred to in OSI as well as in many other
contexts in communication, operating systems and distributed computer systems. A
virtual device is the set of all functions and parameters, described with a specific
syntax, which are relevant for a particular, real, device and that reacts to these
commands like the real device. The set of procedures composing the virtual device
takes care of all the low-level details and accepts and delivers only „clean“ and
structured commands and data. For example, a virtual terminal is a collection of
commands for placing a cursor on the screen, writing a string of characters with
particular highlights like boldface or underline, accepting characters from the
keyboard and so on. Without using the concept of virtual devices, a programmer
writing a text editor would have to care about the different control sequences for
performing the same function on different types of terminal equipment. With a virtual
terminal such a nightmare is avoided; it is sufficient to write the control commands in
the abstract notation. Specific driver routines convert then the commands for the
virtual device in control sequences for the real terminals (Figure 9.5).
For more that a decade the computer terminals VT52 and VT100 by Digital
Equipment were in common use also as virtual terminals. These terminals
298 Chapter 9: Digital Communication in Process Control

(monochrome, 24x80 characters) had a specific control character set for operations
like text scrolling, cursor positioning, switching on blinking or reverse video, etc. Many
programs could generate these control characters and a large number of computer
terminals, also those made by the competition, could be preset to understand them.
In this way at least a minimum level of compatibility between programs and terminals
was ensured. In more recent times the multi-windowing system X-Windows, which is
actually a protocol description, also operates as a kind of virtual terminal. More about
X-Windows in reported in Section 11.6.
A major advantage of the virtual device concept is that new devices may be
added to an already functional system without having to change existing application
programs. It is sufficient to provide each new physical device with a software
interface to the virtual one. The application program does not even need to know that
a different physical device is being used.
An important virtual device supported under OSI is the virtual filestore, with
protocols called File Transfer Access and Management (FTAM). FTAM applications
are important not only in process control but also in distributed databases, as in
financial transaction systems or airline seat reservation systems. In FTAM file
properties like creation date, access control, and many others are described with
help of an abstract notation and operations are supported in a multitasking
environment with functions like open/close, read/write, set locks, etc. The mapping
software between FTAM and the specific file system hardware is part of the operating
systems provided by the computer manufacturers.

Physical
device type #1
Application
program #1

Physical
device type #2

Application
program #2
Physical
device type #3
(a)

Interface Physical
Application device type #1 device type #1
program #1

Virtual device Interface Physical


(protocol device type #2 device type #2
description)

Application
program #2 Interface Physical
device type #3 device type #3
(b)

Figure 9.5: Direct connections vs virtual devices


(a) Direct connections between application programs and physical devices
(b) Interfacing physical devices via a virtual device
9.3: Physical Links (OSI Physical Layer) 299

9.3 Physical Links (OSI Physical Layer)


The most common way to move digital information is on electrical cables.
Simplicity, low cost and an established technological base make cables the most
appropriate medium to carry information within limited areas. Optical cables and radio
links are instead more cost-effective in moving large amounts of information between
distant locations. In particular, optical links are also of interest in industrial and
process environments because they are immune from the effects of electromagnetic
disturbances and can therefore carry sensor measurements in a highly reliable way.
When the installation of a fixed link to the monitored equipment is not feasible, either
because of the distance or for example because the object is moving, radio can also
be used as a medium. All these media are treated in this section.

9.3.1 Basic Quantitative Aspects of Communication


The basic parameter to describe a communication channel is its capacity, i.e.
the amount of information it can transport per unit of time measured in [ bit s −1 ]. A
properly dimensioned communication channel offers enough capacity for the
transport of the required amount of information within the necessary time. The goal is
to carry as much information as possible at as low a cost as possible, but channel
capacity in general costs money, the higher the capacity the more expensive the
channel.
In a physical (electrical, optical or radio) channel the data transmission capacity
is closely related to the channel bandwidth, the signal power and the noise level. The
bandwidth is defined as the range of frequencies that the channel can carry with an
attenuation of less than 3 dB (corresponding to 50% in power level). This concept is
similar - although not identical - to the instrument bandwidth described in Section
4.1.3. The bandwidth is measured in Hertz or some of its multiples. For example, a
normal telephone link carries signals in the frequency range 300 to 3400 Hz and the
channel bandwidth is 3 kHz. A television channel has a typical bandwidth of 5.5 MHz.
The relation between the frequency bandwidth W in Hertz of an electrical
channel and the maximum data rate Rmax [ bit s −1 ] that the channel can carry was
found by the Swedish-American researcher Harry Nyquist in 1924. In Nyquist’s
relation the way the signal is coded, and thus its ability to carry information, plays an
important role. With V signal levels it is possible to carry log 2 (V ) bits and the total
capacity of a channel becomes
Rmax = 2 ⋅ W ⋅ log 2 (V ) (9.2)

This relation is close to the issue of signal sampling and reconstruction described
in Section 5.2. Enough information about a signal with bandwidth W can be
collected by sampling the signal at a frequency 2 ⋅W ; sampling at higher frequencies
would not add anything to the information that is needed to reconstruct the original
signal from the samples. The issue is here about limit values, in practice the sampling
frequency is higher than the Nyquist frequency in order to simplify the reconstruction
of the original signal.
In the technical literature the concepts of channel capacity and bandwidth are
sometimes confused, because the same name is used for two different things.
Channel capacity is a general concept valid for every kind of channel and every type
of communication and is not restricted to specific physical channels. The bandwidth
300 Chapter 9: Digital Communication in Process Control

of a channel, on the other hand, has only to do with the frequency range for which
electromagnetic signals are carried with a specified maximum attenuation. Taken
alone, bandwidth does not imply anything about channel capacity.
In binary data transmission, V = 2 and the logarithm term of Equation (9.1) is =1.
From here derives the popular misconception that the capacity of a channel in bits
per second is equal to twice its bandwidth in Hertz. According to Equation (9.2) there
is no limit to the amount of information that a channel can carry, provided that a
sufficiently large number of symbols is used.
An important factor that negatively influences communication is noise. Noise is a
hard reality of the real world and constitutes an intrinsic factor of the communication
channel. On an electrical channel noise is caused by the random thermal movement
of electrons; its power is proportional to the bandwidth of the channel. Noise can also
be picked up from the environment by electrical conductors, which also act as
receiving antennas. The noise on a line is considered in relation to the power level of
the transmitted signals. Noise can be just a negligible nuisance, but if its power level
is too high compared with the power level of the original signal, this might be
distorted to the point that the original message becomes unintelligible. The receiver
might decode the message wrongly and take an action other than the one envisioned
by the transmitter. If the voltage levels for the different symbols are many and close
to each other, they become difficult to separate and identify univocally. The smallest
voltage spike on the line due to noise would erroneously be interpreted as a different
level and thus as a different symbol. Noise protection and the recovering of corrupted
data are therefore very important issues in communication. In dimensioning
communication channels, noise is the issue about which most compromises have to
be made. In principle, noise can be eliminated but at great expense; in practice there
are ways to cope with it and make it sufficiently harmless.
The problem of communication in the presence of noise was studied by the
American mathematician Claude Shannon. In 1948, in a publication that is still
considered as the foundation of communication theory, Shannon proposed a relation
to describe a channel with bandwidth W [Hz] under the influence of noise. In
Shannon’s relation the levels of the original signal and of the noise on the channel
are expressed by the parameter signal-to-noise ratio, or in short S/N ratio. This is the
quotient between the average power level of the original signal and that of the noise.
The S/N ratio is usually expressed in the logarithmic units decibel [dB].
According to Shannon, the maximum capacity Rmax [ bit ⋅ s −1 ] of a channel with
bandwidth W [Hz] and as a function of the S/N ratio is equal to:
Rmax = W ⋅ log 2 (1 + S N) (9.3)

Shannon’s relation shows the maximum data rate that can be transmitted without
errors in presence of a certain amount of noise. This maximum value is to be
considered as a fundamental physical limit that is impossible to reach in practice. The
concept is equivalent to the thermodynamic limit on the conversion of heat into work.
Yet, as in thermodynamics, Shannon’s relation is a good reference to define how well
a real communication process operates.
In fact it is very difficult to even approach Shannon’s limit; a data rate of one third
of the maximum one is generally considered to be more than satisfactory. To go
above that limit, special multilevel signal coding is needed, which requires time to be
processed. (This method should not be confused with data compression, which
reduces the number of symbols to be transmitted.) In the end, what is gained in
9.3: Physical Links (OSI Physical Layer) 301

transmission rate may be lost again in signal coding and decoding in the transmitter
and the receiver. If data is put on a channel at rates above Shannon’s limit, the errors
due to noise will distort the signal in such a way that it is impossible for the receiver
to decode it correctly.
An analysis of Shannon’s equation indicates that the maximum data rate can be
increased by increasing the bandwidth, increasing the signal power level or
decreasing the noise level. Given a fixed (unchangeable) noise level, an increase in
bandwidth is more effective than an increase in the power level and therefore in the
S/N ratio. In fact, all modern developments in communication technology are
focussed on providing higher bandwidths rather than operating at high power levels.
Attention should be paid to the fact that Equation (9.2) is not a special case of
Equation (9.3) in absence of noise (i.e. for S/N → ∞). Nyquist’s relation expressed by
Equation (9.2) is function of the number of coding symbols and leads to a
theoretically infinite capacity for all channels. Shannon’s relation is a function of the
S/N ratio. According to Equation (9.3), in absence of noise and for any bandwidth
W > 0 it is possible to carry as much information as desired, provided that the
coding is chosen appropriately. In the case of a telephone link with bandwidth 3000
Hz and a typical S/N ratio of 30 dB (corresponding to a power ratio of 1000), the
Shannon limit is about 30 kbit/s. Nyquist’s relation indicates that a coding scheme
with V = 32 different levels must be used to carry this amount of information.
The data rates indicated by the Shannon’s relation may seem to be very small
compared to what is today commonplace and necessary for example for full
graphical workstations running data-intensive applications like multimedia. The
difference lies in the used communication media. A workstation in an office
environment is usually connected all the way by high-capacity links to the server
computer. On the contrary, in many process and industrial control applications the
physical media has limited capacity and noise acts as an additional limiting factor.
In conclusion, in the realization of any communication link the major limiting
factors are the available bandwidth and the S/N ratio. Bandwidth must be available
and be in relation to the required data communication capacity. If bandwidth is not
available, even the best communication equipment will not help.

9.3.2 Electrical Conductors


The most common types of electrical conductors used for communication are the
twisted pair and the coax cable (Section 4.5.2). The twisted pair is more sensitive for
electromagnetic noise, especially in proximity of electric power cables and
equipment, while the shield of the coax cable provides for better screening and
therefore higher immunity toward disturbances. The bandwidth of the twisted pair is
limited to a few MHz, which means that it cannot support data rates higher than a few
Mbit/s over distances of a few kilometers. However, because of its simplicity and its
low cost, the twisted pair is a common choice for communication medium.
Coax cables allow the transmission of a bandwidth up to about 1 GHz and are
commonly used to carry high-frequency radio and TV signals. Because of their broad
bandwidth, coax cables can sustain much higher data rates than twisted pair cables.
A functional distinction is made between baseband and broadband coax cable.
The difference does not have to do with the type of cable (they are actually similar,
the broadband cable is thicker), but primarily with the type of signals they carry.
Baseband coax is used for digital communication with only one carrier frequency,
usually 5, 10 or 20 MHz. Baseband is the standard solution for most industrial
302 Chapter 9: Digital Communication in Process Control

applications. Broadband is used to convey different types of signals at different


frequencies and on longer distances, because its attenuation factor is smaller.
Broadband has little importance in industrial applications because few users are keen
to mix phone, office data, TV signals and factory automation messages on the same
physical conductor; broadband media are more popular on university campuses. The
installation and the maintenance of twisted pair as well as coax cable is generally
unproblematic. The industrial area networks that will be described later in this chapter
use twisted pair, coax cables or optical fibers as physical medium.
In electrical conductors reflected signals are a common cause of problems.
Reflections are caused by impedance mismatches, where part of the signal is
transmitted normally, another part is reflected (Section 4.5.2). Impedance
mismatches are usually caused by sharp bends in cables or by faulty components
like connectors, terminators, or taps. Reflected signals interfere with normal traffic,
create noise and disturbances and make performance drop.
To locate impedance mismatches on communication cables special instruments,
called cable analyzers, can be used. They send signals on the cable and wait for
them to be reflected. The time interval between the transmission of the original signal
and the detection of the reflected pulse gives an indication of the distance of the
impedance mismatch from the test point.

9.3.3 Bit Coding


To transmit a bit sequence along a physical channel, there are basically two
possibilities:
• to put the bits on the line as they are or with some kind of coding, but
maintaining the aspect of digital data;
• to modulate a carrier in amplitude / frequency / phase and transmit the
modulated signal.
The most immediate way to move digital data is to put it directly on the electrical
line as they are. With direct coding, a voltage level of 0 V would represent a logical
„0“ and, say, +10 V a logical „1“ (Figure 9.6.a). A widely used terminology indicates
binary „0“ as space and binary „1“ as mark. Quite often, the bits are reverse-coded:
„0“ (or space) would keep the line at high voltage level and „1“ (or mark) at a low
level. The polar coding, where the digital „0“ and „1“ have opposite levels in respect
to a common reference is also widely used. Direct, reverse and polar coding are
called Non-Return to Zero (NRZ) codings because there is no forced transition back
to zero level. A sequence of 1’s would keep the line at a constant high or low
potential level according to the chosen encoding scheme.
NRZ coding is straightforward but quite sensitive to noise and distortion. To
compensate for line attenuation and distortion, a threshold may be defined at the
receiver site so that anything less than +2 V would be interpreted as a logical „0“ and
levels higher than +5 V as „1“. A Schmitt-type trigger set on those levels can then be
used to reconstruct the digital signal (Figure 9.7).
There is however another big problem with straight NRZ coding. Just putting bits
on the line does not help the receiver to tell where each bit starts and ends; it also
makes difficult to recognize the actual data transfer speed at the beginning of the
transmission, in the case that different speeds can be used. In other words, with pure
NRZ coding there is no way to tell „no message“ from a sequence of information-
carrying 0’s. Should an incoming pulse be interpreted as one long or two short 1’s? A
possible solution would be to require each message to have a preamble, e.g. a
9.3: Physical Links (OSI Physical Layer) 303

sequence of alternating 0’s and 1’s to give the correct timing. But there still would be
a risk of the receiver to lose synchronization with the transmitter during data transfer,
leading to a false interpretation of the incoming data. Finally, the distributed capacity
of the electrical communication line easily leads to d.c. potential buildup if the data
pulses always have the same polarity.

u 1 0 1 0 0 0 1 1 0 1 u 1 0 1 0 0 0 1 1 0 1

t t

(a) (d)

u 1 0 1 0 0 0 1 1 0 1 u 1 0 1 0 0 0 1 1 0 1

t t

(b) (e)

u 1 0 1 0 0 0 1 1 0 1

(c)

Figure 9.6: Digital coding techniques. (a) Binary direct, non-return to zero (NRZ); (b)
binary direct, return to zero (RZ); (c) three-level, return to zero; (d) Manchester
coding and (e) differential Manchester coding. Knowledge of the reference
(zero) level is relevant only for the three-level coding; in the other schemes the
absolute signal levels are not relevant for the identification of the related data.

+5V
Input
signal
+2V

0V

Logical „1“
Output
signal
Logical „0“

Figure 9.7: Threshold levels for a Schmitt trigger


304 Chapter 9: Digital Communication in Process Control

All these problems are solved with Return to Zero (RZ) coding (Figure 9.6.b). In
the RZ coding the original data are combined with a synchronization signal. Like in
the direct coding, also in RZ coding are defined two potential levels, one of which
corresponds to logical „0“ and the other to logical „1“. Each bit starts at its defined
potential level and in the middle of each pulse there is a transition to the zero level;
the transition edge is used to synchronize the receiver. In a different type of RZ
coding are defined two opposite polarities with respect to zero (Figure 9.6.c). RZ
coding requires twice as much bandwidth as NRZ, and the required interface
electronics is also more complicated, but its advantages definitely offset the
disadvantages.
A different and widely used solution is the Manchester coding, also known as
biphase-level or BiΦ-L. In Manchester coding each bit is coded with two voltage
levels and a transition in the middle of each pulse. In straight Manchester coding, bit
„0“ is represented by a transition from a low to a high voltage level and bit „1“ from a
high to a low level (Figure 9.6.d). A similar scheme is the differential Manchester
coding in which bit „0“ is represented with a level transition at the beginning of each
new period and bit „1“ with the absence of a transition (Figure 9.6.e). In differential
Manchester the coding for a bit depends therefore on the level of the second half of
the preceding bit.
Manchester and differential Manchester coding contain the synchronization
reference and offer better noise immunity than RZ coding. As for RZ coding, even the
Manchester schemes require twice as much bandwidth compared to NRZ coding. An
advantage of Manchester coding is that it works with two voltage levels instead of
three and the processing hardware is simpler than for RZ coding. Manchester coding
is widely used in local area networks, as for example in Ethernet.
Several other coding schemes are used, but they are more important in long
distance and satellite communication than in industrial control and will not be dealt
with here.

9.3.4 Carrier Modulation


Carrier modulation is used to match the characteristics of the signal to be
transmitted with those of the line that carries it. Modulation is the change of some of
the parameters (amplitude, frequency, phase) of a high-frequency carrier as function
of the original, information-carrying signal; a high-frequency sinusoidal or pulse signal
serves as carrier. The receiver extracts the original signal from the modulated carrier.
Different types of modulation result from the type of carrier and the modulation
process. The carrier frequency can have a wide range. Typical modems for data
transfer on normal telephone lines (Section 9.8.1) operate for example with
frequencies in the range 800-2500 Hz. Carrier frequencies for transmission on
broadband cables may reach up to 500 MHz.
Amplitude modulation (AM) is little used in digital transmission, while frequency
(FM) and phase modulation (PM) are more common. In all these modulation types a
parameter of the carrier is changed as a function of the input signal. In amplitude
modulation each voltage level in the original signal corresponds to a certain
amplitude of the carrier, in frequency modulation to a certain frequency within a given
range and in phase modulation to a determined phase shift of the carrier signal.
When the carrier is modulated with a digital signal, the modulation types are
called amplitude shift keying (ASK), frequency shift keying (FSK) and phase shift
keying (PSK) respectively. Of these three methods the PSK-modulation has the best
9.3: Physical Links (OSI Physical Layer) 305

performance in relation to disturbances, i.e. for the same S/N ratio on the
communication line, disturbances have a smaller influence on a PSK-modulated
signal than on a ASK- or FSK-modulated signal.
Carrier modulation does not need to strictly follow the pattern of a digital input
signal. A change in some carrier parameter may be associated with a sequence of
several bits and not just one bit, so that it is possible to carry more information at the
same carrier frequency. For example, in phase modulation can be used the direct
relation bit 0 - 0° phase shift and bit 1 - 180° phase shift. Alternatively, the bit
sequences 00, 01, 10, 11 could be associated with phase shifts of 0°, 90°, 180° and
270° respectively, so that the same signal ends up carrying twice the amount of data.
An even more sophisticated technique is the quadrature amplitude modulation
(QAM), in which amplitude and phase modulation are combined to carry several bits
for each change in the envelope of the carrier signal.
The number of times per second at which the carrier changes some of its
parameters is called signaling or Baud rate. There is often confusion between bit rate
and Baud rate. They are the same only when a change in a modulation parameter
corresponds to one bit, i.e. when the carrier may take two states only and each state
represents a „0“ or a „1“. In QAM modulation, where for example a combined change
in amplitude and phase may correspond to four bits, the bit rate is four times the
Baud rate. The Baud rate is not suitable as a practical unit for transmission speed,
because the coding method should be also always specified at the same time and
the bit rate is what is actually of interest.
The added data transport capacity with multibit encoding and QAM technique is
not for free, however. Referring to Equation (9.2), what is being done is to increase
the number of symbols V from 2 to 4 when four phase shifts are employed. To
process the related signals, more complicated circuitry is needed and the transmitted
signals become more sensitive for noise. For a given line with a known bandwidth
and a constant noise factor and for a particular carrier frequency, there is an optimum
data rate. Trying to exceed that rate does not improve the throughput of the channel
because data correction information has to be carried along together with the original
data and additional processing is needed in both transmitter and receiver. But as
long as progress in technology allows the construction of more complex - and
cheaper - processing circuitry, increased use is made of combined modulation
techniques in order to make the best use of the available physical channels. The
theoretical maximum transmission speed for a channel, however, does not depend
on technology and is only function of the channel bandwidth and of the S/N ratio
(Equation 9.3).

9.3.5 Time Synchronization


In order for the communication process to operate correctly, it is necessary that
transmitter and receiver follow the same time reference, i.e. they are synchronized.
The synchronization reference is a pulsed signal with defined frequency, generated
by one of the communicating units or some other external unit. The synchronization
signal is distributed either with a dedicated conductor or transmitted together with the
digital information, as for example in RZ and Manchester-type coding, where the
change in the mid of each pulse represents the synchronization reference. In the first
case additional cabling is required, in the other additional bandwidth.
Data communication may also take place without a defined time reference, the
transmission is then defined as asynchronous. In asynchronous transmission the
receiver must „know“ in advance all communication parameters - in first place the
306 Chapter 9: Digital Communication in Process Control

speed - in order to identify correctly the incoming signals. Moreover, the receiver
must recognize the limits between the single bits and adapt its own timing
accordingly. If some of the communication parameters are set differently at
transmitter and receiver, the receiver can either not synchronize on the incoming
data stream or easily lose synchronization (Figure 9.8).

Synchronous
transmission

Asynchronous
transmission

Time reference

Figure 9.8: Synchronous and asynchronous data transmission

9.3.6 The EIA-232-D and the „RS“ Interface Standards


The interface standard EIA-232-D is probably the best known and most used of
all interfaces for serial data communication. The operation of the EIA-232-D and of
the other data communication interfaces is not particularly complicated in itself. The
real challenge is to keep track of all the reference documents issued by the
standardization organizations, what they do (and do not) specify and how they refer
to each other in a fashion closely reminiscent of the „double-linked list“ data
structure.
The standard EIA-232-D was previously called RS-232 (RS means
Recommended Standard). It was introduced in 1969 by the Electrical Industries
Association (EIA) to define the interface between computers or terminals and
modems. Its latest revision, where its name was changed from RS to EIA, is from
December 1987. The original RS-232 specifications were used by the international
standards organizations CCITT and ISO to issue their own sets of specifications, with
minor changes respect to the RS-232 original. The loop is now closed with the EIA-
232-D, which refers back to the CCITT and ISO standards.
EIA-232-D was initially defined as an interface between data processing and
data communication equipment connected to an external network, but today the
standard is commonplace for many other applications, like e.g. the connection of
computers with terminals, printers and other external equipment. The original
definition has led to the terminology Data Terminating Equipment (DTE) for the
generic processor (computer, terminal) and Data Communication Equipment (DCE)
to indicate the communication device and its interface.
The physical connector has 25 pins and is normed as ISO-2110. EIA-232-D
defines circuits for communication on two channels and DCE testing, but in practice
only the circuits for the first communication channel are used. The electrical interface
of EIA-232-D follows the ITU-T (earlier: CCITT) V.28 recommendations. The signal
levels are between +3 and +15 V for a logical „0“ and -3 and -15 V for a logical „1“
(reverse coding). The input electronics must withstand surges up to ±25 V. Maximum
data rate is 19200 bit/s for a cable length of up to 15 m; at lower data rates the cable
9.3: Physical Links (OSI Physical Layer) 307

length may be increased. The definition of the pin signals and protocols of EIA-232-D
follows the ITU-T V.24 recommendations. Some pin signals are used as indication of
readiness to send or receive data.
The signals in EIA-232-D have been defined to interface with a modem
connected to a communication line and some of the signals are not relevant in other
applications. To connect other equipment directly and without going over an external
communication line, so called „null modem“ cables are used. There are different
types of null modem cables. In one solution the pins are connected so that the
control signals from the communicating devices can handshake directly. A different
configuration is to connect the handshake pins to a constant voltage, so that they are
permanently asserted. In this way the equipment at one end of the line assumes that
the one at the other end is always ready to exchange data.
The standard EIA-232-D does not imply anything about the type of transmission,
which can be asynchronous as well as synchronous (two circuits are defined to carry
the transmission and reception synchronization signals). The digital data may use
any kind of coding.
The major drawback of EIA-232-D is the limitation of its maximum operating
speed at less than 20 kbit/s. To overcome this limitation a new standard was defined,
EIA-449 (formerly RS-449), which extends the functions of EIA-232. EIA-449 defines
more comprehensive signaling than EIA-232-D in order to exploit new capabilities of
public data network services. EIA-449 has two connectors, one 37-pin connector for
the basic circuits and an optional 9-pin connector for the secondary channel.
EIA-449 does not directly specify electrical signal levels. It refers to two other
documents: EIA-422 for balanced and EIA-423 for unbalanced transmission; these
standards deal only with electrical specifications and not with the rest of the
functional requirements for a complete communication interface. The main connector
of EIA-449 provides two additional pins for the return circuits of balanced
transmission. In EIA-422 is defined a data rate of up to 2 Mbit/s, while using
unbalanced circuits and a common return line the maximum is 20 kbit/s. The highest
data rate for EIA-423 (asymmetrical connection) is 20 kbit/s, which is the same as for
EIA-232. Provisions are made in EIA-449 for interoperability with EIA-232-D by using
relatively uncomplicated equipment. So far, few devices make use of the EIA-449
interface standard.

9.3.7 The Multipoint Electrical Interface RS-485


The standards described so far are suitable for data exchange only between two
communicating devices. Many applications require however that several units are
connected together and share a common line. A suitable electrical interface is
described in the standard RS-485. This standard is only concerned with the electrical
interface parameters and does not specify anything about signal quality, timings,
protocols, pin assignments and other such aspects. The allowed signaling rate for
binary data exchange is up to about 10 Mbit/s. The standard RS-485 presents many
functional similarities to the electrical operation of bus systems.
In the RS-485 model several units are connected via a twisted pair, balanced
electric cable. The units can be either transmitter, receiver or transmitter/receiver
combined. The cable has two terminating resistors of at least 60 Ω each at both ends
(Figure 9.9).
308 Chapter 9: Digital Communication in Process Control

balanced cable

R Load R Load

Transmitter -
Transmitter Receiver receiver

Figure 9.9: The RS-485 interface principle

The interface operation is similar to bus tristate logic (Section 8.2.3). The
generators can be in active or passive state. In passive state they present a high
impedance to the network, in active state they drive the network with a differential
voltage, measured between the two output pins, between 1.5 V and 5.0 V. Binary „0“
is related to one polarity, one output pin is positive with respect to the other, and
binary „1“ has reversed polarity in comparison to level „0“. The differential threshold
for the receivers is set at 0.2 V, with an allowed range of input voltages from -7 V to
+12 V with respect to receiver ground. In this configuration no conductor is at ground
potential. Reversing the connections from a generator or to a receiver is equivalent to
inverting the bit values.
The input impedance of a receiver and the output impedance of a generator in
passive (idle) state is measured in unit loads, that are exactly defined in the standard.
A generator must be able to drive up to 32 unit loads and the two terminating
resistors at a total equivalent line load of 54 Ω. The generators must also be able to
withstand the power dissipated when two or more generators are active, some
sourcing and some sinking current at the same time.

9.3.8 Optical Data Transmission


Signal transmission by light pulses on optical fiber cables has become
commonplace in many communication and measurement applications. Optical
communication has several advantages over electric communication, but of course it
also has its peculiarities. The devices for interfacing optical fibers are still quite
complex, and therefore more expensive than for electric cables. The advantages are
however already so relevant that in many applications optical transmission can be
considered as the most viable alternative.
Optical fibers are not just an alternative type of conductor, but represent instead
a full communication system consisting of the optical fiber cable itself, a signal
generator, a signal receiver, signal processing equipment at both cable ends and
ancillary components (Figure 9.10). Different technological solutions can be used for
the optical cable as well as for the generator and receiver, thus bringing to different
performances for the complete system. The channel bandwidth and the operational
distance are determined by factors such the attenuation and the spectral dispersion
of the optical fiber cable, the generator power output and the sensitivity of the light
sensor at the receiver end. Optical fibers are described by a parameter that
9.3: Physical Links (OSI Physical Layer) 309

combines the indications of bandwidth and distance, which are in inverse relation one
to the other, and gives a maximum performance limit in MHz⋅km. For any given fiber
link, the longer the length, the narrower becomes the transmittable bandwidth.
Because optical fiber channels are immune to electromagnetic disturbances, noise
has a very low influence (high S/N ratio) and the bandwidth can be used in full.

data input data output

transmitter receiver
electronics electronics
Optical fiber
LED or laser photodiode
diode

Figure 9.10: Principle for an optical fiber communication system

Optical conductors are very thin (a fraction of mm in diameter) and lightweight


fibers made of transparent substance such as quartz, fused silica (i.e. glass) or
plastics materials. The fiber consists of a core and an external layer called cladding;
the fiber is protected by a plastic sheath. The refractive index of the core is higher
than the refractive index of the cladding layer; the light beams are therefore reflected
on the cladding and remain within the core while travelling along the fiber.
There are three main different types of optical fibers, differing on size, type of
material and refractive index of core and cladding. The simplest type of optic fiber,
called step index multimode, has a sharp interface between core and cladding. This
fiber can be produced with cheap materials like plastics; however it has both high
attenuation (in the order of 2.5 dB/km) and an high spectral dispersion. This latter
factor is important in consideration that the light from the source is composed of
waves at different wavelengths that travel at different speeds along the fiber. This
effect is that a input pulse is attenuated and flattened after traveling a certain
distance along the fiber. Because of their attenuation factor and spectral dispersion,
step index multimode fibers therefore cannot be used on long distances; however,
their low price makes them ideal for use in optical LANs. The relation bandwidth-
length is ≤ 35 MHz⋅km.
In a graded index multimode fiber, the cladding/core interface is altered
gradually in order to provide different refractive indexes within the core. This type of
construction reduces the effect of spectral dispersion and is therefore more effective
for transmission on longer distances. The typical attenuation factor for a multimode
fiber at 1300 nm is 0.8 dB/km. The bandwidth-length relation is ≤ 500 MHz⋅km.
A step index single mode (also called: monomode) fiber has a very thin core
(∼10 µm in diameter) and the refractive index characteristics allows the propagation
of only one frequency. Moreover, this fiber is built of quartz in order to achieve an
high optical purity. This is reflected in low attenuation factors, 0.4 dB/km at 1300 nm
and 0.25 dB/km at 1550 nm, and allows for very high bandwidths, in the order of
10 GHz⋅km. On the other hand, this type of optical fiber is - not unexpectedly - more
expensive than the others.
310 Chapter 9: Digital Communication in Process Control

The light source in an optical communication system is either a light-emitting


diode (LED) or a laser diode to convert the digital electrical signals to light pulses.
The LED has a limited optical power output, up to 0.1 mW; its maximum transmission
speed is about 8 Mbit/s. The more expensive laser diodes have an optical power
output 100 times higher than the LED, up to 10 mW, and can reach a transmission
speed > 10 Gbit/s. LEDs and laser diodes differ also in another important aspect.
LEDs generate light with a wider bandwidth than optical diodes, about 30-80 nm vs. 5
nm. The light generated by laser diodes is therefore much less subject to the effect of
spectral dispersion, so that these must be used with links over longer distances.
The receiver of an optical communication system is a photodiode or
phototransistor that converts the light pulses back to electrical signals. When high
sensitivity is required, photoavalanche diodes must be used.
In practical use have been established three operating windows for optical fiber
operations at 850-900 nm, 1300 nm and 1550 nm, resulting from a combination of
several physical factors in light propagation as well as in the practical construction of
optoelectronic components. 1300 nm represents an optimum to minimize spectral
dispersion, while at 1550 nm are minimized optical losses.
The power balance of a fiber optic communication system is computed by
cascading the generator, the optical link and the receiver. The total attenuation of the
line is given by its length multiplied by the specific attenuation. In addition must be
considered also the spectral dispersion, which becomes more important the longer
the line. To the line attenuation are added about 1 dB for each soldering or
connecting point, future repairs should also be foreseen and finally about 3 dB are
added as extra safety margin. The receiving sensor must have a sensitivity at least
equal to the transmission power minus the total line attenuation.

Example 9.5 Power budget of an optical fiber link system


It is assumed that 50 km must be bridged by an optical fiber link; a graded
index multimode fiber with an attenuation of 0.8 dB/km at 1300 nm is selected. The
total attenuation over the whole distance is 40 dB. To this amount must be added 3
dB for possible future solderings and joints and 3 dB as extra margin. The total link
budget is therefore -46 dB. In order to achieve a large bandwidth, a laser diode
operating at 1300 nm is used as transmission device; its optical power is -4 dBm
(i.e. mW referred to dB units). The sensitivity of the receiver must be at least -50
dBm (the sum of -4 dBm and -46 dB). A GaAs photodiode with a sensitivity
threshold of -52 dBm can be used. The bandwidth-length relationship indicates that
a bandwidth of up to 10 MHz can be obtained. The margin of 2 dB means that if
the line were only 2,5 km longer, different components should be used to stay
within the line optical power budget. In fact, for distances above about 40 km of
length, step index monomode fibers are used.

Optical transmission has several advantages over electric transmission on


twisted pair or coax cable. The principal advantages are the following:
• Optical transmission has a very large data-carrying capacity; data transfer rates
of the order of 100 Mbit/s and higher can be easily reached.
• Optical transmission is immune to magnetic and electric disturbances and also
provides total isolation. This property is useful in difficult measurement
9.3: Physical Links (OSI Physical Layer) 311

environments, such as in proximity of electric motors and frequency converters


as well as in locations where sparks may ignite fires (e.g. close to inflammable
liquids or gases).
• Optical fibers have lower signal attenuation per unit length than electric wires.
For bridging long distances, optical repeaters can be placed at some tens of
kilometers apart. In comparison, repeaters for conventional electric cables must
be placed at most 5-10 km apart.
• Because of their small size, optical fibers are very light. One km of optical fiber,
excluding the coating, weighs 50 g, vs. about 10 kg for twisted pair and 200 kg
for coax cable.

Among the disadvantages of optical transmission must be mentioned:


• The work for connecting (soldering) several fibers in cascade is difficult and can
be carried out only by trained personnel with special equipment. In comparison,
a broken electric cable can be repaired in short time also by a non-specialist.
Joints and solderings on an optical cable usually add about 1 dB attenuation
each.
• Optical fibers connect two points only. It is difficult to realize configurations
where one optical source transmits to several receivers in parallel.

In brief, optical data transmission is suitable to carry large amounts of data over
long distances (>1 km). The principal reason for using optical signal transmission in
industrial environments is primarily motivated not by data-carrying capacity but by
immunity against disturbances. Step index multimode fibers are becoming more and
more common in LANs because of their high data-carrying capacity.

9.3.9 Radio Data Communication


A further physical medium for transport of data are radiowaves. Data
communication with help of radio equipment is a viable alternative in all those
situation where fixed links cannot be installed, for example in communication with
moving vehicles, or when fixed links would be too expensive. An example in this
respect are electrical lines or pipelines, where the equipment to be monitored is
placed over distances of tens or hundreds of kilometers. If the pipeline or electrical
lines traverse unpopulated areas with no available communication infrastructure,
data collection and retranslation by radio may represent the most feasible alternative.
The basic issue in radio data transmission is whether one or several dedicated
frequencies can be used, or if the traffic goes via a service provider, like for example
a Telecom company.
In the first case, transmitter and receiver communicate on a dedicated frequency,
usually in the VHF (30-300 MHz) or UHF (300 MHz - 3 GHz) frequency range. From
the point of view of the data exchange, transmitter and receiver present a user data
interface in form of a standardized communication port. The data rate will depend on
the transmission bandwidth available at the used radio frequency. If only one
frequency is available and two-way communication is required, then a half-duplex
protocol must be used; for full duplex two frequencies must be available (see Section
9.4.2). In all developed and populated societies, airwave space is at a premium and it
can be very difficult to obtain one or two dedicated frequencies from the delegated
authorities.
312 Chapter 9: Digital Communication in Process Control

Public mobile telephone companies in some cases also offer the possibility to
carry data traffic. Basically, data transmission takes place in digital bursts that are
coordinated together with the remaining traffic. The data exchange is under control of
a central computer connected to a master antenna, so that several users can share
transmission capacity in TDMA mode (Time Division Multiple Access, Section 9.4.2).
Also in this case the data interface for the user is a standard communication port.
Contrary to what is the case with dedicated frequencies, digital packet radio is
most cost-efficient in urban, populated areas because the services are usually
offered by one or more operators at competing rates. Digital packet radio is the
solution of choice for data collection from energy distribution networks (e.g. for
electricity and gas) when no fixed channels are available, or for communication with
vehicles moving around in an area.

9.4 Communication Protocols


9.4.1 The OSI Data Link Layer
The establishment of an operating physical link is just the first step in building
reliable communication. The second step is to guarantee that messages arrive intact
at the receiver. In addition, when more than one transmitter is connected to the same
physical link, access to the common channel must be ordered. All these aspects are
dealt with at the OSI data link layer.
At the physical layer little can be done to ensure that data is not distorted by
noise and to recover corrupted data. The verification of the validity of received data is
responsibility of the layers above the physical layer and especially of the data link
layer. The data is transmitted according to specific protocols and together with
additional information that allows verification of data integrity on reception.
There are several data link protocols, all operating on similar basic principles.
The HDLC protocol will be examined in this Section in particular detail, because it is
standardized and represents an important reference on which other protocols used in
industrial applications are based.
Because of their limited bandwidth, communication channels must be considered
as protected resources that have to be used as efficiently as possible. If at a given
moment more information has to be carried than what the communication channel
can handle, a selection principle for access to the channel becomes necessary. The
selection principles for access to a communication channel are similar to those used
for bus systems or CPU allocation.
The part of OSI layer 2 dealing with the procedures for channel allocation among
different users is called Medium Access Control (MAC). These procedures take the
form of sets of rules that depend on the particular hardware interface design. The
most important MAC procedures will be described in the next Section, in relation to
the LAN that use them.

9.4.2 Virtual Channels and Multiplexing


A straightforward way for the division of a physical channel among several users
is multiplexing (Figure 9.11). Multiplexing is transparent for the users, who are not
aware of how the channel is managed in detail. Each user „sees“ a virtual channel
with a fraction of the capacity of the original physical channel.
9.4: Communication Protocols 313

User #1 User #1

User #2 common physical channel User #2

... ...

User #n User #n

Figure 9.11: The principle of multiplexing

Multiplexing is realized by dividing the channel with reference to time or to


frequency. In Time Division Multiplexing (TDM) the channel is divided in periodic time
slots and each user has access only to the assigned slots (Figure 9.12.a). In
Frequency Division Multiplexing (FDM) the channel bandwidth is divided in frequency
bands, each allocated to one virtual channel (Figure 9.12.b). FDM requires that the
original data modulates a carrier wave at the central frequency of the allocated band.
TDM and FDM are complementary methods: with TDM the entire channel bandwidth
is available, but only for a fraction of the time; in FDM a fraction of the original
bandwidth is available for all the time.
The two types of multiplexing are also equivalent in a practical sense, because
they require that the data is processed at both ends of the channel. TDM has
however two advantages over FDM: all processing is digital, there is no need to
install and service high-frequency equipment for the modulation and demodulation of
the carrier signals. In addition, with TDM it is possible to control allocation of the time
slots to the different users who request the channel. If an user does not send data at
some time, the empty slots may be given to another user who needs that capacity.
Under the assumption that a fraction of the users does not need to access the
channel at a given time, it is even possible to share a channel among more users
than what the channel would physically support. This technique is known as
statistical multiplexing and is used for example in data terminal concentrators. The
channel is allocated only to those users that request it at a given moment. On the
other hand, if the number of users that need the channel at a certain time is higher
than what the channel can support, some of these users will have to wait before they
get access. The net result is that the channel is shared by more users than if every
slot were always assigned following the same predetermined scheme.
If transmitter and receiver are located at the opposite ends of a channel and
send data always in the same direction, the transmission mode is called simplex. In
many cases, however, the units at the channel ends need to both transmit and
receive, so that the channel has to be multiplexed for communication in both
directions. If only one unit at the time disposes of the channel, the transmission is
called half duplex. This is equivalent to TDM and requires that the units exchange
control signals to tell each other when it is time to take over the transmission. In full
duplex communication the units communicate all the time in both directions. Full
duplex is realized with FDM, where each side has its own dedicated frequency band
to send its messages in the other direction.
314 Chapter 9: Digital Communication in Process Control

Bandwidth

Data Data Data Data


unlimited
from from from from
User #1 User #2 User #3 User #4

(a)

Time

Bandwidth
Frequency band for User #4

Frequency band for User #3


unlimited

Frequency band for User #2

(b) Frequency band for User #1

Time

Figure 9.12: (a) Time Division Multiplexing (TDM); (b) Frequency Division Multiplexing
(FDM)

9.4.3 Error Detection and Correction


The physical link makes the basic work in the data transfer between nodes, but
cannot ensure that the data arrives in exactly the same form as it was transmitted.
Line noise may have corrupted part of the message. To ensure data protection, error
correction strategies must be used. Error correction requires the active participation
of both transmitter and receiver.
In order to determine whether any errors have occurred during data
transmission, checking methods have been defined. The basic approach is to add
some extra information to the original message so that the receiver can find out
whether there have been any transmission errors.
In digital transmission, errors tend to come in bursts rather that affect single bits.
In other words, in a data message it is more likely that several bits in succession do
not take their correct value rather than that just one bit at random is wrong. This
depends on the fact that external noise sources like voltage surges, spikes and the
like generate pulses a few milliseconds long. At data transmission rates of some
kbit/s, some dozens of bits may be destroyed by a disturbance of a few millisecond
length.
The information appended to a message to verify transmission errors consists in
one or a few Bytes computed from the original message content with help of
9.4: Communication Protocols 315

predefined algorithms and is called checksum, or also Cyclic Redundancy Check


(CRC) or Frame Check Sequence (FCS). The name derives from the fact that the
operations to compute the CRC may be performed by shifting the bits of the incoming
data block through a register. The most common way to compute the checksum is to
split the data to be transmitted in blocks of known length (from a few Bytes to some
thousands Bytes). Each block is then divided by a binary number of one or two Bytes
of length. The checksum is represented by the rest of the division or its binary
complement and has a length from up to some tens of bits. The binary number used
in the division is called generator polynomial and is commonly expressed in the form
x n + x n −1 + 2 + x 2 + x + 1
The polynomial form is not an equation, it is just a notation. The generator
polynomial is one bit longer than the resulting checksum and begins and terminates
with 1’s; only the powers that are different from zero are indicated (the order of the
polynomial gives the length of the checksum in bits). For instance, the standard
CRC-CCITT polynomial is expressed as:
x 16 + x 12 + x 5 + 1
which corresponds to the binary sequence 1000100000010001.
The receiver computes again the checksum on each incoming data block and on
the base of the same algorithm. If both checksums are equal, the data block is
accepted, otherwise the receiver recognizes the presence of an error and can act, for
example by requesting the sender to retransmit the whole block.
When the checksum is appended to the original data, the resulting bit sequence
becomes a multiple integer of the generator polynomial. A new division performed on
the whole sequence must yield a result of 0 if the data has not been corrupted. A
different result indicates that the original data block was corrupted and that
retransmission is needed.
The efficiency of the checksum method in error detection decreases when the
data blocks are long. It is possible to detect all error bursts shorter than the
checksum and more than 99% of the longer error bursts.
In error correction strategies enough information is appended and transmitted
together with the original message so that the receiver is able to reconstruct a
corrupted message on the basis of the received data. The receiver uses the entire
received information to compute back the original data block. The necessary
redundant data notably increases the length of the original message, typically about
10 to 20%, so that in general it is more economical to use a simple error detection
scheme and request retransmission for the corrupted data blocks. Error correction
procedures are important when communication takes place in one direction only (e.g.
telemetry data from spacecraft) or when full duplex handshaking with data block
retransmission is not feasible.

9.4.4 Character-oriented Protocols


The character-oriented transmission is a widely used method for the
asynchronous transmission of Bytes one by one. Every Byte is preceded by a start
bit to synchronize the receiver on the incoming transmission. The Byte is terminated
with a parity bit and a stop pulse of 1, 1.5 or 2 bits length (Figure 9.13). Reverse
coding is common, which means that an idle line is kept at high level. Because of the
presence of the start and stop bits, asynchronous transmission is also known as
316 Chapter 9: Digital Communication in Process Control

start-stop transmission. The character-oriented transmission is simple to implement


thanks to a dedicated chip (UART, Universal Asynchronous Receiver Transmitter).
For this reason is has become commonplace in many devices and has become a
kind of unofficial industry standard.

1 0 1 0 0 0 1 1

(a) (b) (d) (a)

(c)

Figure 9.13: Asynchronous Byte transmission (UART character)


(a) Idle line; (b) start bit; (c) parity bit (in this case parity is even, i.e. the total
number of 1’s is even); (d) stop bit

The parity bit is used as a simple error detection method. In even parity check
the total number of mark „1“ bits in the original Byte plus the parity bit must be even;
for odd parity the sum must yield an odd number. For parity=none, the state of this bit
is disregarded. On detection of a parity error the receiver communicates it to the
higher control layers where it is decided whether to request retransmission of the
Byte. Of the different combinations of number of bits, parity type and length of stop
bits the protocol 8N1 (8 bit, No parity, 1 stop bit) is widely used. Because parity is
disregarded, no error check takes place at this level.
Character-oriented, asynchronous transmission is uncomplicated but also
inefficient because of the bits that are added to each Byte increasing the length of a
bit sequence by more than 25% and also because of the idle periods between the
single characters. Asynchronous transmission is used in practice only at speeds up
to 20 kbit/s.

9.4.5 Bit-oriented Protocols, HDLC


Protocols at data-link layer are used to check the integrity of the transmitted data
and to allow the reconstruction of corrupted data blocks. The protocols are either bit-
oriented (the content of each transmitted message is a string of bits of variable
length) or Byte-oriented (a string of Bytes with some delimiting control characters is
transmitted).
The most famous bit-oriented protocol is the Synchronous Data Link Control
(SDLC) by IBM. Several other protocols, similar - but incompatible - to SDLC, have
also been defined. Particularly important in industrial automation is the High-Level
Data Link Control (HDLC); its characteristics will be examined in more detail in the
following. The HDLC protocol is standardized by ISO and is used as reference for
other protocols, e.g. as for the Ethernet data frame (Section 9.5.4).
The fields in the HDLC frame are predefined and have fixed length (Figure 9.14);
only the data field has variable length. The delimiting start and end flags have the
unique pattern 01111110. To avoid a conflict in case the data to be transmitted also
contains the pattern 01111110 somewhere, a technique called zero insertion or bit
stuffing is used. After five consecutive 1’s in the original data, the sender inserts a „0“
immediately thereafter. The receiver deletes any „0“ following five 1’s to reconstruct
9.4: Communication Protocols 317

the original data pattern. The „0“ is obviously not inserted during the transmission of
the start and end flags, to allow their univocal identification by the receiver.
The address field is relevant only when several units can receive the same
message. This is the case in local area networks, where all units are connected to
the same link and must identify which messages are specifically addressed to them.
The HDLC control field indicates the type of message: information, supervisory
and unnumbered. An information frame carries user data; its control field indicates
the current frame number in sequence and whether more frames are going to follow.
This is the case when long messages must be split up in different blocks. The
supervisory frame is used for coordination between transmitter and receiver, for
example to request retransmission of lost information frames if there has been a
mismatch in the numbering sequence. Unnumbered frames are used for link
initialization and status reporting.
The data field may have any length and the checksum field is computed with a
CRC-CCITT polynomial. The end flag contains the pattern 01111110 similarly to the
start flag.
The structure of the HDLC frame follows the layered protocol structure shown in
Figure 9.4. The start and end flags are necessary at the physical and data link layer.
The address, control and checksum fields are related to the operation of Layers 2
and 3. The transmitted data is application-oriented and belongs to Layer 7.
The general HDLC format allows the implementation of different communication
protocols and provides the means for full duplex communication with error control.
For example, in one scheme the sender may keep transmitting frames without
waiting for their acknowledgement, in another the receiver might have to
acknowledge all of them, in still another it might be necessary to indicate only what
frames need to be retransmitted. All these schemes can be realized on the basis of
the HDLC format.

Field # length, bits value description


1 8 01111110 start flag
(7E hex)
2 8 address
3 8 control field
4 any length ≥0 data
5 16 checksum
6 8 01111110 end flag
(7E hex)

Figure 9.14: Example of high-level data link control (HDLC) frame structure

9.4.6 The Telemetry Protocol IEC 870


The telemetry protocol IEC 870 is a widely used standard for the monitoring and
control of distributed processes with local intelligence, like a central computer linked
to remote data collection and control units. IEC 870 combines some of the features of
318 Chapter 9: Digital Communication in Process Control

the character-oriented protocols in UART format with the bit-oriented format of HDLC
type.
In IEC 870 communication takes place by telegrams consisting of Byte
sequences of 8 bits each. Each Byte is transmitted following the UART format in a 11
bit sequence (1 start bit, 8 data bits, 1 parity bit, 1 stop bit). The octets are
transmitted serially in each telegram according to the following sequence:
• header (1 or 4 Bytes)
• user data (variable length, up to 253 Bytes)
• Checksum (1 Byte)
• End of message character (1 Byte)

The structure of a IEC 870 data telegram is shown in Figure 9.15.


(a)
Field # length, Bytes value description
1 1 01101000 start character (header Byte)
(68 hex)
2 1 length (2-255 bytes)
3 1 length (2-255 bytes), repetition of
field #2
4 1 01101000 start character (repetition)
(68 hex)
5 1 control character
6 1 address (low part)
7 1 address (high part)
8 any length ≥0, data
≤ 253 Bytes
9 1 checksum over fields # 5-8
10 1 00010110 end character
(16 hex)
(b)
Field # length, Bytes value description
1 1 00010000 start character (header Byte)
(10 hex)
2 1 control character
3 1 address (low part)
4 1 address (high part)
5 1 checksum
6 1 00010110 end character
(16 hex)

Figure 9.15: IEC-870 telegram. (a) variable length; (b) fixed length
9.4: Communication Protocols 319

The header Byte indicates what type of telegram is about to follow, a short
message or a variable-length telegram. A short message (Figure 9.15.b) has a total
length of six Bytes. In a variable-length telegram the header contains the start Byte
followed by the telegram length. The first four Bytes in the user data part are used as
address and function indication; the user data is immediately followed by a checksum
Byte and by a stop character. In the four header Bytes the start character and the
message length are repeated as safety measure, because these Bytes are not
included in the computation of the checksum.
The standard IEC 870 foresees several types of messages in order to implement
efficient control schemes, for example message acknowledgement to the central
control unit or to the remote stations, downline loading, etc.
Thanks to the simplicity of its operation and the wide availability of cheap
integrated components for UART transmission, the IEC 870 protocol can be easily
implemented in many devices. This protocol is therefore at the basis of many
industrial solutions that allow for compatibility and interconnectivity, when
components from different vendors are integrated in the same system.

9.4.7 Block-oriented Protocols


In Byte- or block-oriented protocols, the Bytes to be transmitted are grouped in
blocks and each block is delimited by special control characters like SOH (Start Of
Header), SYN (Synchronization), STX (Start of Text), ETX (End of Text) and EOT
(End Of Transmission). Each transmission starts with the SOH and STX characters
and terminates with the end-of-block character ETX, EOT. A few SYN characters at
the beginning of the data block are used to synchronize the receiver on the incoming
transmission (Figure 9.16). Data block transmission is used for the transmission of
blocks of some Bytes up to a few hundred Bytes in an uninterrupted sequence. Such
transmission takes usually place in synchronous mode, where the pulses related to
the single bits are synchronized with a timing signal.

SYN SYN STX data ETX

Figure 9.16: Synchronous block transmission


SYN - Synchronization character
STX - „Start of transmission“ character
ETX - „End of transmission“ character

Depending on how the actual communication protocol is implemented, the ACK


(Acknowledge) and NAK (Not Acknowledge) characters are used to control the
transmission flow. In one solution, the receiver might have to explicitly acknowledge
every transmitted block. In a different procedure, the receiver requests only the
retransmission of corrupted blocks. It is also common practice to never keep a line
idle. Transmitter and receiver may exchange synchronization characters when there
is nothing else to communicate.
Synchronous data communication is in general more efficient than
asynchronous, as it makes better use of the line capacity and avoids idle times. It is
used for data rates higher than 2 kbit/s. On the other hand, the equipment for
synchronous data transmission is more complicated, and therefore more expensive,
than for asynchronous transmission. Synchronous transmission is efficient for long
320 Chapter 9: Digital Communication in Process Control

Byte sequences transmitted in bursts, like in file transfers or long data telegrams. For
those applications that do not require high speed and where the characters are sent
one at the time, like the connection of a terminal to a computer or of a computer to a
printer, asynchronous transmission is usually adequate and therefore widely used.

9.4.8 The higher OSI layers (Layer 3 to Layer 7)


The layers in the OSI model above layer 2 and with exception of layer 7 are of
relatively little importance for industrial applications, so they will be only mentioned
briefly here. The higher layers are used for remote operations like file exchange and
database applications over large data networks. An increasing trend toward complex
internetworked applications is however recognizable also in process control
applications.
In the OSI scheme, the Layer 3 (Network layer) is responsible for the
establishment and the operation of a virtual link between any two nodes that must
communicate in a widespread network. Layer 3 describes how the messages are
routed, i.e. passed from a node to the following in a stepwise fashion until it reaches
its destination after some hops.
The OSI Layers 1 to 3 are called „external“, „network“ or „communication“ layers.
Layers 5 to 7 are internal or application layers, as they build on computer-internal
software. Layer 4 (Transport) is the actual interface between the machine software
and the external network. Although there are several protocols and methods at the
lowest layers to guarantee safety in data transmission, it is only at Layer 4 that it is
possible to verify that the data was actually sent in the right form from the source to
the destination computer. Layer 5 (Session) is responsible for establishing and for
bringing down a connection between computers. The session layer provides also
extensions to the services of Layer 4 with particular concern to the functions for file
transfer from one machine to another.
Layer 6 (Presentation) is related to data coding and structuring. Here two
standard specifications of the OSI scheme play an important role. ISO 8824, known
as Abstract Syntax Notation No.1 (ASN.1) gives guidelines about how to structure
the data that has to be transmitted. ASN.1 is an abstract language for the description
of objects and services according to the client-server model. The specification ISO
8825 for Basic Encoding Rules (BER) indicates how the data is to be coded binary,
i.e. the relation between the content of a message and the „0“’s and „1“’s to be
transmitted.
Two very common codes for character representation have long been ASCII and
EBCDIC. In ASCII (American Standard Code for Information Interchange) a character
(letter, figure, other symbol) is represented by a unique 7- or 8-bit pattern, which
allows the representation of up to 127 or 255 different characters. The EBCDIC code
(Extended Binary-Coded Decimal Interchange Code) uses different bit patterns than
ASCII for the representation of more or less the same characters. EBCDIC is used
principally on IBM mainframe computers.
The limitation to a maximum of 255 characters is since a long time perceived as
a disadvantage because the representation of technical symbols and foreign
language characters is strongly limited. The new, comprehensive 4-Byte code,
Standard ISO 10646 (Universal Multiple-Octet Coded Character Set, or in short:
UCS), allows the representation of all characters that are known on earth and should
then provide respite in the future. In order not to require too much data-processing
capacity, the most important characters (a good 65535, which is still enough to
9.4: Communication Protocols 321

encompass also the Chinese Kanji characters) are contained in the 2-Byte BMP
(Basic Multilingual Plan) code, which is also part of ISO 10646.
OSI Layer 7 (Application) covers several fields related to the utilization of the
transmitted data. The concepts of the virtual device with its hardware-independent
commands and the File Transfer Access and Management (FTAM) protocol, an
abstract notation to describe the different features of a file as for example its creation
date, access control, protection passwords, multiple access information, etc. Another
of the Layer 7 specifications is the Message and Handling System (MHS), standard
CCITT X.400. This is a set of procedures for electronic mail transfer in form of
messages. The Virtual Terminal (VT) concept with hardware-independent commands
to control terminal output (Section 9.2.3) is also part of Layer 7.

9.4.9 The TCP/IP Protocol


The TCP/IP (Transmission Control Protocol / Internet Protocol) is a set of
communication protocols to operate across complex networks that also finds wide
application in networked computer system in industrial automation.
TCP/IP is shorthand for a set of different standards with different features and
functions and of which the Internet Protocol (IP) represents the main part. The full
TCP/IP is more properly called Internet Protocol Suite (IPS). However, the first
definition, although not correct, is so widespread that will be used here as well. It
should be kept in mind, however, that TCP and IP are just two of the protocols that
make up IPS.
Also TCP/IP has a layered structure with five levels similar to that of OSI, but
otherwise there is no direct relation between the two communication architectures.
The difference is probably best exemplified by considering their historic development.
In the mid 1980s TCP/IP was included as a set of routines in the release of the
operating system UNIX V4.2 BSD (Berkeley Software Distribution); this work related
to TCP/IP was financed by the US Government via the Department of Defense. At
that time personal computers also were rapidly gaining in popularity, people logged in
by modem to mainframes to exchange information and messages with other PC
users. In brief, there was an enormous pressure to internetworking of computers and
to produce solutions (hardware, software and communication protocols) reasonably
simple to stay within the scope of advanced PC users. TCP/IP fulfilled well these
requirements. Thanks to the inclusion in a UNIX package and to the fact that also
UNIX was rapidly gaining popularity among academic as well as commercial users,
TCP/IP was almost deemed to be successful. Moreover, the OSI layering scheme
had just been presented, but the standards within the model were not yet fully
defined, so that TCP/IP immediately filled a vacuum.
Probably the main difference between TCP/IP and OSI is their definition process.
TCP/IP was defined and is constantly improved by the users themselves via a
widespread action called RFC (Requests for Change) and mostly carried out via the
computer network itself. Additions and changes to the architecture are proposed and
reviewed by the users, academic, commercial, and even private persons. OSI is
instead defined by international committees, with all the overhead and the delays that
belong to that type of work. A certain interaction and exchange of ideas between the
developments of OSI and of TCP/IP does however take place, still each product
remains within its own scope. At the end, OSI is not yet as diffused as TCP/IP
because it represents a much heavier product that is difficult to implement in full and
that has arrived later. Users are in general reluctant to change something that
already operates satisfactorily, also considering the time that is needed to recover
322 Chapter 9: Digital Communication in Process Control

the investments made in a solution. TCP/IP is therefore here to stay, at least for a
good while.
Despite the fact that TCP/IP was initially offered together with UNIX, it does not
mean that it is confined to that operating system. On the contrary, TCP/IP has been
designed for operation among different operating systems, hardware platforms and
network types. For example, a file on a station can be copied to a different station
with the services provided by TCP/IP; if necessary, during the copy process the file is
automatically converted into the proper data format. TCP/IP is currently available on
all major computer platforms.
To draw a parallel with OSI, TCP/IP can be considered as a structure with five
layers, three of which are actually covered by the Internet Protocol Suite
specifications (Figure 9.17). In the figure it is also indicated how the units of
information are called at the different levels. As a result of the layered structure,
TCP/IP datagrams are formed in a way similar to OSI. Also the concept of peer
routines is similar as that defined in OSI.
layer

1 Application
(NFS, FTP, etc.)

message

2 UDP TCP

datagram segment

3 IP

datagram

4 datalink
frame
5 physical interface
bits

physical channel

Figure 9.17: The basic structure of the TCP/IP protocol or Internet Protocol Suite (IPS).
Layers 1 and 2 are not part of the TCP/IP specifications.

The TCP/IP layers are defined as follows.


The layers 1 (physical connection) and 2 (data link) are not covered explicitly by
the TCP/IP model. Here existing standards, for instance those covered by OSI, can
be utilized; TCP/IP just assumes the existence of an operating physical connection
and the related channel control.
9.4: Communication Protocols 323

Layers 3 and 4 in TCP/IP present some similarity to the corresponding OSI


layers, though they are not directly compatible with any of the OSI standards.
Layer 3 is covered by the IP (Internet Protocol) which represents the „heart“ of
the full protocol suite. This layer is responsible for moving datagrams from one end
station to another on a network. Datagrams are packets of information that can be
destined for one, many or all stations; respectively they can have unique, multicast or
broadcast addresses (Section 9.5.3). There is no requirement for the intended
recipient or recipients to acknowledge at this level the reception of a datagram. IP
has been designed to lead datagrams along the network, but does not check the
result of delivery or that the datagrams are delivered free from errors.
Under IP there is no concept of a sequence of datagrams making up a message.
The datagram service does not have to keep datagrams in the same order as they
were sent. This is responsibility of the protocols at higher layers in the TCP/IP suite.
The IP layer makes use of a particular structure for station network address. An
IP address is a 32 bit number, structured as four 8-bit blocks separated by dots; the
decimal equivalent are four numbers in the range 1-255 (e.g. „137.19.7.224“). The
selection of addresses is not a trivial matter and must follow its specific rules; for
further details it is referred to the literature.
The issue of address selection is very sensitive for computer systems and
networks that are or are possibly going to be connected to worldwide Internet, as
duplicate addresses must obviously be avoided. This is only of partial relevance in
process control systems that are normally self-enclosed and independent of any
external network, so it should not really matter if a robot controller ends up with the
same address as a university campus library computer or a mail-order website. In the
case, however, that a control system is connected to Internet through some of its
computers and therefore no longer operates as an island, then the whole question of
addressing must be reconsidered. Computers acting as filters may have to be
installed to separate the control system part from the Internet connection.
Layer 4 (Transport) comprises facilities to extend the basic IP service. The UDP
(User Datagram Protocol) is a simple datagram service to transport datagrams
between applications that do not require particular reliability, as UDP does not have
any overhead for creating and maintaining a virtual connection; each datagram
transmission is a self-contained instance. With UDP the application must perform its
own error checking and error correction.
UDP is indicated for applications with several recipients (multicast) and in which
it would be unpractical and expensive to acknowledge reception of each single
datagram; this is for instance the case when the information is not too much valuable
and is updated often. In process control this might be background process
information to be showed continuously on several workstations, so that minor
disruptions and sporadic errors would not be very important. Of course alarm
indication that require immediate operator action should not make use of an
unreliable and unverified transport link.
TCP is a full-fledged protocol with handshaking, provisions for opening and
closing down a virtual communication link, error detection and correction and flow
control. TCP does not support broadcast and multicast service. The higher reliability
is won at the price of more overhead in connection with the operation of its services.
The data block from the application that contains the TCP overhead and is passed to
the IP layer for transmission on the network is called segment.
The fifth TCP/IP layer (application) is a collection of services at disposal of the
network users. Examples of routines at Layer 5 are rlogin (remote login), Telnet
324 Chapter 9: Digital Communication in Process Control

(virtual terminal protocol), the File Transfer Protocol (FTP) and the Network File
System (NFS) and a few more.
The Network File System (NFS), originally called Open Network Computing
(ONC) is an addition to the set of TCP/IP protocols made by the company Sun
Microsystems. NFS conveys information about the directory and file structure of
computers that are connected to a network in the presentation form that is typical of
each machine. For example, on a Windows computer NFS shows files located on
other computers connected to the same network in the same tree-like format as for
the local files. On a UNIX system, each remote directory is shown as an additional
directory.
The File Transfer Protocol (FTP) provides a simple means to move files from one
computer system to another; it also provides facilities for managing files on remote
systems with common file operations like change directory, copy file, delete file,
rename file, etc. FTP only operates on complete files and does not deal with their
content: for example, under FTP there is no provision for opening a file to access
individual records. Each file is treated just as a stream of bytes.
The fifth TCP/IP layer cannot be compared to the OSI layers 5 to 7 as it does not
encompass protocols for communication, but instead includes specific application
programs that make use of the TCP/IP facilities. In particular, TCP/IP lacks the
presentation layer (OSI layer 6) with its definition of coding for characters and
symbols.
TCP/IP represents today a popular choice as protocol for data exchange in
industrial automation solutions, where several servers and workstations are
connected to one or more networks. The principal reason is again represented by the
fact that TCP/IP exists, is a mature product, its functionality has been tested, it runs
on different types of hardware and operating systems and is not unreasonably heavy
or requires too many resources and computing overhead.
TCP/IP was developed by users to be simple and practical. The simplicity of the
approach has meant its fortune. In comparison, the only standards developed
following the OSI models that have gained wide acceptance are the X.400 Mail
Service and the X.500 Directory Service. OSI will however play an increasingly
important role in the definition of new services, while TCP/IP will stay on, at least until
it will no longer be viable for the solution of those problems that will arise in the
future. For contained industrial communication problems TCP/IP will in many cases
represent the most feasible solution.

9.5 Local Area Networks


9.5.1 Communication Networks
The description presented so far was focussed on how to connect two different
nodes or stations. This is still of limited relevance for most practical applications,
because communication often takes place among more than two stations. The
installation of dedicated lines between all possible communication partners is not
only impractical but also expensive, because of all the necessary cabling.
Local Area Networks (LAN) are used to connect together several nodes so that
each one of them can communicate with all the others. A LAN is basically a cable,
twisted pair, coax or optical fiber, drawn in proximity of each connected unit and
attached to it via a dedicated interface. LANs have a typical length of some tens of
meters to a few kilometers and support data rates up to 1 Gbit/s.
9.5: Local Area Networks 325

The most comprehensive documentation and specification of LANs has been


done by the professional engineering society IEEE (See Appendix „Standardization
Organizations“). IEEE has published a set of documents known as "IEEE 802"
standard, which describes both general principles and particular types of LANs. The
IEEE 802 specifications have been taken over by ISO, which publishes them as
standard ISO 8802. The LAN standards are subject to periodical revisions, but their
major features are stable.
It happened with LANs the same as with other products for communication and
automation technology. In the beginning it was hoped that only one, general, LAN
standard for office and industrial applications would be selected and everybody
followed it. When it was time to take a binding decision in this sense, there were
three competing - and mutually incompatible - technologies, each backed by powerful
companies. The committee charged with defining the standard could not agree on
any one of them and at the end it was decided that three different standards was
better than no standard at all. This has led to today’s standards CSMA/CD
(“Ethernet”), Token Bus and Token Ring. These are all part of the general IEEE 802
specifications. On the other hand, these specifications contribute to unify as much as
possible, for example addressing formats and packet contents.

9.5.2 Network Topologies


When several stations are connected via a LAN, different topologies (i.e.
geographical configurations) are possible. Any two of several stations may either be
connected together directly or the communication path may have to pass via other
stations, which relay the data further to its destination. The topology and the layout of
the communication channels depend on several factors, like the type of traffic, the
distance between the stations, the kind of disturbances that may affect the data
channel and the desired speed, throughput and accuracy in data transmission.
A basic classification of network topologies can be made by considering the
number of receivers that are directly connected to one transmitter and that can be
reached at the same time by a single message. In point-to-point configurations there
is only one link between transmitter and receiver. The receiver must therefore
process each incoming message, because it was explicitly intended for it. In
broadcast topologies instead a common line is connected to several stations in
parallel (multidrop or bus connection). In this case all stations receive the transmitted
message at the same time and must decode it to verify whether or not it is intended
for them. Multidrop lines also require particular hardware and software solutions for
allocation and sharing of the line medium.
The most important network topologies are shown in Figure 9.18.
The principal characteristics of the illustrated topologies are the following:
Bus - The stations shared a common line for communication; broadcast
topology.
Star - A central point (hub, concentrator) is directly connected with the network
nodes in a point-to-point fashion.
Ring - Each station is connected to two others, all together they form a ring. A
message from any station can reach its destination along two different paths.
Tree - The individual stations/hubs are connected in cascade to other hubs or
the final stations. The messages from source to destination follow a hierarchical path.
Mixed - Several topologies are implemented together.
326 Chapter 9: Digital Communication in Process Control

ring free /
mashed

star

bus

tree /
hierarchical

Figure 9.18: Network topologies

In the selection of a network topology, it is important to choose a structure that


guarantees efficient data transport from the source to the destination and provides
redundant paths in case a direct link should be broken. This can be determined with
a simple „single-point“ failure analysis. In a systematic way it is assumed that one
component at a time (line or station) is unavailable and the behavior of the remaining
circuitry is analyzed by identifying what alternative paths would operate, at which
capacity, and what stations could no longer be reached. In this respect the star
topology is the most failure-sensitive, because if the central hub is unoperative, then
communication is entirely disrupted. The least failure-sensitive topology is the ring,
because failure in one connection would not affect the traffic, which can be rerouted
on the opposite portion of the ring. The failure of a station would similarly only affect
the traffic concerning that particular station and leave the others unaffected, at most
with a reduction in the data-carrying capacity.
A large network can be divided in smaller partitions to increase its availability and
performance. In applications with a large number of devices, if it is possible to
organize smaller islands of devices that have to communicate principally among
themselves, and then interconnect these islands via bridges and routers (treated later
in this Section); this usually increases the total performance of the system.
9.5: Local Area Networks 327

9.5.3 Medium Access Control (MAC)


LANs are covered by the layers 1 and 2 in the OSI model. In the standard IEEE
802.2, layer 2 is divided in two sublayers: Medium Access Control (MAC), which is
responsible for the coordination of access to the channel, i.e. how to share the
channel, and Logical Link Control (LLC), that deals with protocols and error detection
and correction (Figure 9.19). LLC becomes active only after that access to the
communication medium has been opened under control of the MAC sublayer. The
LLC layer provides a consistent interface to the layers above, irrespective of the MAC
layer and hence of the cabling system used: Ethernet, Token Bus, FDDI or other.

higher layers

OSI Layer 3 Network Control

Sublayer 2.2 Logical Link Control (LLC)


[IEEE 802.2]
OSI Layer 2

Sublayer 2.1 IEEE 802.3 IEEE 802.4 IEEE 802.5


Ethernet Token Bus Token Ring

Medium Access
Control (MAC)

OSI Layer 1 physical channel

Figure 9.19: IEEE/ISO network structure for OSI layer 2


Standard IEEE 802.2 (ISO 8802-2): Logical Link Control
Standard IEEE 802.3 (ISO 8802-3): Carrier Sense Multiple Access / Collision
Detection (CSMA/CD)
Standard IEEE 802.4 (ISO 8802-4): Token Bus
Standard IEEE 802.5 (ISO 8802-5): Token Ring

Due to the fact that with LANs several stations can exchange messages, it is
necessary to introduce an addressing mechanism to uniquely identify the originator
and especially the destination of any message. The MAC sublayer of IEEE 802.2
specifies a standard for board addressing.
Each interface board connected to a LAN has an address with the fixed length
48 bits (6 Bytes). This address is used to identify the „source“ or „destination“ in the
messages exchanged between stations. MAC addresses are programmed into the
hardware of network interface boards at manufacture, normally on programmable
read-only memory. These addresses are supposed to be unique; on some systems
328 Chapter 9: Digital Communication in Process Control

the user has however the possibility to select and program a different address. An
explicit and unique board address is often referred to as a unicast address, as it
specifies a single station connected to a LAN.
Boards attached to a LAN will only accept and process data packets with a
destination address corresponding to their unicast MAC address. In addition are also
accepted broadcast and multicast addresses. A broadcast MAC address has all 48
bits set to „1“s. As the name indicates, a broadcast message will be accepted by all
receiving boards. Multicast addresses refer to groups of LAN cards that are related in
some way via their address structure. The LAN cards must be configured to be
identified as members of a particular multicast group.
A LAN is by no means a transparent medium to which the communicating
stations are simply connected to. It represents instead a system that has to be
specifically tuned in order to fulfill its function efficiently and satisfactorily. The
operation and performance of a LAN in terms of general throughput and average
delay before a transmission can take place depends principally on the type of MAC
procedure and the tuning of the related parameters. The importance of this work
should not be underestimated, because the wrong selection of the network
parameters can lead to overloads and bottlenecks, thus hindering proper operation.
The correct selection and definition of the operational parameters of a LAN is in
part a theoretical, in part a practical action. In particular special analysis- and
measuring instruments, called network analyzers, can be used to monitor the
network operations. Network analyzers present statistical values, like for example the
average data throughput, average and highest wait times, together with many others.
A network analyzer offers also the possibility to follow the structure and the path of
specific messages. The user must test different settings of the network parameters to
find an acceptable solution for each particular type of requirements.

9.5.4 The Ethernet Network Standard (IEEE 802.3)


Ethernet is a widely used LAN type for both industrial and office applications.
Jointly developed by the companies Xerox, Intel and Digital Equipment, Ethernet was
introduced in the market in 1980. Ethernet is a de-facto standard and follows closely -
but not entirely - the IEEE 802.3 (ISO 8802.3) specifications. Moreover, it was the
IEEE specifications that were defined with reference to the already existing Ethernet
solution. There are a few differences between the IEEE 802.3 and the Ethernet data
packet description, although their operation is identical. As a result, while the
hardware is compatible for both systems, the frame content is not, with the result that
they can coexist on the same cable, but not intercommunicate. The following
description will refer to the Ethernet standard.
Ethernet has a bus topology with branch connections. At physical level, Ethernet
can operate with baseband as well as broadband cables; the latter can carry at the
same time other types of signals. The broadband cable is more expensive and more
difficult to install; baseband medium is much more frequently used. On the dedicated
baseband medium the digital data is put directly on the line using Manchester
encoding and without the need to modulate a carrier signal.
An Ethernet baseband cable consists of a screened coax cable to which
peripherals are connected with „taps“ (see Figure 9.20). Two types of cable are
available. The original Ethernet cable, „thick“ Ethernet, of about 2.5 cm diameter; this
cable is also indicated as 10BASE5. A more practical type of cable is „thin“ Ethernet
(diameter 0.5 cm); the latter is also known as ThinWire Ethernet, 10BASE2, or by the
9.5: Local Area Networks 329

self-explanatory name Cheapernet. Also twisted pair is sometimes used as Ethernet


medium. The connection to thick Ethernet is made with wiretaps, i.e. cable fasteners
with a nail that punches through the plastic coat to reach the inside conductor. „Thin“
Ethernet uses radio-frequency RG-58 coax cable and BNC-T connectors. With Thick
Ethernet the cable does not need to be cut to connect a new device, because
wiretaps are used, while with Thin Ethernet the cable must be cut and a new BNC-T
connector installed for every new device. Thick and Thin Ethernet can be joined
together via a special connector. At both cable ends must be installed a termination
resistor to avoid signal reflections.

station #2

bus termination bus termination


resistor resistor
Ethernet cable wiretap

wiretap wiretap

station # 1 station#3

Figure 9.20: Typical Ethernet configuration with wiretaps

The maximum length between the most remote nodes is about 2500 m; the IEEE
specifications suggest not to exceed 500 m. An unrestricted number of stations can
in principle be connected to Ethernet, a practical maximum is about 100. In general
the efficiency of the network drops with the number of connected transceivers.
The capacity of ThinWire Ethernet is less than ThickWire, however the first has
the advantage of minor cost and greater simplicity. The maximum length is 185 m
and the number of connected stations should be less than 30.
A new part of the IEEE 802.3 standard addresses the use of fiber optic cable as
Ethernet medium; the conductor is indicated as 10BASE-F. Also Twisted Pair cabling
is foreseen for short connections and is denoted as 10BASE-T.
Ethernet does not have a unit or device in control of the network and all devices
must decide independently whether they can access the medium. Consequently,
being the line entirely passive, there is no single-failure point. Ethernet supports
communication at different speeds on the same physical network, as the connected
units do not need to decode messages that they do not recognize to be explicitly
directed to them. The maximum data transfer rate is 10 Mbit/s.
At the data link layer (OSI layer 2, LLC sublayer), in Ethernet is defined a packet
format similar to the HDLC packet (Section 9.4.5). The Ethernet packet (Figure 9.21)
starts with a 8 Byte preamble with a 010101... pattern, then follow the destination
address and the source address, each 6 Byte long according to the MAC format. The
destination address may cover only one destination (unicast), a defined subset
(multicast), or all the stations connected to the network (broadcast). After the
destination address follows a 2-Byte type field, the definition of which does not follow
particular requirements and depends on the actual system implementation.
330 Chapter 9: Digital Communication in Process Control

Field # length, bytes value description


1 8 all 1’s start flag (preamble)
2 6 destination address (MAC-type
address); can also be multicast or
broadcast
3 6 source address (MAC-type address)
4 2 length of data field (field # 5)
5 46-1500 data
6 4 checksum

Figure 9.21: Structure of the Ethernet packet

The IEEE 802.3 frame has the same format as the Ethernet frame. The 16-bit
field immediately following the source MAC address represents the type field in
Ethernet and the length field in IEEE 802.3. The length field contains the number of
Bytes of data following the length field itself and before the checksum. A station
receiving a valid packet therefore examines the 2 Bytes immediately following the
source address. If this value is less than 1501 (hex 05DD) the packet must be of
IEEE 802.3 type, as that is the maximum allowed length for the data. To ensure
consistency with this definition, the minimum value for the type field in Ethernet
packets is hex 0600. A further difference between the Ethernet and the IEEE 802.3
frames is that in the latter the 8 Bytes following the length field are used for additional
protocol information to allow non-OSI packets to operate over OSI data link layers.
The actual user data begins after all this preliminary information. The length of
the data field is between 46 and 1500 Byte long; messages shorter than 46 Bytes are
padded with empty characters (the minimum length is required to ensure collision
detection). The packet terminates with a 4-Byte checksum. The minimum length of 46
Bytes for the data has been chosen so that a full Ethernet packet from the destination
address and including the checksum counts at least 64 Byte. Considering also the
start flag, the total packet length varies thus between 72 and 1526 Bytes.
The method used in Ethernet for medium access coordination is called
CSMA/CD (Carrier-Sensing Multiple Access / Collision Detection). This method
permits operation without a controller for medium access. According to the CSMA/CD
protocol, a station that intends to initiate a transmission has only to check that the
line is not occupied at that moment by another transmitting unit (Carrier Sensing); if
the line is free, a new transmission can begin (Multiple Access). The transmitting unit
controls constantly the quality of the signal on the line, comparing its own output
signal to what is on the line. If any other unit had attempted transmission at the same
time, after having also sensed a free channel, both units detect that their signals are
garbled (Collision Detection) and immediately stop transmitting. To ensure that all
units detect that a message collision has taken place, after the interruption both
transmitters put a short noisy jam signal on the line.
The time needed for an electric signal to travel the maximum cable length is
about 50 µs; in Ethernet operations this time is called time slot. If a transmitting unit
does not detect a collision for the duration of the first time slot, it is on the safe side
and can continue transmitting without any problems.
9.5: Local Area Networks 331

If two units must wait after a signal collision, they do it for a random period of
time of 0 or 1 time slots (0 or 50 µs) before they attempt a new transmission. The
probability for a new collision is now 50%. If a new collision occurs, the range from
which the waiting period is selected at random is increased by powers of two to 0-1-2
slots, then 0-1-2-3-4 slots and so on, up to a maximum of 0 to 1023 time slots (about
50 ms). In the case that a collisions still takes place, the units assume that the
problem has a different cause and report the situation to the higher communication
layers.
Another situation where error handling is not included in the transmission
protocol but left to higher layers is when the checksum computed by the receiver
does not match the one received with the message. A commonly used strategy is to
issue a request for retransmission only of those packets found to be faulty; if there is
no such request, it means implicitly that the received packet was OK. A different
operational strategy is the explicit acknowledgement of reception and acceptance of
each message. In order to avoid a competition between acknowledgement messages
and normal network traffic, the first time slot after a successful transmission is
reserved for an immediate acknowledgement from the receiver to the transmitter.
The Ethernet concept is flexible and open. The medium itself is cheap and it
does not have active parts like servers or network control computers, which could
break down or act as a bottleneck and tie up communication capacity. A
disadvantage of a network based on the CSMA/CD principle is that the probability for
collision increases with the number of connected units and with the length of the line.
Along with the probability for collisions increases also the time that is lost in trials.
This means in practice that there is no upper bound to the time it may take to access
the medium and transfer a message successfully. This is a drawback for industrial
real-time applications, where in some cases it is necessary to exactly know in
advance the worst-case performances.
Ethernet operates effectively when the packets are short and contain relatively
brief messages. Software applications that involve larger overheads, like client-server
applications or X-terminal connections require typical throughputs for which the
capacity of Ethernet is no longer adequate. In principle a long message can be split
in a several shorter packets, but this would substantially increase the load on the
network. Other solutions, based on higher-capacity media, must be used in such
cases. Some companies offer complete Ethernet-based communication packages
that also implement higher layer services in the OSI hierarchy.

9.5.5 The Token Bus Network Standard (IEEE 802.4)


The LAN type Token Bus is described in the IEEE 802.4 specifications. Together
with Ethernet, it is the most widely used type of local area network in the industry. In
Token Bus all units are connected to the network in a bus fashion (Figure 9.22). The
physical conductor is, as for Ethernet, either coax cable or twisted pair and supports
data rates in the range 1-10 Mbit/s.
Differently to Ethernet and its random-like medium access method, in Token Bus
the access to the LAN follows a strict deterministic pattern, so that only a station at
the time can initiate the transmission of a message. The right to send is given by the
token, a special bit pattern that is passed from one unit to the other in a circular
fashion. The unit that receives the token gets the right to transmit for a specified
interval, and must then pass the token to the following unit. If a unit doesn’t have
anything to transmit, it just passes the token to the next one. The circular pattern in
332 Chapter 9: Digital Communication in Process Control

which the token is passed makes the Token Bus a logical ring, although its physical
topology is a bus.
token
A B C

physical medium

D E F

Figure 9.22: The Token Bus operating principle. The stations A-F circulate the token. A
station can communicate only when it holds the token.

The devices connected to the Token Bus can be active or passive. Active - or
master - devices circulate the token and may transmit whenever they hold it. The
passive - or slave - stations may issue messages only when they are addressed by
an active station; their reply or acknowledgement must be immediate. Active devices
usually have computing capacity, they might for example be process computers,
robot controllers, programmable logical controllers (PLC) and other advanced
equipment. Passive units are sensors and other devices close to the physical
process which do not need to deliver information unless explicitly requested to do so.
The Token Bus specification has provisions for network management that
require the active participation of all devices. A new token must be generated when
the full system is powered-on, or in the case that the station which currently holds the
token should crash and destroy it. Other examples of network management functions
are configuration changes, addition and removal of stations, recognition and isolation
of faulty stations, etc. The length of the time slot, i.e. the time during which each unit
is allowed to communicate, can be selected.
Compared to Ethernet, the Token Bus has a computable worst-case waiting time
for a unit to gain access to the medium. This worst-case delay corresponds to the
total amount of time for the token to circulate around the units and for these to keep it
as long as they are allowed to as well as the maximum length of the messages. In
order to keep the worst-case time low, the time slots must then be kept short. On the
other hand, the allotted transmission time when holding the token becomes in this
way also limited, so that longer messages must be split up and sent in separated
blocks. With a short time slot, the network can be accessed faster, but the total
throughput performance becomes slower. Short messages get through faster, while
longer messages take longer because they must be splitted and sent in different
blocks. In the selection of the time slot must then be considered several factors like
the number of connected stations and the type, frequency and priority of the data to
be communicated in order to reach maximum efficiency.
The advantage of the Token Bus concept in applications with tight timing
requirements is that all parameters of the communication process are deterministic
and not probabilistic, so that the worst-case performance can be known with
precision in advance. On the contrary, Ethernet allows a transmission to be initiated
with no delay as long as the medium is free, but does not guarantee that this may
happen all the time, especially if the number of connected units is large.
9.5: Local Area Networks 333

9.5.6 The Token Ring Network Standard (IEEE 802.5)


The LAN solution Token Ring was introduced by IBM. The operating principle of
Token Ring is similar to Token Bus; the difference is that the ring is not only logical
but also physical, with the stations connected in a circular path (Figure 9.23). The
token is continuously circulated on the ring and each station receives it, regenerates
it and puts it again on the line. When a station receives the token, if it needs to
transmit it removes it from the ring and for the maximum specified amount of time
sends its own data packets. After the time allowed for transmission has elapsed, the
station recirculates the token. Messages can be sent in alternative to the token (the
sender does not pass the token further until it has terminated its transmission),
appended to the token or the token itself can be appended to the message. The
cable used in IEEE 802.5 is a shielded twisted pair with a capacity of 4 or 16 Mbit/s.
Each station checks the destination field in incoming messages. If the message
is not intended for that station, it is just sent further. If the message is intended for the
station, it is retained. The way acknowledgement of message reception takes place
depends on the actual protocol, for example the message might be circulated until it
reaches the station that transmitted it, as implicit acknowledgement that it also
reached its destination. In order to guarantee a maximum predictable delay time, the
protocol for Medium Access specifies a maximum token circulation time (Target
Token Rotation Time, TTRT). When a Token Ring station is not powered-on or
otherwise not ready to operate, its input and output bus connections are shorted
together via a relay so that other messages can circulate on the bus without
hindrance.

Station 2
Token

Station 1 Station 3

Station 4

Figure 9.23: The Token Ring operating principle. The token is circulated among the stations.
A station can send messages only when it holds the token. Each station
recognizes the messages directed explicitly to it and relays further the others. A
message is passed further on until it reaches the station that originated it.
334 Chapter 9: Digital Communication in Process Control

9.5.7 FDDI
The new network standard FDDI (Fiber Distributed Data Interface) has been
defined by the ANSI subcommittee X3T9.5 to provide a framework for the application
of optical fiber technology in LAN applications. FDDI encompasses the first two
layers of the OSI model.
At the FDDI physical level are foreseen the use of different media in relation to
the distances to bridge: multimode optical fiber cable for distances up to 2 km and
monomode cable up to 40 km. Even twisted pair cable is foreseen as physical
medium, yet limited to distances of less than 100 m. The FDDI topology is dual ring
and communication takes place in both directions. The maximum number of stations
is 500, each one connected to both rings. The data transfer rate specified in FDDI is
100 Mbit/s.
The data is transmitted through one of the rings, defined as primary ring. In the
event of a physical disruption on the primary ring, the other one is used as backup,
whereby the data flow direction is reversed. If both rings are broken at a certain point
because of a full cable split the packets are routed on the remaining portions of the
ring. The same holds in the case of failure of a station. Should the cable be severed
at several points, each section can operate autonomously, thus providing at least
partial communication capability. In large FDDI applications additional links may be
installed between single stations as additional backup.
Network access is based on token passing, similarly to Token Ring operation.
The FDDI operation protocol provides for the autonomous recognition of the
connection status and functionality and the adaptivity to new situations, e.g. in the
occurrence of a network fault.
FDDI and Ethernet use the same addressing scheme for the connected stations,
so that the two networks can be easily interconnected via bridges.
FDDI is the first standard that provides a comprehensive reference for optical-
fiber based, high speed LAN applications in the 100 Mbit/s range.

9.5.8 Network Communication Devices

Repeaters
The repeater is a signal regenerator, operating on two or more network
connections. Any signal received on the entry port is regenerated and retransmitted
on the output port or ports. A repeater operates at the physical level and does not
concern itself with the content of the data it relays. Repeaters are normally used to
increase the maximum operative length of line segments, for example to extend
Ethernet to over 500 m and to interface different types of mediums, like coax cable
and optical fiber cable, provided no changes in the packet format are required.
Due to the fact that repeaters do not verify the content of the data they relay, it
can happen that interference is understood as incoming data, so that the repeater
may generate and transmit further nonsense data.
Repeaters cannot be cascaded indefinitely, among other reasons because they
delay the signal along the path, so that limits are specified to the maximum number
and type of repeaters that can be installed in different network configurations and
operating together with other network communication devices. For specific details
one should refer to the standards and the technical literature provided by the
equipment vendors.
9.5: Local Area Networks 335

Bridges
Bridges operate at a higher level (level 2) in the OSI hierarchy. They connect
different bus sections together and provide for signal regeneration as repeaters do; in
addition they filter traffic by Media Access Control (MAC) Addresses. To do so a
bridge analyzes the packet headers for the sender and receiver addresses. If sender
and receiver are located on the same line segment, the bridge does not pass the
packet over to the other segments. If sender and receiver are located on different
sections, then the bridge regenerates and relays the packet. In this way, bridges
contribute to reduce the amount of traffic on each separate portion of the network.
Bridges usually are able to configure themselves automatically, by analyzing the
traffic on each line segment and determine which stations with what addresses are
located on what segments. The station connection topology can thus be changed
without need to reprogram the bridges. Bridges can furthermore be programmed for
specific filtering of messages to determined addresses.
When used in an Ethernet-type network, where the probability of the line being
busy is an exponential function of the number of connected stations and their
average communication load, bridges may sensibly help to increase line availability
and thus the total data throughput. Also fault tolerance of the system is increased, as
a interruption on one line segment would not interfere with operations on other
segments.
For a bridge to be effective, it is necessary to divide a network in several
segments, so that stations that need to communicate more intensively are located on
the same segment and their traffic remains localized.

Routers
Routers are comprehensive communication computers used to link together
networks sections. Routers operate at OSI level 3. They recognize the addresses
contained in the message headers and forward the packets correspondingly along
the network. Routers can even provide for protocol conversion and thus be used to
join networks operating with different physical, data link and network protocols (OSI
level 1, 2 and 3).
The difference between bridges and routers is that the first only „see“ a part of
the network, namely their connected links, while routers must contain a model of the
full network or at least an algorithm for the selection of a path for each data packet.
Special algorithms and strategies can be used to find an optimum path across a
network, for example the shortest path, the fastest, the least expensive or any other
that is selected and optimized according to specific criteria.
The differences in the communication devices are constantly changing as their
functionality is increased. In particular the borderline between bridges and routers is
progressively blurred, as bridges are built with more and more functions that
originally belonged to routers.

Gateways
Gateways operate on all seven functional layers of the OSI model. While bridges
and routers work only on the basis of the header information of data packages,
gateways also operate on the data content, for example to convert it from one
presentation format to another. Gateways are therefore used when it is necessary to
interface not only between networks of different types, but also between applications.
336 Chapter 9: Digital Communication in Process Control

In e-mail systems, for instance, gateways can ensure that messages encoded
following a standard used by a specific word processor can be understood without
loss of information by another e-mail program and another different word processor
operating on another computer. The same can apply for process-related real-time
information, if application programs follow different standards for encoding user data.
Depending on the specific case, however, it might be necessary to develop a specific
gateway system to interface among heterogeneous applications, if these do not
strictly and fully comply with open communication and data format standards.

9.6 Communication in Process Monitoring and Control


9.6.1 The Hierarchical Structure of the Technical Process
In most processes can be identified several hierarchical or administrative levels.
These levels correspond more or less to the different decisions that must be taken for
the control of the process.
As an example, let consider again the chemical tank described in Section 2.2.1.
The lowest level in the heat regulation loop is where it is decided whether additional
heat is necessary or not in order to keep the tank temperature constant. The decision
is made by a controller on the base of the actual and of the reference temperature. At
a higher level it is decided at which temperature the process should operate. At a still
higher level the chemical process to be run is selected. Obviously, it does not make
any sense to have a very stable and optimal temperature for process „A“ when
process „B“ is run. The hierarchical model is decentralized: the decisions influence
each other, but each level is independent in the choice of how to carry them out.
A similar hierarchical model is that of a company. The requirements for data
exchange are quite different at the different management levels. In general, all
entities located at the same level have intensive mutual data exchange; the data
exchange between levels is usually reduced and not time-critical. The entire
company can also be considered as an over-ordered real-time system, where at
each level the data must be processed at corresponding speed. In Table 9.1 are
shown the typical data quantities, the response times and the frequency for control
needs at the different management levels of a company comprehensive of technical
and organizational aspects. How many the decisional and operational levels are, how
much these levels depend on each other and how much autonomy is left to the single
entities varies from one case to another. The quantities indicated in Table 9.1 should
be understood as orders of magnitude. The borders between the levels can be drawn
differently and the description can be related to different organizations than
manufacturing or processing plants.
At the lowest level in the plant hierarchy are situated the machines and the units
that are directly in contact with the process, the sensors and the actuators (field level,
sensor/actuator level). As the name tells, at this level are situated the components
(sensors and actuators) that are directly connected with the technical process. At the
process control level are situated computers, regulators and other „intelligent“
devices that monitor and control the technical process via sensors and actuators.
The devices at the process control level are the lowest ones that can take
autonomous decisions. The next higher level is the cell control level. The cell control
level is no longer directly connected with the technical process, but instead
exchanges information in form of reference and actual values with the levels above
and under it. In the case of a production cell where different machines are connected
9.6: Communication in Process Monitoring and Control 337

together to carry out a certain production, there is a high horizontal exchange of data
(i.e. within the same level), to coordinate the operations of different machines, but
less vertical exchange to the higher levels. In fact, only the materials parts and
energy (material flows, energy flows) in input and output from the cell are of interest
for the higher levels. At production control level, the activity of several cells is
coordinated to reach an uniform material or energy flow (the output of a cell is the
input of another). Finally, at management control level are taken the global decisions
that affect the whole plant.

Control level Data quantity Response time Frequency

Management control level MByte days days

Production control level kByte hours, minutes, hours, minutes,


seconds seconds

Cell control level Byte seconds, seconds


100 ms

Process control level bit ms ms

Field control level bit ms ms


(sensors, actuators)

Table 9.1: Typical requirements for process data (all entries to be understood as orders of
magnitude)

Although necessarily very general, the hierarchical model offers a useful frame
for the analysis and structuring of control systems. The model is not necessarily
restricted to a manufacturing plant; equivalent levels are found in all complex control
systems. For example, in an aircraft autopilot the regulation loops for the
aerodynamic surfaces and for the engines are at the lowest hierarchical level; where
to fly is a „management“ decision left to the pilot. Moreover, the structuring in
different operational levels is by far not only academic. The design of data exchange
between real-time and administrative management systems is a necessary operation
for plant or process control logistics and represents a complex technical challenge.

9.6.2 Data Collection and Information Flow in Process Control


The requirements for data exchange within every one of the hierarchical levels
vary considerably. It was already pointed out several times in this book that real-time
systems must process data at a speed higher of that at which changes can occur in
the process under control. Something similar holds for the process at large. Here,
naturally, the reaction times are different and become longer at the higher levels,
where on the other hand there is more data to process.
338 Chapter 9: Digital Communication in Process Control

A major feature of control system architecture is the number of installed


processors. There are control systems with only one central processor and systems
with several CPUs. In distributed control, different processors are dedicated to the
control of single parts of the physical process; the central unit coordinates the
general operations. The layout of the processors is usually structured according to
the management level structure, as shown in Figure 9.24. The number of
management levels can differ in different plants.

management management
computer computer
management
control level

production production production production


control level computer computer computer

cell control cell cell cell


level computer computer computer

process NC- process


control level machine regulator controller

field control
level sensors S S S S S A A A A A actuators

physical / technical process

Figure 9.24: The hierarchical structure of distributed control systems

Local processors or process interface modules are in direct contact with the
physical process and collect the process data via sensors and A/D converters. The
local processors also control the process via the actuators. The function of the local
processors may be exerted also by PLCs, local controllers or other types of units
connected to the process, like e.g. NC-machines.
9.6: Communication in Process Monitoring and Control 339

There are basically three methods to collect the process data from the sensors
and transmit it from the local controllers to the higher computers in the hierarchy and
to the central control unit.
A first method for data collection is used in telemetry. Telemetry is the preferred
mode of data reporting from the periphery to the central unit when handshaking and
communication in two directions is unfeasible or impossible altogether (e.g. in
spacecraft). In telemetry, all data is reported continuously in a predetermined form.
After a cycle is completed, a new one starts. The address of a parameter is its
position in the incoming data flow.
At the process control level data is collected by polling. A process computer
checks in an endless loop the current state of sensors, so that the data is periodically
updated in its internal database. With polling, the sensors or other peripheral units or
the local processor are periodically asked about their state and must reply to the
requesting unit. In this way it is guaranteed that the data is periodically updated.
Polling is the usual method carried out by the local processors with the
connected sensors, but sometimes it is also used by the central control units to
update their databases.
A third method is to report only the variables which changed their value with
respect to the preceding cycle. Digital variables are reported at each change, while
for analog variables is defined a transition band (see also Section 5.5.1). Only when
the value of an analog variable has changed by some percentage in comparison to
the last reported value, the new information is sent to the central unit. More
sophisticated methods include reporting data when the integral of the change of a
local variable has reached a certain threshold value.
Computers at each level must analyze, organize, process mathematically and
store the collected data before this is passed to the next higher level. The most
common mathematical operations on a set of process data are to find the minimum
or maximum value, the average, some statistical parameter or filtering, as illustrated
in Chapter 5. In this way the quantity of data to pass to the higher levels can be
reduced. In particular, he central processor and the communication channels should
preferably not be overloaded with the logging and transmission of static, i.e. non
changing, data.
In industrial automation systems is used a combination of the second and the
third method, a periodical and an event-driven update method, to report the data from
the sensors to the central control unit. Process values are reported whenever they
change; in addition a general update takes place at longer intervals, e.g. every few
minutes. In this way it is insured that the centrally stored data is reasonably
consistent. An example of industrial equipment for data collection, to be used at
process control / cell control level is shown in Figure 9.25.
In general, the choice of a data collection philosophy requires a careful analysis
of normal operations as well as of the special cases. When only changes of sensor
data are reported, the amount of data to communicate depends obviously on the
state and the operation of the technical process. For a long time there might be no
need to report anything, if a process is in a stable state. A sudden change in the
process, for instance following a change in some reference value, could lead to the
generation of such an amount of data to effectively clog the network. If the changed
process data is not buffered, some state information may be lost, and at the end the
central system may end up operating on wrong information.
340 Chapter 9: Digital Communication in Process Control

Figure 9.25: Field computer equipment for data collection [system ABB Advant OCS] to
operate at process control level (left picture) and at cell control level (right
picture) (courtesy of ABB Automation Products AB, Sweden)

The main advantage of the combined periodical and event-driven data collection
and update method is that the central unit and the communication channels are not
overloaded with the transmission of static data. On the other hand, if many monitored
values change at the same time, the communication channels of the distributed
systems can be overloaded.
The dimensioning of the channel and of the data processing units is a
fundamental aspect. There must be enough capacity to process the required quantity
of data and at the same time provide for safety margins. A simple rule of thumb is to
oversize the minimal required capacity with a factor of 3 to 10 times.

Example 9.6 Required capacity for a communication channel


Fifteen local processors and data collection units are connected to a central
computer. Twenty analog input channels are connected to every local processor
via a Fieldbus (Section 9.7); each processor is connected with a FEP (Front-End
Processor, a dedicated computer operating as communication controller and
interface to the communication links) that relays the incoming data to the central
computer (Figure 9.26). The function of the FEP could in principle also be carried
out by appropriate software running on the central control computer, but the
solution with dedicated FEPs is preferred in order to distribute the processing load
among several machines.
The analog inputs are sampled 100 times per second via 12-bit A/D
converters. The total quantity of collected data is 20 * 100 * 12 = 24,000 bit/s. The
local processor must be able to process this amount of data and to organize it in a
form that can be transmitted further along the Fieldbus. Considering the safety
margin and the processing overhead, the Fieldbus should operate at a speed of at
9.6: Communication in Process Monitoring and Control 341

least 100 kbit/s. If a total of 15 units is connected to the FEP and produces an
equivalent amount of data, the total quantity that has to be carried is 360,000 bit/s.
Considering safety margins and processing overhead, a backbone network of
capacity 5 to 10 Mbit/s should be used.
The amount of data to carry to the higher levels may be reduced if the local
processors operate a selection of the input data. The local processors could for
example relay only one out of ten values for each measuring point, or the average
of these values, which would consequently reduce the total volume of data traffic
by a factor of ten.
control
computer

Front-End
Processor

backbone network

remote links

controller #1 controller #2 controller #15

Fieldbus

Fieldbus
sensors
S S S S S

Figure 9.26: Data collection via Fieldbus controllers and a Front-End Processor

The tradeoff of distributed control systems is communication vs. local


intelligence. The present trend is to have local intelligence installed close to the
physical process whenever possible, with the provision that the central control unit
may always override local control decisions. Such a solution is both economical and
safe. Breakdowns of the central control unit or of the communication links will not
lead to a general system halt. Accurate control also requires as little delay as
possible in the control loop, and is less feasible if all messages from the local
processors have to be sent to the central control unit to be processed and then sent
back. Moreover, the delays in the data communication can lead in some cases to
instability in a process (Section 6.7.1). Finally, in distributed systems there are more
processors to take care of the data than what one single central unit, although
powerful, could ever do.
342 Chapter 9: Digital Communication in Process Control

9.6.3 The Manufacturing Automation Protocol (MAP)


The need for a practical and general way to connect together different units in
production lines and process control has been widely recognized for a long time. The
American automaking giant General Motors (GM) early realized that the
incompatibility of different computer systems was a major hindrance to the integrated
automation of their production plants and began studies on how to interconnect its
production computers. At GM, they noticed how significant were the rewiring costs in
relation to the retooling for every new car model. Moreover, the costs pointed no way
but up. According to estimates made at the beginning of the 1980s, by 1990 there
should be about 100,000 different units like robots and PLCs to interconnect at GM
plants. The costs just for the interconnections would reach a major share of the total
company investments in automation. GM decided therefore to develop a
comprehensive and standard approach to open plant-floor communication, with the
goals of interoperability and interchangeability. The first term indicates that all
information should be understandable by the addressed units without need for
conversion programs; the second that a device that replaces another of a different
model or manufacturer should be able to operate without changes in the rest of the
connected system. The idea quickly won the interest of the major computer
manufacturers and of other companies in the industrial automation business and led
to what it is today known as Manufacturing Automation Protocol (MAP).
MAP is not a standard, an interface or a kind of electric cable, but a
comprehensive concept to realize interconnectivity between different equipment at
the field or plant floor level and higher planning and control instances. The MAP
principle is conceptually simple: different units must be able to communicate together
by using common protocols; yet it has taken about thirty years to implement it and
the concept is far from being completed. The most important reasons may have been
the lack of a general frame for data communication and the fact that major
corporations did not consider it to be in their interest for their products to be
compatible with those of their competitors. Now at last compatibility and
interconnectivity have become primary sales arguments and there are available
standardized communication frameworks as provided by OSI with the related
standards or by the TCP/IP protocol.
MAP follows the OSI layering scheme. For every one of the OSI layers there is a
defined standard as part of the MAP scheme. The standards at levels 1 to 6 are used
also in other applications than MAP; the MAP specific part is the Manufacturing
Message Specification (MMS), described later in this Section. The foreseen MAP
standards for each of the OSI layers are the following:
Layer 7: ISO 9506 Manufacturing Message Specifications (MMS)
Layer 6: ISO 8824 Abstract Syntax Notation (ASN.1) and ISO 8825 Basic
Encoding Rules
Layer 5: ISO 8326/8327
Layer 4: ISO 8072/8073
Layer 3: ISO 8348/8473 (CLNS) and ISO 9542 (ES/IS)
Layer 2: ISO 8802.2 Logical Link Control and ISO 8802.4 Token Bus
Layer 1: Broadband / Carrierband link
In other words, a MAP application must have a physical connection that follows
the LAN Token Bus standard with Logical Link Control according to IEEE 802.2, must
code data following ASN.1 (ISO 8824) and the Basic Encoding Rules of ISO 8825
and has to exchange MMS Messages (ISO 9506). Any other combination of
9.6: Communication in Process Monitoring and Control 343

standards, even if it is technically feasible, is not consistent with the MAP scheme.
For example, a solution where Ethernet is used instead of Token Bus for the data link
and physical connection would not be a MAP application. However, MMS combined
with Ethernet works and also finds support in the industry.
At physical level, MAP can be implemented with different media and signal
types. The initial requirements by General Motors to transport data at 10 Mbit/s
require two adjacent channels with 6 MHz bandwidth if broadband AM-PSK is used.
For baseband-based MAP two data capacities are specified and FSK modulation is
used. For a capacity of 5 Mbit/s the FSK frequencies are 5 and 10 MHz; for 10 Mbit/s
the frequencies are 10 and 20 MHz.
A scheme similar to MAP but more suitable for integrated process-oriented and
administrative data communication is the Technical and Office Protocol (TOP). TOP
follows the same structure of MAP and is for the most part equivalent to it, referring to
the same standards as MAP. At the OSI layers 1 and 2 MAP uses the Token Bus
local area network, while TOP is based on Ethernet. At Layer 7, TOP is richer in the
choice of application interfaces: the Virtual Terminal (VT), the Message Handling
Systems (MHS) and the File Transfer Access and Management (FTAM) protocol.
The TOP concept has been supported by Boeing Corporation, which for long time
has had an Ethernet-based solution to connect their plant equipment with their
production planning system. The basic issues related to MAP and TOP are quite
similar.
MAP has been specifically developed to be used in factory environments with
real-time processing requirements. The reason behind the selection of particular
standards for MAP, and most of all for the choice of the broadband network and the
Token Bus medium access method, was that these had already been tested in real
plants and that Token Bus devices were already available. Token Bus has also a
specified and computable worst-case time limit for message transmission, which
Ethernet lacks. Some real-time applications cannot be designed with this uncertainty
factor. Not surprisingly, MAP and TOP were supported by companies with quite
different requirements because of the way their production is organized. General
Motors has production lines with the cars proceeding at a determined speed on the
assembly line, while at Boeing aircraft is assembled at fixed positions; the related
timing requirements are widely different. Compatibility at higher levels ensures the
interconnectivity of MAP and TOP applications.
In factory automation there are, generally speaking, three operational levels:
general management, process control or production line control and field control.
MAP supports the central levels of communication, it coordinates the operations of
multiple cells on a production line and of several lines at plant level. MAP is not apt
for communication and control down to the sensor level. MAP is a very „heavy“
product because of all the involved layers with the related protocols and does not
match the need for simple, fast and cheap technology that is required at the lowest
factory automation levels. Here a different technique, the Fieldbus, is used (Section
9.7). MAP is also not apt for management support at the highest levels where
strategic factory decisions are made. The software tools to use at that level do not
have to satisfy special real-time requirements and may be developed with the normal
programming techniques for statistical processing and the analysis of large data
quantities. However, MAP remains the key concept for the practical realization of
Computer-Integrated Manufacturing (CIM) applications.
344 Chapter 9: Digital Communication in Process Control

9.6.4 The Manufacturing Message Specification (MMS)


The Manufacturing Message Specification (MMS) is a collection of abstract
commands - or language - for the remote monitoring and control of industrial
equipment. MMS defines the content of monitoring and control messages as well as
the actions which should follow, the expectable reactions, acknowledge procedures,
etc. MMS is a ISO standard (ISO/IEC 9506), structured in the following documents:
Part 1: Service Definition
Part 2: Protocol Definition
Part 3: Robot control messages
Part 4: Numerical Control (NC) messages
Part 5: Programmable logic controller (PLC) messages
Part 6: Process control messages.
MMS provides a large number of different services and options. General-type
functions like e.g. reading and writing the values of variables on remote devices,
starting and stopping execution of programs and transferring files between different
units are described in Part 1 and Part 2. The MMS companion standards (Part 3 to
Part 6) are oriented to specific, real, devices. Although MMS tries to cover all the
functions that are needed in factory automation applications, it is still necessary to
leave a certain margin for flexibility and future expansions. This is the background to
the current document structure. Not every device needs to understand all MMS
commands, but it is sufficient for it to understand the appropriate subset, as
described in the relevant part. Each subset of the whole standard is defined and
revised independently of the others.
MMS is based on object-oriented programming concepts, where classes of
objects are defined together with the operations which can be performed on them. A
central concept of MMS is the Virtual Manufacturing Device (VMD). A VMD is a
collection of all possible command for some type of device, e.g. a robot. A real
machine will understand and react to VMD commands by carrying out the specified
function in a standard, predefined way. MMS and VMD must be very comprehensive
in order to cover different types of similar devices; real devices in general can
execute only part of the VMD commands.
The MMS services are based on a client-server model (Figure 9.27). The client
requests a service from the server. The server executes the service and gives an
answer to the client as acknowledgement and specification of the result of the
operation.
A VMD represents the function of a real device, but from the point of view of the
client there is only the virtual server. The client can give a virtual robot a VMD
command, e.g. to rotate its arm 30° around the Z-axis. This command will lead
different, real robots to perform the same action. The commands generated by the
robots to control their actuators can be quite different, depending on the actual
electrical and mechanical design. In the case a robot is not able to execute the
rotation command, either because it reached the end of the turn radius or because it
has no Z axis, it will answer with a operation result code telling the reason.
An important feature of the client-server model is that the devices acting as
servers do not have a state defined in a local model unknown to the client. All
requests from the client lead to self contained answers and do not imply the use of
information sent previously. In other words, the information from the server devices
(VMD) can be considered to be its own database, where updated values can be
9.7: Fieldbuses 345

collected, or stored, at any time. The independence of the VMD of historical data to
be collected by the client and the specification that all requests be always
acknowledged by the VMD help avoid errors and inconsistencies due to lost or
delayed messages.

client device

MMS
MMS language
interface

network request

answer

MMS language
interface

virtual device
(server)

real device

operations on the
technical process

Figure 9.27: The MMS (Manufacturing Message Specification) client-server model

9.7 Fieldbuses
9.7.1 A Solution for Low-level Plant Communication
The emphasis given by OSI and MAP to interconnectivity at several levels with
all the necessary protocols to accomplish this goal does not always go hand in hand
with the requirements for fast, effective, and - not seldom - financially affordable
communication that is needed in industrial real-time applications. As already pointed
out in relation to the OSI model, not every layer is needed for all applications. When
all communicating units are located in a closed workcell and are connected to the
same physical bus there is no need for multiple end-to-end transfer checks as if the
data were routed along international networks. For the connection of computers in
the restricted environment of a factory plant, the data exchange definition of OSI
346 Chapter 9: Digital Communication in Process Control

layers 1 and 2 and an application protocol as that provided by MMS are more than
sufficient. There is little use for other layers, so that they can be skipped altogether.
In industrial applications, the largest share of the work (and of the costs) for data
collection and processing is not due to the central processing, but comes from the
field level, where the devices are installed. In order to reap the advantages of digital
technology, there is a growing request in the industrial world for a new digital
standard for low-level communication; this standard is known as Fieldbus. There is
no single Fieldbus yet, but different solutions have been presented by the industry
and by research institutions. In course of time, what has been proposed and is
operating in the field will crystallize around one or few technologies that will then
become part of a more general Fieldbus standard.
A Fieldbus standard must gain wide acceptance, as it has been the case with the
4-20 mA current loop. With an accepted standard, costs are kept down and problems
with incompatible components are minimized. In the same way as with the MAP
standard, a Fieldbus standard must guarantee the interoperability of different devices
that are connected to the same physical medium. An obvious advantage of digital
versus analog technique is the saving in the amount of cabling: a single digital loop
can replace a large number of 4-20 mA conductors.
The possibilities opened by Fieldbuses are considerable. A large share of the
intelligence required for process control is moved out to the field. Sensor
maintenance becomes much easier because operations like test and calibration can
be remotely controlled and require less direct intervention by maintenance personnel.
And of course, the quality of the collected data influences directly the quality of
process control.
Several standardization organizations, like e.g. the International Electrotechnical
Commission (IEC), are working on an international Fieldbus standard. National
projects have already started in different countries to define the aspect of a future
standard. A final agreement has not been reached yet, but nobody wants to wait until
a general standard is introduced. Some companies have already defined their
products and are marketing them. In particular, projects have been carried out in
France and in Germany to define national Fieldbus standards. In the end, all
experiences and proposals may come together into a single and widely accepted
standard, but it might turn out that the different, already existing, proposals will live
their own, parallel, lives.
In this Section will be briefly examined the main features of the industrial Bitbus
developed by Intel as well as the Fieldbus PROFIBUS from Germany.

9.7.2 Bitbus
Bitbus has been introduced by Intel in 1984; many industrial products of other
companies are based on it. Bitbus consists of the two first OSI layers: physical (OSI
layer 1) and data link (OSI layer 2).
At physical level, Bitbus uses twisted pair cable according to the RS-485
standard. A maximum of 28 devices can be connected to a single bus and several
buses can be joined together with help of repeaters. Transmission speeds are 62.5,
375 kbit/s and 2.4 Mbit/s. At the lowest speed (62.5 kbit/s), the distance between
repeaters can be up to 1200 m.
Bitbus is structured hierarchically. One of the connected devices acts as master,
all other devices are slaves. The master is always in control of the communication
process. The communication protocol is strictly causal: the master sends a message
9.7: Fieldbuses 347

to a slave device and the slave must reply; a slave cannot initiate communication on
its own, but must wait for a request from a master. A slave must reply to a master
request within a specified time. If the slave fails to respond, the master can try again
for a number of times. If still no answer is received, the master considers the slave
station to be unreachable and virtually disconnects it from operation. When several
Bitbuses are in operation and interconnected via a network, the master units act also
as network communication units. The Bitbus protocol does not foresee multiple
masters and there is therefore no arbitration method to transfer master right. In
general, a „strong“ unit (like e.g. a process computer) will act as master and the
slaves will be devices with simpler electronic circuitry.
The strict division in master and slaves has an advantage in real-time operations,
as it makes reaction times exactly computable in advance. The Bitbus packets follow
the general HDLC structure (Section 9.4.5); they are handled and sent as intertask
messages between the programs on the master unit and those on the slave units.
The application programmer, however, will not work directly at the packet level
because the bus functions can be accessed via predefined procedures in the Bitbus
support software. These procedures include functions to read and write from the
master unit in the memory of local units (and thus to and from the process to be
controlled), to down-load tasks and data, to start and stop tasks in the local units, and
so on.
Bitbus is a mature industrial product supported by several companies. It is a
good solution for smaller production cells or processing units with relatively limited
data traffic, where there is no need for several masters to control communication, yet
the real-time requirements can still be quite strict. In larger-scale applications, the
master units can be connected together via high-speed local area networks and
transfer the concentrated data to a central process computer at higher levels.

9.7.3 PROFIBUS
The PROFIBUS (Process Fieldbus) is supported by a group of German
manufacturers and institutions. PROFIBUS was initially developed under the
coordination of the German Federal Ministry of Research and Technology and is now
a German and European standard (DIN 19245 and EN 50170 respectively). Similarly
to the other Fieldbuses, PROFIBUS combines specifications at the OSI layers 1, 2
and 7 (physical medium, data link and application). PROFIBUS follows existing
standards at the different layers and attention has been paid to retaining compatibility
with hardware that is already in use. The most important bus operations do not
require specialized processors but can be carried out with programs running on
common CPUs.
The PROFIBUS physical medium is a screened twisted pair cable according to
the RS-485 specifications, with a maximum length of 1200 m (up to 4800 m may be
reached with the help of repeaters). Data transmission speeds are 9.6 kbit/s, 19.2
kbit/s, 187 kbit/s and 500 kbit/s. More recent realizations make use of optical fiber
cables and can therefore reach higher speeds.
PROFIBUS can operate with a single master always in control of the bus as well
as in multi-master configuration. Medium access is coordinated with a hybrid version
of the IEEE 802.4 token-bus model with master and slave stations. Up to 127
stations, divided in active and passive, can be connected to the bus. Active stations
circulate the token and may transmit when they hold it. Passive stations do not
circulate the token and must be addressed by an active station to be able to reply
with a message (Figure 9.28).
348 Chapter 9: Digital Communication in Process Control

token
A B C H

physical medium (LAN)

D E F G

Figure 9.28: The PROFIBUS operating principle. The master stations B, C, E, F and G
circulate the token and can communicate only when they hold it. The slave
stations A, D and H are not allowed to transmit spontaneously but must answer
to the requests of a master station.

In PROFIBUS different types of messages are foreseen, from simple data


requests and acknowledgements to longer data packets. The messages have a
maximum length of 256 Bytes and can be classified with two different priority levels.
PROFIBUS messages are based on a subset of the MMS language which includes
the virtual device (VMD) and the client-server concept as well as a set of commands
to perform network operations, remotely start and stop tasks on different computers,
etc. An additional feature of PROFIBUS is the definition of management functions, for
example to change the bus configuration, to add or take away stations, as well as to
detect and isolate faulty units.
PROFIBUS has been designed to support the connection on the same bus of
intelligent sensors together with more complex units (like PLCs, regulators, small
process computers, etc.) The message-based communication scheme allows
flexibility in the type and amount of data that can be exchanged. However, a price
must be paid in terms of speed. PROFIBUS cannot guarantee that all sensor data
are collected at a constant rate. Whether this is relevant or not for a process must be
defined from case to case.
PROFIBUS can be operated in multimaster as well as in monomaster mode (one
medium access control device). If only one master is operating, then the polling order
for requests to the slave units can be exactly determined and calculated beforehand.
In PROFIBUS different network parameters can be adjusted. These parameters
are divided in „bus-wide parameters“ that are equal for all the stations, and „device
parameters“, that can differ from one station to the other. The bus parameters must
be defined in such a way that the required functionality is reached and weak points
are avoided. For example, the bus parameter Target-Rotation-Time (i.e. the
maximum time that is required for a complete travel of the token along the bus)
should be selected in such a way that the active stations are not subject to too long
delays before they can access the medium. The Target-Rotation-Time can be
computed only with knowledge of the type of communication and the typical message
length. In practice, network operations should be analyzed, verified and tuned with an
appropriate network analyzer that can show network operations in relation to
particular capabilities (data throughput, average wait time, average response time).
9.8: Communication over Public Networks 349

9.7.4 Toward a Fieldbus Standard?


The solutions described here are not alone. Almost every major company in the
industrial automation business has some kind of proprietary data bus that is more or
less based on - and compatible with - existing standards. The different Fieldbus
implementations are not necessarily a disadvantage when functionality is concerned.
PROFIBUS has the flexibility of the token, any unit can start its own data search
when it owns the token. Bitbus with its concept based on a central unit is more
effective as long the matter is to follow predetermined schedules and address simpler
devices, but support less well asynchronous operations with more independent
devices. Bitbus is strict hierarchical with only one master, while PROFIBUS supports
the concurrent activity of several intelligent units.
It is difficult to foresee whether the idea of an integrated Fieldbus standard will
see the day’s light, or if different standards will have to live side by side. National and
international projects are carried out in order to provide for unified standards, like e.g.
the project SP50 of ISA (Instrument Society of America), the European Union
ESPRIT projects CNMA (Communication Network for Manufacturing Applications)
and FICIM (Fieldbus Integration into CIM - Computer-Integrated Manufacturing), the
European Union EUREKA project EU 68 Fieldbus and the international
standardization work TC 65 of the IEC (International Electrotechnical Commission).
Given that national proudness and market forces play a role at least as important as
standardization committees do, the solutions illustrated above are almost certainly
here to stay. This does not necessarily have to be a disadvantage. The loss in
uniformity at component level will be offset by the freedom to select a communication
method that can best match a specific applications. Real-time oriented Fieldbuses
like Bitbus can be used at the lowest level to collect sensor data in a cell database,
PROFIBUS may connect together several independent devices and intelligent
sensors in a hybrid configuration.

9.8 Communication over Public Networks


Local area networks are useful to connect together the equipment within a
building or an otherwise limited geographic area. On the other hand, LANs are of little
use when the distances to bridge are larger, in the range of more than about one
kilometer, or if the physical link has to cross public property. In many countries,
notably in Europe, one can connect all the equipment in a large plant with a high
performance LAN, but run into trouble with the authorities on trying to extend the
connection to an office building located on the other side of a public road. The issue
over communication monopoly is a complicated and still not fully resolved question
and it will not be dealt with here, but just taken as a fact of life. In practice, it means
that there are situations where data has to be carried over networks owned by a
public PTT administration (the abbreviation means Post [=Mail] Telegraph and
Telephone and is used to denote national telecommunication organizations) or some
other telecom company. Yet, the ongoing deregulation means that several
companies may now offer data carrying services using different technologies and at
concurrential prices. Another positive factor for the user is that - despite the large
number of vendors and service providers - the technology to interface public
networks is progressively being standardized. So, even if it sometimes it might still be
a problem to draw a cable across the road, at least one can choose among
competing companies to route the data along their networks instead.
350 Chapter 9: Digital Communication in Process Control

The use of a public network to transfer data may also be determined by other
conditions. In some types of industries, e.g. power companies, the data must be
collected over a wide geographical area, like in the monitoring of power lines or water
and gas distribution grids. In some situation it might be unpractical for the company
to build its own communication line to see what happens at a transformer station
located 100 km from a power plant. This is a typical situation where the services of
an external communication provider can be of use.
The following description is a brief introduction to the main features of public
networks from the point of view of the user interface to the networks. It will not
describe the internals on how public networks operate.

9.8.1 The Phone Network and Modems


The phone network can rightfully be considered as one of the wonders of the
modern world. The phone network, that can be also be used to carry data, is installed
and operating. It connects together some half billion phones in all countries on earth
and works reasonably well, although in many cases with deficiencies and
shortcomings. It is a good example of how a very complex system could gradually
evolve around a simple design instead than being planned from the beginning to
become what it is now. It took in fact longer than 100 years for the phone system to
evolve to its present state. However, the world phone system also reflects the huge
differences among world countries. According to United Nations estimates, some two
thirds of the world population still do not have access to telephone services.
From a data transmission point of view, a basic phone connection is a poor
medium. Its bandwidth is about 3000 Hz, enough to carry human voice intelligibly,
but poor for data communication. The limitation in bandwidth is actually not due to
the circuitry in the phone set or to the twisted pair cable connection, which could
support data rates of some hundreds of kbit/s, but to filters installed at the phone
exchanges and along the lines. The signals are limited in bandwidth to allow their
multiplexing for long distance transmission. Analog and digital technology are
combined in the phone system. The voice signals from the subscriber are carried to
the local toll station via the twisted pair connection cable (analog communication). At
the toll exchange they are digitized and transported via high speed multiplexed lines
(cables, microwave links, satellites, fiber optics) to another exchange. Here they are
demultiplexed and carried again to their destination via twisted pair.
Digital data cannot be transmitted directly along a phone line because the limited
bandwidth would cut out the d.c. components and distort rapidly changing signals. To
overcome this problem it is necessary to use modems to match the digital data to the
characteristics of the phone link. Modem is the abbreviation of modulator /
demodulator. Modems are also denoted as Data Communication Equipment or DCE
(Section 9.3.6). A modem generates a carrier wave at a frequency between about
1000 and 2000 Hz and modulates it according to the data to be transmitted. The
frequencies and the modulation type used (amplitude, frequency or phase) vary
according to different standards.
Modem operation can be half duplex or full duplex. In half duplex, only one
device at the time transmits and the other receives. A protocol indicates when it is
time to change the sense of the transmission. In full duplex mode are used different
frequencies for the transmission in the one and the other direction, so that the data
can be exchanged simultaneously. Some of the most modern modems are able to
recognize and adapt themselves to the communication speed and other parameters.
9.8: Communication over Public Networks 351

A common interface between the computer or terminal and the modem is the EIA-
232-D (Section 9.3.6).
Modems operating with sophisticated coding schemes reach today about half of
the maximum theoretical speed as indicated by Shannon’s equation (Equation 9.3).
In presence of noise, their performance drops quickly and the need for error
correction schemes makes their throughput data rate actually less than for slower
modems. Typical current modems for dial-up lines operate between 1200 and 9600
bit/s, some reach up to 28800 bit/s on good lines with an high S/N ratio. Fast
modems can automatically switch back to a slower speed if poor line quality and little
available bandwidth require it. The speed of 28800 bit/s represents an upper practical
limit for transmission on conventional phone lines and will most probably not be
further increased. The trend today goes toward replacing analog lines with high-
capacity digital links altogether.
A solution that helps increase data transmission speed and is used in some
modems is data compression. For instance, instead of sending 100 „0“’s in a row, it is
more efficient to send a control code followed by a message specifying that the next
100 characters are „0“. The efficiency of data compression depends on the nature of
the data. It can bring notable gains in data with redundancies, but does not help if
input data is non-repetitive and follows a random-like pattern.

9.8.2 Digital Networks


The most important digital services provided by the telecom operators and
communication service providers for direct data transmission are:
• circuit switching
• leased lines
• message switching
• packet switching

Circuit Switching
Circuit switching is a different denomination for the use of modems on the phone
network. A phone link is dialed up and remains connected for the whole duration of
the communication. The operational costs depend on the time of establishment and
duration of the connection.

Leased Lines
A leased line is a permanently open connection between two fixed points. Lines
leased for data transmission are normal, analog lines that have been conditioned, i.e.
especially calibrated and shielded in order to offer more bandwidth and a better S/N
factor, which gives higher data transmission capacity. The rental costs for leased
lines is fixed per month or year and does not depend on the amount of voice or data
traffic. For data transmission on leased lines are used modems with typical speeds
from 19.2 kbit/s, 56 kbit/s and higher.

Message Switching and Internet


Another method of data communication is message switching. The whole digital
message is put on the network and transferred from node to node until its final
destination in what is known as store-and-forward fashion. Message switching is
352 Chapter 9: Digital Communication in Process Control

used in telex and for e-mail transfer, but is in general of no interest in industrial
automation applications.
A particular type of message switching network is Internet, which has won
worldwide reputation in the last years. Internet is an extremely flexible message-
switching network that has been technically built on all possible combinations of
digital networks connecting mainframe computers, mainly located at universities and
large corporations. The use of the TCP/IP protocol and routing scheme allow users to
exchange messages and interact worldwide.
It must be kept in mind, however, that Internet does not guarantee any type of
performance, neither that a message actually reaches its destination nor that it does
it within a predefined time. Internet cannot therefore be considered as a means for
real-time, process data communication. If it is necessary to monitor an object located
far away, some kind of digital communication link must be provided anyway to
connect that site with the nearest Internet server computer, from which messages
would be relayed to the central processing system. In such case, one can ask the
communication service provider to relay the digital messages directly to their
destination, without having to make a detour via Internet.
Companies with strong public-relations needs, like power utilities or chemical
industry, might want to establish Internet sites to present themselves to an interested
public or even allow to follow in real-time some basic aggregated processing
parameters (e.g. the instantaneous power production and consumption balance in a
power utility). This data is however not critical for operation of the system, and any
fault in Internet communication would have no negative consequences. Internet is no
suitable alternative for any type of process communication with defined quality and
timing requirements.

Packet Switching
The state of the art in digital communication is packet switching, which offers a
virtual network connection between the communicating nodes. The data from the
sender is divided in packets of limited length (up to some hundreds of Bytes each).
Each packet contains protocol information like destination address and sequence
numbering. The packets in the network are routed toward their destinations on virtual
channels. Each packet is routed independently of the others, so that it happens that
packets addressed to the same destination actually take different physical routes.
Under particular network load conditions, some packets could even reach their
destination before other packets that had been sent earlier. Thanks to the sequential
numbering, the last network node before destination can keep track of the right order
and reorganize the packets before forwarding them to their destination.
Packets from different users are multiplexed on long-distance channels, so that
network capacity is used more effectively than with direct connections and circuit
switching. The network can also be more evenly loaded because digital users do not
require full transmission capacity all the time, but transmit high-capacity data bursts
for short time periods. In this way, the users tend to compensate for each other on
loading the channel. Another important advantage of packet switching is that, in case
of a node crash, packets can be routed on a different path without the end users
noticing it and having to intervene. Thanks to these features, packet switched
networks normally show high availability factors. The costs for utilization of packet
networks depend usually from the total duration of the virtual connection (reflecting
the fact that equipment is ready to transfer the data) and the quantity of the
9.8: Communication over Public Networks 353

transmitted data. In general, digital data transmission on virtual networks is cheaper


than other means of digital communication.
Packet networks are generally accessed via a X.25 interface; the corresponding
ITU-T recommendations cover the first three OSI layers. The physical level interface
between DTE and DCE is X.21; this interface defines the electrical connection and
an handshaking protocol oriented to the network operations („dial number“, „line
busy“, „communication established“, etc.). The X.21 interface makes use of a 15-pin
connector of which only 8 contacts are used. However, the X.21 standard is seldom
used and therefore a provision, called X.21 bis, is made to allow the DTE-DCE
connection via EIA-232-D.
At data link layer of X.25 a specific protocol is defined, called Link Access
Procedure-Balanced (LAPB), with a frame format similar to HDLC (Section 9.4.5). At
network layer, X.25 provides for commands for establishing, managing and ending
the virtual connections. If the communication always takes place to the same
destination, the end address may be stored in the network computers so that the
virtual path can be immediately activated on request. This feature is known as fast
number selection.

9.8.3 The Integrated Systems Digital Network (ISDN)


Analog transmission is satisfying for voice communication but is a poor medium
for data transmission that has to be converted to analog form first. For data transfer,
a better way would obviously be a digital link all the way.
This is precisely the purpose of the Integrated Systems Digital Network (ISDN),
which has been defined in accordance with the OSI model. The basic idea of ISDN is
that all communication is either digital (data, FAX, remote monitoring) or can be
transformed to digital form, like voice through sampling, so that the best way to
transport it is with digital links all the way, from one end point (the subscriber’s phone
set or other device) to another end point. ISDN is the main concept for phone system
development at present time and until a bit well into the 21st century.
In the basic service for normal subscribers, ISDN provides the end user with two
64 kbit/s and one 16 kbit/s channels, called respectively B- and D- channels. The two
B-channels are used for two parallel communication services, as voice and telefax or
voice and e-mail at the same time. A maximum of eight communication devices may
be connected together under the same user number, although only two will be able to
operate at the same time. The 16 kbit/s D-channel is used for operational signaling
and to carry additional information, like shorter messages to be displayed on a phone
set window while its user is calling. In ISDN, voice is sampled at 8 kHz and
reconstructed at the opposite end; all other kinds of transmission, which are digital in
nature, are transferred directly to the line. The three ISDN channels are multiplexed
on the already installed subscriber twisted pair line, whose bandwidth capacity is
sufficient to carry the data.
Digital customers with high data traffic may use so-called primary access
services. In North America and in Japan, primary access consists of 23x B + 1x D
channels, for a total of about 1.5 Mbit/s. In Europe the service provides 31x B + 1x D
channels, totaling 2 Mbit/s. ISDN functions are requested with packets called Link
Access Procedure, D-channel (LAPD), with structure similar to LAPB and HDLC.
Another service of interest is Broadband ISDN with a capacity of 150 Mbit/s. The
innovation behind Broadband ISDN is that the service is of switched type, i.e. can be
354 Chapter 9: Digital Communication in Process Control

routed like conventional phone calls and is not limited to fast point-to-point
connections. As physical medium for Broadband ISDN optical fibers are used.
The two channels of the basic service have been introduced for marketing
reasons. With ISDN, a normal customer only interested in voice services would
notice a better signal quality and a faster connection time compared with the
conventional, analog voice network, but this alone is hardly a sales argument. The
advantage of providing two services at the same time, as would be the case with
voice and FAX, is for many users the deciding factor. Another argument in favor of
ISDN is that it does not need the rewiring of the end user connections; the
connection to new digital toll exchanges can be implemented via the older cabling.
With ISDN no special data networks would be necessary, as ISDN is a digital
network on its own. Thanks to the fact that ISDN was defined in detail before its
implementation began, all telecommunication administrations from different countries
can build ISDN following the same guidelines, thereby keeping compatibility
problems for equipment and network to a minimum. The industry produces ISDN
hardware for a world market and does no longer have to support several different
versions of the same product to use in different countries, as it has been the case
until not long ago.

9.8.4 ATM
ATM (Asynchronous Transfer Mode) represents a very fast switching technology,
developed to integrate heterogeneous types of digital traffic, including digitized voice
and video signals, which require high bandwidth together with no sensible delays in
transmission. In ATM it is not distinguished between the type of traffic, but all
information is conveyed in packets of 53 Bytes length, called cells. Each cell contains
a 5-Byte header with protocol information and 48 Bytes of user data. The fixed-length
definition is necessary for the design of high-speed, high performance switching. The
packet length may appear strange and is actually the result of a compromise
between two different sets of requirements. Short cells are more suitable for voice
and video transmission, while long cells fit best for data transmission. In course of the
definition of the standard the compromise was found at the intermediate length of 48
Bytes. In ATM, data packets longer than 48 Bytes are split in cells at the first node
and reassembled at the last node, similarly as for network packet switching of X.25
type or ISDN communication. Communication paths are virtual, but on establishing
communication all network devices are pre-programmed with routing information so
that, once communication is started, the cells can be immediately forwarded to their
destination without an analysis of the header information each time.
The ATM standard provides for different types of service, depending on the
application. Basically, it can be chosen between a constant bit rate between source
and destination, or a variable bit rate. The first service is necessary for applications
like voice transmission, where no random delays are acceptable. The second service
is suitable for e-mail and file transfer applications, where some delay between
transmission and reception is acceptable, especially if it helps to lower the
communication costs.
The most known standard interface to ATM is SONET (Synchronous Optical
Network), providing for 622 Mbit/s data transfer rate on optical fiber and 155 MBit/s
on twisted pair cable. Other standards are available for lower data rates, down to 1,5
Mbit/s, while other standards for higher speeds are expected to be defined in the
future.
9.9: Summary 355

9.9 Summary
Communication plays a central role in the operation of complex systems, where
different components must exchange data. The importance of communication in a
production or processing plant is shown by distributed control systems, that fully
depend on the data exchange among the different components.
The key parameter to describe communication capability is the capacity (in bit/s
or some multiple) of the communication channel. The capacity is function of the
channel bandwidth, of the noise on the channel and of the used coding method.
The Open Systems Interconnection (OSI) scheme has been introduced to bring
order in what is meant by „communication“ and „compatibility“. In OSI are defined
seven layers for the different aspects of communication, from the physical layer
(cabling, plugs and electric signal levels) to the application layer, where programs
can exchange information on predefined objects (files, production equipment) using
standardized descriptions. Several communication standards have been defined on
the basis of OSI.
Some solutions at physical medium and data link level are particularly important
in industrial automation and process control. Twisted pair, coax cables and optical
fibers are used to carry data. Important electrical interfaces are EIA-232-D, UART
and RS-485; all of them were treated in this Section. Widely used data transmission
protocols are HDLC and other protocols based on it (e.g. the Ethernet protocol) and
the TCP/IP protocol. The latter was initially developed for data transmission along
complex, interconnected networks but has been shown to be a sound product also
for self-contained networking application in industrial environments.
Two comprehensive concepts for information exchange in industrial processes
are MAP (Manufacturing Automation Protocol) and TOP (Technical and Office
Protocol). They are oriented to different aspects of industrial processes (production
vs. administration) and are also largely compatible with each other. Both MAP and
TOP are resource-intensive products and support the interconnection of a large
number of devices in medium-size to large plants.
Communication solutions used in low-level (or „factory-floor“) industrial
automation usually implement the OSI layers 1, 2 and 7. Fieldbuses cover those
levels with products especially designed to operate in industrial environments. The
development of LAN technology as well as the availability of low-priced, flexible and
standardized communication equipment are the reasons for the success of digital
technology at all levels of industrial automation, down to the sensor and actuator
levels. Thanks to new digital solutions like those provided by the Fieldbuses, sensors
and actuators can incorporate some processing capabilities and communicate
directly with data processing equipment, without the need for analog signal
conditioning and processing.
There is no field like communication where the issue of standardization is so
important. When a new technology must be used, but the related standards are still
missing or not fully formalized, it is suggested to use equipment by one single and
recognized manufacturer. This must however be committed and take responsibility to
provide the means for the future integration of his products in new frameworks
eventually provided by new standards.
356 Chapter 9: Digital Communication in Process Control

Further Reading
The classic reference for the foundations of communication theory is [Shannon /
Weaver 1949], a collection of their famous articles about the statistical analysis of the
communication process.
[Tanenbaum 1996] tells almost everything that is to be told about computer
communication, at a very high level and yet not boring, while [Tanenbaum 1995]
deals with computer communication networks as fundamental components in
distributed computer systems. Both books are strongly recommended, as
Tanenbaum is one of the few authors who can provide a very solid technical
foundation, breaking established writing patterns to provide new insights, yet never
leaving safe ground.
[Black 1989] is a modern and comprehensive guide to communication at large,
dealing with data transmission as well as with data and voice communication
technology as operated by telecom companies. The text contains also quite detailed
specifications about communication protocols. [Held 1989] describes data
communication by focussing on the equipment (modems, multiplexer, interfaces). It is
quite advanced reading, illustrating in detail the communication via public data
networks. The TCP/IP protocol is described at detail and with a good balance
between theoretical principles and practical issues in [Washburn / Evans 1996]. This
book provides a good perspective also on networking issues more at large.
A general introduction to PROFIBUS is given by [Bender 1990]. The complete
standard is available as DIN (German standardization organization) document (DIN
19245, Part 1 and 2). An overview of the proposals and expectations for a general
Fieldbus standard is given in [Wood 1988]. The issues related to open
communication for Fieldbus devices is treated in [Warrior / Cobb 1988].
[Kaminski 1986] describes the major ideas behind the MAP concept. In a parallel
article in the same journal issue, [Farowich 1986] introduces the TOP protocol. Some
other books about MAP and TOP have been published meanwhile.
The September 1991 issue of the journal Scientific American provides a good
introduction to the current state of things in communication technology. Together with
articles by American experts on data technology and artificial intelligence, the then
Senator and now US vice-president Al Gore makes a point for data superhighways
for the whole USA [Gore 1991].
Documentation about all the mentioned norms and standards can be ordered at
the national standardization organization. Some addresses are reported in the
Appendix „Standards and Standardization Organizations“.
10 Real-time Programming and Operating System
Support

Aim: To understand the issue of resource management by operating systems


and get acquainted with the methods used in real-time programming, with respect
both to theoretical constructs and practical solutions

Overview
The control of industrial processes is a complex task that is usually carried out
by several computers linked together and with different specializations; this concept
was presented in Section 9.6. The way the computers are programmed depends
mostly on the required response speed. Computers at the highest hierarchical level
usually run programs for database management and statistical analysis. These
programs might run e.g. once per day and therefore there are no strict requirements
on the response time; they are developed with the usual techniques used for
administrative systems, which are amply described in programming textbooks. The
case of computers at the lowest level is different; these are directly in control of the
physical processes. Here the timing requirements are usually so strict that special
programming methods and techniques must be used. These methods are the
subject of this chapter.
Hardware is as important as the software for building efficient real-time computer
systems. In a sense, hardware and software are logically equivalent; many solutions
can be realized with hard-wired circuits as well as with program instructions. In
general, hardware capacity must be available and the software has to exploit it. But
there are situations in which the software seems to fight against all the possibilities
the hardware can offer.
The purpose of this chapter is to present what real-time programming looks like
in practice. Ideally, a programmer is not supposed to leave the protected
environment of a programming language from which - according to language
handbooks - everything can be done. In the real world, programmers work with direct
calls to the operating system, write resident code and mix languages. In this chapter
it is not taken a stand for or against certain programming techniques, but rather on
the background of operating systems theory it will be shown how some problems can
be solved in practice.
Section 10.1 deals with the basics about programs and processes and Section
10.2 introduces some basic operating systems concepts, for one-processor as well
as distributed systems. Sections 10.3 and 10.4 treat the problems of resource
protection and mutual exclusion and introduce constructs for their solution (e.g. the
semaphore). Section 10.5 deals with interprocess communication and Section 10.6
with practical methods for real-time programming. A presentation of some languages
and operating systems for real-time programming in Section 10.7 concludes the
chapter. The material is formal-theoretical in the first five sections and practice-
oriented in the last two.

357
358 Chapter 10: Real-time Programming

10.1 General Concepts about Processes


10.1.1 Sequential vs. Real-time Programming
A program is the description of data objects (constants and variables) and of the
operations to perform on them. A program is just pure information; as such, it can be
recorded on any medium able to store information, as for example paper or a floppy
disk.
Programs may be analyzed and written at several abstraction levels by using
appropriate formalisms to describe the variables and the operations to perform at
each level. At the lowest level, the description is straightforward: the variables are
stored in memory cells labeled with their location/address. At higher levels, the
variables become abstract names and the operations are organized in functions and
procedures. The programmer working at higher abstraction levels does not need to
bother in which cells variables are stored or about the aspect of the machine code
generated by the compiler.
Sequential programming is the most common way of writing programs. The term
„sequential“ indicates that the program instructions are given in a fixed sequence,
one instruction after the other. The purpose of a sequential program is to transform
input data given in a certain form into output data of a different form according to a
specified algorithm (i.e. solution method, Figure 10.1). A sequential program acts
therefore like a filter on the input data. In a sequential program, the only entities are
the data and the code to act upon them. No time constraints are given; the result of a
run depends only on the input data and the properties of the algorithm. The algorithm
of a sequential program can, in principle, be coded in any programming language,
and lead to the same results. Also the execution speed of the processor does not
have any effect on the result. A faster processor will produce the result faster, but not
a different result than a slower processor.

input data sequential output data


program

Figure 10.1: Data processing via a sequential program

Real-time programming differs from sequential programming in several respects.


The program developer must be constantly aware of the environment where the
program is operating, be it a microwave oven controller or a robot arm positioner. In
real-time systems external signals usually require immediate attention by the
processor. In fact, one of the most important features of real-time systems is their
reaction time to input signals that must be adequate to satisfy the stated
requirements.
The special requirements of real-time programming, and in particular the
necessity to react quickly to external requests are not approached adequately with
the normal techniques for sequential programming. The forced serial disposition of
instruction blocks that should be executed in parallel leads to an unnatural involution
of the resulting code and introduces strong ties between functions which should
remain separated. It was already shown in Chapter 2 what problems may arise when
two functionally different program modules are bound together.
10.1: General Concepts about Processes 359

In most cases it is not possible to build real-time systems using the normal
methods for sequential programming. In real-time systems different program
modules or tasks have to be active at the same time, that is, operate in parallel
where each task is assigned to a specific function. This kind of programming is
known as concurrent programming to lay stress on the cooperation among the
different program modules. Concurrent execution may take place on the same
machine or on several CPUs connected via a network in distributed systems. In this
Chapter will be examined the principal issues related to both cases.

10.1.2 Programs and Processes


The basic operating entity in real-time systems are the processes - also called
tasks. There is a very important distinction between programs and processes.
Programs represent information on how to operate on and transform the input data,
while processes are programs in execution on a CPU. A process consists of code,
i.e. the program instructions (code area), a data area where the process variables
are stored and, depending on the actual implementation, a free work area (heap)
and a stack area (Figure 10.2). The stack area is contiguous to the free work area
and grows into it. A program written in the same high level language and then
compiled and executed on different machines will lead to different processes each
with its own code, data, heap and stack areas.

higher memory
addresses

stack
stack pointer
the stack expands
toward lower
work area addresses
(heap)

data area
(constants and
variables) data pointer

code pointer
program area (program counter)

lower memory
addresses

Figure 10.2: Example of internal memory organization of a process


360 Chapter 10: Real-time Programming

Each process is at all instants in a well defined state, unequivocally described by


the contents of the CPU registers, the locations of its code, data and stack areas,
and a pointer (the program counter) to the next instruction to execute in the code
area. This basic information about a running process is called its canonical state or
context. The existence of a context is a general fact, whereas what registers, states
and pointers are actually part of the context depends on the used processor and
operating system.
A particular type of processes are the threads. These are parts of programs that
can run independently on one or different processors. Threads are generated as
child processes of a running process and run concurrently. Other than processes,
threads share the data area, i.e. the variables, of the process from which they were
generated. Each process thread has however its separate code and stack areas.
Threads play an important role in the operating systems UNIX and Windows NT.
The steps needed to transform a program into a process consist of storage on a
computer-readable medium such as magnetic tape or disk, compilation, linking,
loading and execution. These steps are amply described in textbooks on
programming and operating systems, and will not be dealt with here.

10.1.3 Concurrent Programming, Multiprogramming and Multitasking


In real-time programming it must be possible to execute several processes or
tasks simultaneously on the same machine. These processes share the resources of
the system but are otherwise more or less independent from each other.

Multiprogramming or multitasking is the technique of letting several processes


run concurrently. This is a macroscopic effect that can be realized by using either
one or several CPUs: either the processes run on the same CPU, or on different
CPUs connected by communication links. In fact, many computer control systems
consist nowadays of several processors communicating via data networks or buses.
Multitasking is even realized on personal computers on which only one
application seems to run as several background tasks like printer spoolers, network
managers, the clock on the screen, etc. are either active or can be started on request
and run in parallel to the application programs.
To indicate concurrent processes can be used the following notation:

cobegin
x := 1;
x := 2;
x := 3;
coend;
write (x);

The execution of the instructions between the keywords cobegin and coend is
parallel (Figure 10.3). This instruction corresponds also to the generation of threads
on multitasking systems. The instruction cobegin does not impose conditions on the
relative order of execution for the different processes and the instruction coend is
reached only when all processes within the block are ended. If the execution were
sequential, then the final value for x would be 3. With concurrent processes it is not
possible to predict the final result with certainty; the tasks are executed, at least from
10.2: The Management of System Resources 361

an external viewpoint, at random. The final value of x in the example shown can
equally well be 1, 2 or 3.

cobegin

s1 s2 ....... sn

coend

Figure 10.3: The precedence graph for cobegin - coend

Sometimes in the technical literature the term concurrent programming is used


interchangeably with multiprogramming. These concepts have however somewhat
different meanings. Concurrent programming is the abstract study of programs with
potential for concurrency, or parallel execution, independently from the
implementation details of the machine on which they run. In other words, it is
assumed that each task is executed on its own virtual processor. Multiprogramming
is instead the practical technique for letting several programs run on a single central
processing unit or on a distributed computer system. Concurrent programming is
more difficult than sequential programming because the human capacity for following
the development of interdependent processes and to examine their mutual
interactions is limited.
Real-time programming is based on concurrent programming and refers also to
techniques to increase the efficiency and execution speed of programs: interrupt
management, exception handling and the direct use of operating system resources.
Real-time programs also require special testing methods.

10.2 The Management of System Resources


10.2.1 Single-processor vs. Distributed System Architecture
The reduction of the costs of hardware has made possible and economically
feasible the construction of computer systems based on several CPUs. These
systems are commonly known as distributed systems. The principal advantages of
distributed systems are
• economic (less cost per MIPS)
• safety (if some CPUs are down, the rest may run)
• better matching of the hardware to the actual needs.
In the definition of distributed systems it is necessary to look at how the
distribution of resources is achieved. In one extreme case the only common factor is
the connecting network, each machine is independent and they only exchange
messages with one another. In the other extreme case a truly distributed network
362 Chapter 10: Real-time Programming

operating system presents the user with such a homogeneous structure that the
underlying hardware is no longer recognizable. The user can place commands at will
and the operating system will determine the most appropriate way and location to
execute that command.
Distributed systems are used in computer control systems because the type of
application is inherently distributed and therefore there is an immediate match of
hardware and software in the distributed system and the control application.
An example in this sense was shown in Section 9.6. A complex technical
process can be organized in different levels and the client system matches these
levels with computer for data collection, organization and transmission at higher
levels. This type of distributed systems satisfies the principles listed above: it is more
economic than if a single CPU that would do everything (provided it could be built); it
is safe in the sense that - assuming that the system is well structured - the failure of
one component does not hinder the operation of the others and can be built to match
the process requirements.
The issue of safety is itself not immune from problems. In a distributed system,
processes running on different hardware depend on each other and on the network
operations. If a process on any machine, or the machine altogether, crashes, or if the
communication does not work properly, then not only the involved processes would
stop but also any other processes depending on them, for example because they
wait for answers that do not arrive.
Distributed systems need radically different software than centralized systems
do, because they are intimately connected with the network. A network operating
system must deal with machine resources as well as with network resources. The
operating system functions therefore cannot be decoupled from corresponding
network functionality. The operation of the network has a notable influence on the
operation of a distributed system. In fact, network operating systems are structured
in a layered way similar to communication protocols (see Section 9.2).
The major difference in single-processor vs. distributed system architectures is
the way to communicate among the processes. This operation is one of the most
important in multiprogramming and real-time programming and is going to be treated
more in detail later in this Chapter. Basically, when processes exchange data on a
single-processor system, they can do it by writing these data in some memory
location from where other processes can read it. A multitasking operating system can
manage the orderly writing in and reading from memory.
In a distributed system instead there is no common memory as such and
interprocess communication takes place by exchanging messages. When a process
has something to communicate to another, it builds a message and calls an
operating system routine to forward the message to its destination.
This communication principle is at the base of one of the most important
concepts in distributed operating systems: the client-server model. In this model, a
procedure or program (the client) may either request services from another program
or (the server) provide services to other programs. The „services“ consist of self-
contained operations like carrying out a computation, fetching external data or
performing an operation on a device, as for example painting a figure on a computer
screen. In a sense, the client-server model can be looked at as a more extensive
type of subroutine call, in which the server plays the role of a subroutine or system
procedure.
The client-server model is based on the exchange of messages between
programs. If the client and the server run on different machines and the messages
10.2: The Management of System Resources 363

must be routed along a data network, then the computer system operation is
distributed.
The more server and client procedures have computing capacity and can run
advanced functions independently, the more the number of network messages and
thus the load on the network is reduced. In fact it is an important advantage of
distributed systems that resource-intensive computations can be performed locally,
and that the different computers need exchange less data, although at an higher
abstraction level. In other words, in a well-designed system the messages
exchanged among machines contain information about the goals to reach („setpoint
is x=78.2“) and not about all intermediate steps to perform in order to reach that goal
(„what is x now?“, „x=63“, „increase with 16“. „What is x now?“, „x=79“, „decrease by
1“, etc.). The intermediate steps are taken care of by the addressed computer,
provided the software is designed accordingly.

10.2.2 The Function of Operating Systems in Real-time Environments


An operating system is a very complex piece of software for the management of
the hardware and software resources of a computer system. An operating system
offers a virtual (logical) environment consisting in CPU time and memory space for
the execution of the processes. With „virtual environment“ is intended a conceptual
environment with specific features; this environment may or may not exist in physical
hardware in the way it appears to the processes, i.e. it is used by them.
Multiprocessing functionality is nowadays available on almost all types of
computers and is one of the basic features of operating systems like UNIX and
WindowsNT. Multiprocessing deals in first place with the issues of resource
allocation and protection. At an earlier time, multiprocessing systems, then also
known as time-sharing systems, were designed to allocate expensive resources
among several users, check that the users do not influence each other and distribute
the operating costs between them. In real-time programming the purpose of
multitasking is to keep distinct operations separate from each other and to distribute
the workload among different program modules. In real-time systems, the only „user“
is actually the system to be controlled.
In time-sharing - or multi-user - systems, much attention was therefore dedicated
to protection and separation of users by means of passwords, access control, billing
for their share of system use, etc. Real-time programming is less restrictive in this
respect, as the system designer(s) know what each program module does. In
situations where each CPU millisecond counts, no time can be wasted for access
control overhead; for this reason file systems and protection mechanisms are not
important parts of real-time operating systems. Multi-user systems are also
supposed to be „fair“ in some sense, trying not to put any user at a special
disadvantage even under heavy machine load conditions. The same does not hold
for priority-based real-time systems, where the processes strongly differ in their
possibility to access the CPU.
In distributed systems the operating system has the additional function to
interface programs to the network and supervise the exchange of data and
messages between the computers connected to the network. The operating system
is therefore designed to interface and interact with the network facilities. In network
operating systems each machine has a large degree of autonomy; system-wide
requirements on the exchange of information make possible the interaction of
different processors even if they run under different operating systems, provided
each of them offers the necessary networking capabilities.
364 Chapter 10: Real-time Programming

10.2.3 Distributed Operating Systems


The denomination „distributed operating system“ is a general term that can
indicate solutions with different degrees of functionality. A distributed operating
system may be a network facility, a file system to access files across a network with
a common interface or even a collection of independent computers that appear to
the users of a system as a single computer.
The differences may be exemplified by considering the distributed system shown
in Figure 10.4. Suppose that on Machine Nr.3 is given a command to copy a file from
Machine Nr.1 to Machine Nr.2. Such a function basically reads blocks from the
source file into a buffer and then copies their content in the destination file.

machine #1 machine #2

copy file copy file


to buffer from buffer
LAN

machine #3

Figure 10.4 The operation „copy file“ in a distributed system

This operation is straightforward if it is executed on a machine only, but assumes


a different aspect on a networked system. A normal network file system works by
redirecting the inputs and outputs of any program, in this case the one that executes
the „copy“ function, to the Machines Nr.1 and Nr.2. The „copy“ command does not
need to be modified to operate on the network, because the network file system
overtakes all the overhead to manage the operations on the remote files. The „copy“
command does not even know that the files are not local; it just reads and writes
data blocks in succession as if they were from a local file and copies them to another
„local“ file. As a consequence, the execution of the „copy“ command will generate a
large amount of traffic on the network, to transfer the actual data and because of the
overhead due to the communication protocol.
A high level distributed operating system operates instead in an entirely different
way. The command is passed to a system program „copy“ running on the source or
the destination machine. The blocks are therefore copied on the most direct path and
without having to pass through Machine Nr.3.
This example does not only show that the general term „distributed operating
system“ has quite a shifting meaning and may indicate several types of widely
different solutions, but also that in real-time system programming one should not only
look at one programming level only (the file system interface with its „comfortable“
redirection facility) but also at the consequences in system operation, i.e. the
10.2: The Management of System Resources 365

resulting network load, that may reduce the performance of a system, if not hinder its
operation altogether.
Examples of operating systems used in distributed environments are UNIX,
OSF/1 and Windows NT. They will be treated more in detail in later Sections of this
Chapter.

10.2.4 CPU Management and Process States


In multiprocessing, the basic entities are the processes or tasks and their
contexts (Section 10.1.2). Only one process at the time is executed on the CPU. The
context of a process in execution can be „frozen“ at any time by saving the content of
the CPU registers; while the initial process is suspended, the CPU can run other
processes. In this way the CPU, as limited resource, can be divided among all the
processes.
To implement multitasking on a single processor, the execution of each task is
divided in several short intervals (Figure 10.5). The processor begins executing part
of the first task, continues with part of the second, of the third, and so on. A time
interval is assigned to each task, so that, for example, for 10 milliseconds the
processor is dedicated to the first task, then switches to the second, the third, etc.

process nr.

time
(a)

process nr.

(b) time

Figure 10.5: The principle of multitasking: (a) macroscopic effect; (b) CPU time division
366 Chapter 10: Real-time Programming

The macroscopic effect of the CPU time division among the processes is the
parallel execution of n processes. When n processes run in parallel in the system,
then each one of them „sees“ a fully dedicated CPU of capacity 1 n (that is, n times
slower) compared to the original, physical CPU. The execution of several tasks on
the same CPU or on different CPUs are two different realizations of the same logical
principle. In the first case the processes are distributed spatially, in the second case
they are distributed in time. Apart from overhead due to scheduling and intertask
communication, if n processes run on k processors, each process is ideally
assigned to a processor of capacity k n compared to the original one.
A basic multitasking system on a single-processor computer consists of a
procedure to save the context of a process on the stack or at defined memory
locations and restore the context of another process to continue its execution where
it was halted. A system program called scheduler selects, usually by means of some
priority mechanism, the next process to execute from among the loaded processes.
The scheduler runs itself as a process that is automatically restored after every
interruption of a running process.
The process switch operations are time critical and must be realized with
maximum efficiency. In processors that were not designed from the beginning for
multiprogramming, the process switch procedure must save on the stack the content
of all registers and other context parameters and then save the pointers to the stack
in a protected data area. Some processor types have been originally designed to
support multiprogramming and have compact instructions to save and recall the
content of all the registers and other context variables.
When the context of a process is saved, it is not necessary to also save the
values of the process variables. These are namely located in the process memory
area that is usually already protected by the operating system against changes by
other processes. The same does of course not hold for the CPU registers, which are
shared by all processes and whose content is changed all the time.
To be able to halt CPU execution at regular intervals in order for a different
process to be executed, a timing device external to the CPU is needed. A system
timer sends interrupt signals called „ticks“ to the processor at defined intervals, a
typical rate is one tick every 1 ms. At each tick, the CPU briefly suspends its
operations to check whether the current process has to be interrupted and a new one
loaded. The action that forces a running task to halt its execution in order to allow
another task to run is called preemption.
The minimal time interval assigned to each process before it is interrupted is
called time slice; it has the length of a few ticks. The length of the time slice
influences the performance of the system. If the time slice is short (~10-20 ms), the
system is quick to react to external events such as interrupts or terminal input, but
the process scheduling overhead gets an important share of the total CPU time. With
a longer time slice, the processes execute more effectively with less overhead, but
the reaction time gets slower.
The tick interrupt is not the only way to stop a process and transfer execution to
another. A process can stop on its own either because it has reached the end or
because it is idle waiting for an event, such as an I/O operation with a physical
device and that would take several ticks to complete.
A process executed in a multitasking environment can be found in different
states. These states are commonly shown with the help of a diagram (Figure 10.6);
they are defined as follows:
10.2: The Management of System Resources 367

waiting
4

1 2
removed ready running

6 3

Figure 10.6: The states of a process

• Removed. The program is present on system disk, ready to be loaded to


internal RAM memory.
• Waiting. The process is waiting for some external event (I/O data transfer,
input from keyboard, an external interrupt) or internal (explicit signaling by
another process) to become „ready“.
• Ready. The process is scheduled for execution as soon as the CPU is
available.
• Running, executing. The process that is currently being executed.

In Figure 10.6 it is also shown what changes from one state to another are
possible:
1. From „removed“ to „ready“. The process is loaded from disk to central RAM
memory, with relocation of all the relative addresses and assignment of the
work areas (code, data, heap, stack) with the related pointers.
2. From „ready“ to „running“. The process is selected by the scheduler to run and
is assigned CPU control via the process switch procedure.
3. The opposite change, from „running“ to „ready“, is controlled by the same
process switch procedure when it is time to let another process run. This may
be initiated by the running process itself, that for example must wait for a slow
I/O operation, or by the scheduler or another system program that forces the
interruption of the execution of the running process (preemption).
4. From „running“ to „waiting“. The process enters an idle state to wait for an
external event, that is often an I/O operation with units much slower than the
CPU. In some cases the process must wait for a determined period of time
because of an explicit program instruction.
5. From „waiting“ to „ready“. When the awaited event has occurred or the required
time has elapsed, the process is not immediately executed but is put instead in
„ready“ state. The scheduler will later determine when the process can be
executed again.
6. When the end instruction of a program is reached, the operating system may
eliminate a process from central memory.
368 Chapter 10: Real-time Programming

10.2.5 Strategies for Process Selection


Several strategies are possible for selecting from the processes in the waiting
queue the one to run next. Several conflicting factors have to be considered: some
processes need more execution time than others, must react quickly, are more
important, and so on. For the decision of which process may continue execution at a
given time the scheduler can follow different strategies, of which the most common
are round-robin rotation and priority allocation. The strategies are similar to those
used for bus arbitration (see Section 8.2.10).
The most simple selection strategy is the round-robin method: the processes
are selected one after the other for execution, following a fixed order and for the
same time interval. The name comes from the robin bird that makes his round tour
touching flowers in succession and (ideally) dedicates about the same amount of
time to every flower. The main advantage of the round-robin method is its simplicity;
on the other hand there are notable drawbacks when processes with different
requirements are allocated equal CPU resources, as some process will not be
adequately serviced.
A more complicated principle for process selection is based on the assignment
of priorities. At each process change, the scheduler assigns execution to the
process with highest priority. The priorities are defined by the programmer.
Straight priority allocation leads easily to unfair situations. The process with
highest priority would be always selected for execution, unless it is in waiting state,
and be the only one to run. It would also not be trivial to select between processes
with identical priorities. To avoid this situation, the scheduler decreases the priority of
the running process at a constant rate. Eventually, the priority of the running process
will be lower than that of some other ready process, which is then selected for
execution. In this way, it is ensured that all processes are executed. After some time,
the priorities of the waiting processes are set back to their nominal values. This
method is called dynamic priority allocation. It ensures that even processes with
lower priority will be executed and that processes with high initial priority do not hold
control of the CPU indefinitely.
The consequence of different initial priority allocations is that processes with
higher priorities will be executed more often than others. Processes that are called
often and/or must be activated quickly get higher priorities at startup time; less
important processes and for which a longer response time is acceptable get lower
priorities.
The priority-based process scheduling works correctly only when the various
tasks have different priorities. It does not help to give maximum priority to all
processes, as this certainly does not increase the execution speed of the CPU. Each
process would still have to wait until all other processes have been executed before it
can run again. A system where all tasks have the same priority works in a round-
robin fashion. The best results in the operation of a real-time system are achieved
when the relative process priorities are correctly defined and balanced. More on
priorities is contained in Section 10.6.7.

10.2.6 Internal Memory Management


After the CPU, the other most important resource to manage in real-time
systems is the central memory RAM. The methods used in real-time systems are
generally simpler than the ones used in multi-user time-sharing systems. In large
computer systems with many users, most of the programs and data are stored in
10.2: The Management of System Resources 369

secondary memory (hard disk) and are loaded to RAM only when they are needed.
This is acceptable for time-sharing and batch jobs when differences of a few
milliseconds or even seconds to start an execution are not very important, but not for
real-time systems in which there must be no delays in execution. For this reason, in
real-time systems the processes are usually always loaded in RAM ready for
execution. However, disk memory support could still be necessary in real-time
systems because the central memory is not always large enough to fit all programs
and their data.
To be able to utilize more central memory than what is physically available, on
middle- and large-sized computers the virtual memory management technique is
used. Virtual memory works on the assumption that the total size of processes and
data may be larger than the RAM space at disposal. A mass memory unit (e.g. a
disk) that allows fast data exchange with central memory is used. The mass memory
unit must be large enough to hold the total memory space required by all processes.
The operating system copies form the disk to RAM memory only those parts, called
pages, of a process and of its data area that are currently being referred to during
execution, while leaving the rest on external memory. Optimization strategies are
used to load the pages identified to be the most frequently used and to reduce the
number of disk accesses. With virtual memory, a process may address a space
larger than the one actually at disposal in central memory. On the other hand, virtual
memory adds notable overhead and slows down system operations because of the
repeated disk accesses.
The main reasons for the use of virtual memory and disks in real-time systems is
mainly economic. The central memory is more expensive per unit of stored
information than secondary mass memory. Another important aspect is operation
safety. In case of a system crash, it is possible to restore operations almost to the
point where the crash occurred if a constant copy of the processes and their data is
stored on disk. If a crash or a power failure occurs when the whole system is only
loaded in RAM, then all processes and their data would be wiped out, with no
possibility to restore them.
In real-time systems virtual memory is of interest only when it is fast and
efficient. To ensure fast reaction to external signals, the related service routines must
be permanently stored in central memory. Another important consideration related to
the use of secondary memory in real-time applications is whether it can be used in
the operating environment. Hard disk and floppy drives cannot be used in
environments with strong vibrations, shocks or intense magnetic fields.
One of the major differences between multi-user and real-time operating
systems lies in file management. The most important issues in multi-user systems
are directory structure and file protection. The management and protection of
directories, with the related controls and verifications at each access, impose an
overhead that is seldom acceptable in real-time systems. However, these activities
are usually not necessary in real-time systems because the mass memory storage is
mainly used for logs and reports, and moreover all processes belong to the same
owner. For all these reasons the need for a complex file system is usually not
warranted in real-time systems.
The most sophisticated operating systems allow the tuning of CPU and memory
management parameters to achieve optimal performance. The process priorities, the
length of the time slice, the page size in virtual memory and other operating system
parameters must be selected and combined in order to maximize the desired
performance.
370 Chapter 10: Real-time Programming

10.3 Mutual Exclusion and Deadlock


10.3.1 Resource Protection
In multiprogramming there are often situations in which the processes compete
for resources. If the assignment of these resources does not take place in a correct
way, this may lead to erratic behavior and even to the complete halt of a system.
Resources are not necessarily hardware components such as printers, interfaces or
the network; they can be variables in central memory as well. A classic example of
software resource protection is seat reservation for air travel. Before a flight, the
airline seats exist only in the memory of the computer reservation system. Obviously,
a seat cannot be allocated to two different customers, if these happen to show up at
two different counters and make a request at the same time. The seat information is
therefore a type of resource to protect, in this case a resource existing only in
software.
The program part in which access to a resource takes place and under the
assumption that this resource is protected in some way is called protected area.
There is a strong analogy between resource protection, CPU control allocation
and bus master arbitration in a multiprocessor bus system (Section 8.2.10). In all
these cases there is a limited resource (memory space, CPU time or the bus) which
must be divided among several requesting units in a safe, efficient and fair manner.
The criteria to assign the resource, be it a simple round-robin scheme or a more
complicated, priority-based allocation, must avoid deadlocks and lockouts, give
access to all requesting units in a finite time and ensure maximum throughput for the
whole system.
If different processes operate on common variables and read and modify them
without a defined precedence order, their interaction could lead to undesirable
results. This can be shown by two processes that access the same variable, first
reading and then modifying its value. If one process is interrupted just after the read
operation and before it could change its value, the other process may modify the
variable while the first is waiting. When the first process resumes execution it does
not „know“ that the variable has been changed and then proceeds working on an old
value. After all, in a multitasking environment a process does not know when it is
going to be interrupted and when it can start again.
The problem is that the variable is accessed by both processes without
restrictions. It does not help to check the formal correctness of different programs if
the effects of the possible interactions among processes are not taken into account.
A situation where the result depends on the relative random order of process
execution is called race condition.
This problem, known as resource protection, is central to the whole theory of
multiprogramming. It has been studied for a long time and different solution
strategies have been devised. These strategies vary with the type, technology and
most of all access speed of the resource to protect.
In the above-described case, the variable accessed by both processes must be
considered as a resource to protect from their concurrent action. In order to avoid
race conditions, access to the resource by the processes should not be free and
indiscriminate, but follow instead determined precedence rules.
Slow units, which tend to be used for quite a long time by a process (printer,
magnetic tape unit) are usually allocated exclusively to the requesting process
according to a precedence queue. Alternately, a resource is permanently allocated to
a single process (called „spooler“, from „simultaneous peripheral operations on line“)
10.3: Mutual Exclusion and Deadlock 371

that accepts as input from other processes the names of the files or other data
objects, organizes them according to some precedence criteria and sends them one
at a time to the requested unit.
Data networks are still faster hardware resources that on the one hand must also
be protected from concurrent access, but on the other hand must be shared among
many users. Methods for the access to data networks have been shown in Section
9.5. These methods have many similarities with the methods for resource protection
used in programming. Still other methods are used for the protection of resources
with very short access time and which are continuously referred to by different
processes, as for example variables in central memory, records in a file or I/O
interfaces on a data bus. This section is mainly devoted to such methods and will
show different approaches together with their consequences.
The goal of a correct coordination of resource access is to define procedures
and methods so that at least one process, but only one at a time, can access the
resource. In the definition of such procedures one should avoid defining the limits too
narrowly, otherwise execution would no longer be parallel and the processes would
depend too much on each other.
The principal rule for resource protection is that a process must never change
the state of a shared resource while another process has access to it. Or more
generally: a process should never access a resource currently used by another
process, independently of whether or not it is going to change its state. The second
rule is more restrictive but simplifies practical control operations because it is not
necessary to keep track of what operations each process is going to perform on the
resource.
A first, elementary, method to guarantee resource protection is to disable
interrupts while a resource is accessed. This effect is achieved by blocking the
reaction of the processor to the interrupt signals. As process switching is initiated via
an interrupt, disabling the interrupt prevents process switching as well. A process is
then guaranteed to work without interruptions when it accesses a shared resource.
Obviously, this is not a good solution. Interrupts should normally be enabled all
the time to ensure quick reaction to special conditions that require immediate
attention. In a control system part of the program modules are controlled by
interrupts and disabling them can inhibit the processor from reacting to fully
legitimate requests. If interrupts are not buffered after they have occurred and
handling is disabled, they may remain unserviced.
Interrupt disabling should then be used with extreme care and only when no
other solution is feasible. It should also be limited to a few code instructions.

10.3.2 Mutual Exclusion


A different approach to the problem of resource protection is possible if this
problem is considered to be a problem of mutual exclusion, that is, where access to
a protected resource is done from only one process at the time. No process should
access a resource until the resource is explicitly released by the process that
requested it first.
The goals of a correct resource protection are that:
1 Only one process at a time has access to a protected resource.
2 The processes remain mutually independent. The arrest of one process
should not hinder the other process(es) from continuing their execution.
372 Chapter 10: Real-time Programming

The above statements relate to the two correctness properties safety and
liveness. Safety means that access limits have to be respected, so that a protected
resource is not accessed by more than one process at the time. Liveness indicates
that a program at some time will do what it is supposed to, or, in other words, that it
will not stop and wait indefinitely. Safety is a so-called static and liveness a dynamic
property. Safety can always be obtained by giving up some or all concurrency
between the processes. In fact the safest programs are strictly sequential, because
no parallel access to a resource from different parts of the program is possible
altogether.
A practical and common method to manage access to resources is to use
protection variables. A straightforward protection method is based on the use of one
binary variable, f1. This variable is changed by both processes so that one of them
has access to the protected resource when f1=true and the other when f1=false.

program protect_example (* resource protection *)

var f1: boolean;

begin
f1 := true;

cobegin

while true do (* repeat forever *)


begin (* process A *)
repeat until f1=true;
(* protected resource *)
f1 := false;
...
end; (* process A *)

while true do (* repeat forever *)


begin (* process B *)
repeat until f1=false;
(* protected resource *)
f1 := true;
...
end; (* process B *)

coend;
end. (* protect_example *)

This solution satisfies the mutual exclusion principle: the two processes control
the value of f1 and enter the critical region only when f1 takes different values. A
process in the critical region may be assumed to be the only one there.
On the other hand, this solution introduces new problems. The slowest process
determines the total execution speed. It does not matter if A runs faster than B or
vice versa, because every process must wait until the other has changed the value of
f1 before it can run again. In addition, should a process stop execution for any
10.3: Mutual Exclusion and Deadlock 373

reason, even the other would have to stop, at most after one loop. Moreover, the
continuous test loops on f1 are a waste of CPU power.
These problems are a consequence of the introduction of the control variable f1,
which creates unnatural bonds among the processes in order to synchronize them.
Modules that should in principle be independent are tied together by f1, which
actually makes a sequential process out of the two modules. The same result would
be obtained by eliminating f1 and executing both processes in succession in a single
loop.
In a different solution, the protection variable f1 is reset after the test on its value
and before accessing the protected resource:

repeat until f1=true;


f1 := false;
(* protected resource *)
f1 := true;
...

In this case the processes are disjoint (and thus the liveness condition is
satisfied), but the solution is not correct either. If the interrupt for process exchange
halts process A after the test f1=true but before the assignment f1=false and process
B does a similar check on f1, then both processes are enabled to access the
protected resource against the safety property. The use of only one protection
variable for a particular resource leads to the need for protecting the variable, which
has now become a common resource itself.
Some solutions based on the use of several protection variables have been
proposed, but basically they can be considered as curiosities of little practical
importance. In conclusion, it is better not to introduce new variables for
synchronization of parallel processes because they bring new bounds and become
themselves common resources.
To circumvent the problem, some computers have an instruction called
test_and_set (TAS) which combines the check of the state of a boolean variable
and its setting in one operation which cannot be interrupted. The importance of the
test_and_set variable is due to the fact that other synchronization and resource
protection procedures can be built on it. The fact that the test on a variable and its
modification are unified operations is sufficient to ensure protection.
The test_and_set instruction is functionally equivalent to the
read_modify_write cycle in the VMEbus system (see Section 8.3.2). In both cases,
it is necessary to be able to count on the indivisibility of the two operations, read and
write. If the instruction test_and_set - or a similar one - is not present in the used
programming language or in the microprocessor instruction set, it can be realized if it
is possible to disable the interrupts for the brief time of its execution.
The practical realization of critical regions and mutual exclusion in a distributed
system presents particular problem of its own. To begin with, there is no direct
equivalent of the test_and_set variable because here is not just one processor. In
principle, a central coordinator could be assigned to every resource. Any process
wishing to access the resource would first ask the coordinator, which then grants
permission to the requesting processes one at the time. However, this solution is
much less straightforward than it seems. The central coordinator process acts as a
single point of failure, if it crashes the resource remains either blocked or
374 Chapter 10: Real-time Programming

unprotected. Moreover, if the resource is just a variable in memory, then a full


algorithm to protect it is not the most economical solution. A further aspect is that
some resources must be accessed first in order to communicate with a central
coordinator; for example a message via the network is necessary in order to send a
request for accessing the network.
A possible alternative - as already illustrated for communication networks
(Section 9.5) the use of a token that is passed among the processes. Only the token
holder has the right to enter the critical region. The problems are here similar to
those for networks: if the process that holds the token crashes, a mechanism must
be available to generate a new token. Again, the method would be very cumbersome
and processing-heavy to protect a few variables in memory.
In conclusion, there is no practical, efficient and lightweight method for resource
protection in distributed systems comparable to the test_and_set flag of
uniprocessor systems. Every case must be evaluated on its own and a practical
solution devised for the actual type of problem.

10.3.3 Deadlock
The deadlock is the state when some or all processes in a system are halted
and wait for something to happen. If for each process this „something“ can only be
initiated by another of the waiting processes, then all processes end up waiting
endlessly in a deadlock condition (Figure 10.7).

wait for „B“ wait for „C“


A A

wait for „A“

B C
wait for „A“ B
wait for „B“
(a) (b)

Figure 10.7: The deadlock. (a) Mutual deadlock; (b) circular deadlock.

A different case of deadlock is when one or more processes still run but fail to
make any progress. This situation is called starvation; this is for example the case
when running processes continuously test the value of a condition variable which is
not going to be changed because the other processes are also busy testing. In other
words, deadlocked processes are in the „waiting“ queue (i.e. they are blocked) while
starving processes are „ready“ or „executing“, but do not make any progress.
Deadlock and simultaneous access to a protected resource are two symmetrical
problems related to extreme situations. In one case each process waits for the others
to move first, in the other many processes move together.
10.3: Mutual Exclusion and Deadlock 375

Several approaches can be tried to solve the problems caused by deadlocks.


The simplest approach is to ignore the problem altogether, and live with it, that is,
accepting to have to kill some processes or boot the system manually when a
deadlock occurs. Obviously, this solution is not satisfactory in real-time systems, in
particular if they must run unattended.
Other approaches are the detection of deadlocks followed by rescheduling or
killing some of the involved processes and the prevention of deadlocks, that is done
by allocating resources in such a way that deadlock at least in principle cannot
happen.
For deadlock detection it is necessary to check continuously the status of all
running processes and of their mutual interactions, in order to detect loops of the
kind shown in Figure 10.7. This check can be made by a background program that is
started periodically by the scheduler. But even such a program cannot guarantee to
detect all deadlock situations. In distributed systems, information about the state of
all processes on all machines must also be brought to the deadlock detection
program. Besides the overhead network traffic that is created, there is always a risk
of a mismatch in the timing of the process states that are reported, so that deadlock
situations may be erroneously detected, with the consequent killing of the involved
processes.
Deadlock prevention means to try to avoid from the very beginning situations
that can lead to deadlocks. The program code must be structured and the process
interactions must be organized in such a way that deadlocks are avoided from the
very beginning.
It has been shown that several conditions must be verified at the same time for a
deadlock to occur. If any of these conditions is not true, deadlock cannot happen.
1. Mutual exclusion. There are system resources that can be used only by one
process at the time.
2. Non-preempted allocation. A resource can be released only by the process that
allocated it (i.e. the process cannot be forced from outside to release the
resource).
3. Successive allocation. A process can allocate the necessary resources one at a
time.
4. Inverse-order allocation. The processes can allocate resources in different
order.
These four principles indirectly give the key for avoiding deadlock situations; it is
sufficient that one of them is not true to make deadlock impossible.
The first principle cannot be changed, as mutual exclusion is the principal
condition to guarantee the ordered management of shared resources.
The second principle requires that the operating system recognizes a deadlock
situation and reacts accordingly by forcing the release of a resource by a process.
This solution is feasible only if the forced killing of processes can be accepted and
depends on the kind of recovery mechanisms.
According to the third principle, the alternative to allocating one resource at the
time is to assign all needed resources at once. The practicability of this solution
depends of course on the type of resource and on whether they can remain unused
by other processes for the full time of their allocation by a process. If a process
allocates ten variables at a time during the execution of a few instructions without
knowing which ones are actually going to be used is one thing; to lock an entire
database during the complete execution of a process is another.
376 Chapter 10: Real-time Programming

Several variables or resources can be grouped together in what is called critical


section. These resources are program parts that need to be protected and are
allocated at the same time to one process only.
If a system is structured according to the client-server model and operates on
the base of self-contained transactions, then the deadlock problem becomes easier
to solve. In case of deadlock the matter becomes to abort the transaction (that can
be restarted at a later time), rather than to kill one or more processes.
The violation of the fourth of the above-listed principles is what in most cases
leads to deadlock conditions. If two processes need two resources A and B where
one allocates them in order A-B and the second in order B-A, it is sufficient that the
first process allocates A, is interrupted and control passed to the second process,
which allocates resource B, and a deadlock is the result. Each process is now
waiting endlessly for the other to release its resource.
The fourth principle also suggests a practical way to avoid deadlock conditions.
If a precise precedence order in which the resources can be requested is defined
and all processes follow this order, deadlocks can be avoided. In the example above
this would mean to define the order „A must be assigned before B“ and that all
processes strictly follow it. The release of resources must then strictly take place in
inverse order. In principle, this method should not be difficult to apply in the
development of real-time systems as long as all the processes are in the hands of
the same programmer(s), but quickly turns to be unpractical for an increasing
number of resources or shared variables.

10.4 Process Synchronization: Semaphores and Events


10.4.1 Semaphores
The introduction of a time precedence order in the execution of different
processes is called synchronization. Process synchronization is a basic function in
multitasking operating systems and is used in practice for the implementation of
resource protection: the access to a resource is ordered in time with help of a
synchronization mechanism. A process can thus access a resource only after
another process has released it.
As shown earlier, the introduction of extra variables for resource protection is not
free from problems, because the protection variables become common resources
themselves. The root of the problem is that the operations of check and change of
the value of a variable are separated and can be interrupted at any time. Moreover,
continuous tests on the values of the variables waste CPU time.
The semaphore is a basic synchronization method to overcome the problems
related with protection variables. It is in fact probably the most common method for
process synchronization.
A semaphore, in its classical definition, is an integer variable with value ≥0. Its
initial value is defined in its first declaration in a program and is usually equal to 0 or
1. Semaphores that can take only the values 0 and 1 are called binary
semaphores.
Two operations are defined on semaphores: signal and wait. The signal
operation increases the value of the semaphore by 1; the process that calls the
signal function may continue its execution unhindered. The wait operation leads to
different results, depending on the current value of the semaphore. If this value is
10.4: Process Synchronization: Semaphores and Events 377

greater than 0, it is decreased by 1 and the process calling the wait instruction can
proceed. If the semaphore has value 0, the wait is halted at the wait instruction until
the value of the related semaphore is increased again by another process with a
signal operation. Only then is it possible for wait to decrease the value of the
semaphore and proceed with execution.
It is very important is that the operations of test and decrement of the wait
function are executed in one step only. The operating system is not allowed to break
the execution of wait after the test on the value and before the decrement operation.
The semaphore wait has the same operational significance as the function
test_and_set.
If several processes are waiting for the same signal, only one of them may
continue its execution when signal is given. Depending on the implementation, the
processes may wait in an ordered „First In, First Out“ queue or be selected to
proceed either at random or according to their priorities. The semaphore function
alone does not imply a given wait and execution order.
The names of the functions signal and wait have mnemonic meaning: signal is
associated with a „go“ to a process and wait is self-explanatory: if the semaphore
has value 0, the process must wait for a signal. In the literature are also used other
names for the functions signal and wait, although the function is basically the same.
With the introduction of semaphores, the resource protection problem of Section
10.3.2 gets a straightforward solution:

program sem_example (* resource protection *)

var P1: semaphore

begin
P1 := 1;

cobegin

while true do (* repeat forever *)


begin (* process A *)
wait(P1);
(* protected resource *)
signal(P1);
...
end; (* process A *)

while true do (* repeat forever *)


begin (* process B *)
wait(P1);
(* protected resource *)
signal(P1);
...
end; (* process B *)

coend;
end. (* sem_example *)
378 Chapter 10: Real-time Programming

With the use of semaphores, the two processes can access the common
resource in an ordered manner. No unnatural bonds are introduced: if one process
runs faster than the other one, it will just access the resource more often in a given
time interval. A process is forced to wait for the other one only when the latter is in
the protected area. Liveness is also guaranteed. If a process should for any reason
stop running, provided this happens outside the protected area, the other is not
hindered from continuing its execution.
The use of semaphores alone does not guarantee protection against deadlock,
because this depend on how the semaphores are used. If two processes use the
semaphores like this:

wait(P1) wait(P2)
wait(P2) wait(P1)
... ...
(* protected resource *) (* protected resource *)
... ...
signal(P1) signal(P2)
signal(P2) signal(P1)

then there still is a risk for deadlocks. If the interrupt for a process change arrives
between the two wait instructions of the first program, and the second program
executes its wait instructions, deadlock is the result, because each program waits for
the other to release the semaphore. The problem lies in the fact that although the
semaphore guarantees the uninterrupted operations of testing and setting the value,
it remains a protected resource. In the shown example, the principle of ordered
allocation is openly violated, so that deadlocks may result.
The semaphore can help in the synchronization of related activities. For
instance, if a process has to operate on data only after this has been read from an
external port, the code can have the following aspect:

Process Read Data Process Operate on Data

while true do while true do


begin begin
(* get new data *) wait(data_available);
signal(data_available); (* process new data *)
end; end;

This solution separates the operation of data read from data processing. If new
data is available but the data processing algorithm is not yet ready to execute, the
presence of the data is indicated with a semaphore value higher than 0. Under the
assumption that the new data is stored and saved, the processing routine can then
catch up with processing at a later time. In real-time systems this is a common way
to separate routines that must react quickly (as for example fetching data from an
external port) from other processes.
For the protection of critical sections, which by definition can be entered only by
one process at the time, binary semaphores, also called mutex („mutual exclusion“)
should be used. Normal semaphores are not suitable in this case because their
value can be higher than 1 and therefore several programs could gain access to the
10.4: Process Synchronization: Semaphores and Events 379

resource by reducing the value of the semaphore. A signal operation on a binary


semaphore will change its value from 0 to 1, or leave it to 1 if it already had that
value. A wait operation will reduce the value from 1 to 0 and allow the process to
proceed further. If the semaphore has value 0, then the process executing wait on it
must stop until the value of the semaphore changes.
Synchronization errors due to incorrect use of semaphores may be difficult to
trace. A process not executing a wait instruction can enter a protected region
together with another process, leading to unforeseeable results. Of course, it is not
said that such an error will show up during testing, and it may never even happen
during the whole lifetime of a system. It is easier to find is the opposite error: a
missing signal operation should at a certain point lead at least one process to halt,
which is usually easier to detect.
A compiler does not have the possibility of checking whether the semaphores
are used correctly, i.e. if wait operations are matched in other points by signals, and
whether the semaphores are associated to the respective resources, because this
depends on the logic of the algorithm. Moreover, the location of semaphores in
programs is arbitrary in the same way as other instructions. The burden to verify the
correctness of the code lies then with the programmer. The use of structured
programming methods helps considerably in this task.
In conclusion, semaphores are convenient high level substitutes for the single
operation test_and_set and help avoid continuous test loops, but if they are
misused, they can lead to race conditions and deadlock.

10.4.2 Events
A frequently encountered situation is that several processes access common
data and that each one of them must operate on that data only if some condition is
satisfied (which may or may not have to do with the data), and this condition may be
different for each process. The condition may for example be the arrival of new data
to an input port. All processes have the following structure:

begin
wait until condition;
modify data;
end

The code is divided in two major parts. First it is checked whether the condition
is satisfied, and then the operations on the data take place. The checking whether
the condition is satisfied does not modify the data and therefore does not need any
special access protection, but the access to the data must be coordinated among the
processes.
One solution based on semaphores would make use of two such variables, one
to control access to the protected region with the data and the other one to indicate a
change in the common data, so that it is worth repeating the test.
The use of the first semaphore is straightforward, while the second leads to a
particular problem. It is namely necessary to keep track of the number of waiting
processes and provide that when the condition changes all the processes are
released to check the new condition, which means to generate a number of
semaphore signals equal to the number of waiting processes. This solution is not
380 Chapter 10: Real-time Programming

satisfying because of the waste of CPU time due to all the tests. It is also easy to
make errors in the code.
To solve this particular kind of problem, a new synchronization variable has been
defined, the event with the associated operations await and cause (other names are
used in the literature and in operating systems). A process that reaches the
await(event) instruction remains waiting until the value of event changes. This
change is controlled via the function cause. On a change of cause(event) all the
processes waiting for it are released, and not only one process as in the case of
semaphores. An event function can be implemented with a binary variable as well as
with a counter, but even if its definition differs, the basic principles remain the same.
Contrary to the semaphore, an event variable cannot be used to protect a critical
section from the concurrent access of several processes, just because by definition it
releases all the waiting processes. The earlier illustrated problem is solved with the
help of event and semaphore variables if all the programs have the following aspect:

var mutex: semaphore;


change: event;
begin
while not condition do await(change);
wait(mutex);
(* operations on common variables *)
signal(mutex);
cause(change);
end;

At each change in the event value, all processes test condition and only the
processes for which condition is verified are allowed to proceed. Access to the
common resource is then protected with the semaphore mutex. Here only one
process at the time is allowed to proceed. This solution is simpler than the one based
only on semaphores. It is also more efficient because the processes perform the
condition tests only when it is worth doing it, i.e. after the value of the related
variables has changed.
An important type of event in real-time systems is associated with external
interrupts. The processing routine, i.e. the interrupt handler, waits for an interrupt.
When this takes place, program execution is resumed.

10.5 Interprocess Communication


10.5.1 Common Memory Areas
Processes that work in cooperation usually need to exchange information. A
multitasking operating system must therefore provide an adequate method for this
purpose. The exchange of data should be transparent for the processes, meaning
that it should not modify the data to be transferred and that the communication
procedure should be accessed in a simple way from within the processes.
A simple method for data exchange is the use of common memory areas to
which different processes have access for read and write. These memory areas
represent critical regions to be protected, for example with semaphores. The main
advantage of common memory areas is that access to them is direct and immediate
apart from semaphore wait operations. The areas can be also organized for
10.5: Interprocess Communication 381

structured data exchange: a process might write fields one by one and another
process read whole data blocks at a time.
When programming at machine level, common memory areas are located at
known addresses in primary memory. In high level languages global variables
accessed by several subprocesses are used instead. This happens for example with
the „threads“, because by definition their variables are global and function as
common memory areas. In case of potential conflicts in the access to the common
areas, these must be protected by semaphores.

10.5.2 Mailboxes
A different communication method that allows data exchange and process
synchronization at the same time is the mailbox. A mailbox is a message-oriented
data structure, in which the messages can be deposited and collected (Figure 10.8).
Several mailboxes may be defined within the same system to allow the exchange of
different types of messages.

mailbox

input message message output


message nr. 2 nr. 1 message

Figure 10.8: Mailbox operation

In many operating systems mailboxes have the aspect of logical files and the
access procedures are similar to the ones to access physical store devices. The
allowed operations on mailboxes are creation, opening, message writing, message
reading, closing, deleting. Some convenience operations like reporting the number of
messages and „peeking“ at a message without actually deleting it from the mailbox
are also offered by some systems.
Mailboxes are located in central memory or on disk, and exist only as long as the
system is powered up and operating. If they are physically located on disk, mailboxes
are classified as temporary files, to be deleted at system shutdown. Mailboxes do not
have generic identifiers or names like real files; they are labeled with logical
identifiers defined when they are created. All processes that use mailboxes address
them with their logical identifiers.
To create a mailbox, the operating system defines pointers to a memory area for
read/write operations and the associated variables for access protection. The main
implementation methods are either a buffer area with size defined at creation time or
a linked list structure which in principle does not put any limits on the number of
messages that the mailbox can hold.
In the most common implementations, a process intending to send a message
writes it in the mailbox in a way similar to writing in a file:

put_mailbox (#1, message)

In the same fashion, a process intending to receive a message reads it from a


mailbox with an instruction of the kind:
382 Chapter 10: Real-time Programming

get_mailbox (#1, message)

Writing a message in a mailbox is a fairly easy operation: the content of the


message is simply copied in the indicated mailbox. It may happen that the mailbox
lacks memory space to store the new message, indicating that either the mailbox is
too small or the deposited messages have not yet been read out.
In reading from a mailbox, the message that was written first is passed out and
copied into the receiving data structure. After having been read, a message is
deleted from the mailbox. A read operation from an empty mailbox may lead to
different results depending on the actual implementation. The output might consist in
an empty string (i.e. of length 0), or the read operation might be blocked until a new
message is available to be read. In the last case, to avoid the undesired halt of a
process, the number of messages currently stored in the mailbox should be checked
beforehand.

10.5.3 Pipes
A pipe represents a data channel between two processes of which one writes
and the other reads characters. Pipes were first developed in the UNIX environment
as a means to redirect the input and output of a process. According to the initial
concept, hardware devices with possibility for data input/output are considered to be
equivalent to files and to the input and output of programs. Each program has a
standard input and output (e.g. keyboard and terminal screen), but this can be
redirected or chained, so that for example the input and output of a program may
consist in files. When the output of a program is redirected to the input of another
program, the communication link is provided by the pipe (in operating systems the
pipe character („|“) is used as indication of this redirection). Pipes are used in the
operating systems UNIX, OS/9 and Windows NT as a method for interprocess
communication.
Pipes can also be considered as a particular type of mailbox. The difference
between pipes and mailboxes lies in the organization of data to be exchanged. While
mailboxes operate with messages, pipes are principally character-oriented and do
not require any particular structure for the messages. In some operating system it is
however possible to define a structure for the transmitted data. Normally a process
that executes a read operation from a pipe will wait for new data to read and until the
operation is complete. Current operating systems usually provide methods (flags or
functions to „peek“ in the pipe) in order to avoid to lock a program if this is
undesirable from the program logic.
The operations on pipes are equivalent to those to read and write physical files
with functions as define, open, put/write, get/read, close, delete. Extra operations
may allow for example the setting of mode flags, the definition of buffer size and
more.
Due to their uniformity of treatment of input/output for files, physical I/O devices
and other processes, pipes are a natural methods for interprocess communication in
client-server systems. UNIX pipes may in some cases be dependent on the TCP/IP
communication protocol, while pipes in Windows NT operate under any transport
protocol. The simplicity of the pipe-supported I/O-channeling should not distract from
the risk of generating overhead in the execution phase, especially on networked
systems (see Section 10.2.3 and 10.6.7).
10.5: Interprocess Communication 383

10.5.4 Remote Procedure Calls (RPC)


The client-server model is based on the exchange of messages. This exchange
can take place either by building data packets in a „regular“ fashion to be channeled
for example via pipes, or by calling remote procedures. The principal procedure for
data exchange and synchronization in client-server environments is the Remote
Procedure Call, or RPC for short. An RPC can be considered as a subroutine call in
which the operating system takes care of all the details for routing the call to its
destination.
The advantage of RPCs is that the calls to the remote procedure can be treated
(and look like in programming) as local subroutine calls. All details about message
routing, passing to the destination routine and others are taken care of by the
operating system and the network system, so that programming is greatly simplified.
An important aspect in the use of RPCs in real-time environments is whether
they are blocking or non-blocking. Blocking RPCs do not return control to the calling
process until their operation has been completed, and for example data is available
as answer. Non-blocking RPCs have a time-out feature that passes control back to
the calling procedure after some time has elapsed and even if the expected answer
was not produced, together with an appropriate error code. Non-blocking procedure
calls are therefore of primary importance to guarantee the liveness of a system.

10.5.5 Comparison of the Methods for Synchronization and Communication


The main problems related to concurrent programming, mutual exclusion,
synchronization and interprocess communication may seem to be distinct, but they
are in effect different aspects of the same thing. A synchronization method can be
used to implement mutual exclusion and communication functions. Similarly, with a
method of interprocess communication it is possible to realize the functions of
synchronization and mutual exclusion.
For example, a semaphore is equivalent to a mailbox in which are stored
messages of length 0. The operations signal and wait are equivalent to mailbox put
and get; the current value of the semaphore is equivalent to the number of the
deposited messages. Analogously, mutual exclusion and resource protection can be
realized with mailboxes. In this case a message would assume a „token“ function.
The process that has received this token gets the right to enter a protected area or
dispose of a system resource. On exiting the area or releasing the resource, the
process deposits the token in a mailbox. The next process to read and get the token
can then enter the protected area.
The relation among the principles is of practical importance only when in a
system only one method is implemented and the others must be built on it. Modern
operating systems that support multitasking and real-time operations offer all these
methods. In addition, message passing and access to common memory areas is
slower than the control and update of semaphore and event variables and involves
data processing overhead. When it is possible to choose from among different
synchronization and communication functions, the function most apt to solve the
specific problem should be used; the resulting code will be clearer and probably even
faster. It is also very important to consider how efficiently the solutions are
implemented in practice in the actual software environment. Strange and unnatural
constructs should be avoided as much as possible.
384 Chapter 10: Real-time Programming

In distributed systems there is always a risk that messages get lost on the
network. If the networking system is configured to check that the transmission was
successful and there are provisions for retransmission of lost messages, then the
application program does not need to implement an extra verification. As the result of
lower-level operating system and network interface calls is usually reported with a
success (or error) code at higher levels, the application program only needs to check
this result code to see whether the attempt was successful or not, and possibly
repeat it.
If no check is provided, for example because a service like the network Internet
Protocol (IP) is used without the TCP facilities (Section 9.4.9), then the application
program is responsible for its own verification of the results of the transmission
operation. This is a trickier operation than it seems. An acknowledgement message
can be used to confirm reception of a message, but there is no way to guarantee that
the acknowledgment does not get lost in its turn, prompting the sender to initiate a
new transmission. This problem does not have a general solution; message-passing
strategies must instead be defined on a case-by-case basis. A solution can be to
label and number each message, so that sender and receiver can determine if the
passing order is respected. This method is also used in some types of
communication protocols (see Section 9.4).

10.6 Methods for Real-time Programming


10.6.1 What is a Real-time Program?
Real-time programming is a particular form of multiprogramming in which,
besides the development of cooperating tasks, attention is dedicated to the timing
issues of the system interacting with the external world.
There are notable differences in real-time programs and normal sequential
programs with their well-defined inputs and outputs. Some of the problems arising
when a strictly sequential program is used to control processes that are inherently
parallel were shown in Section 2.1.
Real-time programs differ from sequential programs for the following reasons:
• The execution flow of the program is not only determined by the processor but
also by external events.
• Normal programs act on data; real-time programs act on data and on signals
that link to the external world, e.g. via sensors.
• A real-time program may explicitly refer to the time.
• There are timing constraints. Failure to compute a result within a specified time
may be just as bad as computing a wrong result („the right answer too late is a
wrong answer“).
• The result of a real-time execution depends on the global state of a system and
cannot be predicted beforehand.
• Real-time programs usually operate together in multitasking. Procedures for the
exchange of data and synchronization signals among the processes are
necessary.
• A run is not terminated when the input data has ended. A real-time process
waits for new data to be available.
10.6: Methods for Real-time Programming 385

Despite the importance of the factor time in real-time programs, this should not
be understood just that the processes must run fast. Real-time processes must be
fast enough to react within the required constraints to input data and signals by
generating the appropriate outputs, but do not necessarily need to be faster. A „slow“
real-time system can very well control a slow process. The execution speed of real-
time programs must therefore be considered in relation to the process to control or to
the speed at which answers must be produced. In general, a guaranteed response
time of 1 ms is required in typical process automation system applications, in some
cases even 0.1 ms may be necessary. For this reason, particularly important in real-
time programming are considerations on the efficiency and reaction time of
programs. Program development is therefore closely related to the definition of
operating system parameters and, in distributed systems, also of the LAN network
parameters.
The particular aspects of real-time programming require the use of special
techniques and methods, which are not necessary in sequential programming. These
techniques are mainly related to control of program execution flow from the external
environment and in relation to time. The most important of them are interrupt
interception, exception handling and the direct use of operating system functions. In
addition, the methodologies for multiprogramming and client-server programming are
also used in real-time programming, because a dedicated process or thread is
usually assigned to each self-contained part of a major task.

10.6.2 The Programming Environment


Before examining the issues related to real-time programming a look will be
taken at the environment where the programs will run. Real-time execution
environments range from minicomputers, bus systems, PCs and board-based
microcomputer systems connected with the outside world via hardware interfaces to
distributed systems in client-server configuration with centralized process databases
and access from advanced graphical workstations. Complex industrial and process
control systems may encompass all of this equipment within the same system (see
also Section 9.6).
The diversity of hardware environments for real-time systems is reflected also in
the software that may range from ROM-stored routines to complex operating
systems allowing both program development and execution. In large systems,
development and execution take place on the same machine, in some cases even at
the same time. Smaller systems might not be able to support the program
development tools; the programs may have to be developed on more powerful
machines and then downloaded to the target system. A similar case is given in
firmware, i.e. software that is embedded in electronic appliances during their
manufacture. Firmware is hard-coded in read-only memory (ROM); it is developed on
a different machine from the one on which it is run.
The first action for a programmer is to become familiar with the programming
environment and the available software tools. The issues to be faced range from
data-type representation in hardware and software, leading to the discovery that
some operating systems order bits in one direction and some in another, some write
data straight in memory and other use „backword storage“, where the low level byte
of a word gets an higher memory address than the high level byte. The number of
such issues is very high and the attentive programmer knows how to separate
general data and code structuring from the technicalities of the actual
implementation machine.
386 Chapter 10: Real-time Programming

It is essential to become acquainted early on with the functions provided by the


actual environment as well as the possible alternatives. For example, the
microprocessor Motorola 68000 has the function test_and_set in its instruction set,
so that intertask communication can be implemented via shared memory areas. The
VAX/VMS operating system offers mailboxes, and process synchronization can be
implemented by a message-passing mechanism. In UNIX and other operating
systems, interprocess communication is most efficiently realized with pipes. In a
system like UNIX, programs should be developed to make the most effective use of
system features like standard I/O treatment to facilitate later program portability.
Due to the fact that most multitasking and real-time systems are developed by
programmer teams, clarity is required from an early stage on which methods and
techniques to use.
The structuring of hardware and software resources, that is, the assignment of
bus addresses and interrupt priority levels for the interface devices is of paramount
importance. As described earlier, the wrong order in the assignment of resources
can lead to deadlocks. The definition of hardware addresses and relative priorities for
interrupt servicing does not depend on the actual software development, so that it
should be handled at an early stage and recorded in a design document and not be
postponed until coding time, otherwise conflicts between program modules and risk
for deadlock are the likely consequences.
A practical approach is to use in the program exclusively logical names for the
physical equipment and their parameters and enter these names in a table together
with their actual physical pointers. In this way the change of a bus address or of a
hardware priority does not require new software coding but at most a new program
compilation. It also pays to use a structured and organized naming convention for
system resources like devices and program variables. The same holds for the
naming and the address definition of units connected to networks in distributed
systems.
The software should be built as in an operating system: in a modular and layered
fashion, as this considerably simplifies the construction of complex systems. To
begin with the interfaces between the hardware and software components of a
system and the content of single modules must be defined. The structure of the
messages to be exchanged among program modules belongs to the basic
information about the interface. This does not mean that changes in the interface
definition might not take place after software development has started, only that the
later they are done, the more expensive they will be in terms of code rewriting,
testing, etc. On the other hand, it must be expected that some changes will be made
anyway in the course of software development, as progress on the work helps get
better insight into the problem.
The efficiency of the implementation of operating system functions should be
also taken in consideration. The way the operating system works should not be taken
for granted: an analysis and tests on how operations are executed in practice,
possibly with help of benchmarking programs, is necessary to verify that the timing
constraints are respected.

10.6.3 Real-time Program Structure


The development of a real-time system begins with the analysis and description
of a problem. The system functions are divided into elementary parts, and a program
module (task) is associated to each of them.
10.6: Methods for Real-time Programming 387

For example, the tasks for the control of a robot arm could be organized as
follows:
• read path data from disk
• compute next arm position (reference value)
• read actual position from sensors
• compute appropriate control signal for positioning
• execute control action
• verify that reference and actual positions are within the allowed range
• accept data from operator
• stop on emergency (asynchronous command, interrupt driven, e.g. via a „panic“
pushbutton).
Another example was shown in Section 2.1. The plastic extruder was controlled
by two tasks driven by interrupts. In the problem analysis it appeared clearly how a
solution based on a single program would not be acceptable.
The principal feature of real-time programs is that they must always be ready to
run and never terminate their execution. If they are not currently running and
processing data, they stay idle in the waiting list, ready to be scheduled for execution
following an interrupt or event, or also after a period of time has elapsed. Real-time
programs are sequential programs with the aspect of closed loops that repeat
indefinitely. At some point in the code there is an instruction to make the loop wait for
an external event or for a given time. The code is often structured in such a way that
the end instruction is never reached:

while true do (* repeat forever *)


begin (* handling routine *)
wait event at #2,28 (* external interrupt *)
(* handling code *)
...
end; (* handling routine *)

end. (* program end, is never reached *)

In the development of each program module the areas where protected


resources are accessed must be clearly indicated. Entering and exiting those areas
is then coordinated with some synchronization or communication method (e.g. with
semaphores). In general, when a task is in a protected area it must be assumed that
the data it works on cannot be changed by any other task. Interruptions in the
execution of the process should not influence the resources in the protected areas.
In this way, the risk for system errors is reduced.
This consideration holds also for program threads generated as child processes
from a master process. Different threads can still access common variables from the
parent process, so that the programmer must consider whether these variables have
to be protected or not.
To guarantee that a program keeps on running indefinitely, error situations which
could lead to the arrest and abort of a process must be recognized in time and
corrected from within the process itself. This aspect will be treated in the next
section.
388 Chapter 10: Real-time Programming

In real-time systems, different processes may have to call common subroutines.


In the simplest solution the subroutines are linked with the related tasks after
compilation. In this way there will be several copies of the same subroutine code
stored in memory.
A different approach is to load in memory only one copy of the subroutines, but
still access them from several programs. Such subroutines must be reentrant, that is,
they can be interrupted and called several times without interference. Reentrant code
operates only on the CPU registers and on the stack; it does not address any fixed
memory location. As a consequence, a reentrant module shared by different
processes can be interrupted at any time and restarted from a different position in its
code, because it will operate with the stack of the process calling it. A reentrant
procedure can thus be found in many different process contexts at the same time.
Running time efficiency is one of the most important aspects in real-time
systems. The processes must execute quickly and compromises between good and
structured versus time-efficient code often have to be made. It is a fact of life that if
short-cuts are needed to achieve some result, they will be taken anyway. It does not
always need to be a contradiction between structure and efficiency, but when clarity
and structuring of the code must be given up in name of processing speed, then a
full documentation of the devised solutions is an absolute requirement, otherwise it
will be very difficult to maintain the program at a later time.

10.6.4 Interrupt and Exception Handling


Real-time systems are connected with the external environment (the physical
process) via hardware interfaces. Access to the interfaces and to external data is
made either on request (polling) or via interrupts.
In polling, a program must cyclically ask all input ports in succession whether
they have new data to report. If this is the case, the program then fetches the data
from the input port and processes it. The polling order and frequency determine the
reaction time of the real-time system to external inputs. Polling is a simple method,
but inherently inefficient because of the repeated tests on the interface ports.
With interrupts, getting data operates the other way around. The interface
device requests attention when new data is available by sending an interrupt signal
along the system bus to the CPU board, where the real-time process is executing.
With respect to the running process, interrupts are asynchronous events that require
immediate attention. On reception of an interrupt signal, the processor stops its
execution, saves on its stack the context of the process currently executing, reads
from a table the address of a service routine for the interrupt, jumps to it and passes
execution control to it. The service routine is called interrupt handler. Alternatively,
the scheduler selects among the waiting task(s) those to be awakened by this
specific event or interrupt and defines them as runnable, so that they can soon be
executed. This second method may be less rapid than the reaction by an interrupt
handler.
When the CPU transfers control to an interrupt handler, it usually saves only the
pointers to the code area and to the stack of the process that was running. The
interrupt handler must save in temporary buffers or on the stack all registers it is
going to use and restore them at end. This operation is time-critical and it might be
necessary to disable interrupt servicing under execution of the first instructions of the
handler in order to avoid that the handler itself being interrupted in turn.
10.6: Methods for Real-time Programming 389

In interrupt management the response time is a very important factor, and this
time must obviously be as little as possible. The response time is the sum of the time
needed by the CPU to react to the interrupt, called interrupt latency, and the time
needed for a context switch until the interrupt handler is actually running. The typical
system load also plays a role. If the CPU has to service many interrupts at the same
time, new ones will have to be queued until the CPU is available.
Interrupt service routines should be as compact and short as possible. If a
complex action that requires more CPU time (like for example calculations or
database access) is needed after an interrupt, it is better if the action is performed by
a regular process. The interrupt service routine should do only the minimum
necessary, like reading the input data, formatting it in a message and then passing it
to the other routine, signaling that an interrupt has occurred and further service is
requested. In addition, it is always good practice to write reentrant code for interrupt
handlers. In this way, conflicts are avoided in case a handler is interrupted and the
same code is called to service a new interrupt before its execution within the first
context was terminated.
A problem similar to interrupt servicing is the reaction to exceptions. These are
unusual conditions that result when the CPU cannot properly handle the execution of
an instruction and that hinder the normal continuation of a process. Examples of
exceptions are division by zero and addressing a non-existing memory location.
Names for different kinds of exceptions are also traps, faults and aborts.
The common handling of exceptions by an operating system is the termination of
process execution and indication of the error situation with messages written in clear
text on the device used for the output messages. While acceptable in interactive
multi-user sequential processing, in real-time systems the abrupt halt of a process
must be absolutely avoided. It cannot be allowed that a microprocessor-controlled
fly-by-wire or car automatic braking system (ABS) halt because of an unexpected
„divide-by-zero“ exception. In real-time systems all possible exceptions must be
analyzed beforehand and appropriate handling routines be defined.
A very tricky aspect of exception handling is the verification that an exception
does not arise again after having been processed. Put another way, exception
handling must address the cause and not the symptoms of the abnormal situation. If
an exception is not handled correctly, it may arise again prompting the processor to
jump to its specific handling module. For example, the divide-by-zero exception
handler must check and modify the operands and not just resume operations to the
point before the fault took place. This would lead to an indefinite loop.
The effective memory addresses of the program modules are known only after
their loading. At system start-up, a module writes the memory addresses where the
interrupt handlers are loaded in the interrupt service table. The interrupt routines are
then accessed by referencing this table.

10.6.5 Time-related Functions and Time Efficiency


Real-time processes may refer explicitly to time to wait for some interval (relative
time condition) or until a given time (absolute time condition). These functions have
usually the form:

wait (n) n = time in seconds or milliseconds

and
390 Chapter 10: Real-time Programming

wait until (time) time = hours, minutes, seconds, msec

When one of these functions is executed, the operating system puts the process
in a waiting queue. After the requested time has elapsed, the process is moved from
the waiting queue to the „process ready“ queue.
A common, but often unsuitable, method to solve a „time-waiting“ problem is to
introduce a closed loop to check the system time variable in the so-called busy-wait:

repeat (* do nothing *)
until (time = 12:00:00);

In general, these active waiting loops are nothing else but a waste of CPU time
and should be avoided. But there are cases where reality looks different. In a system
where an A/D conversion takes 20 µsec and a process switching operation 10 µs, it
is more economic to run busy waiting for the 20 µsec before new input data is
fetched than to start the task exchange procedure implicit in a „well-behaved“ wait
operation. Each case must be judged on its own; this obviously requires advanced
system knowledge and the right feeling.
An important aspect of processes that are started periodically (such as filtering
or regulation algorithms) is the accumulated time error. This depends on the fact that
a process is not executed immediately after it is moved out of the waiting queue but
has to wait for an additional, random time interval in the queue of executable
processes until its execution turn arrives (Figure 10.9.a). The requested and the real
execution time are not the same.

time error time error


process process process

wait T wait T

0 1T 2T 3T 4T time
(a)
wait
until 3T
process process process process process
wait wait wait
until T until 2T until 4T

0 1T 2T 3T 4T time
(b)

Figure 10.9: (a) The wrong way to execute periodic tasks (it leads to accumulated time
errors);
(b) the correct solution (it does not lead to accumulated time errors).
10.6: Methods for Real-time Programming 391

Accumulated time errors can take place if the running time for a new activity is
computed as:

new start time = end of old start time + interval

The latter is an example of an instruction like „wait 10 seconds“ written at the


end of a loop. The accumulated time error is the sum of the time spent waiting for the
process to be scheduled to run and the time that is necessary for its own execution.
The correct solution is obtained by adding the new start time to the old calculated
start time.

new start time = old reference start time + interval

In this way a relative time condition is changed into an absolute time condition.
Therefore in practice two instructions are necessary:

wait until (ref_time);


ref_time := ref_time + 10 seconds;

The principle is illustrated in Figure 10.9.b, where the nominal times are drawn
on the x-axis. When the absolute time is taken as reference, accumulated time errors
are avoided.

10.6.6 Intrinsic Functions of Operating Systems


A typical situation encountered in real-time programming is the need to use
routines from the operating system because there is no equivalent instruction in the
used programming language. Calls to operating system functions are also necessary
with advanced systems operating on networks, and distributed systems. The
operating system deals with all the overhead on the machine, file system and
network. A simple operating system call can therefore result in a complex sequence
of actions to access a remote database with all the related control and operations,
without the details bothering the application program. The operating system interface
makes operations carried out in this way more transparent and supports writing
complex code.
Many high level programming languages, for example C, offer an interface to the
operating system so that its modules can be called directly from within the running
processes. There are different kinds of program interfaces to the operating system:
direct calls, primitive functions and access via library modules.
Direct calls (also called system calls) take place with a specific language
instruction that transfers the execution to a routine that is part of the operating
system. The necessary parameters are passed to the called routine as a parameter
list like for normal subroutine calls. After the system call has been completed, the
results are passed back to the calling program.
Due to the fact that in multitasking environments routines for the processing of
system calls and primitive functions can be called at the same time by several
processes, their code is reentrant. In this way conflicts are avoided, should the
392 Chapter 10: Real-time Programming

execution of a system routine be interrupted by a different call requesting the same


service from a different context.
In some cases also library modules from the operating system can be used to
access the internal resources of operating systems. These modules are already
precompiled and have only to be linked to the programs using them. It is necessary
to verify with the system documentation which parameters are requested by the
service modules, the aspect of the data interfaces and the methods to link to
programs written in a high level language.

10.6.7 Process Priorities and System Performance


A real-time, multitasking operating system must allow the assignment of different
priorities to the executing tasks. Most often the priority assignment is dynamic,
meaning that the priorities may be modified under execution by the processes as
well as by the operating system. There are usually some restrictions and control
mechanisms for which priorities can be changed by what processes. The assignment
of priorities has a strong influence on the operation of the system as a whole.
The most important processes, or the ones that must ensure fast execution
response, get higher priority. This is the case of interrupt handlers with short reaction
times. Tasks that are in charge of less important actions, as for example printing, get
lower priorities. It is obviously necessary to pay attention to the conventions in the
system used, whether highest priority is associated with a higher or lower numerical
value. Priorities have a relative meaning and make sense only if they are different
between the processes.
In a real-time system the response to interrupts is separated from more CPU-
intensive computations. Whenever an event or interrupt takes place, its handler is
immediately scheduled for execution. The code of interrupt handlers is usually
compact, because their goal is to provide for fast reaction (for example fetching new
data) and then pass it to more complex, and CPU-intensive, processes that can
execute with lower priority.
In the earlier mentioned example of robot arm control (Section 10.6.3), one task,
that can be built as an interrupt handler, waits to get new sensor data about the
current arm position as soon as this is available. This task must be started
immediately after an interrupt signals the presence of new data. This task passes
then the position data to a more computation-intensive routine to process it. This
other routine, however, does not answer to an interrupt and may take more time for
its computations.
The performance of a real-time system is much more difficult to evaluate than
that of systems that run conventional, sequential programs. Whereas a normal,
sequential program has a certain execution speed on a particular CPU, the execution
of real-time systems depends on what happens in the external world, i.e. the
connected technical process. Overall system capacity must be sufficient for the
processing of all routines and the production of results within the specified scopes. In
other words, the real-time system must always be able to meet the maximum load
that can be generated by the technical process.
On advanced and complex operating systems like UNIX and Windows NT - and
even more on distributed operating systems - access from the processes to most of
the functionality (data I/O, network communication, etc.) takes place via system calls
and Remote Procedure Calls (RPC). These are in general simple to use from the
program, but as a rule start a long chain of operating system actions. Reading from a
10.6: Methods for Real-time Programming 393

pipe addressed to a process on a different machine connected to the network


requires a series of operations for interprocess communication, which are then
followed by the actual data transmission. All these operations are not for free. If time
is an issue, it is important to analyze beforehand the response time of these
functions. When the user communication procedures share the same network as the
real-time process data, the load does not depend only on the original process data
but also on the number of logged-in terminals, open user windows, and similar
factors.
Multitasking operating systems provide commands to show at any moment all
active processes, their current status (for example waiting for I/O, waiting for
interrupt, etc.) and their share of CPU time since the last system boot or some other
reference time. The first step in checking the performance of a system is to analyze
its operation with help of such a command. The indication of processes that take an
unfair share of the CPU time may be a good start to where to look in order to
optimize system performance. It is not bad for itself if some processes load the CPU
more than others, yet the system developer must be in the clear whether this
happens, and why.

10.6.8 Testing and Debugging


The proof of the correctness of a program is a fundamental step in its
development. It is imperative to check that the program performs its function without
errors. Program errors can be found only to a limited extent by manual check of the
code, which means in practice that there is little room for a formal theory of testing,
and that experience and tradition also play an important role. The real test comes
from the field operations.
Errors are elusive. Many errors show up sporadically and cannot be reproduced
at wish. No proof can guarantee that a program is entirely error-free and no tests can
ensure to finding all the errors and bugs. The goal of a test procedure is thus to find
as many errors as possible and guarantee that a program is reasonably safe. To
quote one of the pioneers of operating system theory, Edsger Dijkstra: „Testing can
only prove the presence of errors, but not their absence“.
A comprehensive test requires adequate design and preparation; it is necessary
to combine practical checks with analytical verifications. To start with, the test
procedures and data are described in a special test requirement document, in which
also the foreseen and actual results of the tests will be recorded. If several people
participate in system development, it is advisable that the team assigned to program
development be different from the one responsible for the test definition and
execution.
In the testing of real-time systems, a further element of complication is due to
the many possible interactions among the tasks. The probability to introduce a new
error while fixing an old one is very high; experience gained so far by the
development of large programs (of the order of 10 5 lines of code and higher)
suggests that this probability lies between 15 and 50 per cent.
The basic test methods are two: exhaustive and per sample. In an exhaustive
test, all possible combinations of input and output data are checked; this method can
obviously be employed only when these combinations are small in number.
The method by sample is the one most often used. A representative number of
input/output combinations, the „samples“, is selected. The sample data should also
394 Chapter 10: Real-time Programming

include extreme values, like for example data that lies outside their allowed range.
The module to be tested must recognize and process correctly these data.
In multitasking systems, at the beginning the program modules are tested
separately. During this testing it must be ensured that each code line of each
process is executed at least once. That is, if the program module contains branch
instructions such as „if..then..else“, then the condition data during testing should lead
first to the execution of the one branch „then“ and then of the other „else“.
In this testing phase, debug programs are very useful. They allow direct
verification and manipulation of the CPU registers and of the memory locations while
running the actual machine code. When debuggers are used, breakpoints are
introduced in the code. At each breakpoint it is possible to check the state of the
registers and of the variables and compare them with the values required by the logic
of the process. However, with increasing complexity of operating systems and
reliance on system calls (whose code is usually unknown for the programmer) the
use of a debugger may prove of little use. Also in multitasking operations,
conventional one-step-at-a-time debug programs cannot be used, because the
interactions between parallel processes cannot be fully foreseen. Debuggers are
however useful and necessary tools for program development in Assembler at
processor level.
Only after all the modules have been separately checked and all detected errors
have been corrected, the modules can be run in parallel to observe their interaction.
The multiple interactions between program modules may lead to system errors even
if the single modules operate correctly. The general system operation (interrupt
reaction time, performance under loading conditions) is checked on the basis of the
reference documents. Particular attention has to be paid to the functions that are
necessary for system safety.
If a system has been designed to handle interrupt signals and features internal
exception management, the correctness of the related reactions must be checked.
Error situations will be provoked on purpose to check the outcome of the processing.
The results of each separate test and of the common operations are reported in
the test document and on its basis are taken the required correction actions. It
should not be forgotten that errors are much more difficult and expensive to correct
the later they are discovered. An investment in test procedures is not only an
investment in the quality of a system, but also in its general economy. Further
considerations about software reliability are reported in Section 12.3.4.

10.7 Languages and Operating Systems for Real-time


Programming
10.7.1 Requirements for Real-time Languages and Operating Systems
Real-time programming requires special features not commonly found in normal
languages for sequential programming. A language or operating system for real-time
programming must offer the following capabilities:
• definition of processes that can be executed in parallel
• priority-driven process switch (the relative priorities should be under the control
of the processes during execution)
• synchronization among processes
10.7: Languages and Operating Systems for Real-time Programming 395

• data exchange among processes


• time-related functions, wait for a relative or absolute time
• direct access to external hardware points
• interrupt handling support
• exception handling support.
Few languages have all these features. Many languages have only a few of
them, which may still may be sufficient for some applications. Some companies have
developed special languages to support their own product lines. These languages do
not claim universality and are rather oriented to a specific machine and its interfaces.
Typically, they are based on existing languages (FORTRAN, BASIC) with extensions
for real-time functions, as the names „Process BASIC“, „Real-time FORTRAN“
indicate. Some languages do not support real-time programming in a strict sense,
but are designed to be easily extensible (e.g. C, C++).
During the 1970s, the idea of a single, general, multipurpose programming
language enjoyed wide support. Eventually, this idea led to the development of ADA.
The main concept was that the programming environment, i.e. the language, should
be entirely separated from the details of the technical application. The programmer
should not deal with machine-level details but reason only in terms of abstract
structures and data types.
Experience has shown that this approach is not realistic. Universal, strongly-
typed programming languages guarantee a certain safety for a program but at the
same time they are less flexible. The quick development of new hardware imposes
new requirements that could not be foreseen in existing languages, so that many
programmers feel restricted when using programming languages that are not
particularly up-to-date. There is a trade-off: when a language is safe it is also bulky
and difficult; the generated code also tends to be heavy and relatively inefficient. An
open language like C builds on a few basic ideas but gives the experienced
programmer more flexibility and power. No language is best, each language fits a
given application and environment (and suits a programmer) better than others.

10.7.2 The Programming Language ADA


ADA has been the first complete programming language for real-time systems.
Towards the mid 1970s, the US Department of Defense decided to introduce a
single programming language for their control and real-time systems, as an
alternative to the hundreds that were then used, in order to limit software
development and maintenance costs. In 1979, the Department adopted the language
proposal made by the French Company Honeywell Bull. The name of the language
comes from Augusta Ada Byron, Countess of Lovelace (1815-1852), who is
considered to have been the first programmer in history. She wrote the programs for
the analytical engine (a mechanical computer that was never built) designed by the
English inventor Charles Babbage.
ADA is defined as a complete program development environment with editor,
debugging facility, library management system, etc. ADA is an American standard
(ANSI/MIL-STD-1815A) and the language definition includes the control methods to
check conformity to the standard. No dialects are allowed: to be validated, a compiler
must show that it can run all tests correctly.
ADA has a structure similar to Pascal, though ADA is much richer in all respects,
especially regarding real-time systems features. Processes are declared in ADA as
396 Chapter 10: Real-time Programming

tasks, defined as entities with parallel and independent execution, each task on a
dedicated logical (virtual) processor. Tasks can be related to specific interrupts and
exceptions and therefore operate as their handlers.
A new concept introduced in ADA is the package, a module with its own
definitions of data types, variables and subroutines, and where it is explicitly
indicated which of the routines and variables are accessible from outside. Packages
can be compiled separately and later linked together in the same executable
program. This feature supports modular program development and the creation of
application libraries. At the beginning of the 1990s ADA has been extended by new
functions for real-time and object-oriented programming.
Low level, machine-level programming is not effectively supported in ADA, a
consequence of the assumption that all kinds of operations should be dealt with at
high level only. For example, for input/output in ADA are used application packages
with predefined functions for hardware interface management and access to external
data.
The main disadvantage of ADA is its complexity, which makes the language
difficult to learn and to use. The existing compilers are expensive products and
require powerful CPUs. So far, ADA has not reached the popularity initially
envisioned, and it is doubtful if it ever will.

10.7.3 C and C++


The programming language C, although it lacks almost all features that
computer theoreticians deem to be necessary for a good programming language,
has enjoyed wide success since the 1980s and up to date. C has become very
popular for all applications requiring high efficiency, such as in real-time
programming. For normal microprocessors used in control applications C compilers
and development systems are available, often from different sources. There is a
clear trend in the industry towards widespread use of C and the operating system
UNIX (that is itself written in C) because applications written in C are portable with
relatively little effort between different hardware environments.
The philosophy of C is to structure a program in functions. C has weak type
control and allows the programmer to do almost everything, down to register and bit
manipulation. This freedom makes the language unsafe because the compiler does
not have the possibility of checking whether suspect operations were intended or not.
The small number of predefined functions and data types makes the programs easily
portable among different systems. C supports both good (i.e. structured) and poor
programming styles, leaving the responsibility for good development to the
programmer. This is of particular importance when programs have to be maintained:
a poorly written and sparsely commented C program is as cryptic as a program
written in assembler. C is defined in the international standard ISO 9899.
C is the language of choice for writing programs that make calls to the operating
system functions, because it offers immediate compatibility between the variable
definition logic and the system call syntax. Due to the fact that the most widespread
operating systems in process control and automation applications are based on
UNIX, C represents an almost obligated choice for program development. Also
almost all documented examples in the technical literature are nowadays presented
in C. (For the examples in this book has been chosen a Pascal-like syntax because it
is easier to read for non-specialists than C).
10.7: Languages and Operating Systems for Real-time Programming 397

C++ is a much more powerful language than C, from which it is derived. C++
offers greatly improved data abstraction through the class concept, similar to the
abstract data type with its distinction between data and operators. The C++ class is
much easier to use in practice than similar concepts in other languages, as C++
supports object-oriented programming and the stepwise refinement of data types.
The main strength of C++ is its ability to support the design and implementation
of easy-to-use program libraries. Real-time programming is not directly implemented
in the C++ language, but can be supported via specially developed program modules
and class libraries.

10.7.4 BASIC
BASIC is the easiest to learn among the high level programming languages. The
language was originally developed in 1964 to support interactive program
development with teletypes. Because of its simplicity, BASIC is often criticized by
expert programmers and there is no doubt that this language is not a good choice for
the construction of large structured systems. On the other hand, small applications
can be developed in much shorter time in BASIC than in other languages. Moreover,
BASIC is available on almost all mini and microcomputers.
BASIC can be compiled but is most often interpreted, that is, each instruction is
translated in machine code only at the moment of its execution. BASIC is particularly
important for the development of small application tasks to be run within a larger
system. BASIC should not be used for larger applications (in the order of more than
500-1000 lines of code). Still, BASIC is the optimal choice for non-professional
programmers who need to solve specific problems quickly. Command languages
based on BASIC are available in many industrial automation systems to write simple
control procedures without having to resort to more complex facilities for program
development, compilation and loading.

10.7.5 FORTRAN
FORTRAN was the first high level programming language and probably
contributed more than any other to the diffusion and practical use of computers.
Released in 1957, it is still largely used especially for numerically oriented
computations. In general, FORTRAN has limited possibilities for type definition, a
quite complicated way of dealing with non-numeric data and in general lacks too
many of the important features of real-time languages to be seriously considered for
this purpose. Newer FORTRAN versions have imported features from other
languages and support more advanced data structures. In this sense, the difference
between FORTRAN and other languages is becoming smaller.
Due to its established use in scientific application, it is not seldom that data in
real-time systems is processed with existing FORTRAN programs or that new
programs for analysis and statistics are written in FORTRAN. In such cases, the real
issue is to coordinate the data transfer between a real-time database where the data
is collected and application modules written in FORTRAN. Coordination of this type
of data transfer under real-time conditions is the responsibility of the operating
system. FORTRAN is not recommended for other applications, such as writing
device drivers or other modules at operating system level, because other languages
are better suited to this purpose.
398 Chapter 10: Real-time Programming

10.7.6 Pascal and Modula-2


Pascal was introduced by the Swiss Nikolaus Wirth in 1971 as a didactical
language to teach good programming technique. It quickly outgrew its initial scope
and is now used for the most different applications. The fortune of Pascal, like
BASIC, lies in the widespread use of micro and personal computers, for which it was
widely available. Modula-2 was introduced a few years after Pascal to correct some
of the original problems of the latter and to offer an environment more oriented to
multitasking and real-time applications. Pascal and Modula-2 are very similar in style
and structure, although Modula-2 has more functions and reserved words.
In Pascal and Modula-2 it is assumed that the programmer always remains
within the restricted environment offered by the program, which is highly unrealistic in
practical real-time work. Flexibility in their use is much greater if some code for
special applications (device drivers, interrupt handlers) is written in Assembler; both
languages support linking to external Assembler modules. Pascal and Modula-2 are
a good choice for program development for embedded systems, but not for complex
applications on distributed computer systems. Their emphasis on structure makes
Pascal and Modula-2 immediately readable, a crucial factor for later program
maintenance.

10.7.7 The Operating System UNIX


UNIX is a multitasking, multi-user operating system and now one of the most
widespread operating systems in the world; it was originally developed in the 1970s
at the AT&T Bell Laboratories. The particular attention dedicated to portability, an
user interface built on a few basic principles and the possibility to connect different
UNIX systems in networks independently of the hardware environments have clearly
contributed to the success and diffusion of UNIX.
Since it started, UNIX has constantly grown and has undergone several changes
and it exists now in several implementations. Among the major providers are the
AT&T Bell Laboratories, BSD (Berkeley Software Distribution) and more. Almost all
computer vendors offer UNIX from one of the standard packages or in a specially
tailored version for their system. Sometimes the specific offerings have more to do
with licensing than with a really different scope of functionality. After all, to remain
compatible and portable, the UNIX versions by different vendors must not differ too
much from each other.
UNIX has introduced features that have been later overtaken by other operating
systems. On the basis of UNIX has also been developed the operating system
OSF/1 (Section 10.7.8) and many of its features have been incorporated in Windows
NT (Section 10.7.9). UNIX has also been the major platform for the development of
important communication interfaces, like the communication protocol TCP/IP
(Section 9.4.9) and the user terminal protocol X Window (Section 11.6).
UNIX consists of a small kernel to manage the basic system resources (CPU
and memory allocation, I/O management), while the rest of the operating system
routines, and in particular the file system, run as user programs. A typical UNIX
operating system consists therefore of about 10000-20000 program lines in C and
1000-2000 lines of hardware-oriented, assembler routines that have to be developed
independently for each system. The kernel is a single memory-resident program
about 100 kbyte to 1 Mbyte long, depending on the actual machine and the desired
functionality. Adapting a UNIX system on a different machine requires in principle
10.7: Languages and Operating Systems for Real-time Programming 399

that only the machine language kernel is written anew. This means that UNIX can
run on many different computer hardware systems with an identical system interface.
The UNIX kernel lacks a well thought-out structure. This is the consequence of
its swift success and diffusion, as each new version must still be compatible with the
earlier ones. UNIX was initially developed for multi-user operations and not for real-
time applications. As a consequence of the fact that operating system routines run
as user processes but with highest (system-assigned) priority, it is not possible to
interrupt even those system calls that take long time to execute, so that the reaction
time for a system can become quite long. This is a major drawback in real-time,
interrupt-controlled processes. The UNIX process context description is very
comprehensive, which adds up time for process switching. Due to the fact that in
UNIX the pipe writing and reading operations make use of process switches, the use
of pipes for interprocess communication may lead to timing problems in real-time
applications.
Standard UNIX processes are time-sharing processes. To give all processes a
chance for execution, priority allocation is dynamic. When a process is scheduled for
execution it is first assigned its nominal priority. The value of this priority is decreased
in course of time, until it becomes less than the priority of another of the waiting
processes; this process is then selected for execution. In this way processes with
higher initial priorities get a larger share of the CPU time, but still all processes are
periodically executed. System calls operate synchronously to the calling process: this
must wait until the requested operation has been executed and control is returned to
it.
An important feature introduced with UNIX is the similarity between devices.
External I/O devices are treated as files. This aspect notably simplifies programs that
must operate flexibly, as it is simple to redirect I/O between files or external devices
like a local terminal, a printer or a remote terminal connected via a network without
any changes to the program itself. This feature is also important for program
portability.
A common and founded critic to UNIX is its unfriendly user interface. In fact, the
older and most cryptic commands are still in use, or have been changed with other
commands with names and abbreviations at least as unnatural as the previous ones.
On some systems, user-interfaces with windows and menus are available just to
„translate“ the selected actions into original UNIX commands. A positive feature of
UNIX commands is that, thanks to the I/O standardization and the piping
mechanism, they are very short and can be concatenated on the same line, where
the output of a command is understood as the input to the next one. In this way
complex operations can be concentrated to few lines and do not require the writing of
long files.
Although in its beginning UNIX was a multitasking and not a real-time operating
system, because of its large diffusion in scientific and technical environments it was
all too obvious to try to adapt UNIX also to real-time environments. Therefore newer
releases support real-time functionality like semaphores, shared memory,
interprocess signals, priority-driven task management and the direct access to
external hardware.
POSIX is the portable operating system interface based on UNIX, defined by the
IEEE standard 1003.1-1988.
400 Chapter 10: Real-time Programming

10.7.8 OSF/1 and DCE


The initial versions of UNIX were unlicensed and basically free for everybody to
use, which at least in part explains the popularity of this operating system. On
releasing System V, the initial UNIX developer AT&T decided to distribute it only
against payment for licenses. Some of the most important computer vendors (as
Digital Equipment, Hewlett Packard, IBM and more) reacted by founding an
organization, the Open Software Foundation (OSF), in order to be free from the
control of one single company as operating system provider. OSF has developed a
UNIX-compatible operating system as well as other system products without
licensing restrictions on part of a single company.
OSF/1 is a modular operating system developed by the OSF on the basis of
Mach, a machine-independent, multiprocessor kernel developed at Carnegie-Mellon
University in Pittsburgh as a tool for emulating other operating systems. On the basis
of Mach it is actually possible to program and run different operating systems on the
same computer without having to interrupt its operations.
OSF/1 has been designed to be compatible with AT&T UNIX System V and the
Berkeley programming interfaces to ensure program portability. Both Mach and
OSF/1 do not contain any UNIX code so that the licensing problem to another
company is avoided altogether.
In addition to the UNIX facilities, OSF/1 offers its own set of functions to facilitate
program development and execution. OSF/1 has been designed to operate in
networked environments and provides therefore facilities as the Internet
communication protocols. Also the OSF/1 file system is compatible with the TCP/IP
service NFS (Section 9.4.9).
Other products for distributed computer environments have been developed by
OSF. OSF/Motif is a graphical user interface that provides a way to standardize
application appearance and behavior on graphical user terminals (Section 11.6).
The Distributed Computing Environment (DCE) is a set of services and tools for
application development, execution and support on distributed environments. DCE
can be integrated with OSF/1, but is independent from it and can actually run on the
top of other operating systems.

10.7.9 MS-DOS, Windows, and Windows NT


The wide diffusion of the IBM personal computers (IBM PC) and „compatibles“
are the reason for the popularity of the operating systems MS-DOS and Windows by
the company Microsoft, for which they are the native operating systems.
MS-DOS has been the first large diffusion operating system for personal
computers and is still in use as a simple operating system kernel. MS-DOS provides
a simple and clean interface between application program calls and the chips in the
personal computer.
MS-DOS applications are very widespread, and there also are several MS-DOS-
based products with multitasking features. Although MS-DOS does not support
multitasking, it offers some limited possibilities to write resident code to be started via
interrupts or via a clock tick at a frequency of 18.2 times per second. „Multitasking“
systems actually use MS-DOS only as a startup system in order to be loaded from a
diskette, and then take independent control over the whole computer, from the
screen down to the single device drivers, at which point MS-DOS is forced out of the
game.
10.7: Languages and Operating Systems for Real-time Programming 401

In fact, one of the advantages of the IBM PC is that it allows programming from
scratch of all the chips in the machine and thus the construction of a new operating
system. (On the other hand, not everybody is too keen to write an operating system
anew just to be able to run a few routines in parallel.)
The most famous operating system running on top of MS-DOS is Microsoft
Windows; it is probably the most popular graphical user interface worldwide.
Windows allows the operation of several processes at the same time, although only
one of them can be active at any time exchanging data with the user. Some
processes for printer output and network communication can however be active in
background and operate in parallel with the active process. Due to the lack of
preemptive multitasking (i.e. the application cannot be stopped by other programs or
by the operating system) as well as of other real-time features, Windows can hardly
be used as the basis for a serious process control system. However, there are
several data collection and processing systems running under Windows.
The major advantage of Windows is that it imposes a certain consistency on the
application programs, that must follow a basic frame for the most important
commands, and which makes their learning easier. The Windows system also
contains a large number of device drivers for almost every type of personal
computer, very useful when porting applications among computers.
Windows NT („New Technology“) was introduced in 1993 and is available for
different hardware platforms. Like UNIX, also Windows NT is separated in a kernel
and system routines running as application programs. The machine-dependent,
hardware-specific part of Windows NT is called Hardware Abstraction Layer (HAL)
and is available for different architectures. Windows NT is backward compatible to
MS-DOS, Windows, OS/2 as well as UNIX with POSIX specifications. The Windows
NT user interface remains the same on all systems. Windows NT fully supports the
client-server abstraction also in network environments.
Windows NT has several features of interest for practical applications in process
control environments. Among these services are threads, events, semaphores and
asynchronous procedure calls. Communication among processes is realized with
pipes (the system offers several types of pipes with different features) and Remote
Procedure Calls. RPCs are treated as local calls, so that applications may remain
independent of transport protocols. Other features of Windows NT are directed
toward safe and fault-tolerant operations, like for example disk mirroring support.

10.7.10 OS-9
The operating system OS-9 was first developed in 1977 by the company
Microware for the Motorola 6809 microprocessor, and later offered also on other
CPUs, in particular in the series 68000-68040 CPUs. OS-9 is a popular system, with
several hundreds of thousands licenses sold.
On a brief look, the operating system seems quite like UNIX, with similar
commands, compatible system calls, tree structures, pipes and uniform I/O handling.
But despite the similarities, OS-9 is a different product. OS-9 is hardware- and real-
time-oriented; the goal of program development is usually to transfer later the
program to a target system and not to run it on the development system. OS-9 itself
is also modular so that the software to be run on a target system need only include
selected parts of the operating system.
402 Chapter 10: Real-time Programming

All code generated in OS-9 is position-independent, is reentrant and can be


copied to ROM. The uniform I/O handling for example makes it easy to use input
data from a disk file, a comfortable feature during program development.
Signals, events, pipes and data modules are available for interprocess
communication. When a signal is sent from one process to another, the addressed
process is forced to execute a user-defined intercept routine in what is basically a
forced subroutine call. A pipe is, as in UNIX, a sequential data stream from one
process to another. The fastest way to transfer data is via data modules, i.e. shared
memory areas in RAM to which all processes can refer. Among other real-time
features, the system also supports hardware interrupts.
OS-9 includes many possibilities for system parameter tuning, with different
ways to influence the priority behavior. OS-9 and its tools are written in the language
C. Many C programs that are written for UNIX environments can be compiled and
run on OS-9 systems without any changes.

10.7.11 VAX/VMS
VMS is the operating system for the Digital Equipment computers of the 32-bit
processor VAX series. Its popularity in control applications is mostly due to the high
quality of the hardware on which it runs and to the large number of available
development tools. VMS can be used in both real-time and multi-user environments,
with the related security controls of the latter.
VMS offers a wide range of functions and a standard and clean interface for
direct calls from programs. In this way all languages can, at least in principle, be
integrated with all functions of the operating system. As real-time features VMS
offers mailboxes in form of logical, record-oriented files, the possibility of having
resident routines and interrupt handling. In VMS a process can control the conditions
of its own execution (priority, memory allocation) and can create and control the
execution of other processes. A hierarchical control feature hinders processes with
low priorities to modify the execution of processes with higher priorities.
As with all large operating systems, VMS has performance problems when tight
timing is concerned. For this reason, and because of the popularity of the VMS
system, a special version of VMS tailored for real-time applications, called VAX/ELN,
has been developed. VAX/ELN consists of two different products: a run time
environment to execute the application programs on the target machine and a
development package with compilers for different languages. System development
takes place on a large unit with all the necessary resources for preparing a system
that contains only the program modules required for a specific application. The final
system is then downloaded to the target machine.

10.8 Summary
An operating system offers the processes a logical environment consisting in
CPU time and memory space for their execution. Operating systems for multi-user
and real-time applications present many similar features, but programming is done in
practice in different ways. Real-time applications may require reaction times of the
order of 1 ms. In real-time programming functions are used to coordinate the work of
different processes; these functions are not necessary with conventional programs.
In addition, real-time programs are interrupt-driven and can refer explicitly to the
time.
10.8: Summary 403

The central problem in multitasking and real-time programming is the access to


protected resources, which has to be coordinated. There are several analogies
between CPU time allocation, resource protection and bus arbitration in a
multiprocessor bus system (Section 8.2.10). In all these cases the resource (CPU
time, memory space, the bus) is in some way limited and must be divided among
different units in a safe, efficient and „fair“ way. The principle for resource allocation,
which may be a simple Round-Robin method or a complicated, process-driven
scheduling mechanism, must avoid deadlocks and lockouts, assign the resource to
all requesting entities and achieve a maximum of efficiency in the process. At the
lowest level the most basic operation is the test_and_set function. Semaphores and
mailboxes are the most used synchronization and communication methods; they are
realized in different ways depending on the actual operating system.
The theory of concurrent programming studies the related issues and proposes
solutions to implement the necessary functions in practice. The constructs proposed
by the theory are of importance because their correctness has been proved in
advance. This is very important in real-time systems where program testing is
particularly difficult. The application of already verified methods gives reasonable
security for the correctness of the related applications.

Further Reading
[Tanenbaum / Woodhull 1997] is a highly authoritative work on operating
systems which presents both established and new ideas in a comprehensive way.
[Tanenbaum 1995] deals in detail with the theory and design of distributed operating
systems. A solid introduction to operating systems on the basis of the VAX
architecture is to be found in [Levy / Eckhouse 1980].
[Young 1982] describes theoretical computer language issues such as data
typing and constructs with attention to the development of ADA. It is very factual on
language issues but does not deal much with practical real-time problems. [Glass
1983] is a collection of different papers about real-time systems, with emphasis on
the management of development work. It is a good complement to other tutorial
books, even if some of the described cases feel now somewhat out-of-date.
The problems and solutions for resource protection and concurrent programming
are discussed in [Dijkstra 1968]; important multiprogramming concepts, like the
semaphore and the notation cobegin/coend, have also been first introduced in this
publication. Other classical textbooks about multiprogramming are [Ben-Ari 1990]
and [Brinch Hansen 1973]. The deadlock problem and avoidance methods are
discussed in [Coffmann / Elphick / Shoshani 1971] and [Coffmann / Denning 1973].
An overview of the specific aspects of software reliability is presented in [Littlewood /
Strigini 1992].
Handbooks and tutorials for programming languages number in the hundreds for
each language. For operating systems, with the exception of Windows and UNIX,
there is much less choice. The best (only) reference literature might be the original
system documentation delivered together with the software package or real-time
system; not always such presentations have been written to be understood by non-
specialists.
Information on Windows NT and its operation in network environments is
contained in [Sinha 1996]. [Loukides 1990] treats the problem of UNIX systems
performance also in real-time applications and how to improve it by system tuning.
11 The User Interface

Aim: Presentation of the most important concepts in the interaction between the
user and a technical system and their application in the design of user interfaces

Overview
The User Interface or Man-Machine Interface (MMI) is a fundamental component
in computer systems. As the name tells, the purpose of this interface is to allow the
exchange of information between the user and the machine (computer or technical
system) to be controlled. A well-designed user interface does not only make work
conditions more pleasant, it also helps to reduce errors and thus to limit the extent of
possible damages to the system under control. Moreover, a good user interface
enables the user to understand the function of the technical system.
The first Section of the chapter introduces the field of user interface design. In
Section 11.2 are treated the most important aspects - at least as they are known
today - related to how humans deal with information and in Section 11.3 is looked
further to the representation of complex systems and the mental models that users
may form about them. The idea of mental models also offers some clues about the
way the users interface should be designed. An overview of the hardware for user
interfaces is presented in Section 11.4, while in Section 11.5 are presented some
basic principles for User Interface design in form of brief and practical guidelines.
Section 11.6 provides a brief introduction to modern user interface application
products and to the X Window System protocol.

11.1 The User Interface as a Component in Process Control


For a long time since the beginning of computer development the object of
attention was the machine itself. Computers were designed to work effectively with
the available technology, not to be easy to use. Only specialists with detailed
knowledge of their internal workings could operate computers. Yet, the increasingly
wider diffusion of computers has brought to an impact with a nonspecialist
population. It is now just not possible to require hundreds of millions of users to
become experts; the computers must instead be themselves easy to use.
The first methodological study about the effective use of human capabilities in a
technical work environment began in the United States in the 1940s; this new
discipline was called „human factors“. This newly developed methodology was used
to select the personnel able to fulfill certain tasks, like for example flying military
aircraft. Later on, human factors began to be investigated also in Europe, and at the
same time its perspective was somewhat changed. With the growing complexity of
some tasks, some systems became too complicated to be operated even by
specialists. The human factors discipline changed therefore its perspective from the
selection of the appropriate user to the investigation on how to configure the task and
the work environment so that they fit human workers. The discipline did not only
change its approach but also its name and became known as ergonomics.
Ergonomics is an interdisciplinary science that integrates knowledge from fields as
different as engineering, physics, physiology and psychology.

404
11.1: The User Interface as a Component in Process Control 405

The control system engineer faces the computer, or machine, as user or as


designer. As a user, he should know how to approach a system, what to look for,
what to expect and how to quickly recognize its basic operational principles. As a
designer of a control system, he has to define how the process-related data is
presented on terminals and control panels and the aspect of commands to be
entered by the user. If a system is designed with consistent and logical rules, the
user will be able to understand and operate it in a short time. In fact, it has already
been observed that the problem with computers is that they do what the users tell
them to, not what the users want them to do. The user interface fulfills its scope if it
really bridges the gap between the machine and the real intentions of the user.
The user interface is the visible portion of the process control system and the
one that the user actually interacts with. Its importance appears in the operation of
complex technical processes. The operators do not longer need to read process
measurements and set reference values in direct contact with the process. Instead
they are responsible for wider parts of the process that they observe on computer
screens from a control center. The number of personnel is reduced, while at the
same time their responsibility is increased. The user interface must support this
higher responsibility by making operations easier, contributing to reduce stress and
limiting the possibility of insurgence of dangerous errors.
There is still widespread confusion about the scope of the user interface. „User
friendliness“ is taken as a goal in itself and quite often is understood as „many colors
on the screen“, the use of a particular windowing system or dialogues in some
national language. However, ergonomy means much more than that. When in a
system the basic ergonomic principles are not respected, it is reasonable to conclude
that the whole system is chaotic altogether. An elaborate interface with windows,
icons and color graphics might have been put in place in order to hide the poor
functionality of a system. If instead the user interface is easy to understand and to
use, then also the technical system behind it is probably well structured. Ergonomic
principles help in the assessment of the quality of the user interface and in some
instances even of the technical process itself.
The design of a user interface cannot be reduced just to the application of some
rules. Ergonomics will indicate in first place what not to do rather than what to do, so
that normal human cognitive capabilities are not exceeded. The design of the user
interface requires critical thinking and the continuous verification of the proposed
solutions, in order to improve them in course of time.
In every technical process it is possible to identify three components (Figure
11.1):
• goals, tasks
• human user
• technical system/process (tool)

The user wants to reach a certain result and to do this he uses the technical
system (tool). Therefore the tool acts as the interface between the user and the goal.
In an optimal case the tool must allow the user to concentrate on the goals and not
be distracted by the way the tool works; in other words, the tool must be transparent
to the task. Simple mechanical tools like the screwdriver and the hammer, that have
been developed and perfectioned in the course of centuries, fulfill their purpose
neatly. While fixing mechanical parts together one dedicates attention to those parts
and to the screws, not to the screwdriver.
406 Chapter 11: The User Interface

human user technical goals, tasks


system (tool)

Figure 11.1: Interactions between the human user, the goals, and the technical system (tool)

On the other hand, in an automated process control equipment and computer


cannot be transparent by definition, as they are the interface between user and
process, but at the same time they also influence independently the operation of the
process. When do the manual inputs represent set-point and when control values? In
a supervisory system, the user ends up working with a new tool represented by the
combination of the original technical system with the control equipment.
The model presented in Figure 11.1 must be extended in order to distinguish the
technical system itself from the control equipment; together they form the new tool for
the user (Figure 11.2). Here the component become four:
• goals, tasks
• human user
• technical system/process (tool)
• control equipment, control computer (tool)

human user process technical


computer system (tool) goals, tasks

Figure 11.2: Use of the process computer in the control of a technical system

The user still wants to reach a goal, but can reach it only indirectly, with the help
of the technical system. Yet also the technical system cannot be manipulated
directly, but only through the control equipment. Therefore the user ends up working
with a new, combined tool to reach its goal. If the control equipment or process
computer does not correctly match the technical system, this makes the operation
more difficult for the user, because he now has to conceptualize the technical system
itself, the control computer and also the way they interact. The control equipment
represents „the tool to use the tool“ and must therefore not be confused with the
process goal itself. For long time however, because of inadequate and not fully
mature computer technology, human operators not seldom had to dedicate more
attention to the computer systems than to the applications these computers were
intended to control. Yet ultimately the user wants to see the fulfillment of the goal and
does not want to concern himself with the control computer for its own sake. On the
11.1: The User Interface as a Component in Process Control 407

other hand, the user can only interact with the technical system via the control
computer. The interaction of all components must therefore be designed in such a
way that at the end the user remains in control of the goal.
If there is an intrinsic mismatch between the control computer and the technical
system to be controlled, for example because of a poor selection of sensors and
actuators, this will result in higher strain on the operator or a more complex user
interface. Therefore, the requirements of the technical system together with
knowledge of the cognitive capabilities of the user must provide the frame on which
the user interface is built.
The role of process operators has greatly changed with the introduction of
computers. The user of automation and process supervision equipment has gradually
moved the operators far from the very processes they run and into control rooms.
This effect is particularly important in supervisory systems (i.e. those that
combine process monitoring with automation functions). They have not always
necessarily brought a simplification in the work of process operators. Instead, the
concept of automated support has partially backfired, because designers who try to
eliminate operators still leave operators to do the tasks which the designers cannot
think how to automate. Operators have therefore not only to control the technical
process alone, but rather a technical process as understood by the designers of the
automation system. Process requirements and operators’ skills are in general not
weighted against each other in the design of the user interface and the emphasis is
usually put on the computer control hardware. On behalf of the designers it can be
said that they have acted with positive expectations about the role of automation and
have applied what they learned. The problem might also be a cultural and
educational one: the role of operators is seldom considered in engineering courses.
In conclusion, the operation of a technical system should be taken in account
and become part of the system design, and not be left as a separate aspect to be
dealt with after the system has been completed. The technical system and the user
interface must be designed in accordance to the operations to be performed by the
user and not to the internal function of the system.

11.2 Psychological Models


11.2.1 Physiology and Cognition
Psychology is the science of human behavior and experience and of the related
mental processes. Many results derived from psychological research are of direct use
in user interface design. Particularly important are those results related to cognition
and perception (i.e. to become aware of something through the senses),
memorization, and processing of information. With these actions a person acquires
knowledge, solves problems and plans for the future. With help of suitable
experiments it is possible to collect information about psychological and cognitive
processes and build models. A basic theory about perception and memory
processing has already been developed and verified experimentally. This theory
provides a foundation for user interface design and is the subject of this Section.
In the interaction with computers or other types of equipment, perception is
almost exclusively visual or acoustic. The most important sense is vision; hearing is
important when acoustic signals are used. The importance of tactile information was
very important with some manipulators (mechanical actuators, brakes, the yoke in an
aircraft), as they could feed back much information to the user. With the introduction
408 Chapter 11: The User Interface

of computer-controlled servo devices this type of feeling has been lost or replaced by
visual information, for example by lamps or symbols on a screen.
It is estimated that the total amount of information entering the body is 10 9 bit/s,
of which only about 100 bit/s are processed consciously. The brain tends to further
reduce the amount of information to process. If too much information is presented at
the same time, acting capacity is lost and the attention tends to concentrate only on
part of the input data.
The perception of colors is one of the most important factors in user interface
design. The human eye is most sensitive to green and least sensitive to the high-end
frequencies of the color spectrum, blue and violet. The eye focuses different colors at
different distances, so that if red and blue are close to each other, the eye tries to
focus them at different distances and unclarity may result. About 8% of the male
population and 0.5% of the female population in Europe and North America have
some kind of color blindness and do not recognize some colors or color contrasts.
In general, attention is higher for unexpected stimuli, but decreases when the
stimuli are repeated. Other factors that increase attention are intensity, size, contrast
and movement. The brain can „filter out“ pretty well a picture or a sound from a
mixture of colors or noises. For example, in observing a picture the eyes tend to
concentrate on the most important details. A similar effect takes place also in
hearing: one can hear several voices at once, yet only one message is perceived and
understood in what is called „cocktail-party“ effect.

11.2.2 The Levels of Human Action


An action model provides a simplified basis to describe the interaction between a
person and the surrounding environment. One important action model related to
problem solving in the operation of engineering systems and that has found wide
acceptance has been proposed by the Danish researcher Jens Rasmussen.
According to this model, human actions are divided in three decisional and action
layers (Figure 11.3).
The skill-based behavior represents sensory-motor performance during acts or
activities which take place smoothly and automatically and without conscious control.
At the next higher level is the rule-based behavior, that takes place in familiar
situations and is controlled by stored rules or procedures which have been derived
empirically during previous occasions.
Obviously, a person does not face only familiar situations. Under unknown and
unfamiliar conditions, when no previous know-how or rules are available, the control
of action must take place at a still higher level, in which performance is goal-
controlled and knowledge-based. In this situation, the goal is explicitly formulated,
based on the analysis of the environment and the overall aims. At this level, the
structure of the environment to act upon is represented by a mental model on which
depends the selected course of action.
This concept can be illustrated by some practical examples. When learning a
complex task, like for example car driving or instrument playing, at the beginning the
knowledge layer is involved. Shifting the gear in the car or moving the hand on a
keyboard requires very high concentration. At this stage attention is high and
efficiency and performance are low. With time and experience, the action is carried
out more and more automatically, first at the rule-level (e.g. by recognizing directly
and without a conscious analysis when it is time to shift gear) and finally at
sensomotoric level, where the action can be carried out almost without any attention
11.2: Psychological Models 409

given. For the trained car driver it is not a problem at all to observe and understand
the traffic patterns, shift the gear and engage in a conversation at the same time,
because the first actions are performed at the sensomotoric level and therefore do
not require particular attention. Skilled musicians do not read one note after the
other, but recognize immediately more complex patterns like phrases, intervals,
scales, arpeggios and execute then accordingly.
Action at the lowest level are the most effective, because no explicit thinking is
required and the reaction can immediately follow the stimulus. Actions at the rule
layer must be selected among several memorized action patterns and therefore can
take place with some delay, as the appropriate rule must be selected. And when new
action types must be defined for special situations, analytical thinking and
comparison with earlier knowledge and experiences are necessary, which costs even
more time and mental efforts.
The action model can help in the design of process interfaces. The division in
skill-based, rule-based and knowledge-based behavior permits the classification of
the work tasks and indicates what kind of support is needed at each level, to be most
effectively provided by the interface.

symbols KNOWLEDGE-BASED BEHAVIOR

goals

identification decision of task planning

signs RULE-BASED BEHAVIOR

association stored rules


recognition state / task for tasks

signals SKILL-BASED BEHAVIOR

feature automated sensori-


formation motor patterns

sensory input (signs) actions

Figure 11.3: Simplified illustration of the levels of human performance (action model), from
[Rasmussen 1983]
410 Chapter 11: The User Interface

11.2.3 The Dual-Memory Theory


Psychologists have dealt for a long time with the function of memory and storage
of information and experiences. Modern psychology differentiates between different
cognitive functions, i.e. how the brain becomes conscious of something that is
reported by the senses. These functions are sensory storage, short-term - or working
- memory and long-term memory (Figure 11.4). The stages in the information
processing by the brain are perception, storage in short-term memory and from there
into long-term memory.

rehearsal
perception (senses):
vision, hearing

short-term long-term
sensory storage memory memory
transfer

displaced (forgotten)
information

Figure 11.4: The dual-memory model

The information collected by the sense organs into the sensory storage is
transferred to short-term memory where the brain can consciously pay attention to it.
From the short-term memory, and in most cases only with a voluntary effort,
information is transferred to the long-term memory. Short-term memory represents
the consciousness, it holds whatever one thinks about at a given instant and provides
the person with a base for action. The storage capacity of the short-term memory is
however limited. Different studies have shown that in the short-term memory there is
place for about 7±2 information items, also called „chunks“ (this is known as the 7±2
rule). Chunks are not equivalent to information bits; in fact a chunk can be very
complex and rich in its information content. New incoming information will erase or
displace the existing chunks. Items not thought about decay quickly and are lost from
consciousness. The items in short-term memory are at about the same abstraction
level, or show at least some homogeneity.
Long-term memory has an almost infinite storage potential, but memorizing and
recalling takes longer. Information in long-term memory makes a person’s entire
knowledge and includes everything from the use of language to childhood’s
memories, from multiplication tables to the name of the King of Ruritania 1. Short-term
memory is fast to recall (and forget) from, all the information contained in it can be
„seen“ at the same time and quick reactions can follow on its basis. Information in
short-term memory has a retention time of seconds, in long term memory it can last a
lifetime.
The distinction between short-term and long-term memory has also a
physiological explanation. There is no „geographical“ separation in the brain between

1
Rudolph IV
11.2: Psychological Models 411

the two storage areas, but the whole brain is involved in both. The difference is in the
type of activity. Short term memory activity can be described in terms of an electrical
field distribution, while long-term memory consists in neuronal interactions and
connections of a more permanent, chemical, nature.
Human memory does not work with direct cell addressing as computers do (in
what state is your neuron #2023965 ?); it works rather on the base of analogies and
associations. In this respect the coding of the information to be stored plays a very
important role. Modern cognitive research indicates that are not memorized forms or
patterns, but rather concepts and associations. In other words, what is stored is the
meaning and not the form of a message or of symbols; for example, after reading are
remembered the concepts rather than the exact wording of the sentences from the
text or the typefonts in which the text was written. The transfer of information to long-
term memory does not simply take place as a voluntary effort, as any student under
preparation of an exam well knows.
Information storage is easier if the new data can be put into an existing „frame“,
i.e. if the data can be related to information already present in long-term memory.
Memorization of different facts works also better if these are not presented alone but
are put in causal relationships. Similarly, recalling is facilitated by „cues“ hinting at
some aspect of the data to be retrieved. There are experimental indications that
memorization is permanent. Forgetting something does probably not mean that the
information is lost forever, but rather that items already stored cannot be retrieved,
possibly because of wrong or missing cues.
Organization and relation with previous knowledge that is already stored in long-
term memory help to handle new information more easily. A key aspect in the
efficient use of short-term memory is therefore coding, i.e. how much „raw“
information to insert in a chunk. Take for example the number sequence
88123296306. It just looks like an arbitrary sequence of eleven figures. Most people
would not be able to recall such a sequence without some effort and would probably
quickly forget it. But regrouping the sequence as 8-812-329-6306 makes it more
manageable, and even more if it is identified as a St.Petersburg phone number (at
least by Russia residents). Regrouping has reduced the number of chunks from 11 to
4, an amount that most people can handle without major effort. Moreover, abstract
figures have been related to known concepts (a city name, a phone number). A
similar example is found with chess players: a master can remember the position of
20 pieces on the chessboard, the novice will remember much less. The reason is
probably that the novice sees this as 20 separated items, the master as one or two
chunks.

11.2.4 Errors
Errors are a natural aspect of all human actions and ways to cope with them
must be considered also in the design of the user interface. Errors can be considered
as actions that lead to an undesired result, if the involved person could have carried
out a different action according to the situation and the competence level. At least in
principle then errors could be avoided. A wrong action that was caused by the
situation or by insufficient competence for the task does not represent an error.
Two types of errors can be defined: the slips and the mistakes. Slips are
actions that intentionally are correct but are then not carried out. Mistakes are
correctly performed actions on the basis of inappropriate intentions.
412 Chapter 11: The User Interface

Slips and mistakes can be referred to the action model (Figure 11.3). Slips take
place at the lowest, sensomotoric level. Mistakes take place at higher levels, where
decisions are taken. An example of slip is a mistyping error on the typewriter or the
shift into the wrong gear in the car. A mistake can take place at the rule-level (e.g.,
wrong spelling of a word) or at the knowledge-level (use of a correctly spelled - but
contextually wrong - word). In car driving, an example of mistake is the wrong
estimation of a slope that leads to a shift into the wrong gear.
The user interface in a computer system should provide for means for error
management. A good user interface must obviously contribute to the reduction of the
number and the consequences of errors. Error management addresses therefore two
aspects: error avoidance and error correction.
Error avoidance requires that the controlled equipment in some way recognizes
an error situation, possibly even recognize the evolution toward an error situation,
and alarms the operator about it. The equipment would then not accept commands
with possible dangerous consequences.
Error correction means that the operator or the equipment recognizes that an
error has taken place and tries to correct it. A widely used solution used in computer
systems is for example the command „Undo“. The computer buffers all commands
before to proceed to their execution, but shows the result, as if they already were
carried out. For example a file would not be immediately erased from memory, but
only scheduled to be erased, and the erasure would take place later on. If the user
changes his mind after having given the command to delete a file, the action can be
reversed within a certain time, as long as the file has not been physically erased from
the system.
The „Undo“ function can obviously only operate when no change in the physical
process has yet taken place. Here there is no possibility to „buffer“ commands like in
the virtual environment of a computer. For this reason, in monitoring and control
systems errors should be avoided - as far as possible - from the very beginning. The
process control system should therefore include data about possible dangerous
states or even a simulation routine to foresee the outcome of an action.
Paradoxically, in complex systems errors should not be avoided altogether.
Errors represent namely a good experience source. It is no coincidence that an
important learning method is called „Trial-and-Error“. In a way similar to the process
of child development, experimenting on one’s own delivers a „feeling“ for carrying out
actions, most of all at the sensomotoric level. There is no way to substitute this
feeling with theoretical training.
When experimenting and „playing“ with the technical system is not desirable or
just impossible (as it would be the case in nuclear power plants), simulation routines
can help collect the necessary experiences without risk. A pilot who already crashed
several times on the simulator will probably be able to keep his aircraft in the air
better than the one who does not know the limits of his machine. In electrical utilities
simulators are routinely used to check beforehand the effects of power flow changes
and the outcome of different configurations and other operations without putting the
real system at risk.
11.3: Human Control of Complex Systems 413

11.3 Human Control of Complex Systems


11.3.1 Mental Models of Complex Systems
The issue of a mental model is central to the whole operation of complex
systems and user interface design. In the supervision and control of technical
processes, which in most cases are complex and difficult to operate, handling
decisions are taken on the basis of some mental model. A mental model can be
defined as the set of abstract ideas that the user build about how the technical
system works and reacts to commands. Actions at the knowledge-based level in the
action model (Section 11.2.2) imply the existence of mental models. Yet, very little is
known about the nature of mental models, just as little is known about the nature of
thought in general.
How important is actually a mental model in order to run a process? An
interesting indication of the role of models in control tasks is given in the novel
„Reason“ by Isaac Asimov2. A robot called Cutie is highly successful in a complicated
control task, the redirection of a powerful electron storm that may destroy the Earth.
Cutie (who eventually saves our planet) follows a conceptual model entirely different
from the one he was instructed for. Cutie does not believe in the existence of the
Earth itself („just a dot on a radar screen“), yet he is able to perform the expected
tasks by monitoring dials and gauges („I kept all dials at equilibrium“). The astronauts
who watch him performing this task affirm then quite appropriately „Then what’s the
difference what he believes!“.
The most immediate - and for engineers almost natural - assumption is that the
long-term memory of process operators contains a model of the process they control.
According to this assumption, process engineers and operators know all handbooks
and technical drawings by heart and always know what to do in order to achieve the
desired result. In this way the user is considered to be a feedforward control unit, that
in an emergency situation knows how to feed the control computer with appropriate
data. Also many training courses are implicitly based on this assumption, as they
convey numerous technical details and information on the system construction rather
than about process behavior.
The assumption of a process model in long-term memory is naive and wrong for
several reasons: human thinking is much less structured and detailed than
information recorded in handbooks. Humans can also restructure and adapt their
thinking patterns, while information recorded in books stays the same all the time.
And most of all, people in charge of a complex technical process just do not have a
copy of this process in long-term memory, so as to simulate it mentally and intervene
when it is necessary.
From psychological experiments and from the analysis of human interaction with
complex technical systems, the following aspects have been observed:
• most people are not interested in finding out the existent trends and
developmental tendencies at first, but are interested instead in the status quo;
they tend only to react to contingent data, without planning for future actions.
• Delay of feedback negatively influences the ability to control a system; people
usually also do not recognize instabilities caused by delays in control action.
• People have difficulties with exponential developments; when they extrapolate
trends they usually do it in a linear fashion.

2
„Reason“ by Isaac Asimov (1941)
414 Chapter 11: The User Interface

• People tend to think in causal series (i.e. that one event influences another), not
in causal nets (several events influence others in complex patterns).
• People tend to deal with those areas which don’t seem to offer them any
difficulty. These are usually the least problematic and therefore unimportant
areas.
• People tend to reduce the complexity of the problem they deal with to fewer and
fewer causes.
A mental model is built in course of time and can be modified and extended
continuously. At the knowledge-level in the action model, the mental model of a
process can have a formal-theoretical aspect, the necessary information can be
provided with training and courses and are built in general on basic facts from
chemistry, physics, electrotechnics. At the rule-level the model consists in IF-THEN
rules, that are apt for the control of the foreseen process operations. A model is also
present at the sensomotoric level; this model cannot be provided by theoretical
training and courses but has to be learned from practice. This is the so-called
„feeling“, e.g. that when a certain switch is activated, then something happens. An
ideal training program should encompass all three levels. The type of mental model
depends of course on the type of system to control: the „seat-of-the-pants“ feeling
that is so important for aircraft pilots does not belong to the action of a power plant
operator.
There is no general agreement about the importance of a mental model to carry
out control operations. And there is no indication that people with special theoretical
background can carry out operations better than other people without this knowledge.
In general, actions carried out at the sensomotoric level are faster and much more
effective than those that require more intensive thinking. On the other hand, high-
level thinking is necessary to explore new situations, for example to find the reason
for a particular equipment failure and devise ways to cope with it. Mental models for
the same technical system can also take different forms depending on their purpose.
The mental model of a mechanician about a car is different from that of the sports
driver. The driver probably could not do his job if he thought about everything that
might go wrong with the engine while pushing it to its maximum capabilities.
The industry, much more interested in practical aspects than in theory, has long
taken the approach that operators can do their job with comparatively little training
and thus with only partial and incomplete mental models. The personnel in charge of
many complex systems has received only little training about the processes, so that
they build their own mental models from other clues and from repetitive actions. In
industrial practice it is therefore generally expected that process operators build their
own mental models of the processes they run in the course of time from experience;
this knowledge is then periodically integrated with theoretical courses.
In addition, the operation of complex systems takes place in most cases via
predefined procedures. Normal operations as well as special situations are described
in the process technical handbooks and it is mostly not required that the operators
act on their own initiative. Because the procedures there contained have already
been identified in advance, operational handbooks reflect a rule-level approach.
11.3: Human Control of Complex Systems 415

11.3.2 Syntactic Information and Semantic Knowledge


A different way to consider mental models, and in particular without having to
refer to them explicitly, is to look at the type of information that is necessary to carry
out a task. It can be distinguished between two basic types of information: syntactic
information and semantic knowledge. Syntactic information has to do with
appearance and form, while semantic knowledge is related to concepts. For
example, geographical information are the names of world capitals or of mountain
heights; geographic knowledge is related to orientation capacity and to the capability
to draw conclusions about the landscape and the economy of a region from a map.
Syntactic information and semantic knowledge are often confused with each other;
part of the reason can be reconducted to many learning programs and teaching
methods that promise knowledge but just deliver pieces of information.
Syntactic information is arbitrary, unstructured and must be memorized. There is
no rule that relates the concept „the capital of China“ with „Beijing“. The arbitrariness
of the relation becomes also evident from the fact that the city is also called „Peking“,
which does not change anything either in the city or in the geography. Semantic
knowledge is problem-oriented and offers a structure from which new facts can be
derived. The knowledge of half of the world’s capital cities (syntactic information)
does not help to guess a further capital name from the name of a new country. The
dependence of the vegetation on the climate is instead a fact with general validity
(semantic knowledge), from which many other facts can be derived, from the
economy of a region to the lifestyle of its population. In the action model of Figure
11.3, syntactic information are situated at the rule level, semantic knowledge at the
knowledge level.
In text processing semantic knowledge is related to concepts like texts,
paragraphs, markings, formatting, etc. The command „Copy text“ is recognized as a
general concept, irrespective of whether the current program is line-, screen- or
graphic-oriented. Syntactic information are instead related to the actual form of the
commands like „Command-C“ (Macintosh), „<CtrlK><CtrlC>“ (WordStar),
„CUT/PASTE“ (VMS-EDT), icons representing scissors and document insertion in
graphical Windows programs, etc. With exercise, this type of knowledge gets
eventually down to the sensomotoric level.
It is important to consider the difference between syntactic information and
semantic knowledge in work with computers, because many of the cues and
indications that the computer must give to the user depend on it.
Several psychological experiments point out that learning a new task is easier if
it is operationally (syntactically) similar to another task, than when the similarity is
conceptual (semantic). In other words, the similarity in the way that systems are
operated at the sensomotoric level is more important than the similarity of the tasks
that have to be performed by these systems. This also explains the success of
Windows interface programs with standard symbols for similar operations, even in
different contexts like text processing, drawing, spreadsheet calculations and so on.
It is easier to transfer the syntactic information about the use of - say - a word
processor with a particular user interface to a spreadsheet program with a similar
interface than to switch to another word processor with an entirely different user
interface, despite the similarity of the tasks.
Syntactic information is based on rules, can be learned by repeated doing and
put to use immediately. An important consequence related to the design of the user
interface is that existing patterns for displaying of information and for command input
416 Chapter 11: The User Interface

should not be changed unless this is absolutely necessary; any changes must then
be plain and clear.
It happens often that people who know many details about a problem or a piece
of equipment, i.e. who possess syntactic information, or those with good
sensomotoric agility are regarded as experts, instead of people who know how to
approach a problem with creativity. This attitude is unfortunately also present in many
computer books: they promise semantic knowledge, but deliver mostly syntactic
information. They do not explain causes or deepest relationships or structures, just
give „how to do“ information. Syntactic information is no better or worse than
semantic knowledge, it just represents a different level of knowledge. The important
aspect is not to confuse between these two types of information and always know
which one is required.

11.3.3 The Management of Complexity


Automated monitoring and control systems must simplify and make the work of
the operators in control of a technical process safer. There is a direct relation
between complexity and difficulty in carrying out operations, so that a reduction in the
complexity of the interface means an increase in the ease how operations are carried
out. Here a difficult balance must be reached. The user interface should never reach
or override the human cognitive limits on memory and attention. There is no point in
showing on a screen hundreds of process values in a similar format and leaving the
user the responsibility to make sense out of them. Complexity must be reduced until
it reaches a level below the limits set by cognitive capacity. On the other hand, an
interface that is „too simple“ is no good either. Such an interface might not provide
the operators the opportunity to train and keep up with the skills needed to handle
unforeseen situations. In addition, with complex computer systems the operators
must monitor the monitoring system and notice whether it is operating correctly. This
adds complexity to their work.
Complexity has an intuitive meaning, but it is very difficult to find an objective
definition and a measure for it. This derives from the fact that complexity is as much a
subjective experience as an objective factor.
For practical purposes, complexity can be considered not as an objective and
measurable property of the physical/technical system and of its representation but
rather as being the result of both the structure of the system and the human user’s
understanding of the system. This understanding, or mental model, is reflected by the
way the user interacts with the system.
The complexity of physical systems can be related to the degrees of freedom or
the number of independent variables to describe the system and the number of
control variables. Aggregated parameters help reduce the complexity of a
representation. The complexity of an ideal gas is quite different if each molecule is
described with its dynamic variables or the gas mass is considered as a whole in
terms of the thermodynamical variables P, V, t and making use of physical and
statistical properties.
Similarly, the number of measurement and control points in a technical process
is roughly proportional to the complexity in control. This complexity further increases
if some of these parameters are related, but not in an obvious way. It is easier to
follow two separated values for, say, temperature and pressure if these always
increase or decrease together, than if they change in unpredictable fashion, like a
11.3: Human Control of Complex Systems 417

temperature increase that is sometimes related to a pressure increase, and


sometimes to a pressure decrease.
In order to evaluate the role of computers in process control, the technical
process is considered here to be a complex system and the control system interface
is the tool to make this complexity more manageable. In this way there is no need to
refer explicitly to the operators’ mental models of the process. The user interface is
namely in a certain sense an interface between the technical process and the
operators’ mental models. The problem is that different operators will have different
mental models, so how can one be sure to cover all of them? The advantage of the
complexity approach is that the operator can learn and use a particular interface, and
the details of his particular model are not essential. What matters is that the operator
can perform his job properly.
Following this approach, the problem of interaction between people and
machines is considered as a cognitive problem in the operation of an unknown, often
complex system. The user wants to solve a problem or reach a goal with help of the
technical process. The user follows a mental model that more or less reflects the real
technical process and that, with sufficient experience and knowledge, is adequate for
the control task. However, the user can control the technical process only as long its
complexity does not exceed his cognitive capabilities.

Complexity reduction
The first goal of the process control system is the complexity reduction of the
technical process. In other words, the technical process „seen“ through the computer
interface must be simpler that the technical process seen through its conventional
instrumentation. The computer must not add complexity on its own and servicing it
must not represent an overload of the cognitive capacities of the process operators.
Control complexity leads to problems in system control, so that a reduction in
complexity makes the work easier. Here lies a great potential in the use of computers
in process control.
Control computers are most commonly used to replace process instrumentation,
but often still keeping the „one sensor - one display item“ approach. The main
advantage in their introduction lies therefore in the more comfortable organization of
the work place and in the automatic logging of process data. What is lost on the part
of the operator if compared with conventional instrumentation is the direct, „tactile“
perception of the equipment; on the screen, all devices and machines have the same
size. In reality, the difference between grams and tons, kilowatt and megawatt,
milliliters and liters is evident; in the virtual reality of the computer screen the
difference is often reduced to the position of a decimal point.
The first step in complexity reduction is an analysis of the process data that have
to be collected and analyzed by the user. The number of sensors and actuators to
monitor and control a process cannot be defined arbitrarily, but depends on the
nature of the process and the control goals (the issues of observability and
controllability were considered in Chapter 3). Also real-time operation is no absolute
concept, but makes sense only in relation to the time evolution of the technical
process.
Let us consider for example a chemical reactor. This may deliver some dozens
values like temperatures, flows, concentrations, etc. If every value is displayed on a
panel, written off manually and becomes part of some computation, this would
represent a notable workload on the user. What the operator is actually interested in,
i.e. the main goal, is whether all current values are close to their respective set-
418 Chapter 11: The User Interface

points. The comparison of hundreds of monitored data with the related set-point
values can be easily done by a computer several times per second. A Boolean
operation could then deliver a general indication, whether the reactor as a whole
operates correctly or not. The user is relieved of manual work, yet he is free to check
the actual data at the desired definition level, if required. A person can therefore at
the same time control several reactors. The computer can also take into account
special operational situations. For example, during transients there are differences
between actual values and their set-points, so that these differences do not need to
be considered as alarms. Similarly, alarm limits can be considered not just to be
fixed, but also in the context of the actual process and its state. All these automated
actions contribute to complexity reduction.

Complexity matching
The second main consideration together with the complexity reduction in the
user interface is complexity matching. Already at the hardware level, the user
interface must match the amount and the precision of the data that have to be
transferred. Amount and type of data ultimately determine the type of interface and
not the other way around.
If a process generates only a few events per hour and the number of the input
and output parameters is small, there is no reason why a small printing terminal or
control panel cannot be used for control. The installation of a process computer for
the control of a simple process would not contribute to complexity reduction but
rather to an increase, because the complexity of the control system would be added
to that of the technical process itself. If the technical process does not generate
enough data, a screen display acts boring and uninteresting.
An important aspect in the interface design is the user's decision scope. Here it
must be considered how much process operators have to follow predefined
guidelines and how much they should take their own decisions, and where the limits
go. The interface should therefore be oriented to the required user competence (rule-
or knowledge-level) and the type of actions to perform in the work. A complicated
interface must be evaluated against the necessity for training. Only when all
components in the chain goal-operator-machine fit together, then the goal can be
reached with the optimal approach of user and machine.
In conclusion, complexity cannot be considered alone, but only in a context
which includes the users of a system. Complexity and usability are conflicting aspects
that must be evaluated and weighed against each other. The difficulty to use more
complex screen layouts and abbreviated commands can be overcome when
extensive training is permitted. If in this case the additional complexity of the display
pages is due to the fact that they present more information or that the command
language is more synthetic (and thus more cryptic), this may still mean an advantage
in the speed of operations. This is for example the case with the operating system
Unix and the text editor "vi-editor". These systems are often accused to be all too
user-unfriendly, but usually once their users have reached a certain level of
competence, they would not change them with other products.

11.3.4 The User Interface as a Tool to Deal with Complexity


As indicated in the previous Section, there is no general objective and
quantifiable definition of complexity. Complexity is in part an objective property of a
system and in part a subjective experience by the user. A reduction in the intrinsic
11.3: Human Control of Complex Systems 419

system complexity can only take place with an intelligent human effort. This effort can
be made by the plant designer, the process operator or the system programmer. The
process designer can take operational factors into consideration and develop a
system that is straightforward to use. The process operator must also deal with
complexity and form own structures and mental models. The system programmer is
responsible for the development of the user interface.
The amount and type of information from the technical process has to be
reduced and brought within the cognitive limits of the users of those data. This task
can be carried out either by the designers of the original technical process or by the
designers of the user interface. If process designers and programmers do not take
care of this aspect, it will be left to the operators. It is therefore advisable to early
structure the process data, possibly already in the design stage.
The most natural type of structure is hierarchic. In most applications it is possible
to define a hierarchy so that some units or elements can be organized together in a
structure described by common parameters. The hierarchical levels correspond more
or less to different decisions to take for the control of a process. In general, all
entities located at the same level have intensive mutual data exchange; the data
exchange between levels is usually reduced and not time-critical (refer also to
Section 9.6.2 „Data Collection and Information Flow in Process Control“).
For example, in a chemical plant a reactor can deliver a dozen monitoring data.
When the attention is focussed on the reactor alone, then the values of set-point and
actual temperatures, flows, concentrations, etc, are of interest. If the same reactor is
considered in the context of a broader processing chain, then only the influent and
effluent rates would be of interest, together with the knowledge, analyzed and
reported by the process computer, whether everything is OK or not. Only when the
computer reports a failure, it might make sense to look at more detailed data about
the reactor to find the reason.
The hierarchical structure simplifies the supervision of a large process, but hides
some data from view. For example, the output control signal of a regulator might
exceed the value it normally takes and could therefore be an indication for
malfunctioning of some part of the system, but this would not appear on the general
indication for the device, still „green“ as long as set-point and actual values are
similar.
The hierarchical model is necessarily very general, yet it offers a useful frame for
the analysis and structuring of control systems. The model is not necessarily
restricted to manufacturing or processing plants; equivalent levels are found in all
complex control systems.
A structuring scheme similar to that of display pages is also possible for
commands. Commands may be at a very low level, with the direct control over every
single actuator, or at a higher level, to perform complete functions. Commands at the
lower level are usually of scarce interest in complex installations where the
components are closely interconnected and interact in multiple ways. A good tradeoff
is to allow simple commands to be transmitted and executed and prepare
comprehensive command files consisting in several simple „atomic“ commands, to
perform more complex functions. These commands would then be oriented to major
operations.
A basis for the interface design is readily provided by the task analysis. This is
the analysis of the technical process and of the operations that are necessary for its
control. Task analysis is performed by looking at and identifying the following
aspects:
420 Chapter 11: The User Interface

• what are the requested tasks for regular operation


• how are these tasks carried out
• what information is needed to perform these tasks
• what range of freedom is left to the operator to act in case of emergencies and
unexpected situation. (The question is not the same as what tasks are required
in emergency operations. If unexpected situations can be planned, they are no
longer unexpected, but become one type of operation.)
The analysis of the physical process on the one hand and of the cognitive
capacities of the operators on the other hand provides the background on which to
define a user interface not only in terms of hardware and software, but also of the
role to be played by the operators.

11.4 The Equipment for the User Interface


The number of devices for the realization of the User interface is not particularly
large. In process control are used mostly display terminals with keyboards and
panels with switches, lamps and instruments. The user community has already made
a de-facto choice by giving preference to simple and practical devices instead of
strange and uncommon developments.
Computer screen terminals and keyboards are the most used devices for the
information exchange between users and computers. The diffusion of the personal
computers and the constantly growing requirements have brought to a notable
improvement in the quality of screen terminals. Screen terminals have a constant
relation of width to height (4:3); the length of the screen diagonal, which is usually
expressed in inches, is taken as measure for the dimension of the screen size. The
resolution of a screen, measured in picture points or pixels, is related to the screen
dimension. The resolution should allow the presentation of texts and of graphics in
good quality. It must also not always be color monitors. For technical reasons, quality
and sharpness are better for monochrome than for color monitors, so that the first
may in some cases represent a cheaper and better alternative.
An important ergonomic factor in monitors is the picture refresh rate, i.e. the
frequency at which a complete picture is generated by the electron beam. This
frequency should be at least 75 Hz, so that even with unfavorable other factors
related to the size of the screen and workplace illumination, the user still has the
impression of a quiet, flicker-free picture. A factor that has had notable resonance in
the last years is the radiation emitted by screen monitors. This definition is not
entirely correct, because the radiation is actually composed of electrostatic fields,
electromagnetic waves and X-ray radiation. New monitors have usually very low
radiation levels.
The media periodically report about studies that relate illnesses to computer
screen radiation. Without entering in the details of the matter, it should be
remembered that radiation from TV screens is much higher than that of computer
screens, yet its possible danger level remains unspoken of. The distance of the
viewer from the device definitely plays a role, still nobody ever complains for the
radiation levels of computers that are used to navigate the Internet or play electronic
games. Oddly enough, only workplace monitors seem to radiate too much.
The picture quality on a monitor does not only depend on the screen hardware
but also from its control electronics. The graphics interface has a certain amount of
11.4: The Equipment for the User Interface 421

memory storage that can be used, for an higher resolution with few colors or for
lower resolution and many colors. In process control applications in general only a
limited number of colors is required and desirable, so that the interface electronics
can be programmed to enhance the optical resolution in first place.
The keyboard is the most common computer input device. The alphanumeric
keys have almost everywhere the same meaning, besides some national-related
features. The definition of the control keys is instead not standardized, and also the
position of the keys differs depending on the keyboard design. On a new keyboard
the user must learn a new relation between keys and commands, which can lead to
difficulties and errors at the sensomotoric action level. Common screens and
keyboards are built for office use and are therefore sensitive in relation to typical
process environments with high levels of moisture, dust and vibrations. To use
keyboards, finger agility is necessary. Moreover, keyboards can be used only with
difficulties when wearing gloves. Special „rugged“ computer screens and keyboards
are available for use in industrial environments.
Although it may sound antiquated, a cheap and practical I/O device for the
monitoring and control of slow processes is the printing terminal or teletype. It is used
when information is exchanged at a low rate (1-2 events / minute) and each
information item is self-contained, i.e. not related to other information, so that the
user does not have to wait too long for the completion of a long printout in order to
get the complete picture of a situation. The printing terminal has the advantage that
the display medium (the paper) can also be archived as operational record with no
need for further processing.
Control panels were used mostly from the 1950s and through the 1970s, when
the process interface devices were wired one by one to their indicators and controls
located in central control rooms. Control panels have indicators like lamps and
needle instruments as data output and switches or keypads for data inputs. Control
panels can be used with a limited amount of data I/O and when the commands are
clearly identified, with only a few possible alternatives. When control panels are
mainly used as display device they are known also as mosaic boards or mimic
boards.
Mosaic boards still represent a viable alternative in the representation of
processes with a strong linear extension, as for example railway lines and pipelines.
The reason is that in many cases it is unnatural to look at such a system in pieces as
it would be on a screen monitor. Mosaic boards can be built to represent the overall
state of the technical system, while computer screens would provide more detailed
information about specific parts of the system. For example, in a railway control
system a large mosaic board in sight of the train dispatchers would show the linear
extension of a railway connection, indicate the position of the trains and the status of
the most important signals. The computer screens would present on request more
detailed information about specific track sections, trains and other equipment.
Special alarm situations can be shown with optical and acoustic devices on
control panels and under computer control. They are used to draw the immediate
attention of the user, who might be dedicated to a different task. In the case of
acoustic devices, some parameters (tone level, frequency, loudness) should be
adjustable by the operator. It is imperative that such devices have a quick and
practical reset command in order to avoid unnecessary annoyance, once an alarm
has been perceived.
The interest for direct pointing devices like lightpens and touchscreens is still
quite limited among users. The movement of the arm from the worktable to the
422 Chapter 11: The User Interface

screen and back is tiresome, requires time and the precision of the movement is
limited. Pointing to a screen with a finger or with a lightpen takes more time than by
using an indirect control device such as a mouse or a trackball. In the first case there
is also a „fingerprint effect“. Lightpen and touchscreen are however of interest when
the use of a full keyboard is not warranted or possible and the dialogues can be
organized in the form of menus with a small number of basic selections. But even
here, a small keypad could easily replace the touchscreen for input. Still,
touchscreens are quite popular in control systems for machines in the manufacturing
industry and in public information points, for example as remote banking systems. In
these applications the user is standing and the number of interactions is limited, so
that the ruggedness of such terminals is the most important design factor.
The mouse, the trackball and the joystick are indirect pointing devices for the
control of the position of a marker or pointer on the terminal screen. The selected
object or field is highlighted for immediate optical feedback. The selected option is
confirmed by pressing a key, for example one of the keys of the mouse. The
precision of movement is much higher than with touchscreens and lightpens. It will be
incidentally noted that devices like the joystick and then on the mouse were first
developed for use by children. It turned out later on that their simplicity was strongly
appreciated also by adults.
A mouse, a trackball and a joystick are cheap and simple input devices that can
be used for the fast control of processes with an immediate feedback: mouse and
trackball for pointing at objects on a computer screen, the joystick for the remote
control of a mechanical actuator (e.g. a robot arm). All these devices are quite
unprecise by themselves, but allow fast corrections. The human acts as „feedback
correction“ either from the visual input from the screen or by watching the position of
the mechanical actuator. The use of a joystick to control the set-point in a chemical
reactor would be a mismatch, because the device does not provide the required
precision and because the slow dynamics of a chemical process does not require the
use of a fast input device. A potentiometer or, for more precision, a digital input
represent much better choices for that type of control.
The computer industry has invested huge sums in the development of speech
recognition systems. For decades a solution seemed to be very close, but every time
it had to be admitted that it was not yet the case. The systems available today can
only recognize words that are pronounced singularly and match a prerecorded
pattern. Until a machine can reliable decode normal speech with different intonations
and accents, and especially in unfavorable settings like industrial environments with
loud background noises, the use of speech recognition interfaces will remain limited.
Speech generation is technically easier than speech recognition, and different
systems are available on the market. A drawback of speech generation is that their
messages can come at random, when the user does not expect them and therefore
pays no attention. Computer-generated voice simulates human voice remarkably
well, but they still lack intonation, modulation and accentuation, that represent an
important component in human language and convey much information themselves.
The description of the following section will assume the operation of an user
interface built with a computer screen with the possibility to highlight the presented
data, a keyboard with function keys and a pointing device like a mouse or a trackball.
This type of hardware is simple to obtain, inexpensive and very well widespread.
Many of the following considerations can however be used also in the design of
special terminals or control panels.
11.5: A Practical Approach to User Interface Design 423

11.5 A Practical Approach to User Interface Design


11.5.1 General Principles
The general principles in the interaction between people and machines
described in the earlier sections must lead to the practical realization of the user
interface. Hardware and software components have to be properly selected,
designed, constructed and put together. Today, computers and workstations offer
advanced capabilities at little expense. The question is then not whether to use
advanced graphical representation, but rather how to use it effectively. In the
following description it is assumed a hardware user interface based on a graphical
terminal, a keyboard with control keys and a pointing device like a mouse. This kind
of hardware is readily available, is quite cheap and more than adequate to build a
good user interface. Emphasis has to be put on the correct interaction of system
components and on the correct coding of messages and commands. Some of the
following considerations also hold for the design of control panels with pushbuttons
or other types of interfaces.
Three basic principles are valid for all kinds of applied and functional design and
consequently also for user interfaces. These principles are: simplicity, visibility and
consistency. They have to be understood as framework and not as an immediate
design guide for specific details.

Simplicity
Simplicity is the most important principle for all kinds of design. In process-
control applications where computer terminals are used every screen display page
shows a model of the physical process and its operation. Simplicity means that no
useless or irrelevant and excessive information is presented together with the
important data. On the other hand, simplicity should not mean an impoverishment in
the representation. As simplicity as such cannot be measured objectively, it can only
be taken as a general principle to be put in the context of other design and evaluation
methods.

Visibility
Visibility is the degree of transparency of a system in describing its own
operations. Ideally, the user should have the feeling to interact directly with the
technical process and not with the computer system. Visibility allows the recognition
of the purpose and function of a device from some visual clues (color, form, shape)
on the interface. Visibility must provide the link between the technical process, its
operations and the user’s mental model of the process. The monitoring and control
computer must support and enhance the visibility of the controlled process.
An example of simple and „visible“ display for process control applications is
shown in Figure 11.5. It is not necessary to read a numeric value or check in a
handbook to find out whether the displayed value is within the allowed range.

0 10 20 30 40 50 60 70 80 90 100

Figure 11.5: Example of intuitive representation


424 Chapter 11: The User Interface

The aspect of technical display instruments is the result of a development that


took several decades. Pointer instruments provide immediate information about the
relative magnitude of values and their trend; digital instruments show information with
higher precision, but are not perceived as quickly.
In some computer systems, visibility is obtained by using pictorial metaphors
related to everyday experience. An icon on the computer screen represents an
operation by means of known symbols: for example a pen can indicate something to
write with and a magnifying glass a zooming feature to look at data more in detail.
The symbols are not real, they relate the operation of the known objects with similar
operations for the computer: the symbols give visual clues to their function and
operation.
It is important not to overestimate the importance of metaphors, especially in
industrial process control applications. The comparatively unskilled office user might
find it helpful and pleasant when everyday symbols indicate system functions. For
process operations, it is probably better to indicate things for what they are and not
resort to different representations. When metaphors from different sources are mixed,
this may add complexity that contributes to confusion. General consistency with
known and trained rules and established standards is therefore more important than
the use of metaphors.

Consistency
Consistency means that the same representation is used for similar or analog
components in a system. In order to apply consistency in the description or
visualization of a system, it is first necessary to establish or create a structure.
Consistency can also be considered as visibility by analogy. Where visibility is
necessary to understand a concept the first time, consistency helps transfer existing
knowledge to new contexts.
Consistency is probably the most difficult feature of all to realize in a user
interface. In order to achieve consistency it is necessary to form classes of
similarities and differences and then apply the same rules (language, abbreviations,
colors) to qualify the related information. The classes requested by consistency
should be kept to a minimum. For example, if the key <F4> is used to load a file in a
part of a program, is should not be used to reset peripheral units in a different context
of the same program, while files are loaded with <F9> instead.
Consistency is more difficult to achieve when different people participate in the
same development project, as one programmer might like to write warning messages
all in capitals, another in lowercase. There is always a certain number of issues that
remains unaddressed in team projects, and the style of warning messages might be
one of those. But when they will be seen by the user, this will be led to draw
conclusions that in reality are unwarranted.
A difficulty in achieving consistency is when several conflicting rules apply for a
certain representation and it is not obvious what rule should hold. To overcome such
a situation, two methods can be used. One is that each consistency aspect is related
to one visual clue only (size, color, form, etc.), so that different conditions may be
indicated at the same time (e.g. via size and color). A second solution is to establish
a hierarchy, where a type of information overrides others.
An important potential for consistency is offered by the use of standardized
interfaces. The initial anarchy of many different products has evolved to a situation
11.5: A Practical Approach to User Interface Design 425

where specific interface products (Microsoft Windows, IBM Standard Application


Architecture) provide an established frame for the interface.

Example 11.1 Remote appliance controls


Remote controls for appliances like TV sets, videorecorders and CD players
often provide examples of poorly designed user interfaces. It is not unusual for a
remote control device to have between 30 and 50 buttons, of which only a few
ones are of immediate importance (volume, channel selection, mute), others of less
importance (luminance and contrast control, tune selection on CDs) and still others
of very limited importance (clock programming or deck opening in CD players).
What is the point of opening the deck from a distance, when one must be in
proximity of the device anyway to insert or take out a CD? Still the producers
assume - not without reason - that the number of keys on the control panel and on
the remote controls impresses the customers and contributes to increase sales
figures. And many customers actually do the same, as they know that their friends
are at least as impressed by the amount of keys on their latest model of stereo
player as from the music they hear.
A remote control device designed for simplicity and usability would only contain
the most important controls (like volume, tune selection, program selection and a
few more) and leave on the main panel all the keys for those functions that are
executed seldom in the life of the device (e.g. clock programming) or that require
proximity (like tape recording, that requires the manual insertion of the tape, so that
the corresponding commands can be given right away on the device).

11.5.2 Use of Language in the User Interface


Information exchange with computers takes place in different forms: by setting
switches and reading lamp indicators, by entering analog values via a continuous
manipulator (mouse or joystick) and by looking at symbols and data on a screen. A
common way to transfer information is via natural-language messages displayed on
a screen or typed via a keyboard. In this interaction the language is used differently
than for normal communication among people with natural languages.
In most cases, the process or system development engineer is responsible for
the selection of appropriate text dialogues that are then used by other people, the
process operators. The operators will have to take decisions and perform actions on
the base of the presented information. Computer language should then not be a poor
copy of natural language, but be defined on its own to achieve the intended
communication purpose. A few indications about this use of language will follow here.
Typical computer outputs are either sampled information about analog values
(„TEMPERATURE=66.2°C“), clear text messages with a few possible alternatives
(„DEVICE CONNECTED / DISCONNECTED“) or prerecorded messages („The
computer will be shut down in 5 min“). The language used for human-computer
interaction lacks most of the features that belong to natural languages, like margins
of unclarity, redundancies, use of rhetorical figures, etc. The computer use of
language is fully predictable („TEMPERATURE=27.9°C“), contrary to natural
language („the temperature must have reached the thirties“).
A short sentence used to indicate only a limited number of states can be divided
in a fixed text (lead text) to indicate the type of selection together with a variable for
the actual state (dynamic variable). The lead text alone shall not give complete
426 Chapter 11: The User Interface

information in grammatical / syntactical sense; it should rather create a small


„tension“ to be released only in conjunction with the dynamic information. In this case
it is avoided that the lead text alone is misunderstood as to be itself the actual state
information. Only the combination with dynamic information should make complete
sense. In most cases it is sufficient to use a different form for a noun or verb; for
instance
instead of: device A11 powered: YES / NO
use: device A11 power: ON / OFF
In general, lead texts that require an answer like YES or NO should be avoided.
In a particularly poorly designed system known to the Authors were displayed
messages like „NOT ALARM STATE=YES“ (in plain language: „everything’s OK“).
This kind of output might be correct in a Boolean sense, but is not easily understood
by humans and leads easily to confusion.
The lead text should not be too generic and should contain hints on what the
dynamical part is going to be. Compare the following examples:

device A12 status: ON / OFF ?


OK / ALARM ?
ACTIVE / STANDBY ?
write instead:
device A12 power: ON / OFF
device A12 operation: OK / ALARM
device A12 connection: ACTIVE / STANDBY
A clearer distinction between static and dynamic information is obtained on
screens when the lead texts are written with normal intensity and the dynamic
variables in high intensity. If the dynamic variables are also used as input, the
variable currently selected may for example be shown in reverse video (that is, where
foreground and background colors are exchanged). Dynamic variables showing
parameters in alarm state can be highlighted using a different color or reverse video.
Synonyms are very useful to enrich texts and convey subtle meanings in literary
texts. In computer and process control applications should instead hold the principle
one name - one concept. In a very poor system one of the Authors had to work with,
in different program parts/ subfunctions there were among several other
inconsistencies seven (!) synonyms for „Exit“ („Exit“, „Quit“, „Leave“, „Break“, „Stop“,
„End“, „Termination“). All these commands were used to do the same thing, i.e. to
step back to the next higher program control level, yet it was still not clear in what
cases exiting a function would include the automatic saving of recently input data and
when not. The users had to be constantly alert and memorize command sequences
after they were found to lead to the desired results, so that at the end more attention
was dedicated to the commands than to the actual work tasks. It remains unsaid how
much time and work have been lost by the users because of this poorly designed
interface.
The use of words with negative connotation („ALARM“, „WARNING“) should be
avoided in lead texts unless they are clearly unrelated to the actual state of the
controlled system. The texts should motivate and not unnecessarily alarm or irritate
the user.
11.5: A Practical Approach to User Interface Design 427

Quite often, it is important to abbreviate some words and expressions. Different


principles for abbreviation can be followed, an abbreviated text could for example
encompass the first five letters of the original word, or include the first vowel and the
first two consonants following it, etc. What is essential is that the abbreviations are
formed consistently and that different principles are not mixed. Consistency means
that the user should quickly understand the principle and be able to guess the right
form for an abbreviation, even without knowing the related rule.
Concerning the selection of fixed messages, a „nice“ machine does not blame
faults on the user („wrong input!“) but on itself („The command cannot be carried out
as indicated. Please enter parameter xy.“) or on factual data („Your withdrawal limit
for today is 500 USD. Please input the desired amount in the range 20-500 USD“).
The second and the third message indicate also what kind of measure is required by
the user and provide therefore practical support. The style „If the temperature is over
200°C, then the action x should be performed“ should be left to handbooks. On a
screen page, clarity and conciseness are imperative „Temperature = 226°C. Perform
action x.“
Concerning style and pregnancy, the operational instructions for fire
extinguishers are a good reference also for computer texts.

Example 11.2 Intelligent „do-it-all“ office telefax


Office machines often provide examples of mismatches between the different
components of the user interface and about how the wrong use of language makes
operations much more difficult than they need to be. As an example can be
considered a new fully functional telefax manufactured by a world-class company
in its field. This telefax, that also operates as computer printer, modem and
photocopier, has a total of 54 keys on the control panel (only there is no „ON/OFF“
key, to turn the device off one must pull the plug). To be successful on a world
market, the instruction booklet (220 pages) and even the instructions on the panel
are written in local national languages. The problem is that most probably the
control panel labels were translated by different people that those who translated
the handbook, as they match only in a few cases. Where the instruction book
indicates „Directory tuning“, should one press the key marked „List of users“ or the
one „Directory organization“? Two different keys are marked „List options“ on the
panel, whereby - according to the instruction booklet - one means „Report options“
and the other „Copy Quality options“. At this point it is only consequent that what
the handbook calls „Mailbox tuning“ is actually marked „Address setup access“ on
the device. Similar discrepancies are found in the way the dialogues are carried out
and in the programming procedures. As a result, most of the functionality offered
by the device remains unused because the efforts required to learn about it are too
high.
In relation to more process-related applications, how would one feel if the
same approach were used for labeling the controls in the cockpit of a passenger
aircraft or a nuclear power plant?
Companies that sell technical equipment of any kind - from computers to TV
sets to washing machines - know that instruction handbooks are read only after the
sale has been completed and therefore do not put particular efforts in their
preparation. Moreover, also handbooks tend to be thick in order to impress the
customer. The necessary information is almost always reported in the handbooks,
but if at least efforts were made to separate the few important things from less
important details, it would be at everybody’s advantage.
428 Chapter 11: The User Interface

Example 11.3 Public phones and cash dispensers


Public phones and automated teller machines / cash dispensers usually
provide examples about good user interfaces. These devices must be used by a
large nonspecialist population that cannot get special training or spend much time
to operate them, especially when dealing with unfamiliar devices.
To dial a phone call from a foreign country or to get cash from an automated
teller is in principle a more complicated operation than making a photocopy or
sending a fax, because they involve more extended dialogues with the machine,
and some information must be entered by the user (passwords, codes, money
amounts). Yet automatic phones and cash dispensers are remarkably easy to use.
The reason is simple: if they were in the slightest difficult, then a substantial
percentage of potential customers would not be able to operate them and the
related business would be lost.
If copying machines and telefaxes generated cash for their producers in
proportion to the amount of successful operations, how would their control panels
look like? Would the quantitative sales argument of number of functions still be
more important than the qualitative one of ease of operability?

11.5.3 Coding
The human-computer interface must draw the user’s attention to important facts
and support a prompt and correct reaction on the basis of the presented information.
In this task, coding plays a crucial role.
As already examined in the Chapter about communication, coding is the change
of some property of a communication channel (Section 9.1). A code relates the type
and amount of change of the channel property with the information that has to be
transmitted. Several codes may act concurrently, changing different properties in
parallel and thereby conveying more information at the same time. Common visual
codes for items shown on a terminal screen are color, shape, dimension.
Psychological experiments have been carried out to test the human reaction
speed to information conveyed with symbols coded in different ways. These
experiments indicate that coding by color or by color and shape together lead to
faster reaction times in the observers than coding by shape alone. It follows that color
is the more important coding attribute.
Other experiments have addressed the issue of whether highlighting important
items on a display screen makes them easier or not to recognize. Again, highlighting
by color is perceived easier and faster than blinking and reverse video. Moreover,
highlighting can be of benefit at the beginning, but as the user gets more practice, he
generally knows the location of the searched information and highlighting becomes
more of a hinder. In particular, a text should never be let blink or scroll, because this
makes its reading more difficult. It is sufficient to let a small symbol blink near it.
Colors can provide clues when they display functional states. Green is generally
perceived as indication of security, permission or correctness (it may for example
indicate that a unit is in proper working order). Red is related to states of alarm,
danger and prohibition. Yellow is understood as a warning and can indicate the
presence of some minor problem.
Simplicity suggests that the number of colors, shapes and highlights in general
should be kept to a minimum. Moreover, only a few different colors or shapes can be
recognized if considered alone; when it is necessary to present several colors or
11.5: A Practical Approach to User Interface Design 429

shapes (like e.g. fill or raster patterns), then a graded comparison scale should also
be shown as a reference. Colors should be used sparingly; 4-5 colors are understood
with no major effort; there are indications that 7 different colors is an absolute
maximum to never exceed.
It is important not to rely only on colors as a means of showing important
information. A large number of people are blind to some colors and are therefore
incapable of recognizing them. Environmental factors like illumination and shadows
may make difficult the perception of some colors on a terminal screen. The
information to be shown should therefore present some kind of redundancy, for
instance with help of labels, texts or other graphical symbols, in order to ensure that
the conveyed meaning is understood.
The operation of devices may be represented on a computer screen or on a
control panel with symbolic or functional coding. For example, if a switch is used to
connect alternatively two devices (or a production line branches into two cells), the
switch position itself can be shown, or also which device (or cell) is connected,
identifying it with a different feature like an empty or framed symbol (Figure 11.6).
The functional representation does not require an explicit interpretation of the picture.

(a)

(b)

Figure 11.6: Graphical representation: (a) symbolic vs. (b) functional

Consistency requires that a coding clue (color, shape, fill pattern) maintains its
meaning across the whole system and not be context-dependent, i.e. that the same
clue carries a different meaning on different screen pages. If red indicates an „alarm“
state in a screen picture, it should not indicate „hot“ in a different picture or „inflow“ in
a third one. In addition, coding must be natural, i.e. it must be processed
unconsciously and not require explicit interpretation. Coding „cold“ in red and „hot“ in
blue or also „OK“ in red and „ALARM“ in green is technically trivial, but would require
an effort to be understood because it is unnatural.
It might be argued that with training the operators will be able to tell when red
means „alarm“ and when it means „inflow“. This is true, but then an important
advantage of cognitive knowledge is missed. According to the action model (Section
11.2.2), the most efficient reactions are those at skill (sensomotoric) level and at rule
level. If an operator learns by training that red always means „alarm“, when he
perceives the color, there will be an almost immediate reaction. If a thinking effort is
needed, like to weigh the stimulus „red“ with information of the current display screen
and what red means in that specific context, the effort will be greater and the reaction
slower. Also the probability for errors is increased.
There will always be conflicts in the right choice of symbols. A process that is in
alarm state because its temperature is too low should be represented in red or in
blue? It depends on what has highest priority, whether to give an immediate feeling
430 Chapter 11: The User Interface

about the temperature or an indication of the functional state, where the natural color
for alarm is red. In any case, consistency should hold through all representations. It
does not matter what a code represents, as long as it always represents the same
thing.

11.5.4 Process Representation


The representation of process-related information on computer screen displays
is one of the most important aspects of the user interface in process control
applications.
The information showed on a display may be considered from a direct point of
view (to convey information) of from a pragmatic point of view (to lead the operator to
perform the designer’s intentions). The purpose of process control is in general (1) to
direct the process according to a production schedule and (2) to recognize and
identify alarm stati and take appropriate measures to guarantee the safety of a
process. The information presented on the display must then support different types
of task:
• normal operations: start-up, shut-down, normal process control, parameter
identification, process optimization;
• identification of alarm stati;
• support in the search for a correction strategy.
The information content must be adapted to the user: the expert is not interested
to „simple“ information that instead can be very important for a beginner. Yet novices
use the same equipment as expert users and compromises have often to be made.
In addition, the typical computer user tends to give importance to everything that
appears on a screen. Therefore screen displays should be simple and not contain
useless information, otherwise there is a risk that unimportant items draw
unwarranted attention.
The problem of the screen representation consists on what must be shown and
how it should be represented. The first question can be answered with an analysis of
the structure of the technical plant and the goal of the representation, i.e. what
information must be conveyed or what work task have to be accomplished. If the data
have general information character, then possibly even a simple tabular
representation might fulfill the goal. In this case it should only be ensured that
consistent measuring units, lead text and state representations, etc. are used.
The simplest method for structuring the data from a complex plant follows the
hierarchical division of the information flow described in Section 9.6.1, as shown in
Figure 11.7. On each display page should be shown only one basic concept in the
simplest possible way. Emphasis should then be given to the most important
information concerning a specific object or work task. For example, in a plant
overview the functionality of the plant has the highest importance. All parameters
related to the same device can be shown on a screen. The screen dedicated to a
work cell will present only few basic data for each device, like whether it is operating
correctly and the current production or processing rate. At an higher abstraction level,
the screen layout for a production line will present basic data for all the cells, whose
detailed states do not have to be displayed. Although the main concept (the plant or
production line) is complex, the functional idea on each screen can remain simple:
does the machine, cell or plant operate correctly or not ?
11.5: A Practical Approach to User Interface Design 431

management
level

production
control level

cell control
level

process control level


(data from sensors,
actuators)

Figure 11.7: Structuring of the process representation in relation to the control levels

With modern windowing systems it is easy for the user to put together the
information that is needed exactly as wished (Figure 11.8). Nevertheless, each
window should still convey one basic concept; it is the user who organizes the
different windows on the screen as required.
In general, a good layout organization has the following characteristics:
• it is adequate for the purpose; it does not present more or less information than
necessary (simplicity);
• it is, as far as possible, self-explaining (visibility);
• it is consistent at more levels. The same coding, in symbols and colors, carries
the same meaning on different screen pages and the user knows what to
expect in different situations (consistency).
432 Chapter 11: The User Interface

The purpose of a display representation can be to induce the user to perform a


certain action. In this case, the information on which basis the user must act should
be highlighted on the screen. If instructions for the control of a machine are given,
these must be clearly represented. When several alternatives depend on the
displayed data, the required action should be represented in a direct way.
The memory of the user should not be overloaded, especially in consideration
that one problem computers do not have is to effectively store and recall information,
and do it definitely more efficiently than humans. The user should not have to
remember information from a display page to use it then in another page; essential
information can much more simply be displayed on several pages in relation of the
tasks to support. The completion of any given task should then be completed in few
steps and with as few commands as possible.
The picture of a process in a graphical display page can be designed according
to different principles. In the geographic or physical representation a plan of the plant
or unit is drawn with its specific symbols (most technical symbols are standardized
and can be used in screen representations). The layout is then produced on the
basis of technical drawings; the result might however turn out to be complex and
difficult to understand. An alternative is to represent the evolution of the physical
process linearly, without consideration for the actual spatial placement of the devices.
In the latter case, a straight layout disposition from the left to the right is usually
preferred.
The principles of simplicity, visibility and consistency applied to the design of
screen pages are probably the most successful method for the reduction of the
complexity of a presentation. Any step or change in design that improves one of
these aspects without negatively influencing the others should be carried out.

Figure 11.8: Example of windowing system for the presentation of process data, for the
process control system ABB Advant OCS. Different levels of detail are shown
simultaneously on separate windows under the control of the user (courtesy of
ABB Automation Products AB, Sweden).
11.5: A Practical Approach to User Interface Design 433

In Figure 11.9 and 11.10 it is shown how structuring can help make a
representation much better understandable. The data shown is exactly the same, the
difference in the result is immediately apparent.

Water Treatment Plant [24] Chemical Precipitation Section 14:18:04

PUMP 105 PROCESS WATER STATE=ON ALARM=NO OVERHEAT=NO


PUMP 118 WASHWATER STATE=ON ALARM=NO OVERHEAT=NO
PUMP 127 REACTION VESSEL OUTPUT STATE=ON ALARM=YES OVERHEAT=NO
PUMP 132 SLUDGE SILO FEED STATE=ON ALARM=NO OVERHEAT=NO
PUMP 138 SLUDGE SILO OUTPUT STATE=ON ALARM=NO OVERHEAT=YES
PUMP 139 SLUDGE FINAL OUTPUT STATE=OFF ALARM=NO OVERHEAT=NO
PUMP 143 VACUUM FILTERING STATE=ON ALARM=NO OVERHEAT=NO
PUMP 154 LIQUID WASTE STATE=ON ALARM=NO OVERHEAT=NO
PUMP 166 LIQUID FILTRATION STATE=ON ALARM=NO OVERHEAT=NO
PUMP 221 ALKALI INLET STATE=ON ALARM=NO OVERHEAT=NO
PUMP 226 NA-SULPHIDE INLET STATE=ON ALARM=NO OVERHEAT=NO
PUMP 232 POLYMER PROC.A INLET STATE=ON ALARM=NO OVERHEAT=NO
PUMP 237 POLYMER PROC.B INLET STATE=OFF ALARM=NO OVERHEAT=NO
PUMP 242 POLYMER PROC.C INLET STATE=ON ALARM=NO OVERHEAT=NO
REACTION VESSEL OUTPUT /127/ (m3/h) = 53
SLUDGE SILO FEED /132/ (m3/h) = 92
SLUDGE SILO OUTPUT /138/ (m3/h) = 74
NA-SULPHIDE INLET FLOW /226/ (m3/h) = 68

Input Command >>

Figure 11.9: Example of a poorly structured display page

Water Treatment Plant [24] Chemical Precipitation Section 14:18:04


Main reaction Operation Function Overheat Flow Rate
PUMP 105 PROCESS WATER ON OK OK
PUMP 118 WASHWATER ON OK OK
PUMP 127 REACTION VESSEL OUTPUT ON ALARM OK 53 m3/h
PUMP 132 SLUDGE SILO FEED ON OK OK 92 m3/h
Main reaction Operation Function Overheat Flow Rate
PUMP 138 SLUDGE SILO OUTPUT ON OK ALARM 74 m3/h
PUMP 139 SLUDGE FINAL OUTPUT OFF OK OK
PUMP 143 VACUUM FILTERING ON OK OK
PUMP 154 LIQUID WASTE ON OK OK
PUMP 166 LIQUID FILTRATION ON OK OK
Main reaction Operation Function Overheat Flow Rate
PUMP 221 ALKALI INLET ON OK OK
PUMP 226 NA-SULPHIDE INLET ON OK OK 68 m3/h
PUMP 232 POLYMER PROC. A INLET ON OK OK
PUMP 237 POLYMER PROC. B INLET OFF OK OK
PUMP 242 POLYMER PROC. C INLET ON OK OK
Input Command >>
>>

Figure 11.10:The same information as on the display page of Figure 11.9, in a structured
representation
434 Chapter 11: The User Interface

11.5.5 Operator Commands


The interaction between humans and computers does not only take place from
the machine to the user but also from the user to the machine, when control tasks
have to be carried out. The user enters data by typing in command sequences on a
keyboard, by pushing buttons on a panel or by manipulating a device like a mouse or
a joystick. Some considerations regarding the design of communication from human
to machine follow here, with special consideration to controls typed in via a keyboard.
It is very important for the user to get an immediate „feeling“ that a command has
been received and accepted, even if the related processing does not start
immediately. The feeling starts right from the acoustical „click“ when a key is pressed
or by seeing a pointer moving on the screen under control of the mouse. Another
example of direct feedback are the tones in a touch-tone dialing phone. The
feedback is intuitive: few people would recognize the dialed number from the tones,
but the information is sufficient to tell that all the numbers were dialed and whether a
finger slip led a number to be skipped or dialed twice. If instead nothing seems to
happen after having pressed the <RETURN> or <ENTER> key because of a long
process response time, one may wonder whether the system operates correctly.
A command defines a reference value for a state; the actual value will later
become equal to the reference value only if control system, actuators, sensors and
physical process all work correctly. It takes some time before a command reaches
the actuators, is executed and the verification is reported back to the user. Actual and
reference values must be presented with a clear identification so that they cannot be
confused with each other.
If a system does not immediately react to a command, some kind of preliminary
response should still be produced as verification that the command was accepted
and is currently being processed. This could for example be a message of
acknowledgement or a different highlight of the input data on the screen. The effect
of a command should be immediately evident and there should always be a
possibility to reverse it. For processes with longer time constants, the first reaction
could be a message from the process computer of the kind: „New temperature set-
point value is 66°C. Estimated time to reach set-point is 18 minutes [at 14:28].“
A hierarchical structure, in a way similar to the hierarchical structuring of the
process and its communication flow is also possible for commands. At the lowest
level are the input commands for the direct control of the actuators, while at higher
levels complete sequences for the control of complex procedures can be started.
These sequences have the aspect of batch or command files.
Consistency is not only important in the process representation, but plays an
important role also for command input. Similar to the data output, also the command
input should be context-independent and lead to the same results, irrespective of
past activities and system history and the current state of the program.
String commands to be typed explicitly on a keyboard should be as short as
possible, yet not lose their meaning. A good method is to use the first letters of the
command name, provided that different abbreviations are not confused with each
other. In the VAX/VMS operating system this method is used for all commands and
parameters, where the first four letters are sufficient to uniquely identify any
command (commands may also be typed in their entire length).
In fields where an alphanumeric input is requested, only a few combinations
usually make sense. „FGS“ and „OID“ are letter combinations as „ON“ and „OFF“ are,
but they won’t be understood by a binary actuator. The possible alternatives to avoid
11.5: A Practical Approach to User Interface Design 435

nonsense input data are: (1) to display the correct values as part of the background
information; (2) to provide a window menu selection of the possible values; (3) to
display a message if the input is not understood by the system.
The alternative (1) is not feasible when the number of possible commands is
large; it leads easily to cluttering the screen with too much static information.
Alternative (3) may cause delays, depending on the frequency of mistakes. The
solution (2) may be the optimal choice; it is the preferred method with windowing
systems and pull-down menus. A new value can be selected either by typing in it
explicitly, or at least some of its characters, or by pointing at it in the sub-menu with
help of the arrow keys or the mouse. The selection is then confirmed by an
<ENTER> command or a mouse click. One of the command alternatives - the
current, previous, most common, or safest one - could also be shown as default
selection for a command. The displayed value is then accepted by the system as
valid unless explicitly changed by the user.
Also the principle of complexity matching holds for the control interface from the
user to the machine. If the command input consists only of few bits, then keyboard
dialogues are superfluous. Why typing „SET DEVICE#2=ON“ when a simple switch
fulfills the same function? If the process is more complex and includes several
parameters, then the user of a keyboard is warranted („SET DEVICE#2=ON,
POWER=MID, SETPOINT=3224“).
Typing a command from the keyboard requires some thinking and can lead to
errors. It is good to ask for confirmation before execution of sensitive commands, for
example with a question of the kind „Do you really want to boot the system
[YES/NO]?“ Here it might however arise a problem, because once an action is
learned, it is carried out automatically at the skill-based (sensomotoric) level and
without further thinking. The question alone is no guarantee for the exact intentions of
the user, who might first type [YES] and then think about the question. Different
strategies might have to be defined.
In some technical systems, potentially dangerous commands are made
deliberately difficult to carry out. This is not necessarily a good approach. Special
commands (that probably have to be used only in particular emergencies) can
instead be protected with special passwords. A good control system should be at the
same time safe and easy to use. If a process simulation routine for the control system
and the technical process is available, potentially dangerous commands could be
accepted only after having been run in simulation and then letting the system pass
them further to the real technical process. Of course, this strategy is valid for certain
systems but not others, depending of the required speed for process manipulation.
It is important to have the possibility to stop a computer-controlled machine
immediately in case of an emergency. In such a situation, nobody would have the
patience to type in an ordered command sequence. A clearly marked emergency
OFF button should be installed within easy reach for the operator. It is common
practice to paint the button red on yellow background. „OFF“ buttons are usually
large enough to be operated with gloves on and without need for careful aiming.
It is advisable that help is available on line. Help should always be called from
the same key, which should be distinct and clearly marked. Modern systems offer
context-related help, that is, they recognize the current situation (the data or program
which is currently active) and offer help related to that situation.
436 Chapter 11: The User Interface

11.5.6 Menus
The principles of visibility and consistency required in screen and command
design must of course also be followed in the design of menus. In particular, the
following considerations can be made.
To begin with, the menu structure should become quickly clear to the user. Each
menu should be identified by a title or headline, possibly using the same text
indicated as choice in an higher-level menu.
The items in a menu should be at the same abstraction level: Functions like
„delete character“, „print file“ and „boot computer system“ do not belong to the same
menu selection. The menu items must not be placed randomly, but should follow
some logical principle. This ordering principle should also be easily recognizable. In
case no such principle is evident, alphabetic order will serve as a possible ordering
criterion.
Ideally, the number of items in a menu is not too large. With too many items on
the screen, one may have already forgotten the first ones by the time he is through
scanning the list. If a system has a very large number of action paths that can be
followed, a tradeoff must be made between the approximate number of choices in
every menu and the number of levels in the menu hierarchy.
Similar functions in different menus should be connected to the same keys
(consistency). A <BREAK> and <GO BACK> command should always be present,
possibly with its own dedicated key. It should be possible at any moment to interrupt
the current work and go back to the next higher menu level or even to jump to the
highest level, or root, menu. It should not be required to go through a series of
screens, or even reply to additional questions, just to leave the current menu or
dialogue page.

11.5.7 User Interface Evaluation


After the design and implementation of an user interface it is necessary to check
whether it satisfies the set requirements. One type of requirement may be purely
formal, i.e. whether the result of the programming work corresponds to the design
document. More important is however to check whether the interface as a whole - the
design and the way it was implemented - helps in the operation of the technical
system and therefore whether the goals of complexity reduction and matching to the
human user are achieved.
Before a test can take place, the reference criteria must be defined. It may be
difficult, or too time-consuming, to define test benchmarks. Moreover, the effort must
also be commensurate to the goal. The testing level is obviously different for a
control system for a very specific application built under strict budgetary constraints
or a mass-distributed product with a large potential number of users.
In addition, due to the fact that the test necessarily involves the human users and
builds on their judgement and evaluation, there is a notable subjective component.
What one may find as a good feature might be very annoying for another. The
following criteria for the evaluation of a computer system and of its user interface are
sufficiently objective to be used as general reference:
• Speed of performance. How long does it take to carry out a benchmark set of
tasks?
• Rate of errors by the users. How many and what kinds of errors are made in
carrying out the benchmark set of tasks?
11.6: Graphical User Interfaces, The X Window System 437

• Subjective satisfaction. How much did the users like using the system?
• Time to learn. How long does it take for the typical user to learn the most
important commands?
• Retention over time. How well do users maintain their knowledge after an hour,
a day or a week?
Of these goals, speed of performance, rate of errors and satisfaction can be
evaluated after a comparatively short time and therefore make a good choice of
testing benchmarks. The time to learn and retention over time require by their nature
a longer time for evaluation. Therefore, they cannot realistically be included among
the parameters for direct consideration. They could, however, play an important role
in the periodic re-evaluation of products that reach a larger market and are not limited
to one target user group only.
It is not possible to state in general that a good interface is easy to learn. Rather,
the actual goal in relation to the work task has to be considered: Is the interface
supposed to be easy to learn, flexible, understandable or else? Only the fulfillment of
the stated goal can give a measure of the quality of the interface.
It sounds like a paradox, but the best user interfaces are also the easiest to
forget. The reason is that if they appear to be natural, the user will not have to make
any special effort to memorize them and their commands.

11.6 Graphical User Interfaces, The X Window System


Graphical user interfaces (GUI) for use on personal computers or on work
stations are in widespread use. These interfaces are built and operate on similar
principles. The user focuses his attention not on the action and the related object
(like e.g. in „RUN PROGRAM“), the action is instead already implicit in the object,
because a program cannot do anything else but run, a text can only be edited or
processed by a text processor, and so on. The objects are represented graphically
on the screen with help of icons; they are selected with a pointing device and
activated with the so-called „Point-and-Click“ method.
The obvious advantage of the graphical interfaces lies in that they strongly
support consistency in the interaction with the computer. Several indications and
controls are represented in a similar way for different programs. Most skills at the
sensomotoric and rule action levels are retained by the trained user and simplify the
change from the use of a program to another.
Graphical software packages for data collection and processing based on
modern user interface concepts are available. The user builds a system as block
diagram on the computer display and the computer builds its function accordingly.
The relations so defined can also be very complex and increase work effectivity,
because in this way programming in classical sense is avoided.
The most known graphical user interface types are the User Interface Guidelines
(UIG), also known in practice as „Apple Macintosh Interface“, the Microsoft Windows
interface and the Common User Access (CUA) for the IBM Systems Application
Architecture (SAA). Particularly important are the graphical interfaces Open Look
from AT&T, Open Windows from Sun Microsystems Inc. and the OSF/Motif Display
Standard promoted by the Open Software Foundation Inc. (OSF is a cooperating
consortium of several companies, including Hewlett-Packard, Digital Equipment and
Microsoft, see Section 10.7.8). In particular OSF/Motif enjoys wide diffusion also in
438 Chapter 11: The User Interface

process control applications and can nowadays be considered as a de-facto


standard. This interface combines features derived from the personal computer and
from the mainframe world and provides a common feel across different systems.
The application programmer can use the graphical user interface as framework
for the „feel“ of the application, as the basic commands of the windowing system are
already provided for by the windowing system itself. These are commands of the type
„change window position“, „change window size“, „reduce to icon“, „open dropdown
menu“, „move the cursor on menu and make selection“, etc. From the programmer’s
point of view, many advanced interfacing operations can be solved with a call to the
GUI software. Of course, the selection of what to write in the menus and in the
application is left to the programmer and that is where the actual interaction between
user, computer and task takes place. A windowing system like OSF/Motif or Open
Look can enhance the quality and functionality of well-thought user dialogues but will
not improve much the operability of a messy system.
The operation of GUIs is based on the idea of „virtual terminal“ (Section 9.2.3).
The most important application in this respect is probably the X Window System, a
network-based windowing system developed at the Massachusetts Institute of
Technology (MIT) as a method of controlling an advanced graphical „windowing“
interface. The X Window System has been implemented for several operating
systems.
Using X Window System a user can access in a standard way any application
that generates the X protocol as output, irrespective of what hardware or operating
system that application is running on. The X protocol is a complete definition of
functions that support the terminal output screen with facilities for drawing windows,
boxes, lines, circles and anything else related to pictures and text to be displayed on
a screen. A window on a workstation can come from a program running on the
station itself or from another computer connected via a network. Even if a program
runs on another computer and under a different operating system, provided it has an
X Window interface it can send data for display to the first workstation. X Window
supports also input devices like keyboard and mouse.
In essence, the X Window System is a message protocol between an X server
and an X client, where the server is normally the user’s workstation and the client is
the application host. In X Window it is the client which generates the drawing
instructions, while the X server operates the display terminal, drawing graphics
objects and text in response to messages from the X client. The server also reports
user actions such as keystrokes and mouse movements to any X clients - i.e.
application programs - that will be affected by them.
Each display has a window manager, a special X client that supervises the
construction of all the graphics objects on the screen. It is the window manager that
implements the window style, or „look and feel“ of the windowing system, and
therefore that controls the overlaying of windows and operations like window sizing,
scaling and positioning in response to user commands.
The operation of X Window System is not tied to any particular protocol but so
far it has been predominantly used with UNIX and hence with TCP/IP, so that these
products have been often associated with one another. Yet they remain different
solutions for different - although strictly correlated - problems.
11.7: Summary 439

11.7 Summary
The design of user-oriented process interfaces must be focussed on the human
cognitive capabilities. The computer must not be a substitute for those tasks that
people perform well, but instead enhance the performance of those tasks where
humans are less capable. In this respect, the process computer can be considered
as a kind of complexity interface. If the complexity required in the control of a
technical process is higher than what human capabilities allow for, the computer
must help reduce this complexity to a level where it becomes manageable. In
addition, the complexity must match the task to be solved.
A computer monitoring and control system is not „good“ or „bad“ on its own, but
must be considered in relation to the task to be accomplished. If the monitoring and
control system contributes to the reduction of the complexity of the object system,
then its use is warranted. A poor monitoring and control system has an high intrinsic
complexity which provides an additional burden on the human user, without really
helping in the control task.
That many systems, that many users. There is no standard user profile. Some
people are knowledgeable about computers, curious, show a positive attitude and
always want to learn more. Others are afraid of computers, or just unmotivated, and
don’t care much. Very often, and especially when a control system is built around an
already existing technical process, users are technicians with good knowledge of the
process under control. Not seldom they mistrust the computer programmers who
ignore the details of the technical process and at every occasion they air comments
about „their good old way of doing things“.
The designer has the machine in mind and the user the task to be accomplished
by the machine. The computer control system is accepted by the user when it is seen
as a tool not to disrupt but to enhance the plant control operations. The correct
design of the man-machine interface plays here a fundamental role. The ergonomic
aspects are particularly important with untrained users. Here a tradeoff must be
made, either assuming that the users do not know anything and that they will not
learn either, or require that the users learn something about the computer control
system. The second way requires more attention and planning but also has the better
payoff. Instruction is always a good investment: the trained user will in general be
more motivated and less likely to make mistakes.

Further Reading
Some basic knowledge of psychology is useful to understand the underlying
concepts in the design of user-friendly applications. An introduction to psychology
with comprehensive sections dedicated to perception, learning and the dual memory
theory is [Atkinson et al. 1990]. This is recommended for the reader interested in
background information. The dual-memory model is also described in [Atkinson /
Shiffrin, 1971]. A more in-depth consideration of cognitive aspects in psychology is
given by [Solso 1993].
[Sanders / McCormick 1993] is a comprehensive reference textbook about
different aspects of practical ergonomics; the book is recommended for the reader
interested in the broader view. [Salvendy 1987] collects contributions of different
authors and considers in particular the psychological and cognitive aspects in the
handling of complex systems.
440 Chapter 11: The User Interface

An excellent book to look at things from the point of view of the user is [Norman
1988]. This text contains several examples about how not to design devices and
tools: a captivating lecture about common sense in engineering. This book makes a
strong point about the principles of simplicity, visibility and consistency by giving
several practical examples of good and poor user-oriented design. Paradoxes in the
handling of machines by their users are described in [Bainbridge 1983].
[Shneiderman 1998] deals with software ergonomics with particular
consideration to the design of computer screen layouts and the definition of
interactive command languages, in particular for information search in databases.
General introductions to the problems of the user interface are [Norman / Draper
1986] and [Preece / Keller 1990]. The action model at the sensomotoric, rule and
knowledge levels was first introduced by [Rasmussen 1983]. Errors and their
consequences in complex systems are treated in [Rasmussen / Duncan / Leplat
1987].

Guidelines and Standards for User Interfaces


Some of the most accepted guidelines for the development of user interfaces in
process control applications are listed here. These guidelines provide frameworks
that can help enhance the aspect of consistency in the interface design.
ANSI/IEEE 845-1988, "Guide to Evaluation of Man-Machine Performance in
Nuclear Power Generating Stations, Control Rooms and Other Peripheries"
ANSI/IEEE 1023-1988, "Guide for the Application of Human Factors Engineering
to Systems, Equipment and Facilities of Nuclear Power Generating Stations"
Sun Microsystems Inc., „OPEN LOOK Graphical User Interface: Functional
Specifications“ and „OPEN LOOK Graphical User Interface: Application Style
Guidelines“, Addison-Wesley, Reading, MA, December 1989.
Open Software Foundation, „OSF/Motif Style Guide“ and „OSF/Motif User’s
Guide“, Prentice Hall, Englewood Cliffs, NJ, 1990.
Several other textbooks are available about the most common user interfaces, in
particular in the Windows and UNIX environments.
12 System Integration

Aim: To look at all the material presented in the book under the aspect of
interaction and integration of system components in order to build and operate
complex control systems

Overview
The ideas and concepts about the control of technical processes that have been
treated so far in this book must now be put into a general frame. In complex systems
everything has to fit together. It is enough if one part or component does not fit so
that the global performance of a system is jeopardized. There is no ready recipe on
how to build and structure a system. Mathematical analysis and modeling helps to
identify physical limits, yet at the end system design remains more an art and a craft
than a science. The best school is undoubtedly to learn the necessary dos and
don’ts from experience.
Process control systems are treated in Section 12.1 from the standpoint of their
historical development, while Section 12.2 deals with the integration of control
systems. The reliability of a system plays a very large role in its operation. Reliability
can be described with help of specially developed mathematical methods, which can
however only be used under particular situations; they are treated in Section 12.3.
The function of a process control system is the object of Section 12.4. The
materials previously treated in Chapter 7 (digital and sequencing control) and
Chapter 10 (real-time programming) are integrated and extended here with the
treatment of programming of real-time databases and software integration. Although
the description is oriented to large industrial systems, many ideas can be used for
smaller-scale applications.
Not only technical aspects are of importance in practical real-life applications,
actually also economical, organizational and psychological factors play a decisive
role for the acceptance of any complex technology - and therefore of automated
process control systems. These aspects are briefly treated in Section 12.5. At this
point, the reader should have got a sound and realistic view of the problems and the
possibilities in the automation field. The Authors hope that the reader looks at this
chapter more as an opening to new experiences than just as the final part of this
book.

12.1 The Structure of Process Control Systems - Lessons Learned


from History
Some important lessons can be learnt from the short history of four decades of
computer process control. Quite expectedly, the two main driving forces behind
computer control development have been the technology and the market.
Many of the pioneering projects were driven by the new available technology. As
already remarked in the introductory chapter (Section 1.2), some technical processes
were too complex for the computer control tasks, and the process control solutions
were not adequately structured in terms of hardware and software. As an example
can be taken the software development in the „Apollo“ space program. The small

441
442 Chapter 12: System Integration

computer memory of the spacecraft on-board computer (64 kByte) had to be utilized
to the last bit and the resulting programming task was enormous; at the end it turned
out to be almost 1000 man-years. Today even the cheapest computers have at least
hundred times as much memory, which is quickly used up by normal office
programs.
Two successful areas of process computer control in the early 1960s were
chemical process control and the control of power generation and transmission. In
the control of chemical plants the computer simply replaced the analog PID
controllers. The control strategy was already well understood and the computer
basically did the same as the previous controllers. Also in the power industry system
structuring had a long tradition. The engineers in the power utilities had a good
feeling for how to use computers in the analysis and design of power systems and
could therefore formulate adequate performance criteria and specifications, releasing
the computer manufacturers from this kind of responsibility.
The typical process engineer sees his plant in terms of partial systems and unit
processes. The computer programmer, who is often unfamiliar with the specific plant
application, would rather think in terms of computer structures, which usually are
organized hierarchically. And here lies the real issue. It is crucial that the process
structure is reflected into a proper computer structure; the computer and its software
must be adapted to the process and not the other way around.
Structuring is the most important issue in process control; it influences the
configuration of the hardware as well as the modular construction of the software. In
the chemical and power industries standards have been since long established. The
operators’ needs were initially quite obvious: to transfer the process control interface
from large panels and racks to computer terminals. The plant operators wanted to
see the same information as in the old PID controllers, the same curves as those
from the old plotters and the same process schemes as in the control rooms. This
led to the development of „fill-in-the-blank“ programming languages, in which the
controllers are described in parameterized form.
For logical circuits and sequencing networks the solution was obviously to
replace the old relays with computer technology (Chapter 7). The old ladder
diagrams could be translated to similar symbols on the computer screen, only now
the implementation of the logical operations is done in software. The first PLCs were
actually just replacements for relay technology, yet the increasing demand for
structuring has led today to constantly new added functionality for PLC and to the
availability of communication interfaces for the integration in larger control networks.
The requirements for structuring have also led to the development of sequencing
languages.
It was also recognized early that feedback control and sequential control should
be integrated. Some steps in this direction were actually already taken in the first
systems, although not yet in a methodical and structured way. Today’s industrial
control systems are integrated in a more structured way and contain building blocks
for both feedback controllers and logical circuits.
For some years a lot of attention has been paid to Computer Integrated
Manufacturing (CIM), yet few real CIM applications have so far seen the light of day.
Once more, an important reason for this is structuring. Unlike the chemical process
industry, the manufacturing industry has no established methodology to formulate
and structure the production process. In addition, the manufacturing industry is
extremely diversified, so that it is so much more difficult to formulate proper
performance criteria for integrated control. Today, only limited solutions are available
12.2: Integration of Computer Control Systems 443

as for instance for the control of NC machines, of robots and of production cells. The
overall control problem for a full manufacturing plant, however, remains in general
much less structured.
From the experiences gained so far the following can be derived. It is relatively
easy to build adequate hardware components or software modules for computer
control tasks. The real problems lie elsewhere, they have to do with the overall
objectives, with the difficulty in getting a unified view of the system and to structure
the control hardware and software in a relevant and goal-oriented way. This kind of
overall view has in fact been the Authors’ driving force for writing this book.

12.2 Integration of Computer Control Systems


12.2.1 Integration Levels
A real-time control system may take different aspects depending on the
complexity of the problem to be solved and the desired goals. Although most of the
involved issues are similar, technology and tools at disposal lead to many different
implementations of automation systems. Similarly to what happens in other technical
specialties, there is no generally applicable solution, but only solutions which are
valid in relation to specific problems.
It is not easy to differentiate among integration levels of control systems,
because the borders cannot be drawn all too precisely. Still, there are major fields
which can be identified, with their technology, their industrial basis and their market
share. A brief overview is given here without pretension for completeness.
Integrated circuits (IC) and hybrid circuits contain data processing logic that can
carry out complex function either as combinatorial function or following hard-coded
control programs (firmware). Also general-purpose microprocessors are based on
simple logic gates operating under program control. ICs can be produced on
customer specifications and for specific applications. The development of
application-specific ICs becomes cost-effective from production figures of some
thousands and upward to compensate for development costs that are usually very
high. Typical applications of ICs are in mass-produced units with no need to change
the installed program for the whole life of a product and where the control logic must
be packed in a very small space, as for instance in microcontrollers for microwave
ovens or the ignition in combustion engines.
An alternative to customized IC production or the construction of IC-based
electronic circuits is the use of general-purpose controller boards on which is
installed a central processing unit (CPU) and where the programs are hard-coded in
Read-Only Memory (ROM). Logical functions can also be implemented with
Programmable Logical Devices (PLD), treated in Section 7.1.5. Such solutions are
more cost-effective for small production figures and in those cases where the
necessary space for the installation of the circuitry is available. Due to the fact that
this technology is neither too expensive nor too complicated, it represents the
preferred solution by many smaller companies for their specialized productions of
automatically controlled equipment.
Controller boards are larger units for more complex applications, used in
particular where the program or application data are probably going to be changed
during the life of the product. A typical example is the control logic for a numerically-
controlled (NC) machine. These compact, board-based units are typically built with
444 Chapter 12: System Integration

the possibility for external communication via Fieldbuses or LANs and can therefore
be integrated in larger processes.
Controller boards are usually programmed directly as target system (i.e. the
system where the final application is run), but in some cases the support of a
different machine with more resources may be needed, e.g. to run a large compiler.
The ready programs are then downloaded and run on the target machine.
Several peripheral boards can be installed on bus systems (Chapter 8), so that
the hardware configuration of the control system can match as closely as possible
the requirements of the technical process. The boards on the bus can be changed at
any time with comparatively little effort. Software development for the effective use of
a bus system is not a simple matter, but can be supported considerably with help of
special bus operating systems.
Programmable logic controllers (PLC) (Chapter 7) are self-contained units for
those automation applications where the input and the output data are digital signals.
For uncomplicated automation applications with a limited number of parameters,
PLCs represent a cost-effective solution. PLCs can also be connected to Fieldbuses
and communication networks for integrated process control. Modern PLCs have also
analog input/outputs and can carry out more complex functions, like for example
regulation with PID controllers.
With the connection of local control systems like PLCs, bus systems or other
controllers together on a common network, information from a whole plant is
collected and recorded and commands can be sent to the detached units in a
coordinated way. Integrated systems of this kind are known as Monitoring and
Control (M&C) systems. In the application of a M&C system in a complex plant it is
strongly advised to structure the control task and the related hardware and software
solutions; an example in this respect is to follow the principles for hierarchical
structuring of the control levels as described in Section 9.6.1. Complex monitoring
and control systems are built modularly and can be constructed from existing kit
components.
The implementation of automated systems does not require that the whole
software is written anew every time. For automation and supervisory computers
software packages are available in which programming does not take place
procedurally but with a description of application-specific parameters („fill-in-the-
blanks“ programming).

12.2.2 System Rack Integration


When different units are connected together to build a system many aspects
must match together, from physical dimensions to the type of information that is
exchanged. The interoperability of different parts is ensured if common interfaces are
used. In the treatment of different types of interfaces in this book it was shown how
they evolved in course of time and represent the result of a combination of factors
like tradition, innovation and planning.
In the construction of a system the most important compatibility factors are:
• mechanical (physical dimensions of the system components)
• electrical (signal levels and frequencies, power supply, cabling)
• thermal (power dissipation, cooling requirements)
• functional (communication, monitoring and control)
• operational (which functions must be carried out).
12.2: Integration of Computer Control Systems 445

At the mechanical level, the most common industrial standard is today the 19“
format for cabinets and racks. The measure 19“ refers to the width of the rack, which
is 19 inch or 482.6 mm. The height of rack system components is measured in
height units (U), where one U is 44.45 mm or 1.75 inches. In practice, only multiples
of three are used for heights, like for example 3U (133.35 mm or 5.25 in). In common
talk the expressions „single height“ and „double height“ are long established.
However, it should be noted that „single height“ means 3U, not one U. These
dimensions are compatible with those for bus board formats (Section 8.2.2). The
Eurocard boards, designed to fit in a 19" rack, have a minimum height of 100 mm
and increase then in steps of 133.35 mm, or 3U. In Figure 12.1 is shown a 19“ rack
cabinet.

Figure 12.1: 19“ Rack cabinet for industrial applications (courtesy of Schroff, Germany)
446 Chapter 12: System Integration

The 19“ standard is internationally normed as ISO/IEC 297, in Germany as DIN


41494 and in the USA as American standard ANSI/IEEE 1101. The German DIN
standard is very comprehensive and does not only cover cabinets, mechanical
frames and racks, but also components like printed circuits and connectors. The 19“
standard is widely accepted and most producers of computing equipment and
peripherals devices for industrial applications follow it. Several bus systems, like
VMEbus and Compact PCI, are available in the 19“-rack format.
The 19“ format has - at least for Europeans - the disadvantage of the unusual
American units and the IEC 297 standard brings together two different unit systems,
which is not particularly convenient. For this reason a new standard, IEC 917 „Metric
rack components, multimodule 25 mm“ has been defined. In this new standard the
dimensions for heights, widths and depths equal subdivisions of 2,5 or 25 mm. The
new standard takes also in consideration the large popularity of the 19“ standard;
existing components in 19“ format can be used also in the metric rack format with
help of simple adapters.
The cabling among the devices installed in a rack is drawn in the backside; the
front panels are used for the controls and are therefore usually free of interfering
cables. Power supply or power distribution units are often also installed in the racks,
usually in their base because of the weight of the transformers and because they
seldom must be reached for service. Ventilation takes place by free convection or via
additional fans and cooling surfaces; obviously it must be sufficient to carry away the
generated heat. For more effective ventilation, when it is possible some slots
between the installed boards are usually left free. The units that are serviced most
often are installed at medium height in a rack, in order to be reached easily. If
necessary, an emergency button to switch off the whole unit, marked in red on yellow
background, will also be located where it can be reached easily.
The single components can be purchased as well as also be built on one’s own
all the way down to the chip level. Standard equipment like measuring instruments,
process computers and modems are available from several sources. These devices
usually have an interface that allows remote operations, or can be upgraded with it.
Yet, when components and units are based on new ideas, they must be developed
autonomously and then combined with other, already available equipment.

12.2.3 Interface Design


An essential role in system interconnection is played by the interfaces between
the different components. In a well-designed system all components act like black
boxes, i.e. they can be substituted with different components that fulfill the same
specifications and the system as a whole will not operate differently than earlier.
The specification of an interface must take into consideration all aspects that
have to fit together in order for the function to be fulfilled. A taste of how involved and
complicated specifications can be has been shown for example with OSI (Section
9.2). Normal project specifications need not be that complicated, though care must
be taken to ensure that no important factor is left out. Depending on the specific
application, the description of an interface will have to include everything from
mechanical and electrical specifications to the content and meaning of the
exchanged data.
When different devices have to be connected together, there are in most cases
already available specifications that can be followed, like for instance the
communications standards described in Chapter 9. In the definition of new
12.3: Systems Reliability 447

interfaces, it is better to check whether there is already an established standard that


covers the specific aspect or that can be taken as reference. There is no point in
defining a sensor loop working between 5 and 28 mA, or a new way to code
alphanumeric characters in a Byte, when the 4-20 mA loop and ASCII or EBCDIC
can do the job as well. In most cases the available components will force a specific
choice.

12.2.4 Selection of the Integration Level


The ways to automation are many and it is not possible to define a few single,
general solutions. Many problems can be solved in different ways and with different
equipment. What is important is to recognize different levels of system integration
and match the right hardware and software solution to the actual problem.
Equipment and components performing the same function can take very different
forms. For example, to measure a voltage and deliver the value in digital form,
everything is available from chip-built A/D converters to fancy digital voltmeters with
remote data collection and programming.
A car fuel injection control system has to be rugged, small and cheap. Such a
system will be mass-produced in thousands of units and it may be cost-effective to
implement it with custom-built integrated circuits. On the opposite side there might be
a large chemical plant, with thousands of sensors and actuators. In is unlikely that
the company running the plant will invest huge sums and tens of man-years
equivalent work to build a 100 per cent-optimal monitoring and control system. In
such a plant a standard monitoring and package can be installed, where
programming is done via the definition of the sensors, actuators and control loops in
form of parameters and of the user interfaces as the content of input/output
dialogues. Special control cases will be solved with dedicated hardware and
software.
External constraints and economics will indicate the final solution. All advantages
and disadvantages and their different costs have to be weighed against each other.
Higher flexibility and the potential for future expansion may cost more money, but
this investment could turn out to be the more cost-effective solution in the longer
perspective when an expansion of the system actually takes place. The solutions for
automation are not only technical but largely economical and strategical. In the
distraction of so many conflicting factors, the most important things to keep in mind
are that the set goals have to be reached and that it is necessary to look at things in
a long temporal perspective. Today’s problems are part of tomorrow’s problems (and
problems, of course, should be seen as „challenges“).

12.3 Systems Reliability


12.3.1 The Reliability of Equipment
Automation technology gives a new meaning to the concept of reliability.
Everybody wants to have reliable devices and systems. With automation, however,
systems operate without human intervention and different machines and
components influence each other. The consequences of the dependence of large
systems on small components appear clearly for example when the breakdown of a
small component like a relay causes a power interruption in part of a city. Often the
malfunction or breakdown of a system is caused by the failure of a single, simple
448 Chapter 12: System Integration

component. Of course this type of problems can happen also in manually controlled
systems, but automation makes the problem bigger.
For the operation of a system the availability is a parameter of practical
importance. Availability is defined as the probability that a component, device or a
system at a given time operates correctly. This probability represents the relation
between the time during which the component operates correctly and the total time in
which the component should operate at all. The availability of a component or a
device is a function of the probability of failures during a given time and of the time
for bringing the component or device back to normal operation after a failure.
Because of the interaction between system parts and components, the total
reliability of a system can become quite small if not all components have a very high
reliability. As an example can be considered a production line with ten machines
connected in series. If each machine always repeats the same operation and makes
an error at an average of every hundred operations, then the probability that the
machine does not make any error during a cycle is 99%. For the preparation of an
acceptable final product all machines must operate correctly, so that the related
probability becomes:
0 .9910 = 0 .904
i.e. the probability that an error-free part is produced is only about 90%. A
commonly used method for the improvement of the total reliability on production lines
is the introduction of buffers between the machines. In this way it is avoided that the
whole production line is brought to a halt in case of failure of a single machine.

12.3.2 Models for the Computation and Determination of Reliability


In the computation of the reliability of a complex system it is usually assumed
that the possible errors are uncorrelated, i.e. that the errors represent independent
events. This assumption is correct provided that a faulty component does not
influence the others and have a causal effect on their functionality.
In the case of n components, it holds:
n = n h (t ) + n f (t )
where n h (t ) is the number of the correctly operating components and n f (t ) the
number of the faulty components as function of time; the sum n is constant. The
reliability function (also called „survival function“) R(t ) is defined as follows:

n h (t ) n (t )
R(t ) = = 1− f
n n
It is interesting to analyze the relative number of errors of all other operating
components as function of time. This is expressed by the error intensity z(t ) :

f (t ) 1 d
z( t ) = =− R(t ) (12.1)
R(t ) R(t ) dt
If a component has remained operative until the time t, the error intensity
indicates the probability that this component fails immediately after the time t. The
error intensity function z(t ) can be estimated from the observation of a large number
of components over a long time period. Somewhat simpler the function z(t ) can be
12.3: Systems Reliability 449

represented in Figure 12.2. Because of its shape, this curve is also known als
„bathtub“-function.

z (t )

λ
(a) (b) (c)

time

Figure 12.2: The failure rate z(t ) of a component as function of time („bathtub“ function):
(a) early faults; (b) random faults (region with constant fault rate λ ); (c) wear-
out faults.

In general it is examined the „best time“, i.e. the central part of the error intensity
function z(t ) . It is then assumed that a system has been in operation long enough so
that no children illnesses take place. On the other hand a system should not have
been so long in operation, so that its components are already worn out and the
failure rate increases again. With this limitations, z(t ) can be assumed to be
constant, i.e. z(t ) = λ . The solution of Equation (12.1) becomes then:

R(t ) = e − λ ⋅ t (12.2)
The parameter of interest for both user and producer of system components is
how long the component can operate according to the specifications before a fault
occurs. A measure for this is the MTTF (Mean Time To Failure), i.e. the
mathematical expectation of the exponential distribution:

1
MTTF = ∫ R(t ) dt = (12.3)
λ
0
A measure for the availability of a system is derived from the average value in
the time interval in which the system operates correctly. This value is called MTBF
(Mean Time Between Failures). Also a measure for the time in which a system does
not function can be derived from average values; the related value is called MTTR
from Mean Time To Repair and represents the time between the appearance of a
fault and the reestablishment of full system functionality.
The availability A of a component or subsystem is defined as follows:
MTBF
A=
MTBF + MTTR
In systems that consist only in one device or component there are rarely
problems in the calculation of availability. More complex systems of course present
450 Chapter 12: System Integration

entirely different problems. In this brief description it was considered only the case in
which the components are connected in series and how this influences the reliability
of a system. Similar computations can be carried out also for systems connected in
parallel; in general, the parallel connection of similar components increases
reliability, because only when all the components in parallel are faulty the system
function is no longer ensured.

12.3.3 Reliability of Process Control Systems


One of the reasons for the success of digital process control systems is their
high reliability, that in general is independent of how these systems are used and for
how long. As an example will be considered a programmable logic controller that is
built only of semiconductors without moving parts. Its operating life is therefore
practically independent from the number of switching operations, differently than
electromechanical relay.
The error frequency notably influences the reliability of a system, but equally
important are also the repair actions. Also in this case the electronic systems are
better than the older electromechanical systems. In case of failure of a relay control
equipment the search for the fault with a voltmeter can take a long time; instead the
testing of a PLC with a portable terminal and the necessary software tools can
proceed in an entirely different way. On the other hand, the maintenance personnel
must be better educated. In addition it should be noted that the repair of electronic
systems more and more often is carried out by exchanging larger and more complex
system components entirely, and therefore sometimes takes a wasteful aspect.
In process control systems the total reliability depends form the system
structure. In the DDC („direct digital control“) design solution there is only a central
computer on which the full software for data collection and process control and
regulation is installed. As a consequence, a computer breakdown causes the failure
of all functions. In the distributed direct digital control solution (DDDC, Section
12.4.3), the control and regulation functions are carried out instead by local
computers in proximity of the technical process. The computers at higher hierarchical
levels (see Figure 9.24) pass to the lower computers reference values instead of
control values. The breakdown of a computer or even of the central processor
influences only a part of the functions, because the system components are
independent. The difference in reliability appeared clearly already in the first process
computer applications: at that time the MTBF was measured not in years, but in
hours.
Faults are caused either by malfunctions of single components or - in complex
systems - because the components do not interact correctly. In large systems with
several components the probability that some component will be faulty is of course
high, and if the operation of the system as a whole is affected then the reliability of
the system diminishes.
Fault-tolerant design should ensure that a system as a whole must continue to
function, even in presence of faults. It is therefore not matter of just using highly
reliable components, but rather of designing a system from the very beginning so
that single faults do not affect operation as a whole. Moreover, a computer system
does not mean only hardware, but includes also software that can contain bugs or
react in an unpredictable manner to unforeseen inputs, data exchange protocols,
communication on external links, and so on.
12.3: Systems Reliability 451

Basically, fault-redundant design is based on some kind of redundancy. If some


part (hardware or software) does not work, then another part will replace it.
Redundancy can take different forms, as for example
• physical redundancy
• information redundancy
• time redundancy

Physical redundancy is usually achieved by replicating some components. If a


components fails to work properly, another takes over in its place. If cost is an issue,
then only the most important components or those most prone to failures will be
installed in redundant configuration. This principle is used for example in the FDDI
network (Section 9.5.7), in which the two data links are built in such a way to
minimize the effect of faults, whether they are a cable rupture of malfunctioning of a
connected device and its FDDI interface. A common design principle in real-time
system is the physical duplication of the main server and of the local area network.
Depending on the specifics, both LANs can operate at half load, or only one be
active at any time, while the other can be immediately activated in case of
malfunction of the first one.
An important issue in the practical realization of physical redundancy is that the
redundant components must be connected together, and the interface between them
represents a new element that could also malfunction, as well that some principle for
the choice of the functional component must be defined. The issues are (1) how to
recognize unequivocally that a component or subsystem failed and (2) how to
connect the redundant one.
Information redundancy is used for example in communication protocols, when
extra information is added to a packet in order to allow recovery from a garbled
message. Data backups on external media or the use of shadow variable storage (a
variable is stored at the same time on two different disk units) are other examples of
information redundancy.
Time redundancy is achieved when an action is first carried out and its result is
then evaluated. If the result is not successful, then the action is performed again.
Time-outs and limitations on the maximum amount of repetitions help avoid endless
loops.
Fault-tolerance in communication protocols (Section 9.4) is actually realized with
a combination of information redundancy and time redundancy. The checksum in the
data packets provides for information redundancy, while the procedures to
acknowledge message reception and if necessary to request a new transmission are
examples of time redundancy.
When redundancy is necessary for the construction of fault-tolerant systems, all
components - and not just the more apparent ones - must be considered. For
example: two computers should be connected to two independent power supplies,
otherwise a power supply failure, i.e. a single-point failure, would bring down the
operation of both computers and thus turn into a system-wide failure.

12.3.4 Software Reliability


Program errors can often be deceitful and more difficult to find than hardware
problems. And they are not necessarily harmless. In Section 2.3 it was mentioned
452 Chapter 12: System Integration

how a single program mistake could bring a major disruption in the American
telephone network.
The problems with programming errors are related with system complexity;
mistakes made during program development can reproduce and remain hidden in
the final product. Programming errors belong to everyday life of complex realizations,
like e.g. automated systems, although only in a few and spectacular cases it is
reported about them.
Differently than with hardware, software does not wear out. All defects in a
program come from the time of its development, so that at least in theory all errors
could be eliminated once for all at the very beginning. The problem is how to
discover them. Mathematical and logical methods help the programmers in the
development of error-free programs. In practice, however, despite intensive and
comprehensive tests most programs still contain mistakes at the beginning of their
operations. In case of unforeseen input data and interrupt signals a program can
behave differently than earlier planned and tested.
Quite often the requirements for a program are changed during the development
phase, as the goal of program utilization becomes clearer and better understood.
Late changes to a program can have considerable effect over its full operation. A
fully ready and tested program could also be used in a different way than originally
foreseen by its developers, which increases again the possibility of errors.
If the perfect program is an illusion, how can it be determined when a program is
sufficiently reliable? First the necessary safety requirements for any specific problem
must be defined. Flight control systems represent a good example for systems with
extreme safety requirements. The requirements for the new control system of the
whole North American airspace state for example that the system can on average be
out of service for only three seconds during a year.
The reliability of a program in relation to the functional requirements must be
determined, for example with tests in the form described in Section 10.6. At the end,
a program should be reasonably error-free. Later on, the program is run for a certain
time and its behavior is observed. All detected errors must be analyzed and
corrected. However, this method is appropriate only if the requirements are not all
too strict (the magnitude order lies at some errors per year). Instead, in complex
systems like aircraft for civil transportation, the specifications require reliability figures
in the magnitude order of 10 −9 serious errors per hour. To test and demonstrate
whether such requirements are fulfilled the programs should be run for a multiple of
10 9 hours, i.e. for a time in the magnitude order of 100,000 years, which is
obviously an impossible task. Another major problem during testing is due to the
effect of the law of diminishing returns. If a program is tested during a very long time,
the errors that are found become so small that their correction has only a minor
effect on the general reliability of the program.
An higher reliability can also be achieved if methods for reliability improvement
are used during program development. Such methods are based on a formal
mathematical theory, they however function only in those cases in which also the
program requirements are defined in a formal way. This means that they should be
expressed in mathematical terms, and this is not always a simple matter.
A method that is used to increase reliability in flight and in railway control
technology is the utilization of redundant systems. Several similar systems are
developed at the same time by different work groups. The assumption is that if any
of the group makes mistakes, at least these mistakes are not the same. The result is
12.4: The Functions of a Computer Control System 453

then a combination of different solutions. For example, the board computer of the
fully electronically controlled aircraft Airbus A320 consists of five different systems
that have been developed on the basis of the same specifications by five different
workgroups in five different programming languages. These systems operate in
parallel and independently of each other. The final control signals for the actuators
that control the aerodynamical surfaces are selected from the output signals by an
electromechanical selector.

12.4 The Functions of a Computer Control System


A process control system can carry out many different functions, that can be
divided into three major groups (Figure 12.3):
• collection and interpretation of data from the technical process; process
monitoring
• control of some parameters of the technical process
• connection of the process input and output data: feedback, automatic control.

monitoring data analysis and


presentation

physical / automation,
technical process regulation user

control remote control

Figure 12.3: The main functions of a control system

12.4.1 Monitoring
Process monitoring, or process data collection, is the basic function common to
all control systems. Monitoring is the collection of the physical process variables,
their storage as well as their presentation in suitable form to the human operator.
Monitoring is fundamental for all other data processing.
Monitoring can be limited to displaying raw or processed data on a terminal
screen or printing them out on paper, but can also include more sophisticated
analysis and presentation functions. For example, variables that cannot be read
directly have to be calculated or estimated from the available measurements (see
observability, Section 3.5.2). Another basic monitoring operations is the verification
that monitored or computed process values do not exceed preset limits.
When the function of the process control system is limited to data collection and
presentation, all control decisions must be taken by an operator. This control mode,
known as supervisory control, was quite common in the first applications of
454 Chapter 12: System Integration

process computers. Supervisory control is still useful, particularly in relatively slow


processes with great complexity and where human interaction is essential. An
example are biological processes, where part of the observations cannot be carried
out automatically.
As soon as new data is collected, their value is examined with respect to alarm
limits. In more advanced testing, several observations may be combined in more or
less complex ways in order to check if the process is in a normal state or if it has
exceeded some allowed limits. In the most advanced solutions, in particular for
expert or knowledge-based systems, the on-line information from the sensors is
combined and integrated with observations made by the operators.

12.4.2 Control
Control is the opposite function to monitoring; the term is however also used to
denote actions related to monitoring. In control in a strict sense, commands from the
computer reach the actuators in order to influence the physical process. In many
cases the required process parameters can be influenced only indirectly via other
control parameters (see controllability, Section 3.5.1).

12.4.3 Automatic Control


A system that acts autonomously and without the direct intervention of a human
operator is called automatic. Automatic control can consist of simple control loops
(one for each input-output variable pair from the process), but also in more complex
controllers with many inputs and outputs.
There are two different principal techniques to implement feedback control in
computer systems. In the traditional direct digital control (DDC) the central
computer calculates the control signals for the actuators. The monitoring data has to
be transmitted all the way from the sensors to the central control unit and the control
signal back to the actuators.
In distributed direct digital control (DDDC) the computer system has a
distributed architecture and the digital process regulators are implemented in the
local processors, i.e. those in proximity of the technical process (Section 9.6.1). The
computers at the higher control levels produce reference values, while the local
processors are principally responsible for execution by computing the appropriate
control values for the actuators based on the local monitoring data. These local
computers also contain digital control loops.
In relation to the structuring of the processing and control levels the difference
between the DDC and the DDDC structure lies in the fact that in the first case, when
several computers are available, these are only responsible for communication and
do not decide autonomously about the control actions to be carried out. In the DDDC
structure instead the computers at the process, cell and management level can act
more or less autonomously and are largely independent from the central computer.
And as already mentioned, the difference among both structures affects also the
reliability of a complex system. In case of failure of the central computer a DDC
control system would stop its operation; a DDDC system can continue its operation -
although with reduced functionality - also in case of failure of one or more of its
components.
A simpler and earlier used form of computer control is the so-called setpoint
control. The computer calculates the setpoint that is then fed to a conventional
12.4: The Functions of a Computer Control System 455

analog controller. In such a case, the computer is used only for carrying out
calculations and not for measurement or actuation.

12.4.4 A Process Database for Monitoring and Control


A medium or large control system has hundreds or thousands of interface points
to the technical process. It is practically impossible to manage the related amount of
information with program modules written specifically for each point. What is needed
instead is a systematic method for the processing all input data. A simple structuring
of the processing parameters can be achieved with help of records, for more
complex relations is actually necessary a full database with the related access
operations.
For the reduction and systematization of process data the nature of the related
information must be considered. Very often these are measuring values or binary
input/output data of the type ON/OFF or OK/ALARM. Thanks to the regularity of
these representations, the input data can be processed via a general acquisition and
interpretation program that acts on the basis of specific parameters for each point.
The parameters for the description of the single points are stored in a process
database, which represents the central component of the control system software.
An example of the structure of the process database is shown in Figure 12.4.

A database for automatic process control contains data structures for the
processing of the following data:
• parameters of all sensors and actuators
• parameters for the computation of derived variables
• event definition and - if required - connection with control actions
• table with control actions as function of time
• parameters for the digital controllers.

The programs for the access to the data stored in the process database include
among other the following:
• data input and interface to the database
• data output, i.e. interface between the process database and the process
computer output or actuating devices
• data representation
• interface for command input.

Sophisticated databases may include up to a couple of dozens description


parameters for every I/O point. Some of the description parameters are particularly
important and are found in all database implementations; others are used only in
some particular cases.
456 Chapter 12: System Integration

programs data

interface to the user interface


technical process
data update

sensor data presentation


input and of process
filtering filter relations for output display data
parameters derived values layouts

main process database


output for measurement and command
parameters reference values table
actuator command
control input
regulator automated
parameters functions, PLC alarm stati

digital automation cyclical


regulator procedures read-out

clock alarm log

Figure 12.4: Structure of the real-time process database and of the modules for data access

The principal parameters, or record fields, for the description of a point are listed
in the following. It should be paid attention that different terminologies are used in
different systems although the meaning remains the same.
• code
• name / description
• type
• address or physical reference: channel / message
• event class
• alarm class
• sampling time
12.4: The Functions of a Computer Control System 457

• raw (non-processed) value


• converted value
• alarm state

For analog points, the following additional parameters are necessary for the
conversion from the raw values to engineering units (Section 5.5):
• scaling coefficients
• measuring units
• minimum and maximum limit values;
and for digital points:
• description of the states in clear text
• state for the generation of an alarm.
An example of process database record for an analog input is the following:

CODE: T439
DESCRIPTION: PRIMARY CIRCUIT TEMP IN
TYPE: AI
ADDRESS: #7.12.2
EVENT CLASS: 0
ALARM CLASS: 3
SAMPLE (SEC): 30
RAW VALUE: 3228
CONVERTED VALUE: 78.8
ALARM STATE: YES
A-COEFFICIENT: 0.
B-COEFFICIENT: 0.0244
UNITS: °C
MINIMUM VALUE: 50
MAXIMUM VALUE: 75

The code is used to univocally identify the point; in the process database it acts
as key and pointer to the related record. The name (or description) is a clear and
mnemonic text reference to define the point which is used in printouts and screen
presentations. The type shows whether the point is input or output and the kind of
data: analog, digital, counter, etc. In this example, „AI“ indicates that the point is an
Analog Input.
The point must be associated with a certain input channel and a position in the
incoming messages from the peripheral computers. The address of the example
could therefore mean channel #7, unit #12, point #2.
The event class shows whether the point is connected to automated functions to
be started when its value changes. The alarm class indicates whether some state is
to be understood as alarm. The alarm class may also be structured to show the
relative importance of the alarm. Some alarms may namely represent just warnings,
while others could be high-priority alarms and the two types should obviously not be
confused.
458 Chapter 12: System Integration

The parameters sampling time, scaling factors and the limit and alarm values are
contained also in the data structure (record) for input data processing described in
Section 5.5.4. These parameters are needed for a first processing of the signal at a
level as close as possible to the sensors and to the process; the preliminary
processing should take place as fast as possible after sampling.
In the case of the analog input point above, the scaling coefficients for the linear
conversion from raw data to temperature are: a = 0 and b = 100/4095 = 0.0244. It is
assumed here that the analog input value is converted in digital form by a 12-bit A/D-
converter, with 0 corresponding to 0°C and 4095 to 100°C. The raw input value 3228
is converted in (3228*0.0244) = 78.8°C. This is higher than the maximum allowed
value 75°C, so that an alarm state is reported.
For a Digital Input (DI) some of the record parameters differ:

CODE: K010
DESCRIPTION: PRIMARY LOOP PUMP
TYPE: DI
ADDRESS: #7.45.01
EVENT CLASS: 0
ALARM CLASS: 0
SAMPLE (SEC): 0
RAW VALUE: 1
CONVERTED VALUE: ON
STATE=0: OFF
STATE=1: ON
ALARM GENERATION: NO
ALARM STATE: NO

In a point defined as digital input („DI“) the states 0 and 1 are associated to
descriptions in clear text, as e.g. 0=„OFF“ and 1=„ON“, or 0=„OK“, 1=„ALARM“. To
avoid ambiguities and facilitate the programming, the generation of an alarm is not
controlled by the raw value 0/1, but via the converted value „ON“/ „OFF“.
The process database provides the stored data with homogeneity and structure.
In a process control system sensors and actuators are of many different types. A
temperature could be read with a PTC resistor, another with a thermoelement, a third
one with a small digital instrument. The data from the sensors would then reach the
central unit in raw format, or in complete data packets, maybe even already
converted and coded in ASCII. Via the process database each measuring value is
processed separately and converted to a uniform representation. The application
program modules need only to access the database and do not need to take in
consideration the particular physical details of the sensors and the actuators. The
substitution of a sensor with another of a different model does not require the new
coding of one or more program modules, but only the input of the new parameters in
the database. The parameter change can even take place online and without the
need to disconnect or switch off the control system.
Abstraction and separation of the measured values from the physical data is
useful when some parameter has to be updated. It is not necessary to modify a
program or halt the control system, but it is sufficient to redefine the conversion
parameters stored in the database.
12.4: The Functions of a Computer Control System 459

12.4.5 Derived Variables


In system control, the ideal situation is when all state variables are directly
measurable with appropriate sensors. In practice it is often difficult or just not
possible to measure some of the values of interest, so that important values must be
computed or estimated on the base of others. There are no sensors for „energy“ or
„efficiency“, although these values have a physical meaning and are of practical
importance.
The problem of estimating non-measurable state variables was treated in
Section 3.5.2. The control system software must allow the computation of new
variables from those which are collected directly. Whenever new data is available for
some of the input variables, even the derived variables must be computed anew. In
addition, derived variables should be able to refer also to other derived variables.
The computational principle is not much different from that of spreadsheet programs,
in which the values for each cell may depend on the other cells also in a very
complex way.
An important type of derived variables are operational statistics for the different
hierarchical monitoring and control levels. The knowledge of total aggregated or
integrated quantities, like for example production figures for a whole day, used
materials or consumed energy, is important at the higher control levels. Other
important global variables, like e.g. the total energy consumed per product unit or per
machine, can be easily derived from the integrated values. These values offer a
better insight in the operations than the instantaneous raw data delivered by the
sensors and are of importance for the analysis of the functionality of single
machines. A higher specific value for energy consumption in a machine, that would
otherwise remain unobserved, can in this way be tracked down and point to a
particular problem. The aggregated data and other derived relations (quality data,
efficiency values) can be printed out in form of statistical tables.

12.4.6 Access to the Process Database, Queries and Protocols


The data contained in a database can be accessed with three fundamental
operations which can be combined together: selection, projection and sorting. Strictly
speaking, these operations are formally defined only for relational databases, they
can however also be used for other database structures.
Selection indicates an operation to chose from the database only data matching
specific criteria, e.g. all points with code beginning with the character „A“. A
comfortable feature of selection is when different criteria can be combined together,
for example in the selection of all digital input objects whose code begins with „A“
and are located in a determined geographical area.
The projection is the choice of part of the stored information about an object for
printout or output of some kind. For instance, from the general database record
described above, only code, description, converted value and units could be chosen
(projected) to be tabulated. A line output would therefore have the following aspect:

T439 PRIMARY CIRCUIT TEMP IN = 78.8 °C

Sorting means ordering the selected data according to some principle, like e.g.
alphabetical ordering of the code field or ordering for increasing/decreasing value, for
sensor type, etc. Sorting is done with reference to one or more of the fields that were
selected in the projection operation.
460 Chapter 12: System Integration

When the three basic database operations are combined together, they may
lead to a large number of combinations. The data contained in a database is too
much to make sense and be understood, but once it is approached with the right
tool, all kinds of desired and task-oriented information can be extracted. The
database access operations provide this tool.
An operation on the database to extract information is called query. There are
several query languages, but their basic operations are always the same, and also in
their syntax there are not many differences. An example of query is the following:

FOR ALL POINTS WITH CODE = A*, B* AND TYPE = AI


PRINT CODE, DESCRIPTION, VALUE, UNITS
ORDERED BY CODE
END.

It is easily recognized that „WITH CODE = A*, B* AND TYPE = AI“ is the
selection operation, „PRINT CODE, DESCRIPTION, VALUE, UNITS“ is the
projection and „ORDERED BY CODE“ is the sorting. For newcomers to databases it
will be remembered that sorting may take quite some time, depending on the amount
of records to sort, the quality of the software and the machine capacity. It is not
recommended to start a large database query when in a hurry.
The use of some logical principle in the code structuring for the process points
contributes notably to increase the flexibility of the database. To this purpose it is
necessary to consider the most important selection criteria. The most important
selection types are geographic (all points at a specific location), for system /
subsystem / work cell and for type of sensor. In the definition of the code structure a
precise meaning can be given to all character positions. In the database all objects
are of course treated in a similar way, but still the definition of a structure notably
helps the process operators in the organization and completion of their work tasks.
In order to effectively use a database access program it is necessary to select
beforehand a subset for the data of interest. It is useless to list out the state of all the
points of a system if it is known in advance where the information of interest is
located. Usually only a few combinations of data printouts from the database are of
interest at any particular time, so that a small number of standard queries can be
identified. These queries are known as protocols (no relation with the protocols as
set of rules and procedures for data communication described in Chapters 8 and 9).
Protocols are basically queries in which the projection and sorting operations (what
information to print out and in what order) are predefined and only the selection
parameters need to be given when the function is started (Figure 12.5). Note that the
fields to print out and the sorting order are not explicitly indicated in the query.

Alarm protocols
One of the most important functions of a control system is to quickly recognize
unallowed states and to alarm the human operators. Every variation of the state of
points classified as alarm should also be recorded with indication of the time in a
special file, the alarm-log.
12.4: The Functions of a Computer Control System 461

STATE PROTOCOL ===== BEGI N ON 01- APR- 98 10: 30: 05


SELECTI ON = K* , T*

DI K010 PRI MARY CI RCUI T PUMP = OPERATI NG


DI K012 PRI MARY CI RCUI T PUMP = NORMAL
DI K014 SECUNDARY CI RCUI T PUMP = OPERATI NG
DI K016 SECUNDARY CI RCUI T PUMP = NORMAL
DI K023 SAFETY SWI TCH 1 = OFF
DI K024 SAFETY SWI TCH 2 = OFF
DI K025 SAFETY SWI TCH 3 = OFF
DI K098 FI RE SENSOR = OK
DI K099 PLANT VENTI LATI ON = OK
AI T439 PRI MARY CI RCUI T TEMP. I N = 78. 5 ( 75) °C ***
AI T442 PRI MARY CI RCUI T TEMP. OUT = 59. 4 ( 60) °C
AI T444 SECUNDARY CI RCUI T TEMP. I N = 38. 8 ( 45) °C
AI T445 SECUNDARY CI RCUI T TEMP. OUT = 54. 0 ( 60) °C

STATE PROTOCOL END ON 01- APR- 98 10: 30: 12

Figure 12.5: Example of process state protocol

A particular query, the alarm protocol, is used to search and list all those objects
from the database that are in alarm state at any given moment. This protocol is
particularly important for maintenance and repair works.

Maintenance Protocols
Another important aspect of the operation of a technical plant is the maintenance
of devices and equipment, that has to be carried out by the personnel. Examples of
maintenance actions are the substitution of worn-out machine tools, the calibration of
sensors and the control of the level of fuel and lubricants. Maintenance actions can
even be quite complicated, up to the point of disassembling complex machine
equipment to check and clean all of their parts. This type of maintenance is called
preventive maintenance and is carried out to keep the equipment at an optimum
operational state. Actions to repair devices or parts that are already defective or
broken down are instead known as corrective maintenance.
Depending on the type of device, preventive maintenance operations are carried
out either on a fixed schedule (e.g. once every thirty days) or after a certain
accumulated work time (a tool may have to be changed after 200 hours of
operation). In a large plant, maintenance is required for hundreds or even thousands
of devices. To keep tab of the right schedule manually is a complicated and not
particularly grateful task.
It is straightforward to prepare schedules for the planned maintenance actions
for a workday or other selected time period from the data stored in the process
database. The repair of a device after a defect appeared cannot of course be
planned in advance, but still also the data of the unplanned measure can be stored
in the database, to save some redundant maintenance actions later on. If a piece of
equipment is repaired on Monday after a breakdown, it is not necessary to carry out
the yearly control on Wednesday, even if it was initially planned for that date. An
example of preventive maintenance schedule is shown in Figure 12.6.
462 Chapter 12: System Integration

MAI NTENANCE PLAN FOR: MON 06- APR- 98


BEGI N ON 01- APR- 98 09: 05: 12

K022 DRI LL VERI FY TOOLS ( 200 HRS) . ACCTD = 228. 4 HRS


MA12 DI ESEL GEN. VERI FY OI L LEVEL ( 50 HRS) . ACCTD = 47. 2 HRS
LA05 LATHE MAI N REVI SI ON ( 1500 HRS) . ACCTD = 1502. 0 HRS
CO37 COMPRESSOR 01 XCHG AI R FI LTER ( 1 MTH) . LATEST = 28- FEB- 98
CO38 COMPRESSOR 02 XCHG AI R FI LTER ( 1 MTH) . LATEST = 28- FEB- 98
P101 WATER PUMP MAI N I NLET, CHECK ( 100 HRS) . ACCTD = 98. 2 HRS
P102 WATER PUMP MAI N I NLET, CHECK ( 100 HRS) . ACCTD = 102. 7 HRS

MAI NTENANCE PLAN END ON 01- APR- 98 09: 05: 16

Figure 12.6: Example of maintenance plan

Data Analysis and Trends


An important task in production and process industry is to keep tab of production
rates and produce statistics. The data contained in the database can be the first
input to the statistical routines. The basic statistical operation is the integration of
data over time, that is, to produce accumulated values for a given period of time:
days, weeks, months. The total accumulated values can then be printed out as
statistical tables and other relations like efficiencies or quality values extracted out of
them.

12.4.7 Control Operations via the Process Database


In some control systems, automated reactions can be carried out via the central
database. A table in the database indicates when variations in the value of input
parameters are associated to output commands. This table operates in a way similar
to Programmable Logic Controllers (PLC), although the data it refers to is at a much
higher abstraction level and can include derived variables. The form of the fields in
the table is
when (variable=value) -> action.

A particular kind of event is when a certain time has been reached or when a
period of time has elapsed. The action table has then the form

time -> action

In this way for example in a factory the lights can be automatically turned on and
the machines powered shortly before the beginning of the first work shift. Extra
parameters can be used to qualify the data in the tables. Holidays are recorded
separately to be treated e.g. as Sundays, to avoid a plant warming up and starting all
automated equipment at 6:30 a.m. on a Monday, Dec. 25th.
Also the parameters for digital regulators can be stored in the database in form
of records. The most common types of digital regulators are implementations of PID
regulators where the integration and derivation operations are approximated with
numerical methods. In Direct Digital Control (DDC) the regulators are built in the
database. DDC packages are implemented with a single program module acting on
the basis of parameters for each single control loop; the parameters are structured
12.4: The Functions of a Computer Control System 463

as records to be stored in the database. Examples of such data structures and of the
code for a digital PID regulator have been shown in Chapter 6.
There is an important practical difference in automation function and process
regulation via the database or with PLC systems or local regulators. The latter are
installed close to the process inputs and outputs and can react quickly to a change in
the input data. The database of a hierarchical control system has instead a slower
reaction time because the information must follow the communication chain up and
down, and go through several processing steps in the central processor. It is
therefore worth programming automated reactions in the central computer only when
several parameters have to be compared to each other and when the same
operation cannot be performed in the local control units. Tight control loops cannot
be implemented in DDC form, and the possibility of a heavy overload of the
communication channels must also be taken into consideration.

12.4.8 Advanced Languages for Process Control


For a long time, control systems were programmed almost exclusively in
Assembler. Two major reasons for this were the necessity to exploit all resources of
machines of limited capacity and the lack of adequate languages for real-time
programming.
Current languages for control system programming can be divided in two main
types: procedural and descriptive. Procedural languages - which include ordinary
programming languages - require the definition of all single instructions that the
computer must execute. Descriptive languages require only the definition of data,
relations and parameters to store in the different databases. The desired input/output
relations are described in a table-like fashion and the program execution internals
are left to the machine. An example of descriptive language is the database
described earlier in this section; another example is represented by the sequential
languages for programmable logical controllers (Section 7.4). Descriptive languages
are in general easier to use than procedural languages. They are on the other hand
less flexible, but this can be compensated for with smaller procedural programs
developed for special tasks.
To use and program a control system via descriptive languages, detailed
computer knowledge is generally not required. Good knowledge of the process to be
controlled is of greater importance, as well as an understanding of what the control
system can and cannot do. The success of a particular application depends strongly
on the quality of the model of the physical process and on the definition of the I/O
parameters. Descriptive programming requires also the correct tuning of the
operating parameters in order to best match the control system capabilities to the
process under control. The assignment of different priorities to different tasks may
also help in that respect. It does not make any sense to try to collect hundreds of
data every second in a computer of limited capacity defining for each input the
shortest sampling time. Such a system would at the end operate in the round-robin
mode (Section 10.2.5) and the machine capacity would set in practice the sampling
rate, not to mention all the information that is going to be lost.
464 Chapter 12: System Integration

12.5 Project Realization and Quality Control


12.5.1 Project Organization
A control system is not only a computer program but also includes processors,
networks, terminals, sensors, actuators and many more components. In some cases
the vendors of industrial automation systems require that everything is bought from
them, from the software down to nuts and bolts. Others take a more systematic, and
customer friendly, approach and deliver single modules on request. The current
trend is to support standardization, that is, the interconnection and interchangeability
of components.
The practicing automation engineer will dedicate a large part of his or her time to
the construction of systems for solving special problems. As problems tend to
become more complicated and specialized, the chance to find a complete solution in
a ready package becomes rather slim.
There are no „optimal“ solutions; these exist only as mathematical concepts, that
can be used only in special cases for concrete problems. External factors - many of
them seem indeed esoteric, from the climate to the availability of spare parts and to
the education of the maintenance personnel - are nevertheless relevant to the
success of a complex solution. Everything should be considered in order to avoid
malfunctions and costly surprises at a later stage.
Among the non-technical aspects that directly determine the success of an
automation application is the overall organization, that becomes more and more
important the larger the project is. Normally, a project is divided into planning,
implementation, documentation, testing and operation phases. Each phase is critical
for the success of the project at large.
The planning phase includes a general analysis of the problem to be solved. At
the end of the planning, a project specification document is produced. Another type
of document is the feasibility study, an analysis of whether and how a problem is
solvable, of the possible solutions and their approximate cost. A feasibility study is
usually not as detailed as a specification document. The feasibility study is intended
for the company management while the specifications are for the external suppliers.
The final contracts should exactly specify what the system has to do. If they build
on too generic terms as „monitoring“, „process control“, and the like, then
dissatisfaction and conflicts are bound to follow. General concepts should be
specified as soon and as clearly as possible. Instead of „process monitoring“ it
should be reported what process values must be processed and in what form they
should be presented, whether the representation of process data can remain „raw“ or
take place with help of graphical interfaces, etc.
The operational specifications are in part the responsibility of the buyer of a
control system and in part of the company that delivers the control system. To avoid
conflicts, it is better to define in advance the respective competence areas. It is also
advisable that a person or a group of people representing the customer follows the
execution of the project. The deliverer offers his generic knowledge about control
systems, while the customer has to check that all the needs and requirements are
satisfied.
A solution must fulfill several requirements at once, many of which are quite
contradictory. The most important aspects are:
• goal fulfillment
• reliability
12.5: Project Realization and Quality Control 465

• safety (the system won’t act in a dangerous way under unforeseen conditions)
• maintainability (almost all systems need some kind of periodical human
intervention for cleaning, checking, calibration, etc; these operations should be
facilitated)
• economy (more in the sense of getting value for money than just spending as
little money as possible).
It is imperative that all parts of a system are correctly documented in relation to
the hardware and software implementation as well as to the functions to be
performed. The documentation is the interface between the different people working
at the project when they cannot communicate directly. The documentation should not
be considered as an uncomfortable contractual duty to fulfill after a system has been
developed and delivered, but rather as a key element of its development and its
success.
Testing a system is a very important step. It must be verified that the operations
satisfy the general planning indications and the specification documents. Testing is
of course necessary to identify errors as soon as possible for immediate correction.
The steps of planning, project design, implementation and testing are ideally
separated, but there are actually strong interactions and feedback among them.
During the project phase some new facts may appear, which might lead to changes
in planning. Practical, previously unknown, implementation constraints may also
influence the course of the project. With new experience gained in the field it may
become necessary to change again parts already considered as completed.
Unfortunately, changes in the specifications become harder and costlier to
implement the later they are done, but on the other hand a complex system is
constantly modified anyway. There is no final version as such, only different degrees
of functionality.
The project engineer and the test engineer have two different goals. The project
engineer has to design a robust and efficient system. The test engineer has to think
out various tests in order to find as many errors as possible. Both have to follow the
original requirements’ document, although changes dictated by practicality and
common sense may be included.

12.5.2 Quality Control as Part of System Development


The quality control of industrial products and processes has gained enormously
in importance. Some of the principal reasons are the international competition, high
quality requirements of the consumers and the necessity to make optimal use of
scarce material and energy resources. Therefore, quality control has become an
important component of a technical process and can even represent the decisive
factor for the cost-effectiveness of production plants. A plant in which too many
products must be discarded because of quality problems, or if the products are not
accepted by the consumers, has no survival chance.
The international standard ISO 9000 deals with quality management and control
in different technical processes. This standard does not define how quality can be
ensured; to this purpose there are thousands of other standards, and at the end this
problem can be solved only with human know-how. Instead ISO 9000 deals with how
quality can be defined in project development and in the contracts between
manufacturers and customers.
466 Chapter 12: System Integration

The standard ISO 9000 „Quality management and quality assurance standards“
is actually a collection of five standards (ISO 9000 through 9004), in which it is
defined how controls and verifications should be carried out in the different phases of
work organization for project development. These standards specify also in what
measure manufacturer and customer carry the main responsibility for different
project phases and define also the type of contractual regulations. ISO 9000 does
not only refer to the technical production or the construction of a plant, but includes
also the related services and organizational measures on the part of the contractor.
In other words, the quality-conscious contractor can follow the indications of ISO
9000 in its production and in this way show his customers a concrete quality
certification.

12.5.3 Towards the Automated Factory?


The Computer Integrated Manufacturing (CIM) has become one of the key
concepts in factory automation. What is meant is the integration of all production-
related information in a plant. But there is still a long time left before a factory can be
switched on just by pressing one button! (And it is not even said that it would
necessarily be worthwhile doing it.)
CIM is not a simple business. Automation is not an „all or nothing“ concept, but a
gradual development. And this development is not limited to the factory or the plant.
As an example it is instructive to compare what happened in the last decade in the
USA, in Europe and in Japan in relation to car production. In Japan, at the same time
when automation was introduced in the plants, the new car models were designed to
be easier to build. In Europe, progressive changes were made on existing plants. In
the USA the approach was to automate everything at once, the old operations should
be carried out by machines instead of the workers. The result of the competition was
that at Toyota, about 100,000 workers produced almost as many cars per year as
more than half million workers at General Motors (and in Japan unemployment
figures are still lower than in Europe or the USA). Later on, both European and
American producers have learnt the Japanese lessons very well. Today, there is
stronger competition between all manufacturers.
The moral of the story is that „system thinking“ is not limited to the plant
technology, but involves a great number of other factors, which may be harder to
define and describe but are not less important for the result. A constant verification of
the proposed solutions versus the set goals is therefore imperative.
Also in the development of the world-famous Swatch wristwatch, that is
produced in Switzerland, construction aspects played an important role. The number
of parts that must be mounted in the watch was first notably reduced via advanced
design, which in turn made possible mass production and therefore a considerable
reduction in cost for a highly qualitative product.
CIM does not represent a software package that can be bought more or less off-
the-shelf or especially tailored for a particular situation. Instead all activities in a plant
must be planned and organized in such a way, so that automation technology can
first be introduced in a cell and then gradually extended step by step to other areas.
CIM is no quick solution; it must be seen as evolution rather than revolution.
A Japanese concept in logistics that also in the West has reached its point of
fame is „Just-in-Time“ (JIT). This production concept is used for the reduction of
storage and warehousing, i.e. of the buffers between machines and production
plants. The JIT-principle is based on the idea of delivering the necessary
12.5: Project Realization and Quality Control 467

components exactly at the moment when they are needed. Large companies, in
particular in the automotive industry, can in this way do without large and costly
warehouse storage.
The JIT principle was first developed at Toyota. It combines socio-economical
factors with technical methods and regards information technology as well as the
distribution of responsibilities among the personnel and the subcontractors. The
realization of the JIT principle is a long and costly process; it took Toyota itself about
ten years to introduce JIT in its production lines.
A further reason for the introduction of the JIT method was that warehouse stock
hide problems in the production. To explain the JIT principle the Japanese use the
following analogy. Buffering warehouses are like water in an harbor, while the sea
bottom represents the problems. The buffer-water hides the sea floor, so that a boat
can run into it. If the water level is lowered, the floor can be recognized and detours
can be made if it is necessary. In a similar way, if buffers are eliminated from the
production, also the problem areas become clearer, so that the necessary solutions
can be found easier.
For European and American companies the main goal is to make quick profits in
existing markets. Development and marketing are focussed on this goal, and the
main object of attention are the products. In Japan, instead, also the productive
process is considered. The company strategy is not only oriented toward short-term
profits, but rather toward long-term growth and stability. In parallel to product
development the Japanese also make efforts to create the related markets with long-
term actions. This does not easily fit the rougher, profit-oriented policies of Western
companies. However, in the meanwhile the Japanese insights have also reached
many European and American companies.
Each medal has its backside. Thanks to JIT the warehouses of the ordering
companies are kept small, but those of the subcontractors become larger. And when
parts of the warehouses are brought to the street, traffic density increases. Traffic-
related problems have now such influence over transport links, so that „Just-in-Time“
turns more and more into a kind of „Just-in-Line“. To reverse the Japanese analogy:
when the water level is lowered, the sea floor is better recognized, but new
unnavigable shallow areas are also created. In fact, in the meantime, the high
sensitivity to disturbances of the JIT concept has brought companies like Toyota and
Nissan to build again warehousing capacity in their new plants.
Computers act as information amplifiers, and therefore will enhance both the
good and the bad sides of a process or a system. With computers, what already
works satisfactorily will work even better, but what works poorly will cease to work
altogether. And technology should never become an end in itself. A microprocessor
can be installed in the coffee machine, but that doesn’t mean that the way of drinking
coffee is much different than if the water had been cooked on a stove. What is
essential is to define exactly measurable goals and design the tool or the automated
plant accordingly. The goals should be clearly identified, for example:
• reduction of the mean production time per unit from 2 hours to 45 min
• reduction of the production costs per unit by 10%
• quality control: reduction of faulty parts from 20% to 5%
• reduction of dead times (i.e. when a machine is not utilized because another
has to terminate its operation) by 50%
If this type of goals cannot be reached with automation, or if it can be reached
with other solutions than automation, then - don’t automate!
468 Chapter 12: System Integration

12.6 Summary
Computers are used in process control for data collection, analysis and
archiving, but apart from process regulation there are comparatively few applications
in automatic control. There is still much to do in this respect.
In a digital control system it is comparatively easy to try new control strategies,
because a digital computer may completely change the way it operates when its
software is modified, without need to redesign and rewire the whole hardware. Digital
control systems are thus not just a new way to implement established principles for
control, but rather an entirely new technique that offers greater flexibility and new
possibilities.
The implementation of control systems takes place at many levels. The final
choice of a particular solution may be dictated not only by technical aspects, but also
by factors as different as personnel availability, operating environment, and others.
For large applications that are typical in both manufacturing and process industry,
generalized monitoring and control packages programmed on the basis of parameter
tables can be used. The advantage of ready packages for automated monitoring and
control lies in simpler programming and operation. Often such systems also support
the writing and updating of the documentation.
Automation is a key technology to support quality and efficiency in industrial and
processing applications and computers are the basic components for advanced
automation. The future of automation is not restricted to manufacturing plants:
automation is going to play a key role also in the efficient use of natural resources
and in the protection of the environment from the negative aspects of a too fast and
indiscriminate industrial development. Automation is one of the few realistic answers
to the problem of enjoying a high quality of life in a world worth living in.

Further Reading
Discrete manufacturing offers different kind of computer control problems. A
descriptive view of these problems is found in [Groover 1987], while a more
analytical description of representative problems is found in [Gershwin 1994].
[Brooks 1975] is a witty and pregnant pamphlet about the real-life aspects (read:
delays) of software project planning. Recommended lecture for software
development managers, especially when they do not have direct programming
experience.
A general introduction to software reliability is provided in [Littlewood / Strigini
1992]. Fault tolerance in complex and distributed computer systems, under
consideration of hardware, software and communication aspects is given in
[Tanenbaum 1995].
Databases are described in [Ullman 1988]. This book offers a high-level
description of different database types (relational, hierarchical, etc.) as special cases
of a general database concept. Applications of expert systems for process fault
diagnosis is discussed in [Hayes-Roth / Waterman / Lenat 1983].
An important information source are the product catalogues of the different
hardware and software producers in industrial automation. Some of these catalogues
are particularly instructive and also written pedagogically.
Appendix: Standards and Standardization Organizations

The need to standardize the interfaces of different components and systems has
long been recognized by the users and the industry. Also in this book standards are
referred to in several places. Different professional and governmental organizations
work to define standards in different sectors to be used as guidelines for the
construction of components and services. Basically, standards are needed to ensure
that different components can operate together and that the required quality level is
achieved. Standards are prepared by national and international committees in which
customarily participate representatives of companies, professional organizations,
universities and governmental institutions. However, in many cases current
standards do not necessarily represent the best technical solution, because they
describe already existing realizations and therefore create „compatibility islands“. In
some cases, it is attempted in the standardization work to define general frames
before the introduction of practical - real - solutions.
On the other hand, some design solutions for components and system parts
have been so widely accepted in industrial environments to become de-facto
standards. In this respect the „anarchy“ of the industry and of the free market has led
to better results, namely less standards but that are also more widely accepted and
recognized, than what the ordered and lengthy work of international bureaucrats
would have created. The most successful solutions have been those that gave room
for flexible realizations at reasonable costs together with a practical mechanical and
electrical construction basis.
Different terminologies are used in different contexts, so that „standards“,
„recommendations“, „guidelines“ and others are encountered. Only standards that
have been developed by recognized governmental or professional organizations
have official status. Any other recommendations, guidelines and the like have no
official character and their acceptance depends ultimately on the users.
Standards can be either de jure („legal“) and de facto („factual“). Legal standards
are defined by recognized government or industrial organizations. De facto
standards, often also called „industrial standards“, develop spontaneously when in
practice almost everybody does the same thing or uses the same product but without
anyone officially taking the decision. This has been the case with the „industry
standard“ computer (what is meant is the IBM PC and its compatibles), the Hayes
modem protocol, the Epson printer control language and others. Many de facto
standards have even been later sanctioned by official organizations. The nice thing
with de facto standards is that everybody agrees on using them without being told to
do so.
The case is different with standards meant to be such. As there is always
disagreement in large international panels in what to do, in many cases several
incompatible standards are defined for the same issue, as for example has
happened with the network data packet formats described in Section 9.5. Yet such a
situation is better than nothing. It must be noted that the need for convergence and
for the use of common standards is more and more recognized, and that the
cooperation between the different standardization organizations is improving. The
most important organizations responsible for the definition of standards recognized
and used by the industry are briefly listed below.

469
470 Computer Systems for Automation and Control

The most important international standardization organization is ISO


(International Organization for Standardization). The acronym is not misspelled, but
derives from the Greek word „isos“ (=„equal“). This has the advantage that this
denomination can remain the same in different languages, while it would not be the
case with real abbreviations; for example, in French the name would be:
Organisation Internationale de Normalisation.
ISO is the common association of about 90 national standardization
organizations like ANSI (USA), GOST (Russia), DIN (Germany), AFNOR (France),
BSI (Great Britain), UNI (Italy), SS (Sweden) and many others. These organizations
define standards in all possible branches. Many of these standards are related to
industrial and computer technology. Once ISO standards have been issued,
everybody in the participating countries should in principle conform to them.
Standards from some of the ISO participating organizations are so highly regarded
that they are directly „imported“ into other countries; this is often the case with the
German DIN standards.
The ISO organization that specifically deals with standards for electrotechnics
and electronics is the IEC (International Electrotechnical Commission). Within the
IEC the Technical Committee TC65 is responsible for issues related to Industrial
Process Measurement and Control. The TC65 itself is divided in several sub-groups
that deal with the most important aspects of process control technology, from system
issues and software up to programmable logic controllers and digital communication.
The standardization organizations of the European Union member countries,
besides their representation in ISO, form also the CEN (Comité Européen de
Normalisation) and the CENELEC (Comité Européen de Normalisation
Electrotechnique). These committees were organized in the 1960s to continue at
European level the work of ISO and IEC. The Commission of the European
Communities is encouraging the use of common standards in the process of political
and economical integration; the activities of CEN and CENELEC have therefore
gained in importance in the last years.
The ITU-T (International Telecommunication Union) recommendations are very
important in the field of communication. ITU-T was earlier called CCITT (Comité
Consultatif International de Telégraphie et de Teléphonie) and many
recommendations are still known under that acronym. In practice all countries
member of the United Nations are represented in ITU (and earlier in CCITT) through
their national Telecom companies. A notable exception is the U.S., where there is no
state monopoly for telecommunication but several private companies share the
communication market. For this reason the U.S. is represented at ITU via the State
Department, i.e. the ministry for Foreign Affairs.
ITU-T does not issue standards, but recommendations. In principle, each
Telecom could do as it wants in its (geographical) area of responsibility, but
compatibility is obviously necessary for international phone and data communication
to function. Even here there is a trend toward common rules, as for example has
happened with the digital network ISDN, that is being implemented in the whole
world according to similar guidelines.
ISO standards cover all possible technical fields and are therefore the main
reference for the industry, together with the applicable national standards. ITU-T
recommendations are in first line of interest for voice and data communication. When
the competence areas overlap, like for example in the definition of communication
interfaces or data network equipment, a common standard is published twice, both
by ISO and by ITU-T.
Appendix: Standards and Standardization Organizations 471

EIA is the abbreviation of Electrical Industries Alliance, an American trade


association responsible for the development of standards at hardware level. Some of
the EIA standards, like the communication port interfaces RS (now also called EIA),
have found wide acceptance also outside the U.S.
The IEEE (Institute of Electrical and Electronic Engineers) is a professional
society based in the U.S. and with local national chapters in the whole world. The
IEEE issues its own set of standards, related to the aspect and the quality of
hardware as well as to performance criteria and work methods. Also IEEE standards
enjoy worldwide recognition. In the U.S., IEEE standards are issued jointly with ANSI
(American National Standards Institute).
The ISA (Instrument Society of America) is another standard setting society in its
specific field. On request of ANSI, the ISA publishes standards about instrumentation
and control. Similarly to the IEEE standards, ISA standards are not only related to
hardware but refer also to operational practice and procedures.
Two organizations are actively supporting the development and utilization of
industrial bus systems. VITA (VME International Trade Association) is responsible for
the development of VME and related standards; most VITA standards are issued
jointly with ANSI. PICMG (PCI Industrial Computer Manufacturing Group) is a
consortium of companies with the responsibility for developing Compact PCI
specifications.

Reference addresses
The original standards publications can be ordered from the respective
organizations; some addresses are reported here for convenience. National
standards organizations also act as points of sale for literature of the standards
organizations from other countries. On placing orders it should be noted that some
standards are just a few pages long, others encompass hundreds or even thousands
of pages. Because of the necessary precision and clarity the style is precise, but dry
and reminds of definitions from dictionaries. This type of publications is therefore
intended for reference rather than for continuous reading.

Copies of the ISO/IEC standards are available from


ISO Central Secrétariat http://www.iso.ch/
1, rue Varembé
CH - 1211 Genève 20 (Switzerland)
or from the
IEC Central Office http://www.iec.ch/
3, rue Varembé
CH - 1211 Genève 20 (Switzerland)

The ISO/IEC standards are also available from any of their national member
organisations.

The address of the ITU is


International Telecommunication Union http://www.itu.ch/
Place des Nations
CH - 1211 Genève 20 (Switzerland)
472 Computer Systems for Automation and Control

ANSI/EIA publications can be obtained from the


American National Standards Institute (ANSI) http://web.ansi.org/
Sales Department
1430 Broadway
New York, NY 10018 (USA)

They can also be ordered from the


Electrical Industries Alliance (EIA) http://www.eia.org/
Standards Sales Office
2001 I Street, NW
Washington, DC 20006 (USA)

IEEE Standards may be purchased from


The Institute of Electrical and Electronic Engineers, Inc. (IEEE)
345 East 47th Street http://www.ieee.org/
New York, NY 10017 (USA)

The address of ISA is:


Instrument Society of America (ISA) http://www.isa.org/
67 Alexander Drive
P.O. Box 12277
Research Triangle Park, NC 27709 (USA)

The address of the Russian Standardization organization GOST is:


GOST http://www.gost.ru/
117049 Moskva (Russian Federation)
Leninsky Prospekt, 9

German DIN standards can be ordered at the following address:


Beuth-Verlag GmbH http://www.din.de/
Burggrafenstraße 6 http://www.din.de/set/en/DIN_e/BeuthIntro_e/
10787 Berlin (Germany)
Bibliography

[Alloca / Stuart 1984] Alloca, J. and A. Stuart: Transducers - Theory and


Applications; Reston, VA: Reston Publishing Company, 1984.
[Asada / Slotine 1986] Asada, Haruhiko, and Jean-Jacques E. Slotine: Robot
Analysis and Control; New York: Wiley, 1986.
[Åström / Hägglund 1988] Åström, Karl Johan, and Tore Hägglund: Automatic
Tuning of PID Controllers; Research Triangle Park, NC: Instrument Society of
America, 1988.
[Åström / Wittenmark 1990] Åström, Karl Johan, and Björn Wittenmark: Computer
Controlled Systems - Theory and Design (2nd edition); Englewood Cliffs, NJ:
Prentice-Hall, 1990.
[Åström / Wittenmark 1995] Åström, Karl Johan, and Björn Wittenmark: Adaptive
Control (2nd edition); Reading, MA: Addison-Wesley, 1995.
[Atkinson / Shriffin 1971]

[Atkinson et al. 1990] Atkinson, Rita L., Richard C. Atkinson, Edward E. Smith, and
Ernest R. Hilgard: Introduction to Psychology (10th edition); San Diego, CA: Harcourt
Brace Jovanovich, 1990.
[Bainbridge 1983] Bainbridge, Lisanne: „Ironies of Automation“; Automatica, Vol.19
No.6, pp.775-779, 1983.
[Barney 1988] Barney, George C.: Intelligent Instrumentation: Microprocessor
Applications in Measurement and Control (2nd edition); Englewood Cliffs, NJ:
Prentice-Hall, 1988.
[Bellman / Kalaba 1964] Bellman, Richard E. and Robert Kalaba (Eds.): Selected
Papers on Mathematical Trends in Control Theory; New York: Dover Publications,
1964.
[Ben-Ari 1990] Ben-Ari, M.: Principles of Concurrent and Distributed Programming;
New York: Prentice Hall, 1990.
[Bendat / Piersol 1986] Bendat, Julius S. and Allan G. Piersol: Random Data -
Analysis and Measurement Procedures (2nd edition); New York: Wiley, 1986.
[Bendat / Piersol 1993] Bendat, Julius, and Allan Piersol: Engineering Application of
Correlation and Spectral Analysis (2nd edition); New York: Wiley, 1993.
[Bender 1990] Bender, Klaus (Hrsg.): PROFIBUS (in German); München and Wien:
Carl Hanser Verlag, 1990.
[Black 1989] Black, Uyless D.: Data Networks - Concepts, Theory and Practice;
Englewood Cliffs, NJ: Prentice-Hall, 1989.
[Bode 1960] Bode, Hendrik Wade: „Feedback - the History of an Idea“, lecture given
at the Conference on Circuits and Systems, New York, 1960, reprinted in [Bellman /
Kalaba 1964].
[Brinch Hansen 1973] Brinch Hansen, Per: Operating Systems Principles;
Englewood Cliffs, NJ: Prentice-Hall, 1973.
[Brooks 1975] Brooks, Frederick P.: The Mythical Man-Month; Reading, MA:
Addison-Wesley, 1975.
[Buckley 1964] Buckley, Page S.: Techniques of Process Control; New York: Wiley,
1964.
[Cannon 1967] Cannon, R.H. Jr.: Dynamics of Physical Systems; New York:
McGraw-Hill, 1967.

473
474 Computer Systems for Automation and Control

[Coffmann / Denning 1973] Coffmann, Edward G. and Peter J. Denning: Operating


Systems Theory; Englewood Cliffs, NJ: Prentice-Hall, 1973.
[Coffmann / Elphick / Shoshani 1971] Coffmann, E.G., M.J. Elphick, and A.
Shoshani: „System Deadlocks“; Computing Surveys, vol. 3, n. 2, pp. 67-78, June
1971.
[Craig 1989] Craig, John J.: Introduction to Robotics - Mechanics and Control (2nd
edition); Reading, MA: Addison-Wesley, 1989.
[Derenzo 1990] Derenzo, Stephen E.: Interfacing - A Laboratory Approach Using the
Microcomputer for Instrumentation, Data Analysis, and Control; Englewood Cliffs, NJ:
Prentice-Hall, 1990.
[de Silva 1989] de Silva, Clarence W.: Control Sensors and Actuators; Englewood
Cliffs, NJ: Prentice-Hall, 1989.
[Desrochers 1990] Desrochers, Alan A.: Modeling and Control of Automated
Manufacturing Systems; Washington DC: IEEE Computer Society Press, 1990.
[Dijkstra 1968] Dijkstra, Edsger W.: „Co-operating Sequential Processes“, in F.
Genuys (Ed.), Programming Languages; London and New York: Academic Press,
1968.
[Doebelin 1990] Doebelin, Ernest O.: Measurement Systems - Application and
Design (4th edition); New York: McGraw-Hill, 1990.
[Driankov / Hellendoorn / Reinfrank 1993] Driankov Dimiter, Hans Hellendoorn and
Michael Reinfrank: An Introduction to Fuzzy Control (2nd edition); Berlin, New York:
Springer-Verlag, 1993.
[Elgerd 1982] Elgerd, Olle I.: Electric Energy Systems Theory - An Introduction (2nd
edition); New York: McGraw-Hill, 1982.
[Elmqvist 1978] Elmqvist, Hilding: „A Structured Model Language for Large
Continuous Systems“, Ph.D. Thesis, TFRT-1015; Lund, Sweden: Department of
Automatic Control, Lund Institute of Technology, 1978.
[Elmqvist 1995] Elmqvist, Hilding: Dymola - User’s Manual; Lund, Sweden: Dynasim
AB, Ideon Research Park, 1995.
[Farowich 1986] Farowich, Steven A.: „Communicating in the technical office“; IEEE
Spectrum, pp. 63-67, April 1986.
[Fitzgerald / Kingsley / Umans 1990] Fitzgerald, Arthur E., Charles Kingsley Jr. and
Stephen D. Umans: Electric Machinery (5th edition); New York: McGraw-Hill, 1990.
[Fletcher 1980] Fletcher, W. I.: An Engineering Approach to Digital Design;
Englewood Cliffs, NJ: Prentice-Hall, 1980.
[Franklin / Powell / Emami-Naeimi 1994] Franklin, Gene F., J. David Powell, and
Abbas Emami-Naeimi: Feedback Control of Dynamic Systems (3rd edition); Reading,
MA: Addison-Wesley, 1994.
[Franklin / Powell / Workman 1990] Franklin, Gene F., J. David Powell, and
Michael L. Workman: Digital Control of Dynamic Systems (2nd edition); Reading,
MA: Addison-Wesley, 1990.
[Fuller 1976] Fuller, A.T.: „The early development of control theory“ (Parts 1 and 2);
Transactions of ASME - Journal of Dynamical Systems Measurement and Control,
vol.98, pp.109-118, 224-235 (1976).
[Gershwin 1994] Gershwin, Stanley B.: Manufacturing Systems Engineering;
Englewood Cliffs, NJ: Prentice-Hall, 1994.
[Ginzberg 1982] Ginzberg, Eli: „The Mechanization of Work“; Scientific American,
vol.247 n. 3, pp. 38-47, September 1982.
[Glasford 1986] Glasford, Glenn M.: Analog Electronic Circuits; Englewood Cliffs,
NJ: Prentice-Hall, 1986.
Bibliography 475

[Glass 1983] Glass, Robert L. (Ed.): Real-Time Software; Englewood Cliffs, NJ:
Prentice-Hall, 1983.
[Gore 1991] Gore, Al (Senator): „Infrastructure for the Global Village“; Scientific
American, vol.265 n.3, pp. 108-111, September 1991.
[Groover 1987] Groover, Mikell P.: Automation, Production Systems, and Computer
Integrated Manufacturing; Englewood Cliffs, NJ: Prentice-Hall, 1987.
[Hassel / Tuvstedt 1978] Hassel, K., and G. Tuvstedt: „Microcomputer Problems in
Real-Time“ (in Swedish); Elteknik med aktuell elektronik, No 14 (1978).
[Hayes-Roth / Waterman / Lenat 1983] Hayes-Roth, Frederick, Donald A.
Waterman, and Douglas B. Lenat (Eds.): Building Expert Systems; Reading, MA:
Addison-Wesley, 1983.
[Held 1989] Held, Gilbert: Data Communication Networking Devices; New York:
Wiley, 1989.
[Henze et al. 1987] Henze, Mogens, C.P. Lesley Grady, Willi Gujer, and G.v.R.
Marais: Activated Sludge Model No.1, Scientific and Technical Report; London:
IAWPRC (International Association for Water Pollution and Control), 1987.
[Hofstadter 1979] Hofstadter, Douglas R.: Goedel, Escher, Bach - An Eternal
Golden Braid; New York: Basic Books Publishers, 1979.
[Hufault 1986] Hufault, John R.: Op Amp Network Design; New York: Wiley, 1986.
[Irvine 1994] Irvine, Robert G.: Operational Amplifier Characteristics and
Applications (3rd edition); Englewood Cliffs, NJ: Prentice-Hall, 1994.
[Jones 1986] Jones, Brian K.: Electronics for Experimentation and Research;
Englewood Cliffs, NJ: Prentice-Hall, 1986.
[Juds 1988] Juds, Scott M.: Photoelectric Sensors and Controls - Selection and
Application; New York: Dekker, 1988.
[Kaminski 1986] Kaminski, Michael A. Jr.: „Protocols for communicating in the
factory“; IEEE Spectrum, pp. 56-62, April 1986.
[Kay 1977] Kay, Alan: „Microelectronics and the Personal Computer“; Scientific
American, vol.237 n.3, pp. 230-244, September 1977.
[Kay 1984] Kay, Alan: „Computer Software“; Scientific American, vol.251 n.3, pp. 41-
47, September 1984.
[Kenjo / Sugawara 1994] Kenjo, Takashi, and Akira Sugawara: Stepping Motors
and their Microprocessor Controls (2nd edition); Oxford: Clarendon Press, and New
York: Oxford University Press, 1994.
[Klir / Folger 1988] Klir, George J., and Tina A. Folger: Fuzzy Sets, Uncertainty, and
Information; Englewood Cliffs, NJ: Prentice-Hall, 1988.
[Kosko 1990] Kosko, Bart: Neural Networks and Fuzzy Systems - A Dynamical
Systems Approach to Machine Intelligence; Englewood Cliffs, NJ: Prentice-Hall,
1990.
[Kreutzer 1986] Kreutzer, Wolfgang: System Simulation - Programming Styles and
Languages; Reading, MA: Addison-Wesley, 1986.
[Kuo 1995] Kuo, Benjamin C.: Automatic Control Systems (7th edition); Englewood
Cliffs, NJ: Prentice-Hall, 1995.
[Lee 1978] Lee, Samuel C.: Modern Switching Theory and Digital Design;
Englewood Cliffs, NJ: Prentice-Hall, 1978.
[Leonhard 1985] Leonhard, Werner: Control of Electrical Drives; Berlin and New
York: Springer Verlag, 1985.
[Levy / Eckhouse 1980] Levy, Henry M. and Richard H. Eckhouse: Computer
Programming and Architecture - The VAX-11; Bedford, MA: Digital Press, 1980.
476 Computer Systems for Automation and Control

[Littlewood / Strigini 1992] Littlewood, Bev, and Lorenzo Strigini: „The Risks of
Software“; Scientific American, vol.267 n.5, pp. 38-43, November 1992.
[Ljung 1987] Ljung, Lennart: System Identification - Theory for the User; Englewood
Cliffs, NJ: Prentice-Hall, 1987.
[Ljung / Glad 1994] Ljung, Lennart, and Torkel Glad: Modeling of Dynamic Systems;
Englewood Cliffs, NJ: Prentice-Hall, 1994.
[Ljung / Söderström 1983] Ljung, Lennart, and Torsten Söderström: Theory and
Practice of Recursive Identification; Cambridge, MA: MIT Press, 1983.
[Loukides 1990] Loukides, Michael: System performance tuning; Sebastopol, CA:
O'Reilly, 1990.
[Luenberger 1979] Luenberger, David G.: Introduction to Dynamic Systems -
Theory, Models and Applications; New York: Wiley, 1979.
[Luyben 1990] Luyben, William L.: Process Modelling, Simulation and Control for
Chemical Engineers (2nd edition); New York: McGraw-Hill, 1990.
[Mayr 1970] Mayr, Otto: The Origins of Feedback Control; Cambridge, MA: M.I.T.
Press, 1970.
[Mohan / Undeland / Robbins 1995] Mohan, Ned, Tore M. Undeland, and William
P. Robbins: Power Electronics - Converters, Applications, and Design (2nd edition);
New York: Wiley, 1995.
[Morrison 1986] Morrison, Ralph: Grounding and Shielding Techniques in
Instrumentation (3rd edition); New York: Wiley, 1986.
[Newsweek 1990] „Can We Trust Our Software?“; Newsweek Intl., January 29,
1990.
[Norman 1988] Norman, Donald A.: The Psychology of Everyday Things; New York:
Basic Books Publishers, 1988.
[Norman / Draper 1986] Norman, Donald A. and Stephen W. Draper (Eds.): User
Centered System Design - New Perspectives on Human-Computer Interaction;
London and Hillsdale, NJ: Lawrence Erlbaum Associates, 1986.
[Norton 1989] Norton, Harry N.: Handbook of Transducers; Englewood Cliffs, NJ:
Prentice-Hall, 1989.
[Olsson 1985] Olsson, Gustaf: „Control Strategies for the activated sludge process“
(Chapter 65), in Cooney, Charles E. and Arthur E. Humphrey (Eds.): Comprehensive
Biotechnology - The Principles of Biotechnology; New York: Pergamon Press, 1985.
[Ott 1988] Ott, Henry: Noise Reduction Techniques in Electronic Systems (2nd
edition); New York: Wiley, 1988.
[Pessen 1989] Pessen, David W.: Industrial Automation: Circuit Design and
Components; New York: Wiley, 1989.
[Peterson 1989] Peterson, Wade D.: The VMEbus Handbook; Scottsdale, AZ:
VMEbus Intl. Trade Association (VITA), 1989.
[Pirsig 1974] Pirsig, Robert M.: Zen and the Art of Motorcycle Maintenance - An
Inquiry into Values; New York: Bantam, and New York: Morrow, 1974.
[Preece / Keller 1990] Preece, Jenny, and Laurie Keller (Eds.): Human-Computer
Interaction; Englewood Cliffs, NJ: Prentice Hall, and The Open University, 1990.
[Rasmussen 1983] Rasmussen, Jens: „Skills, Rules, and Knowledge; Signals, Signs
and Symbols, and Other Distinctions in Human Performance Models“; IEEE
Transactions on Systems, Man and Cybernetics, Vol.13 No.3, pp.257-266, 1983.
[Rasmussen / Duncan / Leplat 1987] Rasmussen, Jens, Keith Duncan, and
Jacques Leplat (Eds.): New Technology and Human Error; New York: Wiley, 1987.
[Salvendy 1987] Salvendy, Gavriel (Ed.): Handbook of Human Factors; New York:
Wiley, 1987.
Bibliography 477

[Sanders / McCormick 1993] Sanders, Mark S. and Ernest J. McCormick: Human


Factors in Engineering and Design (7th edition); New York: McGraw-Hill, 1993.
[Sargent / Shoemaker 1995] Sargent, Murray III, and Richard L. Shoemaker: The
Personal Computer from the Inside Out - The Programmer’s Guide to Low-level PC
Hardware and Software (3rd edition); Reading, MA: Addison-Wesley, 1995.
[Seborg / Edgar / Mellichamp 1989] Seborg, Dale E., Thomas F. Edgar, and
Duncan A. Mellichamp: Process Dynamics and Control; New York: Wiley, 1989.
[Shannon / Weaver 1949] Shannon, Claude E. and Warren Weaver: The
Mathematical Theory of Communication; Urbana, IL: University of Illinois Press,
1949, with later reprints.
[Sheingold 1986] Sheingold, Daniel H. (Ed.): Analog-Digital Conversion Handbook;
Englewood Cliffs, NJ: Prentice-Hall, 1986.
[Shinskey 1996] Shinskey, F. Greg: Process Control Systems - Application, Design,
and Tuning (4th edition); New York: McGraw-Hill, 1996.
[Shneiderman 1998] Shneiderman, Ben: Designing the User Interface - Strategies
for Effective Human-Computer Interaction (3rd edition); Reading, MA: Addison-
Wesley Longman,1998.
[Sinha 1996] Sinha, Alok K.: Network programming in Windows NT; Reading, MA:
Addison-Wesley, 1996.
[Smith 1957] Smith, Otto J.M.: „Close Control of Loops with Deadtime“; Chem. Eng.
Progr., 53, 217-219 (1957).
[Söderström / Stoica 1989] Söderström, Torsten, and Petre Stoica: System
Identification, Englewood Cliffs, NJ: Prentice-Hall, 1989.
[Solso 1993] Solso, Robert L.: Cognitive Psychology (3rd edition); Boston, MA: Allyn
and Bacon, 1993.
[Spector 1984] Spector, Alfred Z.: „Computer Software for Process Control“,
Scientific American, vol.251 n. 3, pp. 127-138, September 1984.
[Spong / Vidyasagar 1989] Spong, Mark W. and M. Vidyasagar: Robot Dynamics
and Control; New York: Wiley, 1989.
[Stearns / David 1988] Stearns, Samuel D. and Ruth A. David: System
Identification; Englewood Cliffs, NJ: Prentice-Hall, 1988.
[Stephanopoulos 1984] Stephanopoulos, George: Chemical Process Control - An
Introduction to Theory and Practice; Englewood Cliffs, NJ: Prentice-Hall, 1984.
[Stroustrup 1997] Stroustrup, Bjarne: The C++ Programming Language (3rd
edition); Reading, MA: Addison-Wesley, 1997.
[Tanenbaum 1990] Tanenbaum, Andrew S.: Structured Computer Organization (3rd
edition); Englewood Cliffs, NJ: Prentice-Hall, 1990.
[Tanenbaum 1995] Tanenbaum, Andrew S.: Distributed Operating Systems;
Englewood Cliffs, NJ: Prentice-Hall, 1995.
[Tanenbaum 1996] Tanenbaum, Andrew S.: Computer Networks (3rd edition);
Upper Saddle River, NJ: Prentice-Hall, 1996.
[Tanenbaum / Woodhull 1997] Tanenbaum, Andrew S. and Alfred Woodhull:
Operating Systems - Design and Implementation (2nd edition); Upper Saddle River,
NJ: Prentice-Hall, 1997.
[Ullman 1988] Ullman, Jeffrey D.: Principles of Database and Knowledge-base
Systems; Rockville, MD: Computer Science Press, 1988.
[Vögtlin / Tschabold 1990] Vögtlin, B. and P. Tschabold: Direct Measurement of
Mass Flow Using the Coriolis Force; Reinach, Switzerland: Flowtec AG, 1990.
[Warnock 1988] Warnock, Ian G.: Programmable Controllers Operation and
Application; Englewood Cliffs, NJ: Prentice-Hall, 1988.
478 Computer Systems for Automation and Control

[Warrior / Cobb 1988] Warrior, Jay, and Jim Cobb: „Structure and Flexibility for
Fieldbus Messaging“; Control Engineering, pp. 18-20, October 1988.
[Washburn / Evans 1996] Washburn, Kevin and Jim Evans: TCP/IP: Running a
Successful Network (2nd edition); Harlow, England and Reading, MA: Addison
Wesley, 1996.
[Wilson / Hawkes 1989] Wilson, J. and J.F.B. Hawkes: Optoelectronics - An
Introduction (2nd edition); Englewood Cliffs, NJ: Prentice-Hall, 1989.
[Wolfram 1991] Wolfram, Stephen: Mathematica - A System for Doing Mathematics
by Computer (2nd edition); Reading, MA: Addison Wesley, 1991.
[Wood 1988] Wood, G. G.: „International Standards Emerging for Fieldbus“; Control
Engineering, pp. 22-25, October 1988.
[Yager / Zadeh 1987] Yager, Ronald R. (Ed.): Fuzzy Sets and Applications -
Selected Papers by L[otfi] A. Zadeh; New York: Wiley, 1987.
[Young 1982] Young, Stephen J.: Real-Time Languages - Design and Development;
Chichester, England: Ellis Horwood Ltd., and New York: Wiley, 1982.
Lund University
Lund Institute of Technology
Department of Industrial Electrical Engineering and Automation

1998

You might also like