Universität Stuttgart
Institut für Automatisierungs- und Softwaretechnik
Prof. Dr.-Ing. Michael Weyrich
Industrial Automation Systems
Summer Term 2015
www.ias.uni-stuttgart.de/ia
[email protected]
IAS
Contact person for „Industrial Automation Systems“
In case of organizational issues or problems in the progress of the lecture
„Industrial Automation Systems“ please contact:
Matthias Klein, M.Sc.
Room:
1.112 (Pfaffenwaldring 47, 1st floor of IAS)
Tel.:
0711-685-67292
E-Mail:
[email protected]
© 2015 IAS, Universität Stuttgart
2
IAS
Material
– Lecture notes „Industrial Automation Systems“
Blue texts to be written down (not included in the lecture notes)
Live writings (empty slides in the lecture notes, planned for written notes)
Questions at the end of each subchapter – answers to be written down
Preparation task at the end of each chapter – for your own preparation
– Lecture portal on the Internet www.ias.uni-stuttgart.de/ia
Current information about the lecture
Complete lecture materials
Exercises materials
Questions at least one week before the exercise
Solutions just after the exercise
Exams materials
Solutions available on the website
Lecturnity recordings of the lecture and the exercises (also available
as Podcast)
© 2015 IAS, Universität Stuttgart
3
IAS
MOFIAS:
Mobile Online Feedback System for Lectures of the IAS
MOFIAS is a platform independent Web-App for Smartphones.
IAS-Students can interact with the lecturer by smartphone live during a
lecture.
Following functions are available:
Send questions / comments to the lecturer
Feedback the speed of the lecture
Answer questions to the chapter
Evaluate the lecture
Access: http://m.ias.uni-stuttgart.de
© 2015 IAS, Universität Stuttgart
4
IAS
Live-Stream
The complete presentation (pictures and sound) will be streamed live over
the internet during the lecture.
We recommend to use VLC player to play the stream.
Questions / comments can be sent to the lecturer from outside the lecture
room.
Access: http://visstreamworld.hlrs.de/ias-vorlesung
© 2015 IAS, Universität Stuttgart
5
IAS
Literature
Rudolf Lauber, Peter Göhner:
Prozessautomatisierung I
3rd Edition
Springer-Verlag Berlin Heidelberg 1999
ISBN 3-540-65318-X
Price: 59,95 EUR
In German
© 2015 IAS, Universität Stuttgart
6
IAS
Lectures
Nr. Date
Subject
1*
2
3*
16.04.15
21.04.15
23.04.15
4
5
28.04.15
05.05.15
6*
7
8
9
10
11
12
13
07.05.15
12.05.15
19.05.15
02.06.15
09.06.15
16.06.15
23.06.15
30.06.15
Organization / What is Industrial Automation?
What is Industrial Automation?
What is Industrial Automation? / Automation Device
Systems and Structures
Automation Device Systems and Structures
Automation Device Systems and Structures / Process
Peripherals
Process Peripherals
Process Peripherals
Real-Time Programming
Real-Time Programming
Real-Time Programming / Real-Time Operating Systems
Real-Time Operating Systems
Real-Time Operating Systems / Programming language
Programming languages
(*) Lecture instead of exercises
© 2015 IAS, Universität Stuttgart
Tuesday: 8:00 – 9:30, Thursday: 11:30 – 13:00
7
IAS
Exercises
Nr. Date
Subject
1
2
3
4
5
6
7
8
9
10
11
12*
Process signal capturing 1
Field Bus (CAN Bus)
Field Bus (Profibus)
Scheduling
Scheduling
Semaphore / Schedulability test
Semaphore / Schedulability test
Mini Operating System 1
Mini Operating System 2
PLC
PLC
Exam Questions
30.04.15
21.05.15
11.06.15
18.06.15
25.06.15
02.07.15
07.07.15
09.07.15
14.07.15
16.07.15
21.07.15
23.07.15
(*) Exercise instead of lecture
© 2015 IAS, Universität Stuttgart
Tuesday: 8:00 – 9:30, Thursday: 11:30 – 13:00
8
IAS
Goals of the Lecture
– Understanding what Industrial Automation is and why it is relevant
– Knowing basic terms of Industrial Automation
– Knowing and differentiating the types of automation devices and structures
– Understanding the different types and application areas of field busses
– Getting familiar with real-time programming methods
– Mastering of synchronization concepts and scheduling methods
– Understanding the different parts of a real-time operating system
– Knowing how to develop a real-time operating system
– Understanding different programming languages applied in Industrial
Automation
© 2015 IAS, Universität Stuttgart
9
IAS
Relations to other Lectures
Specialization of
selected topics in
Communication
Networks
Industrial Automation Systems
Real Time
Programming
Basic knowledge from
Higher
Mathematics
Selected Basic
Subjects of
Computer Science
© 2015 IAS, Universität Stuttgart
Networks and
Processes
Software
Engineering
for Real-Time
Systems
Introduction to
Distributed
Systems
10
IAS
Table of Content (1)
§ 1 What is Industrial Automation?
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
Definition of Several Basic Terms
Degree of automation and computer deployment
Automation of technical products and technical plants
Components of an industrial automation system
Levels of process management and automation functions
Technical systems
Graphical representation of technical processes
Effects of industrial automation on people, society and environment
§ 2 Automation Device Systems and Structures
2.1
2.2
2.3
2.4
2.5
Automation Computers
Automation structures
Automation Hierarchies
Distributed Automation Systems
Automation structures with redundancy
§ 3 Process Peripherals
3.1
3.2
3.3
3.4
3.5
3.6
Interfaces between the technical process and the automation computer system
Sensors and Actuators
Representation of process data in automation computers
Input / output of analog signals
Input / output of binary and digital signals
Field bus systems
© 2015 IAS, Universität Stuttgart
13
14
30
37
49
57
62
73
80
89
90
116
125
132
137
150
151
160
172
178
203
209
11
IAS
Table of Content (2)
§ 4 Real-Time Programming
4.1
4.2
4.3
4.4
4.5
4.6
Problem definition
Real-time programming methods
Tasks
Synchronization of tasks
Communication between tasks
Scheduling methods
§ 5 Real-Time Operating Systems
5.1
5.2
5.3
5.4
5.5
5.6
Definition
Organization tasks of a real-time operating system
Development of a mini-real-time operating system
Software system design of the mini real-time operating system
Examples for real-time operating systems
Examples for real-time operating systems
§ 6 Programming Languages for Process Automation
6.1
6.2
6.3
6.4
Basic Terms
Programming Programmable Logic Controllers (PLC)
Universal Programming Languages for Industrial Automation
Concepts of parallel programming
© 2015 IAS, Universität Stuttgart
250
251
269
288
299
313
318
340
341
348
359
374
403
409
424
425
439
447
463
12
Chapter 1: What is Industrial Automation?
IAS
§ 1 What is Industrial Automation?
Learning Objectives/Goals
–
to know what Industrial Automation is
–
to understand what a real-time system is
–
to know the different „degrees of automation“
–
to recognize the different kinds of computer deployment
–
to be able to differ between product automation and plant automation
–
to know the components of an industrial automation system
–
to know the different levels of an industrial automation system and their
requirements
–
to be able to classify processes in technical systems
–
to know the different ways of graphical representation of technical
processes
–
Understand the responsibility of an automation engineer
© 2015 IAS, Universität Stuttgart
13
IAS
§ 1 What is Industrial Automation?
1.1
Definition of Several Basic Terms
1.2
Degree of Automation and Computer Deployment
1.3
Automation of Technical Products and Technical Plants
1.4
Components of an Industrial Automation System
1.5
Levels of Process Management and Automation Functions
1.6
Technical Systems
1.7
Graphical Representation of Technical Processes
1.8
Effects of Industrial Automation on People, Society and Environment
© 2015 IAS, Universität Stuttgart
14
1.1 Definition of Several Basic Terms
IAS
Economic Relevance of Automation
228 billion EUR total volume (2006) for the electric automation
in energy, process and manufacturing technology
Source: VDI - Automation 2020 (Juni 2009)
Manufacturing of Automation
Equipment (2006)
Others
;
EU-25
(without
GER);
20%
Germany;
Usage of Automation in
Production (2006)
Others;
EU-25
(without
GER);
20%
Germany;
Germany has the largest export share of automation products
9% of the world market of automation is utilised in Germany
Export rate is 77%
© 2015 IAS, Universität Stuttgart
15
1.1 Definition of Several Basic Terms
IAS
Definition 1:
A technical process is a process during which material, energy or
information is altered in its state. This modification of state can imply
the transition from an initial state to a final state.
Initial state of
material, energy
or information
TECHNICAL
PROCESS
in a technical system
Final state of
material, energy
or information
Technical process effects the flow of material, energy, or information
© 2015 IAS, Universität Stuttgart
16
1.1 Definition of Several Basic Terms
IAS
Examples
Initial State
Technical Process
Technical System
Final State
Low ambient
temperature
Heating of a house
Dirty
laundry
Washing process
Unsorted parcels
Transportation and distribution
processes
Parcel distribution system
Energy of fossil or
nuclear fuels
Energy transformation and
energy generation processes
Power plant
Parts to be
stored
Storage process
Train at location A
Traffic process
Monomere substance
Chemical reaction
Untested device
Test process
Test laboratory
Tested device
Parts without a drillhole
Drilling process
Drilling machine
Parts with drill-hole
Pollutants
Pollution monitoring
© 2015 IAS, Universität Stuttgart
Oil-fueled heating system
Washing machine
High bay warehouse
Train
Chemical reactor
System for air
pollution monitoring
Higher ambient temperature
Fresh laundry
Parcels sorted by destinations
Electric energy
Parts compiled for commissions
Train at location B
Polymeric substance
Information on pollution
concentrations are indicated
in monitoring center
17
1.1 Definition of Several Basic Terms
IAS
Definition 2:
DIN 66201
A process is the entirety of all interacting processes within a
system that transforms and stores material, energy or information.
A technical process is a process in which its physical parameters
are recorded and influenced by technical means.
effecting
variables
material,
energy or
information
inflow
output
values
TECHNICAL PROCESS
material, energy,
or information
outflow
in a technical system
–
from simple to highly complex
–
different partial processes are combined to an overall process
© 2015 IAS, Universität Stuttgart
18
1.1 Definition of Several Basic Terms
IAS
Technical system with technical process
actuating
signals
material, energy
or information
inflow
measured
signals
Technical System
material, energy
or information
outflow
(device,machine
or technical plant)
process
influencing
information
process
outcome
information
Technical
Process
process
input
© 2015 IAS, Universität Stuttgart
process
output
19
1.1 Definition of Several Basic Terms
IAS
Example
actuating signals
Technical Plant
measured signals
substance A
substance B
substance C
Technical Process
feed
substance A
feed
substance B
–
–
fill
reaction
empty
outflow
reactions
product
substance C
technical plant: chemical reactor
technical process: 3 sub-processes (fill, reaction, empty)
© 2015 IAS, Universität Stuttgart
20
1.1 Definition of Several Basic Terms
IAS
Industrial automation
= process
+
automation
automat
automation
© 2015 IAS, Universität Stuttgart
= technical systems
acting on itself
= to enable machines,
installations and facilities
to operate autonomously
21
1.1 Definition of Several Basic Terms
IAS
Industrial automation
=
the automation of a technical process
Industrial automation system
=
technical system with technical process
+
computer and communication system
+
process operators
© 2015 IAS, Universität Stuttgart
22
1.1 Definition of Several Basic Terms
IAS
Structure of an industrial automation system
People
(process operators)
for managing and operating
the technical
process as well as
intervening in
exceptional situations
process
influence
process
outcome
computer and
communication system
consisting of e.g.,
programmable logic
controllers (PLC), industrials PCs,
micro controllers,
bus systems, etc.
control
signals to the
technical
process
signals
from the
technical
process
technical system
(technical product or
technical plant), in which
a technical process
is implemented
© 2015 IAS, Universität Stuttgart
23
1.1 Definition of Several Basic Terms
IAS
Industrial automation system
–
Goal is the automation of operations in the technical process with the
help of appropriate information processing
–
Human operators define the outputs only
Process control system / distributed control system
–
Human operator is steering the overall technical process, but is
supported by automated control of sub processes
Process informatics
–
Focus is on the automation software system
–
Real-time processing
© 2015 IAS, Universität Stuttgart
24
1.1 Definition of Several Basic Terms
IAS
Definition: Real-time operation (DIN 44300)
Real-time operation is the operation of a computer system, in which
programs required for the handling of incoming data are in constant
operation so that the processing results are available within a given
period of time.
This data may appear according to a random time distribution or at
regular intervals.
Features of a real-time system
–
Hardware/software system
–
Data reception, data processing, data delivery to the process within a
given time interval
–
External events
–
Priority of processing
© 2015 IAS, Universität Stuttgart
25
1.1 Definition of Several Basic Terms
IAS
Requirements on real-time systems
–
Timeliness
react right on time
–
Simultaneousness
concurrent reaction to various events
–
Dependability
reliable, safe, available
–
Predictability
all reactions must be predictable and deterministic
© 2015 IAS, Universität Stuttgart
26
1.1 Definition of Several Basic Terms
IAS
Industrial automation system as real-time systems
people
time
time
external
influences
sensor signals
computer and
communication
system
© 2015 IAS, Universität Stuttgart
control signals
technical process
in a
technical plant
27
1.1 Definition of Several Basic Terms
IAS
Features of automation computer systems
Processors applicable in a process automation system are freely
programmable digital processors (computers) that have to show mainly 3
features:
–
Compliance with real-time operation requirements, that are:
recording, processing and output of process data in a timely
manner
–
Possibilities for input/output of process signals (directly or via a
communication system) for process connection
–
Effective processing of numbers, characters and bits
© 2015 IAS, Universität Stuttgart
28
1.1 Definition of Several Basic Terms
IAS
Question referring to Chapter 1.1
In addition to the correctness of the data the timeliness of data is of high
relevance in industrial automation. With which of the following statements
do you agree?
Answer
Early data is bad data
Delayed data is bad data
As fast as possible data is correct data
Timely and precise data is bad data
No data is as bad as wrong data
© 2015 IAS, Universität Stuttgart
29
IAS
§ 1 What is Industrial Automation?
1.1
Definition of several basic terms
1.2
Degree of automation and computer deployment
1.3
Automation of technical products and technical plants
1.4
Components of an industrial automation system
1.5
Levels of process management and automation functions
1.6
Technical systems
1.7
Graphical representation of technical processes
1.8
Effects of industrial automation on people, society and environment
© 2015 IAS, Universität Stuttgart
30
1.2 Degree of automation and computer deployment
IAS
Degree of automation
The meaning and value of an automation system depends on the technical
process (accessible / inaccessible) and the general conditions (economically
reasonable / uneconomic).
The degree of automation describes the extend to which the processes are
automated. Span: from manual to fully autonomous
Attention: As per today human can intervene even in a fully automated
system.
Types of operation
–
Off-line operation (operation with indirect process connection) with the
lowest degree of automation
–
On-line / open-loop operation (open on-line operation) for a medium
degree of automation
–
On-line / closed-loop operation (closed on-line operation) for a high
degree of automation
© 2015 IAS, Universität Stuttgart
31
1.2 Degree of automation and computer deployment
IAS
Operation without computer use
general management
orders
operation
accounting
operation
report
process
management
applications
process
personnel
control and
regulation devices
display device and
graphical recorder
manual
device
technical plant
© 2015 IAS, Universität Stuttgart
32
1.2 Degree of automation and computer deployment
IAS
Off-line operation (indirectly connected operation)
input,
operation modes
instructions
General management
orders
operation
report
operation
protocol input
Off-line
computer
process
management
instructions
process
personnel
control and
regulation devices
display and
graphical recorder
manual
device
technical plant
© 2015 IAS, Universität Stuttgart
33
1.2 Degree of automation and computer deployment
IAS
On-line/ open-loop operation of a computer system
General management
operation
monitoring
orders
operation
report
control room
instructions
processpersonnel
control and
regulation devices
computer
system
manual
device
technical plant
© 2015 IAS, Universität Stuttgart
34
1.2 Degree of automation and computer deployment
IAS
On-line-/ closed-loop operation of a computer system
operation management
and control
orders
operation
report
computer and communication system
emergency
control
emergency
instruments
technical plant
© 2015 IAS, Universität Stuttgart
35
1.2 Degree of automation and computer deployment
IAS
Question referring to Chapter 1.2
Concerning the type of operation, three types can be differentiated. To
which of the following statements do you agree?
Answer
Off-line operation shows the highest degree of automation
On-line / closed-loop operation requires a high number of operation
personnel
On-line / open-loop operation is best suited for a medium degree of
automation
In case of off-line operation the computer is used as an assistance for
calculations and analysis.
© 2015 IAS, Universität Stuttgart
36
IAS
§ 1 What is Industrial Automation?
1.1
Definition of several basic terms
1.2
Degree of automation and computer deployment
1.3
Automation of technical products and technical plants
1.4
Components of an industrial automation system
1.5
Levels of process management and automation functions
1.6
Technical systems
1.7
Graphical representation of technical processes
1.8
Effects of industrial automation on people, society and environment
© 2015 IAS, Universität Stuttgart
37
1.3 Automation of technical products and technical plants
IAS
Product automation
industrial automation systems, in which the technical process takes place
within a device or within a single machine
Plant automation
industrial automation systems, in which the technical process is composed of
multiple sub processes that are often specially distributed or wide spread over
plants
© 2015 IAS, Universität Stuttgart
38
Examples
cameras •
navigation systems •
mobiles, telephones •
machine tools •
automobiles (with sub-systems
engine control, ABS, ESP, navigation) •
Product automation
1.3 Automation of technical products and technical plants
IAS
• TVs, radios, CD/DVD-players
• kitchen appliances (e.g. dish washer,
microwave oven)
• washing machine
• measuring devices
• alarm systems
railway traffic systems (long distance
trains, locomotives, metros) •
energy distribution, gas supply •
purification and water plants •
chemical reactors •
process technical plants •
© 2015 IAS, Universität Stuttgart
• traffic light installations
Plant automation
power plants •
• heating systems
• building automation systems
• logistic installations (high bay,
warehouse, parcel distribution)
• production plants
39
1.3 Automation of technical products and technical plants
IAS
Characteristic criteria regarding product automation
–
Technical process in a device or machine (embedded systems)
–
Dedicated automation functions
–
Automation computer in the form of a micro controller or PLC
–
Few sensors and actuators
–
Degree of automation 100%, on-line/closed-loop operation
–
High quantities (volume or mass products)
–
Engineering and software costs of inferior importance since they are
distributed among large unit numbers
© 2015 IAS, Universität Stuttgart
40
1.3 Automation of technical products and technical plants
IAS
Structure with simple product automation
micro controller
process results
display
set values
manipulated variables
user
or
operator
technical product
© 2015 IAS, Universität Stuttgart
41
1.3 Automation of technical products and technical plants
IAS
Example of a simple product automation
User
or
operator
Washing program,
spin speed
LCD (washing time,
operation directions)
Microcontroller
(e.g. Siemens C167)
Motor speed,
heating control
Temperature value,
actual spin speed
Washing machine
© 2015 IAS, Universität Stuttgart
42
1.3 Automation of technical products and technical plants
IAS
Future of the product automation
„Ubiquitous
Computing“
Picture Source: Internet
1991
The Computer
For the 21st
Century
Definition:
“Cyber-Physical
Systems”
2006
NSF
Workshop
2010
acatech
A cyber-physical system
(CPS) is a system of
collaborating computational
elements controlling physical
entities.
[…]
-- Wikipedia EN, 11.03. 2014
Mark Weiser
Xerox PARC
"Ubiquitous computing names the third wave in computing, just
now beginning. First were mainframes, each shared by lots of
people.
…
Next comes ubiquitous computing, or the age of calm technology,
when technology recedes into the background of our lives."
© 2015 IAS, Universität Stuttgart
43
IAS
Source: Swarm Lab, UC Berkeley
1.3 Automation of technical products and technical plants
© 2015 IAS, Universität Stuttgart
44
1.3 Automation of technical products and technical plants
IAS
Structure with complex product automation
user
or
operator
microcontroller
bus-system
microcontroller
1
microcontroller
2
microcontroller
n
subsystem
1
subsystem
2
subsystem
n
technical product
© 2015 IAS, Universität Stuttgart
45
1.3 Automation of technical products and technical plants
IAS
Characteristic criteria regarding plant automation
Technical process in an industrial plant, often geographically wide spread
Extensive and complex automation functions
PLCs, PCs and process control systems are used as automation computer
systems
Large number of sensors and actuators
Medium to high degree of automation
One-of-a-king system
Engineering and software costs are critical for overall costs
© 2015 IAS, Universität Stuttgart
46
1.3 Automation of technical products and technical plants
IAS
Structure for a larger technical plant
factory bus
monitoring,
operating,
protocolling
master
computer
PC
level 3
PC
plant bus
level 2
PLC
PLC
PLC
field bus
field bus
level 1
subsystem
subsystem
subsystem
technical plant
© 2015 IAS, Universität Stuttgart
47
1.3 Automation of technical products and technical plants
IAS
Question referring to Chapter 1.3
A company wants to automate the production of refrigerators. For this
purpose, a new production line shall be constructed. In this production
line, the coolant will be filled in and the rear will be screwed to the case.
Which kind of automation system is this ?
Answer
© 2015 IAS, Universität Stuttgart
48
IAS
§ 1 What is Industrial Automation?
1.1
Definition of several basic terms
1.2
Degree of automation and computer deployment
1.3
Automation of technical products and technical plants
1.4
Components of an industrial automation system
1.5
Levels of process management and automation functions
1.6
Technical systems
1.7
Graphical representation of technical processes
1.8
Effects of industrial automation on people, society and environment
© 2015 IAS, Universität Stuttgart
49
1.4 Components of an industrial automation system
IAS
technical components
of an industrial
automation system
technical system to
be automated
(automation object)
technical
product
facilities necessary for
automation
(automation system)
facilities for
user - process
communication
technical
plant
hardwired
individual
devices
interface to the
technical process:
sensors and actuators
automation
computer system
communication
system
communication
system close to the
process (field bus)
bus system for the
communication between
automation computers
hardware system
(device system)
computer
hardware
© 2015 IAS, Universität Stuttgart
process
periphery
automation
software system
user
software
system
software
50
1.4 Components of an industrial automation system
IAS
Sensors
–
Acquisition of information on the progression of process variables
–
Sensors, detection devices, measuring devices
–
Conversion into electrical or optical signals
Actuators
–
Conversion of control information in order to influence process variables
–
Actuators (correcting element)
© 2015 IAS, Universität Stuttgart
51
1.4 Components of an industrial automation system
IAS
Communication system in product automation
Simple products
set values
– few sensors and actuators
manipulated variables
micro controller
process results
– short line distances
display
user
or
operator
technical product
Complex products
– communication between subsystems via bus system
– examples: CAN bus, Interbus-S
user
or
operator
microcontroller
bus system
microcontroller
1
microcontroller
2
microcontroller
n
subsystem
1
subsystem
2
subsystem
n
technical product
© 2015 IAS, Universität Stuttgart
52
1.4 Components of an industrial automation system
IAS
Communication system in plant automation
–
Many sensors and actuators, spatially distributed
–
Many automation computers, spatially distributed
–
additional requirements: intrinsic safety for explosion protection
Communication tasks on several levels
factory bus
– Factory bus
monitoring,
operating,
protocolling
master
computer
PC
level 3
PC
plant bus
– Plant bus (process bus)
level2
PLC
PLC
PLC
field bus
– Field bus
field bus
level1
subsystem
subsystem
subsystem
technical plant
© 2015 IAS, Universität Stuttgart
53
1.4 Components of an industrial automation system
IAS
Automation software system
– Set of all programs necessary for the execution of automation tasks,
including their documentation
– Differentiation between executive and organizational/administrational
tasks
Executive programs
(application software)
© 2015 IAS, Universität Stuttgart
Organizing and administrating
programs (operating software
or system software)
54
1.4 Components of an industrial automation system
IAS
System software
programs for
acquisition of
process variables
programs for
organization of
application
programs
programs for
process
monitoring
programs for
process
control
programs for
process
regulation
programs for
process
optimization and
management
programs for
process safety
and security
© 2015 IAS, Universität Stuttgart
operating system
Application software
programs for managing
periphery devices
programs for
organizing data traffic
with
external memories
programs for the
dialogue between
human and computer
compilation programs
run-time
programs
55
1.4 Components of an industrial automation system
IAS
Question referring to Chapter 1.4
For the control computer of a production line of refrigerators (described in
the last question) the company received two offers:
• „ordinary“ PC
• industrial PC with the same performance
2000,- €
5000,- €
Which computer would you choose ?
Give reasons for your choice and explain the difference in price.
Answer
© 2015 IAS, Universität Stuttgart
56
IAS
§ 1 What is Industrial Automation?
1.1
Definition of several basic terms
1.2
Degree of automation and computer deployment
1.3
Automation of technical products and technical plants
1.4
Components of an industrial automation system
1.5
Levels of process management and automation functions
1.6
Technical systems
1.7
Graphical representation of technical processes
1.8
Effects of industrial automation on people, society and environment
© 2015 IAS, Universität Stuttgart
57
1.5 Levels of Process Management and Automation Functions
IAS
Model of levels in the management of a technical process
levels of
hierarchy
strategic
level
dispositive
level
tactical
level
operative
level
field of action
© 2015 IAS, Universität Stuttgart
levels of distribution
long-term
distribution policy
levels of
industrial automation
business management
level
distribution planning
production and operation
management level
distribution tactics
process control level
sales
level of measuring
controlling and regulating
process variables
(process variable level)
market
technical process in a
technical system
58
1.5 Levels of Process Management and Automation Functions
IAS
Model of levels in the management of a technical process
Impact
Levels
Enterprise Resource Management
Production and Operations
management
Supervisory and
Process Control
Variables of the Process
(I/O Signals)
min
MByte
s
KByte
0.1 s
Byte
ms
Bit
Sample rate
© 2015 IAS, Universität Stuttgart
Data Volume
59
1.5 Levels of Process Management and Automation Functions
IAS
Automation functions
Levels
company
Levelsof
ofathe
enterprise
business
Enterprise
Resource
management
Managementlevel
Automation
functions
Type
of Automation
cost analysis,
statistical evaluations
Production
production and
and
Operations
operation
management
level
management
work sequence planning,
capacity optimization,
evaluation of process results
Supervisory
process control
and
level
Process Control
process monitoring,
start-up and shut-down,
malfunction handling, process
guidance, process security
Variables of the
process variable
Process
level
(I/O Signals)
measuring, controlling,
manipulating, regulating
interlocking, emergency
handling of process variables,
shut-down, protection
field level
level
Field
© 2015 IAS, Universität Stuttgart
recording and influencing
process variables with sensors
and actuators
60
1.5 Levels of Process Management and Automation Functions
IAS
Question referring to Chapter 1.5
How do amounts of data and time requirements behave on the different
levels of management of technical processes?
Answer
On the upper hierarchy levels only little amounts of data are exchanged.
Actions on I/O signals of the prcess take effect within the scope of
minutes.
The lower the level, the more critical the time requirements.
© 2015 IAS, Universität Stuttgart
61
IAS
§ 1 What is Industrial Automation?
1.1
1.2
1.3
1.4
1.5
Definition of several basic terms
Degree of automation and computer deployment
Automation of technical products and technical plants
Components of an industrial automation system
Levels of process management and automation functions
1.6
Technical systems
1.7
1.8
Graphical representation of technical processes
Effects of industrial automation on people, society and environment
© 2015 IAS, Universität Stuttgart
62
1.6 Technical systems
IAS
Types of process variables (1)
–
Process variables, that are allocated to the course of physical
state-variables with a continuous or piecewise continuous range of values
example: temperatures in a heating system
–
Process variables, that are allocated to certain discrete process states
physical variables with a continuous range of values that characterize
the process states
binary process variables that are allocated to state transitions i.e., to
events that cause the change of state
example: switch setting: 0/off - 1/on
© 2015 IAS, Universität Stuttgart
63
1.6 Technical systems
IAS
Types of process variables (2)
–
Process variables that are allocated to individually identifiable objects
physical variables with a continuous range of values
example: temperature of a slab in a clogging mill,
size of a part in a store
non-physical variables
example: type, design, application, depot number
© 2015 IAS, Universität Stuttgart
64
1.6 Technical systems
IAS
Definition of three process types in technical systems
–
continuous processes
–
sequential processes, discrete event type processes
–
object-related processes, discrete object type processes
Attention! - a clear distinction is not always possible!
Example: transportation as a continuous and object-related
process
© 2015 IAS, Universität Stuttgart
65
1.6 Technical systems
IAS
Continuous processes in technical systems
Characteristics
processes containing time-dependent continuous
process variables
Process variables
physical variables with a (at least piecewise)
continuous range of values
Examples
generation processes,
transformation processes,
movements, etc.
Mathematic
models
differential equations (time as an independent
variable), transfer functions
© 2015 IAS, Universität Stuttgart
66
1.6 Technical systems
IAS
Sequential processes in technical systems
Characteristics
processes containing sequences of
different, distinguishable process states
Process variables
binary signals that cause or indicate discrete process
states as well as continuous physical variables
allocated to process states
Examples
sequences of process states during start-up or
shut-down of a turbine, sequence of states during the
operation of an elevator, sequence of states during
production using a machine tool
Models
flow charts, function plans according to DIN 40719,
state models, Petri nets
© 2015 IAS, Universität Stuttgart
67
1.6 Technical systems
IAS
Object-related processes in technical systems
Characteristics
processes during which individually identifiable
objects are transformed, transported or stored
Process variables
physical variables with a continuous range of values
or non-physical variables (e.g. type, design, application,
bay number) that are allocated to the objects, as well
as binary variables, that cause or indicate state changes
of objects
Examples
processes during the manufacturing of parts,
traffic processes, storage processes,
information processes in computers
Models
simulation models, queue-models, state models,
Petri nets, OO-models
© 2015 IAS, Universität Stuttgart
68
1.6 Technical systems
IAS
Classification Methods for Technical Processes
Classification according to the kind of...
– transformed or transported medium
example: material related processes, energy related processes,
information related processes
– effect
example: generation processes, distribution processes, storage
processes
– material-related transformation
example: chemical processes, production processes
– dominating process type
example: continuous processes, sequential processes, object-related
processes
© 2015 IAS, Universität Stuttgart
69
1.6 Technical systems
IAS
Assignment of technical processes to process types
Technical processes
Process types
energy-related
processes
continuous processes,
sequential processes
chemical
processes
continuous processes,
sequential processes
production
processes
continuous processes,
sequential processes,
object-related processes
material-handling
processes
continuous processes,
sequential processes,
object-related processes
Technical processes can contain processes of different types,
a process in turn can be a technical process.
© 2015 IAS, Universität Stuttgart
70
1.6 Technical systems
IAS
Examples:
– Generation of electric energy in a turbo generator
• continuous process
• sequential process (start-up sequence)
– Batch processes
• single process steps are continuous processes
• sequence of steps is a sequential process
– Manufacturing a swivel plate
• transportation of the machine’ parts is an object-related process
• manufacturing process consists of a sequence of steps (“mount
part”, “drive machine to position “ etc.), thus it is a sequential
process
• cutting process is a continuous process
© 2015 IAS, Universität Stuttgart
71
1.6 Technical systems
IAS
Question referring to Chapter 1.6
The IAS modular production system is shown below.
Which kind of processes do you identify in this system?
Answer
© 2015 IAS, Universität Stuttgart
72
IAS
§ 1 What is Industrial Automation?
1.1
Definition of several basic terms
1.2
Degree of automation and computer deployment
1.3
Automation of technical products and technical plants
1.4
Components of an industrial automation system
1.5
Levels of process management and automation functions
1.6
Technical systems
1.7
Graphical representation of technical processes
1.8
Effects of industrial automation on people, society and environment
© 2015 IAS, Universität Stuttgart
73
1.7 Graphical representation of technical processes
IAS
Flow diagram
– Similar to block diagrams used in control engineering
– Processes and process steps are represented as rectangles
– Arrows represent the information or material flow
– Bundles of connections are shown as double lines with arrow
Example:
additive
crush
additive
crushed
solvent
raw
material
reaction
dissolve
solvent
© 2015 IAS, Universität Stuttgart
material
dissolved
intermediate
product
separate
final product
74
1.7 Graphical representation of technical processes
IAS
Examples for the flow diagram representation (1)
additive
crushing
raw material
dissolving
solvent
reaction
separation
final product
additive
350 kg/h
x
raw material
800 kg/h
M1
M2
M
M
z1
heating steam
3 bar
solvent
W1
solvent
1000 kg/h
heating
steam
B1
solvent
700 kg/h
1 bar
108° C
B2
1 bar
20° C
1 bar
20° C
final product
1450 kg/h
depot
P1
© 2015 IAS, Universität Stuttgart
P2
75
1.7 Graphical representation of technical processes
IAS
Examples for the flow diagram representation (2)
heating steam
5 bar
V301
F1
additive
350 kg/h
solvent
700 kg/h
V302
V304
V206
V303
M
3h
FRC
raw material
800 kg/h
1.01
M1
Z1
M2
V101 V102 V103
V201 V202 V203
V105
X
TRC
1.02
W1
M
3h
LRC
V112
V111
solvent
1000 kg/h
V204
K1
V305
FRC
M
3h
2.01
B1
TRC
1.02
M
3h
W2
LRC
LRC
1.03
1.04
M
3h
M
3h
P1
V106
A1
B2
W3
V306
V301
LRC+
1.04
P2
V107
V106
V302
V116
V303
V110
condensate
© 2015 IAS, Universität Stuttgart
1.04
final product
1450 kg/h
76
1.7 Graphical representation of technical processes
IAS
Information/material-oriented representation
– Information/materials as circles
– Processes/functions as linking arrows
Example:
additive
additive
crushed
solvent
intermediate
product
material
material
dissolved
final
product
solvent
© 2015 IAS, Universität Stuttgart
77
1.7 Graphical representation of technical processes
IAS
Phase model representation
– Mixture of flow diagram and information/material-oriented representation
Example:
additive
sub
process
„crush“
additive
crushed
solvent
reaction
raw
material
sub
process
„dissolving“
material
dissolved
intermediate
product
separate
final
product
solvent
© 2015 IAS, Universität Stuttgart
78
1.7 Graphical representation of technical processes
IAS
Question referring to Chapter 1.7
To which of the following statements concerning the graphical
representation of technical processes do you agree?
Answer
In the flow diagram processes and process steps are represented as
rectangles.
In the information/material-oriented representation processes are
represented as circles.
The flow diagram and the information/material-oriented representation use
the same notation.
The information/material-oriented representation is rather used for
organizational processes than for technical processes.
© 2015 IAS, Universität Stuttgart
79
IAS
§ 1 What is Industrial Automation?
1.1
Definition of several basic terms
1.2
Degree of automation and computer deployment
1.3
Automation of technical products and technical plants
1.4
Components of an industrial automation system
1.5
Levels of process management and automation functions
1.6
Technical systems
1.7
Graphical representation of technical processes
1.8
Effects of industrial automation on people, society and
environment
© 2015 IAS, Universität Stuttgart
80
1.8 Effects of Industrial Automation on People, Society and Environment
IAS
Intentional (positive) effects
Simplified and more convenient operation
automation of a washing machine
automation of a heating system
Production of better, cheaper products of equal quality with lowered
production costs
automation of chemical production processes
Reduction of hazards to people
ABS system
traffic system automation (like inductive train securing, automatic
barrier close)
Better, more humane working conditions
automation of painting or foundry work
Securing jobs through higher competitiveness
use of robots in automobile manufacturing
Film: Automated Medicine Cabinet In Everyday Life
© 2015 IAS, Universität Stuttgart
81
1.8 Effects of Industrial Automation on People, Society and Environment
IAS
Unintentional (negative) effects
Redundancy of workers may lead to unemployment
use of robots in manufacturing
Restructuring of jobs due to changes in work flow and fields of work
lower/ higher qualified jobs
drop of ancillary tasks
increase of jobs in the service sector
Reduction of human relationships
introduction of ticket vending machines and information systems
Increase of stress and reduction of relaxing tasks
automation of testing systems
Overstraining in difficult situations
safety-critical decision in a nuclear power plant
© 2015 IAS, Universität Stuttgart
82
1.8 Effects of Industrial Automation on People, Society and Environment
IAS
Source: Internet
Trend: climate change
© 2015 IAS, Universität Stuttgart
83
1.8 Effects of Industrial Automation on People, Society and Environment
IAS
Source: Internet
Trend: energy shortage
© 2015 IAS, Universität Stuttgart
84
1.8 Effects of Industrial Automation on People, Society and Environment
Trend: ageing of the population
IAS
„In Germany, the current
population of approx. 82 million
people will shrink to 70 - 65
million people in 2060“ (from a
government report on demographics
summit 2/10/2013)
at 31.12.1910
at 31.12.2005 and at 31.05.2050
age in years
Men
lower limit of the „average“ population
upper limit of the „average“ population
age in years
Women
Source: Internet
Men
thousands of people
© 2015 IAS, Universität Stuttgart
thousands of people
thousands of people
Women
thousands of people
85
1.8 Effects of Industrial Automation on People, Society and Environment
IAS
Trend: globalisation
Let‘s talk about
the laws of
nature e.g. …
gravitation
thermodynamic
globalisation
Source: Internet
You
are
here
!
!
© 2015 IAS, Universität Stuttgart
86
1.8 Effects of Industrial Automation on People, Society and Environment
IAS
Question referring to Chapter 1.8
Discuss the positive and negative consequences of industrial automation
on people, environment, and society.
Daimler aims to lay-off 750
employees in the passenger car
division.
Spiegel Online, 13.03.2013
The automotive and industry
supplier Bosch plans job cuts in
Europa
N24, 14.02.2013
Siemens cuts jobs to reduce
costs
Focus de, 21.02.2013
Photo: Volkswagen Sachsen GmbH
© 2015 IAS, Universität Stuttgart
87
Chapter 1: Preparation Task
IAS
Preparation Task to Chapter 1
Question: Real-Time Requirements (ST 2004)
Several automation functions in modern cars are realized electronically, such
as the steering of the wheels and the braking system. In the automation of
these functions all the requirements on real time systems discussed in the
lecture are present.
Explain these requirements using as examples scenarios of the automation
functions described before.
© 2015 IAS, Universität Stuttgart
88
Chapter 2: Automation Device Systems and Structures
IAS
§ 2 Automation Device Systems and Structures
Learning targets
–
to know differences between computer systems for automation
–
to understand the PLC operation mode
–
to be able to differentiate between centralized and distributed structures
–
to understand automation hierarchies and their requirements
–
to understand distributed automation systems
–
to know basic topologies of communication
–
to be able to differentiate between an open and a proprietary
communication system
–
to know what is meant by redundancy
–
to be able to explain what is meant by diversity
© 2015 IAS, Universität Stuttgart
89
IAS
§ 2 Automation Device Systems and Structures
2.1
Automation computers
2.2
Automation structures
2.3
Automation hierarchies
2.4
Distributed automation systems
2.5
Automation structures with redundancy
© 2015 IAS, Universität Stuttgart
90
2.1 Automatiion computers
IAS
Kinds of automation computers (repetition)
–
Programmable logic controller (PLC)
–
Micro controller
–
Personal computer (PC)
Industrial Personal Computer (IPC)
–
Process control system
© 2015 IAS, Universität Stuttgart
91
2.1 Automation computers
IAS
Programmable Logic Controllers
– Programmable Logic Controllers since 1972
– Influenced by components and technologies
– Dependent on the task
– Beginnings of software application
1980
:
2
kByte
1990
:
20
kByte
2000
:
2000
kByte
2009
:
64
MByte
© 2015 IAS, Universität Stuttgart
92
2.1 Automation computers
IAS
Goals of PLC
– Goal groups
users without computer science studies
"electrician"
–
–
Goal for the use of PLCs
replace contactor/relay
increase reliability
reduce costs
interconnection of binary signals
Goal for the PLC languages
to describe functions in known representations
ladder diagram (derived from the circuit diagram)
function plan (derived from the logic plan)
Standardization of the development of PLC systems
© 2015 IAS, Universität Stuttgart
93
2.1 Automation computers
IAS
Block diagram of the hardware structure of a PLC
program memory
digital and
analog
digital and
analog
output
internal bus
input
RAM
© 2015 IAS, Universität Stuttgart
timer
clock
actuator signals
sensor signals
central processing
unit (CPU)
interface to
programming
device
94
2.1 Automation computers
IAS
Cyclic operation of a PLC
PLC
process
image
in
output
memory
all actuator signals
technical
process in a
technical
system
automation
program
process
image
in
input
memory
© 2015 IAS, Universität Stuttgart
all sensor signals
95
2.1 Automation computers
IAS
Sequence of the cyclic program execution of a PLC
output
process image
from
output memory
execute
program
load process
image in
input
memory
reaction time
reaction
on process
event
process
event
start of
1st
cycle
© 2015 IAS, Universität Stuttgart
start of
2nd
cycle
start of
3rd
cycle
start of
4th
cycle
96
2.1 Automation computers
IAS
Characteristics of the cyclic program execution
Advantage:
simple programming through cyclic operational mode
Disadvantage:
maximum reaction time on events in the technical process
is equal to two program cycles
Program execution time:
© 2015 IAS, Universität Stuttgart
97
2.1 Automation computers
IAS
Program execution of a PLC
Execution of
initialization
program
Load process
image
wait on cycle time
wait on event
Execution of cyclic
program
Execution of
time-driven
program
Execution of
event-driven
program
Output of process
image
© 2015 IAS, Universität Stuttgart
98
2.1 Automation computers
IAS
Soft-PLC
Setup:
PLC Runtime environment on PC system
Standard- or real-time operating system
Process coupling over digital and analogue in-/outputs
PLCPLCProgram 1 … Program n
Userprogram
PLCRuntime Environment
Operating System
PC-System
© 2015 IAS, Universität Stuttgart
Process
coupling
99
2.1 Automation computers
IAS
Soft-PLC
Advantages:
Integration of visualization and PLC on one device
Integrated development environment for modification of programs
Parallel PLC-Tasks with different cycle times
Large amount of system interfaces
Disadvantages:
Reliability
Problems when using standard operating systems
At full workload: restrictions in real-time behavior
© 2015 IAS, Universität Stuttgart
100
2.1 Automation computers
IAS
highly integrated components
employment for mass products
composition of
Source of picture: http://www.r1-community.de
Microcontroller
standard micro processor
data memory / program memory
bus interfaces
process signal interfaces
programming with development environment
short word length
extremely low price
good reliability and long life span
high requirements regarding environmental conditions
© 2015 IAS, Universität Stuttgart
101
2.1 Automation computers
IAS
Simplified block diagram of a micro controller
8 channels
Microcontroller 80C167
16-bit
CPU
2 kBytes
RAM
2kBytes
RAMextension
ROM
Watchdog
Timer
clock
direct
memory
access
serial
input/
output
interfaces
pulse
input/
output
interrupt
controller
external
data bus
CAN
bus
interface
56 interrupt
inputs
external
data bus
internal bus 16 bit
programmable
digital
input/
outputs
111 digital
inputs/outputs
10-bit
ADconverter
with
multiplexor
16 analog
inputs
2 channels
© 2015 IAS, Universität Stuttgart
32 inputs/ outputs
CAN bus
102
2.1 Automation computers
IAS
Differentiation
–
Microprocessor
processor on a micro electronic chip
–
Microcomputer
all components on a micro electronic chip i.e., processor,
memory, interface to periphery
–
Microcontroller
automation computer or an automation computer system
on one chip
© 2015 IAS, Universität Stuttgart
103
2.1 Automation computers
IAS
Basic terms
Microprocessor:
CPU = Central Processing Unit
Data memory:
RAM = Random Access Memory
Fixed memory:
EPROM/PROM/ROM = Erasable/ Programmable/
Read Only Memory
Process and data periphery: I/O = parallel or serial input/output components
Counter/Timer = generation of clock pulses
Interrupt Controller = handling of hardware interrupts
© 2015 IAS, Universität Stuttgart
104
2.1 Automation computers
IAS
Industrial PC (IPC)
– Pluggable circuit boards for connection of
electrical process signals
optical process signals
bus systems
– Programming in high-level language
– Use of real-time operating systems
as single operating system
in addition to standard operating systems
Operational areas of industrial PCs
–
Process visualization
–
Process evaluation and monitoring
–
Superordinate control tasks (control room tasks)
© 2015 IAS, Universität Stuttgart
105
2.1 Automation computers
IAS
Environmental conditions
– Harsh environmental conditions
temperature variations
shocks and vibrations
dust and humidity
electrical or electromagnetic disturbances
–
Protective measures in industrial PCs (IPC)
vibration absorbing disk drives
high quality of integrated components
special protecting case
© 2015 IAS, Universität Stuttgart
106
2.1 Automation computers
IAS
Pure IPC solution
–
acquisition of process data
–
execution of control program under real-time conditions
–
interface to the user
Advantages of a pure IPC-solution
–
better scalability of hardware
–
many operating systems available
–
wide range of programming languages available
–
open system for the integration of ready-made subsystems
© 2015 IAS, Universität Stuttgart
107
2.1 Automation computers
IAS
Structure of a pure IPC system
industrial PC
control
panel
remote maintenance
modem
field bus
printer
...
modules for
input and
output of
signals
sensors and actuators
© 2015 IAS, Universität Stuttgart
108
2.1 Automation computers
IAS
Structure of a PLC-IPC system
remote maintenance
industrial
PC
modem / ethernet
serial connection
over LAN or field
bus
printer
PLC
sensors and actuators
© 2015 IAS, Universität Stuttgart
109
2.1 Automation computers
IAS
Process control system (PCS)
–
Distributed computer systems, connected via bus systems
–
Interconnection with PLC computers
–
Usage of prefabricated program modules developed by the
manufacturer of the PCS
–
Configuration by operator
Complete solutions from a single manufacturer
–
No compatibility problems
–
Uniform process operation and monitoring
–
High availability
–
Defined responsibility
–
Long lifetime
© 2015 IAS, Universität Stuttgart
110
2.1 Automation computers
IAS
Fields of application of process control systems
–
Power plant automation
–
Process engineering
–
Building automation
–
Production engineering
Components of a PCS
–
Display and operation components
–
Field level components
–
Communication systems
–
Engineering station
© 2015 IAS, Universität Stuttgart
111
2.1 Automation computers
IAS
Schematic structure of a PCS
operation master
computer
factory
bus
display and operation
component
(DOC)
display and operation
component
(DOC)
engineering
station
Redundant, manufacturer specific bus system
field level
component (FLC)
field level
component (FLC)
field level
component (FLC)
sensors and
actuators
field bus
field device
© 2015 IAS, Universität Stuttgart
112
2.1 Automation computers
IAS
Engineering Station
Tasks
Configuration
Programming
Maintenance
Tools
Graphical tools (IEC 61131)
Standardized libraries
with components
Powerful editors
© 2015 IAS, Universität Stuttgart
Source of picture: Pamphlet Integrated Engineering with
COMOS and SIMATIC PCS 7, Siemens AG
113
2.1 Automation computers
IAS
Control system manufacturers and their products
Manufacturer Product
ABB
FoxboroEchardt
Siemens
Honeywell
Yokogawa
Remark
AdvantOCS
Company-specific field bus
AdvaSoft
for small systems
Procontrol P
power plant automation
Symphony
Supports connection to operation level, remote I/O system
Contronic P
process engineering, extension up to 12km,
formerly Hartmann & Braun
I/A Series System
process engineering, field level with PCMCIA-technology
SIMATIC PCS 7
process engineering, user interface based on Windows
2000, XP. Extensive hardware supply.
fieldbus: Profibus; connection to operation level possible
Teleperm M
process engineering, largely used, no installation in new
plants; migration to SIMATIC PCS 7 possible
Teleperm XP
power plant automation, open communication, extensive
hardware supply
PlantScape
process engineering, open system, based on Windows NT;
support of remote I/O. Connection to operation level possible
TDC 3000
process engineering, several process buses with different
data transmission; supports MODBUS
CENTUM CS 3000 process engineering, power plant automation
© 2015 IAS, Universität Stuttgart
114
2.1 Automation computers
IAS
Question referring to Chapter 2.1
What are the advantages of an IPC as automation computer?
Answer
Scalability of the hardware
Costs of the hardware
High variety of available programming languages
Form factor of IPCs
© 2015 IAS, Universität Stuttgart
115
IAS
§2
Automation Device Systems and Structures
2.1
Automation computers
2.2
Automation structures
2.3
Automation hierarchies
2.4
Distributed automation systems
2.5
Automation structures with redundancy
© 2015 IAS, Universität Stuttgart
116
2.2 Automation structures
IAS
Structure of the technical process
–
–
technical process as an entity (centralized)
e.g.: drilling process with a drilling machine
technical process consisting of sub-processes (decentralized)
e.g.: manufacturing of a gear
Structure of automation devices
–
–
spatially concentrated
spatially distributed
Functional structure of automation systems
=
allocation of automation functions on the automation devices
–
–
functionally centralized
functionally distributed
© 2015 IAS, Universität Stuttgart
117
2.2 Automation structures
IAS
Spatially concentrated automation devices
correcting
elements
field
measuredvalue
transformer
jumper
board,
galvanic
disconnector,
automation
device
display
© 2015 IAS, Universität Stuttgart
monitoring signals
control room
subdistributor
multi-color
screen for
process
management
118
2.2 Automation structures
IAS
CM
CM
field
CM
field bus
CM
plant bus
PLC
CM: connection
module for sensors
and actuators
PLC
display
master
computer
control room
field bus
Spatially distributed automation devices
multi-color
screen for
process
management
© 2015 IAS, Universität Stuttgart
119
2.2 Automation structures
IAS
Functionally centralized automation structure
central automation
computer
subprocess 1
subprocess 2
subprocess n
technical process in a technical system
© 2015 IAS, Universität Stuttgart
120
2.2 Automation structures
IAS
Functionally distributed automation structure
automation
computer
1
automation
computer
2
automation
computer
n
subprocess 1
subprocess 2
subprocess n
© 2015 IAS, Universität Stuttgart
121
2.2 Automation structures
IAS
Criteria for the comparison of automation structures
–
Costs for devices, cabling, software, maintenance and service
–
Availability of parts in case of hardware failure or software faults
–
Flexibility in case of modifications
–
Coordination of sub processes and optimization of the overall process
–
Operability / Usability
© 2015 IAS, Universität Stuttgart
122
2.2 Automation structures
IAS
Evaluation of automation structures regarding the criteria
C=
D=
centralized structure
distributed structure
CCC
typical for the automation of small devices
CDC
lower cabling costs as in CCC
DCC
unfavorable regarding availability, maintenance,
cabling costs
DDC
unfavorable regarding availability and flexibility
CCD
favorable regarding maintenance and flexibility,
unfavorable regarding cabling
CDD
favorable regarding flexibility, availability,
cabling and transparency
DCD
favorable regarding availability, maintenance,
unfavorable regarding cabling costs
DDD
favorable regarding flexibility, availability,
cabling and transparency
functional structure
spatial structure of the automation devices
structure of the technical process
© 2015 IAS, Universität Stuttgart
123
2.2 Automation structures
IAS
Question referring to Chapter 2.2
What are advantages of a distributed automation structure?
Answer
Higher flexibility in case of modifications.
Reduced effort for the communication between the individual automation
units.
Easier localization of malfunctions.
Easier software development for process control.
© 2015 IAS, Universität Stuttgart
124
IAS
§2
Automation Device Systems and Structures
2.1
Automation computers
2.2
Automation structures
2.3
Automation hierarchies
2.4
Distributed automation systems
2.5
Automation structures with redundancy
© 2015 IAS, Universität Stuttgart
125
2.3 Automation Hierarchies
IAS
Introducing a hierarchy of automation units
coordination
unit
1
distributed
automation
unit
1
subprocess 1
coordination
unit
2
distributed
coordination
unit
m
distributed
automation
unit
2
automation
unit
n
subprocess 2
subprocess n
field
level
complexity of operational tasks
requirements on availability
master
unit
central
coordination
master level
level
Combination of centralized and distributed structures
technical process
(overall process)
© 2015 IAS, Universität Stuttgart
126
2.3 Automation Hierarchies
IAS
Allocation of automation functions to the process
management levels
–
distributed automation units perform tasks of the field level, high
requirements on availability
–
coordination units perform the automation functions of the
process level, as well as the coordination of sub-processes,
optimization, process monitoring and safety functions
–
master units perform the tasks of the operational level
© 2015 IAS, Universität Stuttgart
127
2.3 Automation Hierarchies
IAS
av
ai
field level
© 2015 IAS, Universität Stuttgart
la
bi
d
re
i
u
lit
y
o
pr
q
re
coordination level
optimization
n
y
required processing capacity
g
sin
s
ce
cit
a
p
ca
performance
value
calculation
en
ts
o
Higher
control
locking
m
higher
regulation
ire
regulations
qu
single controls
re
protection, safety
monitoring
requirements on availability
Requirements on availability and processing capacity
master level
128
2.3 Automation Hierarchies
IAS
Prerequisites for the realization of an automation hierarchy
–
segmentation of the technical process into sub-processes
–
deployment of intelligent automation units
–
communication system between automation units
Depending on the size of the company and the extent of the
technical process, sub-levels can be added or levels can be merged.
© 2015 IAS, Universität Stuttgart
129
2.3 Automation Hierarchies
IAS
Example
Realization of an automation hierarchy with a bus-oriented distributed process
master
computer system
level
master
computer
user computer
coordination
level
coordination
computer
1
coordination
computer
2
process bus
decentralized
automation
computer
1
decentralized
automation
computer
2
decentralized
automation
computer
n
field
level
field bus
CM
CM
subprocess 1
CM
CM
subprocess 2
CM
CM
CM
CM … coupler module
sub-process
n
technical process
© 2015 IAS, Universität Stuttgart
130
2.3 Automation Hierarchies
IAS
Question referring to Chapter 2.3
Which of these tasks are executed on the field level?
Answer
Performance value calculation
Single control
Monitoring
Optimization
© 2015 IAS, Universität Stuttgart
131
IAS
§2
Automation Device Systems and Structures
2.1
Automation computers
2.2
Automation structures
2.3
Automation hierarchies
2.4
Distributed automation systems
2.5
Automation structures with redundancy
© 2015 IAS, Universität Stuttgart
132
2.4 Distributed automation systems
IAS
Objectives when using distributed automation systems
–
High reliability through fault tolerance
failure of a distributed computer does not lead to an
overall failure
isolation of the fault by means of reconfiguration
–
Increase of availability through rapid maintenance and service
mutual control with fault diagnostics
–
Mutual support during peak load times
automatic adaptation of the task distribution
reduction of the standby capacity of the individual units
–
Simple upgradeability
© 2015 IAS, Universität Stuttgart
133
2.4 Distributed automation systems
IAS
Realization for distributed automation systems
Connection of distributed automation units via a communication system
Difference to the automation hierarchy
–
In automation hierarchy, units only communicate with the level
directly above them
–
Only the process-related information tasks are performed
decentralized
© 2015 IAS, Universität Stuttgart
134
2.4 Distributed automation systems
IAS
Criteria for the selection of a communication system (1)
–
Low cabling costs
–
Standardized interfaces regarding
plugs, cables (mechanical)
voltage level (electrical)
transmission protocol (logical)
–
Flexibility in case of modifications
–
Low requirements on the communication partners
demand on memory size
demand on computation power
–
High availability and reliability
© 2015 IAS, Universität Stuttgart
135
2.4 Distributed automation systems
IAS
Criteria for the selection of a communication system (2)
–
Error free transfer of information
utilization of test bits
acknowledgement of correct reception
–
Achievement of high data transmission rates
–
Short reaction times on transmission requests
–
Coupling of various communication entities
Problem:
Definition of priorities in the realization of the partially contradicting criteria
e.g.: high availability and reliability through redundant bus systems causes
high cabling costs
© 2015 IAS, Universität Stuttgart
136
IAS
§2
Automation Device Systems and Structures
2.1
Automation computers
2.2
Automation structures
2.3
Automation hierarchies
2.4
Distributed automation systems
2.5
Automation structures with redundancy
© 2015 IAS, Universität Stuttgart
137
2.5 Automation structures with redundancy
IAS
Types of redundancy
Always: operating personnel monitoring parallel to process computer!
– Hardware redundancy
redundant hardware
–
Software redundancy
redundant software
–
Measured value redundancy
redundant measured values
dependent measured values
–
Time redundancy
multiple inquiry of the same measured value in certain intervals
Hardware and software redundancy implies a bigger effort
– higher availability and reliability
– safety-relevant systems
© 2015 IAS, Universität Stuttgart
138
2.5 Automation structures with redundancy
IAS
Objectives when using Fault-tolerant structures
Design the systems in such a way that they are able to function as a whole
even if faults occur in individual components.
Levels of fault-tolerance
– complete fault-tolerance
– reduced operational capacity
– transition to a safe state
© 2015 IAS, Universität Stuttgart
139
2.5 Automation structures with redundancy
IAS
The principle of fault-tolerance
Construct a system with redundant modules (hardware and software) in order
to maintain a functioning system in case errors occur.
Types of redundancy
–
Static redundancy
all redundant modules are permanently in operation
–
Dynamic redundancy
redundant modules are only used after a failure occurs
blind redundancy
redundant modules do not act in fault-free cases
function-participating redundancy
redundant modules run stand-by-functions in fault-free cases
© 2015 IAS, Universität Stuttgart
140
2.5 Automation structures with redundancy
IAS
Hardware redundancy
– Goal:
Detection of hardware failures
– Operation principle:
m-of-n-redundancy
majority ruling
no faults, until multiple defects occur
– Realization of redundancy
double computer structures
triple computer structures
…
© 2015 IAS, Universität Stuttgart
141
2.5 Automation structures with redundancy
IAS
Double computer structure with static redundancy
input signals (e.g. measured values)
computer 1
computer 2
comparator
2 -out-of- 2
alarm signal
output signals
(e.g. manipulated variables)
© 2015 IAS, Universität Stuttgart
142
2.5 Automation structures with redundancy
IAS
Double computer structure with dynamic blind redundancy
input signals
main
computer
stand-by
computer
M
Ü
M
alarm
signal
output signals
© 2015 IAS, Universität Stuttgart
143
2.5 Automation structures with redundancy
IAS
Double computer structure with dynamic functionparticipating redundancy
input signals
computer 1
computer 2
M
M
alarm
signal
necessary
output signals
© 2015 IAS, Universität Stuttgart
less important output
signals
144
2.5 Automation structures with redundancy
IAS
Triple computer structure with static redundancy
input signals
computer 1
computer 2
computer 3
comparator
2-out-of-3
output signals
© 2015 IAS, Universität Stuttgart
145
2.5 Automation structures with redundancy
IAS
Software redundancy
–
Objective:
detection of errors in software
–
Starting point:
software has errors
Redundancy measures for software:
Multiple use of the same software makes no sense, failure of software is not
the problem
- heterogeneous structure of program components
- the same input data must lead to the same results
© 2015 IAS, Universität Stuttgart
146
2.5 Automation structures with redundancy
IAS
Diverse software
Diversity = Heterogeneity of software with identical functionality
–
independent development teams solve the same problem
–
intentional development of different strategies, algorithms and
software structures
Application and execution of diverse software components
–
–
–
Redundant software alternatives are executed one after another and
are compared with the help of a voter (not for real-time systems
with high requirements on timeliness)
simultaneous execution of redundant software components on
redundant multi-computer systems
cyclic alternation of diverse components
Comparison difficult
–
Two algorithms with different processing times
–
Both results can be correct even though their values might be
different
© 2015 IAS, Universität Stuttgart
147
2.5 Automation structures with redundancy
IAS
Question referring to Chapter 2.5
In aircraft’s important systems, variables are calculated more than once.
Which kind of system would you use for this application: a double or a triple
computer system with static redundancy?
input signals
input signals (e.g. measured values)
computer 1
computer 2
computer 1
computer 2
computer 3
comparator
2-out-of- 3
comparator
2-out-of- 2
alarm signal
output signals
output signals
Answer
© 2015 IAS, Universität Stuttgart
148
Chapter 2: Preparation Task
IAS
Preparation Task to Chapter 2
Question 1: Redundancy (ST 2006)
In a plant control, one computer is used for process control and a second one
is used for logging. An additional program supervises in every computer the
functioning of the other computer. In case of failure of the computer for process
control, the logging computer takes over the task of the process control and
stops the logging function.
– Which kind of redundancy is used?
– State a second type of redundancy.
Question 2: PLC (WT 2003/2004)
In the programming of a Programmable Logic Controller (PLC), the so called
programming devices are used. What are they and why are they necessary?
© 2015 IAS, Universität Stuttgart
149
Chapter 3: Process Peripherals
§3
IAS
Process Peripherals
Learning targets
–
to know the kinds of interfaces in an automation system
–
to understand sensors and actuators concepts
–
to understand how an analog to digital conversion and vice versa is done
–
to be aware of different kinds of converter realizations
–
to understand the concepts of field buses
–
to be able to explain the different bus access methods
–
to know how PROFIBUS and CAN bus communication is working
© 2015 IAS, Universität Stuttgart
150
IAS
§3
Process Peripherals
3.1
Interfaces between the technical process and the
automation computer system
3.2
Sensors and actuators
3.3
Representation of process data in automation computers
3.4
Input / output of analog signals
3.5
Input / output of binary and digital signals
3.6
Field bus systems
© 2015 IAS, Universität Stuttgart
151
3.1 Interfaces between the technical process and the automation computer system
IAS
Input/Output Interfaces
Transmission of process signals between the technical process and the
automation computer system
–
Process signal input:
acquisition of process data
–
Process signal output:
manipulation of actuators
© 2015 IAS, Universität Stuttgart
152
3.1 Interfaces between the technical process and the automation computer system
IAS
Possibilities for the connection
– connection via bundles of cabels
–
connection via bus coupler module (I/O nodes)
–
connection via sensor/ actuator bus system
Direct connection of sensors and actuators
–
within the product automation
–
short distance to micro controller
Input/ output via field bus systems
–
within plant automation
–
reduction of cabling and installation costs
© 2015 IAS, Universität Stuttgart
153
3.1 Interfaces between the technical process and the automation computer system
Overview
Facilities for the
coupling of automation
computers with the
technical process as
well as with interfaces
IAS
Process bus
Interface to the higher
levels of the computer
hierarchy
Automation
computer
(e.g. PLC, PC)
Process signal
input/ output
Computer input/
output interface
(computer system
bus)
Bus coupler
Bus coupler
Process peripherals
interface (electrical or
optical signals )
Field bus
interface
Field bus
......
in/
output
node
in/
output
node
Sensor/ actuator bus
......
Sensors/ actuators
Interface
(electrical or
optical signals)
Bc
Bc
Bc
Bc
Sensors and actuators
Process variable
interface
(physical
quantities)
Technical process in a technical system
© 2015 IAS, Universität Stuttgart
154
3.1 Interfaces between the technical process and the automation computer system
IAS
Requirements of a bus system on actuator sensor level
–
Open to Sensors/actuators of different manufacturers
–
Fast system reaction time
–
Low costs for the connection
–
Small volume / geometric dimensions
–
Easy handling with wiring and set-up
Goals of the actuator-sensor-interface (AS i)
–
Designed for the actuator-sensor-level
Few data set per participant
Fast response times
–
Replacement of the parallel wiring of binary actuator/sensors
Signals and power supply using the same line
© 2015 IAS, Universität Stuttgart
155
3.1 Interfaces between the technical process and the automation computer system
IAS
Characteristics of AS i
– User defined network structure
– Transmission principle
single-master-system with cyclic polling
one fixed address per slave
max. 31 slaves per line
up to 4 sensors/actuators per slave
– Transmission medium
not protected and not twisted two-wire line
common use of cabeling for data and energy
– User data and cycle time
4 bits user data
5 ms max. cycle time
© 2015 IAS, Universität Stuttgart
156
3.1 Interfaces between the technical process and the automation computer system
IAS
AS i - principle structure
– 1 Master node
Variant 1: nodes integrated in controlling
Variant 2: separate locking module (e.g. for PLC)
Supervises bus communication
– Slave nodes
Variant 1: Sensor/actuators with integrated AS i – slave chip
Variant 2: Separate connection module
AS i – Master node
Control
AS i – Master chip
AS i - line
Power
supply unit
Common line for
signals and power
supply
AS i – Slave chip
AS i – Slave chip
Connection module
Sensor/Actuator
S/ A
© 2015 IAS, Universität Stuttgart
S/ A
S/ A S/ A
AS i – Slave nodes
157
3.1 Interfaces between the technical process and the automation computer system
IAS
Signal and supply on the same two-wire line
–
Signal is modulated on DC voltage supply
–
Condition: no direct current contingent of the signals
Realization by means of alternating pulse modulation (APM)
sender
0
example
sequence
0
1
0
Pause
– Target bit sequence in Manchester coding
– Generation of a current signal
60mA
0
– Transformation of current signal into voltage signal
Intrusion on supply voltage
2V
Ub
2V
receiver
– Detection of positive and negative impulses
– Recovery of the original bit sequence
© 2015 IAS, Universität Stuttgart
Pause
0
0
1
0
158
Chapter 3: Process Peripherals
IAS
Question referring to Chapter 3.1
Which statements are correct with respect to the requirements on bus
systems on the actuator sensor level?
Answer
Simple handling with wiring and start-up is irrelevant
The reaction time should be minimal.
Compatibility to sensors/actuators of different manufacturers should be
provided.
Connection costs are negligible.
© 2015 IAS, Universität Stuttgart
159
IAS
§3
Process Peripherals
3.1
Interfaces Between the Technical Process and the
Automation Computer System
3.2
Sensors and Actuators
3.3
Representation of process data in automation computers
3.4
Input / output of analog signals
3.5
Input / output of binary and digital signals
3.6
Field bus systems
© 2015 IAS, Universität Stuttgart
160
3.2 Sensors and actuators
IAS
Sensors
Tasks
–
Capturing of physical process variables
–
Transformation into a form that is suitable for further processing
–
Supervision of limits of values
–
Self-test
Intelligent
–
Self-calibration
Sensors
–
Adaptation to a bus system
© 2015 IAS, Universität Stuttgart
161
3.2 Sensors and actuators
IAS
Sensor element
Task
Transformation of a non-electrical, physical variable into an electrical
or optical value
Usage of physical effects
–
–
–
–
–
–
–
–
Variation in resistance
Variation of inductance
Variation of capacity
Piezoelectrical effect
Thermo-electrical effect
Photo-electrical effect
Eddy current effect
Radiation absorption
© 2015 IAS, Universität Stuttgart
162
3.2 Sensors and actuators
IAS
Intelligent sensor
"Intelligent" sensor
physical
input
variable
mechanical
converter
element
micro
processor
sensor
element
amplifier
bus
adaption
sensor
bus
analog to
digital
converter
calibration
© 2015 IAS, Universität Stuttgart
163
3.2 Sensors and actuators
IAS
Classification of sensor elements according to the kind
of sensor output signal
–
binary sensors
–
digital sensors
–
amplitude analog sensors
–
frequency analog sensors
Sensor system
Integration of several sensors for different process variables with the
evaluation electronics on one component
© 2015 IAS, Universität Stuttgart
164
3.2 Sensors and actuators
IAS
Binary sensors
–
Yes/No information
–
Limit value transmitter/ threshold transmitter
–
Example: end switch, light barrier / light curtain
Digital sensors
–
Conversion of a non-electrical signal into a digital value
–
Opinions:
Direct conversion
Conversion of the non-electrical signal with encoder disc
(rotating movement) or encoder ruler (linear
movement) into a digital signal
Indirect conversion
Conversion of non-electrical signal into an amplitude analog
signal, then from analog to digital conversion
© 2015 IAS, Universität Stuttgart
165
3.2 Sensors and actuators
IAS
Amplitude analog sensors
–
The transformation of a non-electrical, measured quantity into an
amplitude analog output signal. The amplitude of the electronic
output signal is proportional to the physical quantity to be measured
–
Conversion needs also:
amplification
normalization
linearization
temperature compensation
–
Available for all important measurement categories
© 2015 IAS, Universität Stuttgart
166
3.2 Sensors and actuators
IAS
Frequency analog sensors
–
Outputs an alternating voltage signal whereby the frequency is
proportional to the physical value to be measured
–
Advantages:
–
Insensetive against disturbing interferences on the
transmission lines
–
–
Simple frequency-digital conversion with a counter
–
No loss of precision from amplification and transmission
–
Simple potential isolation with transformer
Rarely used in comparison to amplitude analog sensors
t
© 2015 IAS, Universität Stuttgart
t
167
3.2 Sensors and actuators
IAS
Different kinds of sensor elements
physical
process variable
sensor element
output variable
temperature
thermo element
metal resistor
semiconductor resistor
(negative temperature coefficient resistor)
ceramic resistor
(positive temperature coefficient resistor)
mV
variation in resistance
variation in resistance
pressure-can with membrane and strain
gauge element
pressure-can with silicon-membrane
(piezoresistive effect)
strain gauge element
inductive force sensor
piezoelectric sensor
variation in resistance
impulse generator
impulse counter
silicon piezo-resistor
silicon capacitor
ring piston meter
inductive rate of flow measurer
hall-element out of silicon
V
pulse sequence
angle encoder
pulse generator
lithium chloride moisture sensor
digital value
pulse sequence
mV
photo diode
photo resistor
µA
variation in resistance
pressure
force
rotational speed
acceleration
flow
approach
angle
moisture
light intensity
© 2015 IAS, Universität Stuttgart
variation in resistance
variation in resistance
variation in resistance
variation of inductivity
charge
variation in resistance
variation in capacity
pulse sequence
mV
mV
168
3.2 Sensors and actuators
IAS
Actuators
Tasks
Conversion of the information obtained from the automation computer system
into manipulating interventions in the technical process
Actuator as a converter of information into a control
operation
information
actuator
(e.g. on a sensor/
actuator bus or
field bus )
control operation
(e.g. path, force, angle
rotational speed)
auxiliary energy
Actuator for different manipulated variables
– optical variables
– mechanical variables
– thermal variables
– flows
© 2015 IAS, Universität Stuttgart
169
3.2 Sensors and actuators
IAS
Actuators with mechanical output quantities
actuator principle
actuator
electronic mechanical
movement
hydraulic cylinder
electro-motor, stepper motor,
electro-magnet, linear-motor
pneumatic cylinder
pneumatic actuator
piezoelectric effect
magnetostrictive effect
piezoelectric actuators,
electrostrictive actuators
magnetostrictive actuators
electrorheologic effect
electrorheologic actuators
magnetorheologic effect
magnetorheologic actuators
electrically produced gas pressure
chemical actuators
bimetal effect
thermo bimetal actuators
memory metals
memory metal actuators
silicon micro techniques
micro mechanical actuators
© 2015 IAS, Universität Stuttgart
hydraulic actuator
170
Chapter 3: Process Peripherals
IAS
Question referring to Chapter 3.2
Your task is to design a level sensor for a water tank.
Which parameters can be used to determine the level of a tank?
Which type of sensor element could you use to create such a sensor ?
Answer
© 2015 IAS, Universität Stuttgart
171
IAS
§3
Process Peripherals
3.1
Interfaces between the technical process and the
automation computer system
3.2
Sensors and actuators
3.3
Representation of process data in automation computers
3.4
Input / output of analog signals
3.5
Input / output of binary and digital signals
3.6
Field bus systems
© 2015 IAS, Universität Stuttgart
172
3.3 Representation of Process Data in Automation Computers
IAS
Kinds of electrical process signals
–
Analog process signals
amplitude analog
frequency analog
phase analog
–
Binary process signals
–
Digital process signals
–
Process signals in the form of pulses
–
Process signals in the form of pulse edges
© 2015 IAS, Universität Stuttgart
173
3.3 Representation of Process Data in Automation Computers
IAS
Conversion of analog process variables
Analog process variables have to be converted into digital values before they
could be used in a computer system. Therefore, the analog value range is
discretized.
value coding by
the AD-converter
representation error
(% of maximum
value)
bits
0.39%
0.10%
0.025%
0.006%
0.0015%
Important:
8
10
12
14
16
decimal
0 ...
0 ...
0 ...
0 ...
0 ...
necessary
word
length
(in bytes)
255
1 023
4 095
16 383
65 535
1
2
2
2
2
A word length of 16 bit is sufficient for
representing analog process variables.
© 2015 IAS, Universität Stuttgart
174
3.3 Representation of Process Data in Automation Computers
IAS
Representation of digital process signals
Digital process signals are usually represented as binary, octal or hexadecimal
values. The picture illustrates each encoding.
bit #:
binary #
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
0
0
0
1
0
1
1
1
1
1
0
1
1
0
1
1
214 213
1
octal #:
137338
hexadecimal #:
17DB16
Important:
1
23
3
7
7
2 2 21 20
3
D
3
B
A word length of 16 bits is normally sufficient for
representing digital process variables.
© 2015 IAS, Universität Stuttgart
175
3.3 Representation of Process Data in Automation Computers
IAS
Binary format for switching status representation
Contact positions are frequently summarised as bits and bytes. In such case
single bits have to be addressable and modifiable.
bit position
7
6
5
1
0
0
1
0
4
3
2
1
0
Important: A word length of 16 bits is normally sufficient for representing binary process
variables and pulse shaped process variables.
Question:
Why use 32 bit computers for automation tasks?
© 2015 IAS, Universität Stuttgart
176
Chapter 3: Process Peripherals
IAS
Question referring to Chapter 3.3
The motor’s rotation speed shall be controlled.
The incoming current and the motor’s rotation will be measured by an
inductive sensor and a photo electric sensor, respectively. In case that the
incoming current is to high, the motor has to be automatically shut down
through a switch.
Which kinds of process signals can be identified?
Answer
© 2015 IAS, Universität Stuttgart
177
IAS
§3
Process Peripherals
3.1
Interfaces between the technical process and the
automation computer system
3.2
Sensors and actuators
3.3
Representation of process data in automation computers
3.4
Input / output of analog signals
3.5
Input / output of binary and digital signals
3.6
Field bus systems
© 2015 IAS, Universität Stuttgart
178
3.4 Input / output of analog signals
IAS
Input forms of analog process signals
–
electrical voltage signals
–
electrical current signals
–
electrical analog resistance values
Various forms of signal conversion
Realization arises from the requests of the technical system
–
fast A/D conversion
–
slow A/D conversion
© 2015 IAS, Universität Stuttgart
179
3.4 Input / output of analog signals
IAS
Fundamental structure
data
computersystem
bus
addresses
control signals
bus coupling
n
n
analog to
digital
converter
address
decoding
D
1
A
1 2
2
preamplifier
m
1
2
2
2
switching
element 2
feeder
lines
2
2
2
2
2
2
2
2
2
2
2
sensors
© 2015 IAS, Universität Stuttgart
process periphery
interface
sensor interface
U
180
3.4 Input / output of analog signals
IAS
Fast analog to digital conversion
–
Fast analog to digital conversion
ADC with conversion time of 1-100 µs, i.e.
data
computersystem
bus
addresses
control signals
1. Through-switching of
the selected analog
signal to the ADC
and conversion
2. Input of the
converted
value via the
data bus
bus coupling
n
analog to
digital
converter
address
decoding
D
1
A
1 2
2
preamplifier
m
1
2
2
2
switching
element 2
feeder
sensors
© 2015 IAS, Universität Stuttgart
n
2
2
2
2
2
2
2
2
2
2
2
process periphery
interface
sensor interface
U
181
3.4 Input / output of analog signals
IAS
Slow analog to digital converter
–
Slow analog to digital converter
ADC with conversion time of > 100 µs, i.e.
1. Address of the analog signal is output to the switching device
2. Conversion into digital value is initiated
3. A different program is initiated, to use the (rather long)
conversion time
4. When conversion is completed an interrupt signal is created
5. The corresponding interrupt program reads in the converted
information
© 2015 IAS, Universität Stuttgart
182
3.4 Input / output of analog signals
IAS
Types of analog to digital converter
–
Instantaneous value converter
single values of an analog process signal are sampled and
converted into digital values
–
Integrating converter (Mean Value Converter)
Analog process signal is integrated over a period T of the net
frequency and the mean value is calculated
Mean value is converted into digital value
1
u (kT )
T
kT
( k 1)T
u (t )dt
Advantage: high measurement safety accuracy
Relative low effort
Elimination of high frequency non-periodic disturbances
Suppression of line frequency interference voltages
Only applicable for relatively slowly changing process signals
© 2015 IAS, Universität Stuttgart
183
3.4 Input / output of analog signals
IAS
The principle of the integrating ADC
u( kT )
1
T
kT
( k 1) T
u(t )dt
u (t)
analog process signal with overlayed 50 Hz interference
voltage as well as high frequency pulses
T
(k-1) T
© 2015 IAS, Universität Stuttgart
kT
(k+1) T
t
184
3.4 Input / output of analog signals
IAS
Conversion methods for analog to digital converter
Instantaneous
value converter
Advantage
High conversion
speed
104 ... 10 8 values/s
Mean value converter
High interference voltage
suppression
Disadvantage Interference pulses Low conversion speed
cause falsification
of digital values
Conversion
met hod
Counter method,
step method,
direct method
© 2015 IAS, Universität Stuttgart
Voltage time or
voltage frequency converter
185
3.4 Input / output of analog signals
IAS
Instantaneous-value-ADC using the counter method
structure
U
analog
input
signal
in
+
US
comparator
-
D/A-converter
1 2
n
digital
output signal
(n-bit-word)
counter
&
clock
© 2015 IAS, Universität Stuttgart
186
3.4 Input / output of analog signals
IAS
Principle procedure
–
–
–
–
–
–
Us at the output of the DAC
compare to Uin
in case of equality the counter gets no impulse
otherwise counter is increased
new counter signal is D/A converted
procedure is repeated until Us > Uin
analog
input
signal
U in
+
US
comparator
-
D/A-converter
1 2
n
US
US
analog
input
voltage
U in
digital
output signal
(n-bit-word)
counter
&
t1
t
clock
© 2015 IAS, Universität Stuttgart
187
3.4 Input / output of analog signals
IAS
Instantaneous-value-ADC using the counter method
Conversion time T is depending on:
–
Sampling rate of the DAC
–
Switching speed of the comparators
–
Input voltage
–
Word length of the digital output (2n steps in worst case)
–
Clock frequency f
Clock frequency depends on:
© 2015 IAS, Universität Stuttgart
188
3.4 Input / output of analog signals
IAS
Instantaneous-value-ADC using the step method
Basic structure
D/A-converter
US
analog
input
signal
U in
+
comparator
-
control
clock
output register
digital
output signal
© 2015 IAS, Universität Stuttgart
189
3.4 Input / output of analog signals
IAS
Principle procedure
–
–
–
–
–
–
Control sets highest order bit (MSB = Most Significant Bit)
US at exit of the DAC
Comparison with Uin
If Uin > US MSB stays set, if not then reset
Procedure is repeated for further bits
After the last comparison (bit n) the value of the analog input signal is
represented digitally encoded in the output register
analog
input
voltage
US
Uin
dual values
1
0
1
1
0
t
digital signal
© 2015 IAS, Universität Stuttgart
190
3.4 Input / output of analog signals
IAS
Instantaneous-value-ADC using the step method
Conversion time T:
–
constant (after n steps results are available)
–
T = n/f
–
Limitation through
settling time (speed) of the DACs
switching speed of comparators
© 2015 IAS, Universität Stuttgart
191
3.4 Input / output of analog signals
IAS
Instantaneous-value-ADC using the parallel conversion method
Basic structure
analog
input
signal
comparators
+
Uin
K2 n-1
n
–
reference
voltage
UR
~
+
K2
Code
converter
2
n-bit-word
resistor
network
–
+
K1
1
–
© 2015 IAS, Universität Stuttgart
192
3.4 Input / output of analog signals
IAS
Principle procedure
–
Input signal is given to 2n - 1 comparators
–
Reference voltages are produced over resistor network with
reference voltage source
–
Conversion by code converter into n-bit-word
Conversion time
–
Dependent on switching speed of the comparators
and of the code converter
–
108 values/sec
–
Very costly, 8-bit ADC needs 28 - 1 comparators
© 2015 IAS, Universität Stuttgart
193
3.4 Input / output of analog signals
IAS
Integrating ADC using the “Dual-slope-method”
Basic structure
analog input voltage Uin
S
R
IC
URef
C
+
integrator
UC
-
+
comparator
-
control
logic
© 2015 IAS, Universität Stuttgart
counter
UK
digital
signal
clock
194
3.4 Input / output of analog signals
IAS
Principle procedure
–
–
–
–
–
Capacitor C is charged from t0 until t1 with the current IC = Uin /R
URef is set at the input of the integrator at time t1
Capacitor C is discharged, Uin defines the time span of discharge
Time until UC = 0V is directly proportional to Uin
Measurement of time span with a counter, which counts the impulses
generated by time clock
analog input voltage Uin
S
R
IC
URef
C
+
integrater
UC
-
+
comparator
-
control
logic
© 2015 IAS, Universität Stuttgart
counter
UK
digital
signal
clock
195
3.4 Input / output of analog signals
IAS
Course of signals of an ADC according to the “Dual-slope- method”
UC
U C2
output
integrator
U C1
t0
t
UK
output
comparator
Advantages
t0
t1
t2
t3
t
–
Long term variations are not influencing the measurement
–
Precision is independent of the product of R C, it is only dependent on the
precision of the reference source and of the operation amplifiers
© 2015 IAS, Universität Stuttgart
196
3.4 Input / output of analog signals
IAS
Analog output
data
computer
system
bus
addresses
Conversion of the
digital, time-discrete
values from the
automation computer
into continuous
signals
control signals
n
Addressdecoding
1
2
m
n
&
n
&
n
n
n
n
n
n
D
buffer
intermediate storage
n
D
D
A
switching element
n
n
n
&
n
A
A
Structure of an
analog output
module
D/A-converter
output stages
process
periphery
interface
feeder
lines
sensor-/ actuatorinterface
actuator
© 2015 IAS, Universität Stuttgart
controller
197
3.4 Input / output of analog signals
IAS
Remarks to the analog output
–
buffering is necessary in order to store the information at the switching
element
–
Analog controls e.g. signals servo motors are typical applications of
digital to analogue conversion
–
Analog outputs are driven by the binary signals
© 2015 IAS, Universität Stuttgart
198
3.4 Input / output of analog signals
IAS
Types of digital to analog information converters (DAC)
– Most of the DACs are using a direct method with resistance network
– Various characteristics of the resistance network
– Possible ways of realizing a DAC with resistor network
• DA-conversion via the summing up of weighted currents
• DA-conversion via a conductor network
© 2015 IAS, Universität Stuttgart
199
3.4 Input / output of analog signals
IAS
Realization of a DAC by summing up of weighted currents
UREF
S0
MSB
R
2R
RR
4R
+
-
LSB
Sn-1
U out
R 2 n-1
Disadvantages:
– very different potentials on the switches
(Bipolar transistors or field-effect transistors)
– required precision of the very different resistors is hard to fulfill
© 2015 IAS, Universität Stuttgart
200
3.4 Input / output of analog signals
IAS
Realization of a DAC with the help of a conductor network
iREF
UREF
UREF
S0
R
UREF /2
R
UREF /4
R
UREF /8
R 0 = 2R
R 1 = 2R
R 2 = 2R
R 3 = 2R
i0
i1
i2
i3
S1
S2
2R
S3
RR
+
isum
i0
U Ref
2R
i1
U Ref
4R
i2
U Ref
8R
i3
U Ref
16R
-
Uout
Currents add up according to position of switches to current isum
Operation amplifier creates Uout
Switches are often bipolar transistors of field-effect transistors
© 2015 IAS, Universität Stuttgart
201
Chapter 3: Process Peripherals
IAS
Question referring to Chapter 3.4
The mean value converter is an analog to digital converter. Which of the
following statements do you agree?
Answer
The value in the middle of an interval is sampled every time.
Error voltage with frequency of the supply voltage is always suppressed.
The converter can only be used for fast changing signals.
Every time a complete period of the supply net frequency is integrated
A comparatively low effort is necessary for the technical realization.
It’s a time-discrete method
© 2015 IAS, Universität Stuttgart
202
IAS
§3
Process Peripherals
3.1
Interfaces between the technical process and the
automation computer system
3.2
Sensors and actuators
3.3
Representation of process data in automation computers
3.4
Input / output of analog signals
3.5
Input / output of binary and digital signals
3.6
Field bus systems
© 2015 IAS, Universität Stuttgart
203
3.5 Input / output of binary and digital signals
IAS
Digital input
–
Input of single binary process signals, e.g.: limit switch, photo sensors
–
Input of groups of binary process signals, e.g.: position of multistage switch
Kinds of binary input signals
–
binary voltage input
–
–
binary current input
binary contact input
power supply for contact transmitter
facility for the suppression of contact bounces
Distinction regarding signal parameters
–
Static digital input: High and low for binary signal
–
Dynamic digital input (impulse input): trigger on the signal edges
© 2015 IAS, Universität Stuttgart
204
3.5 Input / output of binary and digital signals
IAS
Structure of a module for the static digital input
Input operation in two steps:
data
computersystembus
addresses
control signal
1. Provision of the address
of the binary signals,
that are gathered to a group,
on the address bus
n
n
address
decoding
>1
n
n
1
m
n
2.Switching-through
of the addressed binary
signals to the data bus
&
n
n
&
n
n
&
n
n
process peripheral
interface
feeder
sensor
interface
© 2015 IAS, Universität Stuttgart
205
3.5 Input / output of binary and digital signals
IAS
Digital output
data
computersystembus
addresses
Structure of a digital
output module
control signals
n
address
decoding
– Output of single binary
signals
1
– Output of a group of
binary signals
n
2
m
n
n
&
&
n
&
n
switching element
n
intermediate
storage
n
n
n
output stages
n
n
n
n
n
n
process
peripheral
interfaces
feeder
sensor-/ actuatorinterfaces
n
© 2015 IAS, Universität Stuttgart
n
n
binary signal
actuators
206
3.5 Input / output of binary and digital signals
IAS
Kinds of binary output signals
–
–
–
Voltage output
Current output
Output of potential-free contact positions
Execution of digital output
–
Output signal of process computer is only valid if according address is
output on the address bus
–
Control of devices (contactor, relays, lamps) need a continuous
signal as input signals
Intermediate storage
Output operation in three steps:
1.
2.
3.
Provision of the address of the word to be given out
Output of the selected binary signal in the intermediate storage
Output of the continuous signal from the intermediate storage to
the connected device
© 2015 IAS, Universität Stuttgart
207
Chapter 3: Process Peripherals
IAS
Question referring to Chapter 3.5
Regarding digital input, two kinds of signal types can be identified. Which
statements are correct?
Answer
Static digital input values do not change during operation.
Using dynamic digital inputs, the signal parameters correspond to the
transition from high to low or vice versa.
Using static digital inputs, the signal parameters correspond to the high and
low states.
Using dynamic digital inputs, the signal parameters correspond to the
frequency of the alterations of the signal state.
© 2015 IAS, Universität Stuttgart
208
IAS
§3
Process Peripherals
3.1
Interfaces between the technical process and the
automation computer system
3.2
Sensors and actuators
3.3
Representation of process data in automation computers
3.4
Input / output of analog signals
3.5
Input / output of binary and digital signals
3.6
Field bus systems
© 2015 IAS, Universität Stuttgart
209
3.6 Field bus systems
IAS
Motivation for the introduction of a field bus system
Weaknesses of conventional connection techniques:
Use of serial bus systems for communication between the sensors/
actuators and the automation computer system in order to reduce
planning and installation costs
Application fields:
–
plant automation
–
production automation
–
automobile electronics (control and monitoring)
© 2015 IAS, Universität Stuttgart
210
3.6 Field bus systems
IAS
Requirements on field bus systems
Differentiation between general requirements as
– Reliable communication under all environmental conditions
– Simple handling through maintenance staff
– Simple and robust connection technique
– Intrinsic safety in explosive areas
and application-oriented requirements as
– Number of input/output signals,
– Complexity,
– Granularity,
– Plant extension,
– Real-time requirements.
© 2015 IAS, Universität Stuttgart
211
3.6 Field bus systems
IAS
Terminology
Field area:
That part of the automation system that is spatially
close to, or in direct connection with, the technical
process
Field devices:
Measuring instruments, switch gears, controlling
devices, that interact directly with the technical
process
Field bus systems:
Serial data communication systems for the data
exchange within the field area. Special
requirements on the security of the data transfer:
data integrity, EMC (Electromagnetic Compatibility)
© 2015 IAS, Universität Stuttgart
212
3.6 Field bus systems
IAS
Basic topologies of communication
a) star topology
c) net
topology
DAU
DAU
CAU
DAU
DAU
DAU
CAU
DAU
DAU
DAU
DAU
DAU
b) ring
topology
d) bus
topology
D
AU
CAU
D
AU
DAU
DAU
DAU
D
AU
D
AU
CAU
DAU
CAU = centralized automation unit
DAU = decentralized automation unit
© 2015 IAS, Universität Stuttgart
213
3.6 Field bus systems
IAS
Basic topologies of communication
star topology
failure of the central unit causes failure of the communication system
ring topology
each unit can only transmit messages to its direct neighbors
net topology
parallel information transmission, short reaction time, many interfaces, high
cabling costs
bus topology
only one participant at a time is able to send, simultaneous information
reception from all participants
© 2015 IAS, Universität Stuttgart
214
3.6 Field bus systems
IAS
Parallel bus
–
addresses, data and control signals are transmitted parallel
–
bundles of wires
Serial bus
–
bits of a message are transmitted one after another
–
transmission time is longer than that of parallel bus
–
lower cabling costs
–
increase of reliability
–
flexibility regarding the transmission protocol
© 2015 IAS, Universität Stuttgart
215
3.6 Field bus systems
IAS
Question referring to Chapter 3.6
There are some different topologies for a communication system. With
which of the following statements do you agree?
Answer
the bus topology causes the lowest cable expense
the bus topology is faster than the net topology
a net topology is able to broadcast a larger amount of data in parallel than
a bus topology
a bus topology has a shorter reaction time than a net topology
it is easier to expand a net topology than a star topology
a bus topology is only suitable for decentralized systems
© 2015 IAS, Universität Stuttgart
216
3.6 Field bus systems
IAS
Field bus systems
Examples
Manufacturer or main application area
– AS-Interface
11 actuator/sensor manufacturers,
simple interface of binary field devices
– INTERBUS-S
Phoenix Contact
Application in manufacturing automation
„cooperative project field bus“
European field bus standard
– PROFIBUS (Process Field Bus)
– Foundation Field Bus
Field bus Foundation
American field bus standard
– EIB (European Installation Bus)
Manufacturer of electric installations
Building automation
– CAN
BOSCH - main field of application in
automotive industry
FlexRay-Group
Automobile
Ethernet extensions for application in
automation systems
– FlexRay
– Industrial Ethernet
© 2015 IAS, Universität Stuttgart
217
3.6 Field bus systems
IAS
Classification of field bus concepts
decentralised
automation
computers in the
field area
sensors/
actuators with
bus interface
I/O nodes
central
computer
area
field bus
interface
field bus
field
area
field bus
automation
computer
automation
computer
I/O
Node
I/O
Node
field bus
(sensor/ actuatorbus)
sensor/
actuator
interface
© 2015 IAS, Universität Stuttgart
218
3.6 Field bus systems
IAS
Bus access methods - Overview
Bus systems can be classified according to their access concept. Only the
deterministic methods can guarantee a max. response time. For non-deterministic
methods the response time is only statistically describable.
Bus access methods = Rules for sending messages
Bus access methods
controlled
(deterministic)
central
bus allocation
Master/Slave
© 2015 IAS, Universität Stuttgart
decentral
bus allocation
Tokenring,
TDMA
random
(non-deterministic)
CSMA
(Carrier Sense Multiple Access)
CD
CA
Ethernet
CAN
219
3.6 Field bus systems
IAS
Bus access methods: deterministic bus access
Master-Slave
The master polls all slaves periodically
whether they want to send or receive (so
called polling)
Advantages:
- Simple organization
- Guaranteed max. time
Master
Disadvantages:
Slave 1
Slave 2
...
slaves transmit messages only
on request of the master
© 2015 IAS, Universität Stuttgart
Slave n
- Maximum latency period
proportional to the number
of bus participants
- In case of failure of the
master the communication
is no longer possible
220
3.6 Field bus systems
IAS
Bus access methods: deterministic bus access
Token-Passing
Token is passing from one station to the
neighbor station in a logical ring topology
Advantages:
- good, predictable real time
behavior
A
- very good high load
capability
Disadvantages:
B
C
If participant A wants to transmit data to
participant C, it waits until the token passes and
adds the data packet (provided it is vacant) and
addressed to participant C.
© 2015 IAS, Universität Stuttgart
- Long delays in case of error
- Monitoring of the token
passing
- re-initialisation after loss of
the token
221
3.6 Field bus systems
IAS
TDMA-Method (1)
–
Within a period (TDMA-cycle) each participant is assigned one or
several time slots of determined length
–
Principle of distributed shift registers
master shift register with m * n bit
frequency
register in
register in
participant 1 participant 2
© 2015 IAS, Universität Stuttgart
register in
participant n
222
3.6 Field bus systems
IAS
TDMA-Method (2)
Advantages
–
short, constant cycle time
–
low protocol overhead
Disadvantages
–
synchronization of participants necessary
–
not suitable for autonomous participants
–
low flexibility, no dynamic adaptation
© 2015 IAS, Universität Stuttgart
223
3.6 Field bus systems
IAS
Bus access methods: non-deterministic bus access
„CSMA – Carrier Sense Multiple Access“
Principle of Telephone:
Send request
Multiple
Access
(wait, to try it
later)
Carrier Sense
(line idle)
?
yes
sending
Upon send request:
first, it is checked if
the line is idle. If yes,
the message will be
sent. Otherwise,
waiting and try later.
no
Dynamics over time
cause problem
especially for
automation
applications
© 2015 IAS, Universität Stuttgart
random access (i.e. nondeterministic), everyone can
access anytime. However, it
is not guaranteed that a
transmission right is given
during a certain time interval.
basically not suitable for real
time applications
exceptions:
a) low bus load over time
(<10%)
b) no time critical transmisson
224
3.6 Field bus systems
IAS
CSMA/CD - Method (Collision Detection)
–
Recognition of collisions through data comparison
–
Repeat of transmission after participant specific waiting period
Advantages
– low bus load
– short latency time in low load situations
Disadvantage
– long waiting periods in high load situations
© 2015 IAS, Universität Stuttgart
225
3.6 Field bus systems
IAS
CSMA/CA-Method (Collision Avoidance)
Priority rules
–
Address-Arbitration
Participant with lowest or highest address asserts in case of
simultaneous attempts of transmission.
–
Time span assignment
After the completion of a transmission participant specific waiting time
© 2015 IAS, Universität Stuttgart
226
3.6 Field bus systems
IAS
CAN (Controller Area Network)
Developed by Bosch/Intel for the application in automobile industry
–
–
–
–
Airbag
ABS
Motor management
Air conditioning systems
Building instrumentation and control
–
–
–
–
elevator control
supervision
alarm systems
air-conditioning system
Industrial automation
– production plants
– machine tools
© 2015 IAS, Universität Stuttgart
227
3.6 Field bus systems
IAS
Characteristics of CAN
–
Message oriented addressing
Several objects can be located on one node. The object is addressed not
the node.
–
Multi-master bus access method
–
In case of access conflict: bus arbitration according to priority
through non-destroying, bit-wise arbitration according to CSMA/CA
Method
–
Short length of messages (0...8 byte)
–
Transmission rate up to 1Mbit/s (in case of a maximum bus length of
40m)
–
Various error recognition mechanisms
–
Self-test through error counter
if a node causes too many errors it uncouples itself from the bus step by
step.
© 2015 IAS, Universität Stuttgart
228
3.6 Field bus systems
IAS
CAN for environments with heavy electromagnetic
disturbances
Interference detection mechanism
–
Bit stuffing and de-stuffing. After 5 bits with the same logic state
one bit of the opposite logic state is added.
stuffing by the sender
de-stuffing by the receiver
–
15 BIT CRC (cyclic redundancy check)
cyclic binary code with
64 message digits
15 control digits
Hamming distance d = 6
Residual error probability
–
Bus level check
simultaneous sending and reading
–
Message frame protection
checking of the frame for correctness
© 2015 IAS, Universität Stuttgart
229
3.6 Field bus systems
IAS
Data frame
Interframe
Space
>3
Data-Frame
1
11
1
6
0 ... 8
Bytes
15
1
1
1
7
>3
End of Frame
ACK Delimiter ACK-Field
ACK Slot
CRC Delimiter CRC-Field
CRC Sequence
Data Field
Control Field
RTR Bit Arbitrations Field
Identifier
Start of Frame
© 2015 IAS, Universität Stuttgart
230
3.6 Field bus systems
IAS
Time triggered bus system
Time triggered: Actions are triggered by the progression of time
Advantages of the time control
–
Determinism
Safety properties easier to verify
–
Synchronization of the applications on different nodes
Coupling of redundancies for the realization of fault tolerance
Distribution of a closed effect chain for the realization of distributed
control applications
Disadvantages of the time control
–
inflexible to unexpected events
–
inflexible to expansions and changes of the system
© 2015 IAS, Universität Stuttgart
231
3.6 Field bus systems
IAS
Construction of a time controlled architecture
redundant unit
redundant unit
node
node
node
node
AC
AC
AC
AC
CC
CC
CC
CC
AC: application controller
CC: communication controller
–
Distributed system (cluster): Set of nodes that communicate via a bus
system
–
Static hardware redundancy: two or more nodes are doing the same task
–
Bus system is also constructed with redundancy
© 2015 IAS, Universität Stuttgart
232
3.6 Field bus systems
IAS
Properties of the time controlled communication system
– Synchronization:
All bus users refer to a global clock
– Time slot method:
Every bus participant has access to the bus at a definite time interval
determined in advance
– Static messages scheduling
The sending time slots are determined statically before runtime
– Integrated network management:
Recognizing a node failure, integration of nodes
– Redundancy management:
Every arbitrary single fault is tolerated
Examples:
TTP:
FlexRay:
TU Wien, TTTech
FlexRay-Consortium (BMW, Daimler, Bosch, Motorola, Philips)
© 2015 IAS, Universität Stuttgart
233
3.6 Field bus systems
IAS
Message schedule
Example: Message schedule for TTP
TDMA-cycle 0
TDMA-cycle 1
FSU6
N
FSU5
1
2
3
4
5
N
N
I
0
N
N
I
N
N
N
I
N
N
N
0
N
N
I
N
FSU2
N
I
N
FSU3
TDMA-cycle 3
I
N
FSU4
FSU1
TDMA-cycle 2
1
2
3
4
5
0
N
1
2
3
4
5
0
1
2
TSlot
TDMA-cycle
(TTDMA = 2ms)
3
4
5
time
complete cluster-cycle (TCluster = 8ms)
Legend:
N
Normal-frame
I
Initialization-frame
New attempt: FlexRay
Integration of additional message frames for dynamic contents
© 2015 IAS, Universität Stuttgart
234
3.6 Field bus systems
IAS
FlexRay
Development by a consortium (Daimler, BMW, Motorola, Philips) for safety
and time-critical applications in automobile
– ESP
– driver assistance systems
Properties:
– Transmission rate up to 10 MBit/s
– Multi-Master structure
– Redundancy of the communication channel
– 24 Bit CRC (Cyclic Redundancy Check)
© 2015 IAS, Universität Stuttgart
235
3.6 Field bus systems
IAS
FlexRay - Message schedule
– Defined cycle time
– Division of any cycle in static and dynamic segment
– Fixed message schedule for static segment of any FlexRay-Cycle by
assignment of bus participant/message to slot
– collision free, dynamic bus access in dynamic segment according to fixed
priorities
• Priority is determined by assignment of mini slot to bus participant
FlexRay FlexRay FlexRay FlexRay
Cycle 0 Cycle 1 Cycle 2 Cycle 3
…
…
FlexRay FlexRay FlexRay
Cycle 62 Cycle 63 Cycle 0 …
t/T
Cycle
1
2
3
4
5
6
…
n
static segment
dynamic segment
slot
© 2015 IAS, Universität Stuttgart
minislot
236
3.6 Field bus systems
IAS
PROFIBUS
– Field bus family
PROFIBUS - DP
PROFIBUS - FMS
PROFIBUS - PA
–
(Decentralized Periphery)
(Field Message Specification)
(Process Automation)
Distinction of master and slave participants
– Master participants (active participants)
Transmission of messages without request in case of Token
possession
– Slave participants (passive participants)
No Token possession possible
Acknowledgement of messages
Message transmission on request
© 2015 IAS, Universität Stuttgart
237
3.6 Field bus systems
IAS
Hybrid access method in the Profibus
active participants (master-devices)
PLC
PLC
Profibus
M
M
sensor
sensor
drive
actuator
sensor
drive
measured
value-
V
supplier
passive participants (slave devices)
© 2015 IAS, Universität Stuttgart
238
3.6 Field bus systems
IAS
Interbus-S
– Objective:
Transfer cyclically data in the sensor-actuator-area without large overhead.
– Topology
active ring
Master-Slave method, fixed telegram length, deterministic ring
transfer rate: 500 kBits/s
max. 4096 I/O-points
extension of the bus: 400 m (between 2 neighbored field bus users)
total extension 13 km
– Physical addressing
The assignment of the data to the single participants is not carried out via
the assignment of a bus address but automatically by the physical
placement of the participants in the system
© 2015 IAS, Universität Stuttgart
239
3.6 Field bus systems
IAS
Example of an Interbus configuration
© 2015 IAS, Universität Stuttgart
240
3.6 Field bus systems
IAS
Principle of the shift register
–
–
–
The Interbus is a closed shift register ring
The information flows only in one direction
The information is shifted through the complete ring, one bit after another
[ref.: Interbus ONLINE-Seminar, www.interbus.com]
Control
Protocol
send register
The data are lying in the send register
ready for the participants
(TN1, TN2 and TN3).
receive register
actuators
actuators
actuators
At the beginning of the data chain
stands the loopback, at the end the
FCS and Control
sensors
paticipant 1
© 2015 IAS, Universität Stuttgart
sensors
participant 2
sensors
participant 3
241
3.6 Field bus systems
IAS
Trends in Industrial Automation:
– Close interconnection of production management, plant management and
automation of the plant
Seamless use of the communication system from strategic to operative
level
Strategic Level
Dispositive
Level
Tactical
Level
Operative
Level
technical process
© 2015 IAS, Universität Stuttgart
Requests of the Communication system:
– High transfer rate
– Real-time ability
– Reliability
– Robustness against electrostatic,
mechanical, physical and chemical
influences
242
3.6 Field bus systems
IAS
Industrial Ethernet:
Objective:
Application of Ethernet (IEEE 802.3) on field level
Challenges:
- Non deterministic bus access
- Long latency time caused by network topology
- Small mechanical robustness
© 2015 IAS, Universität Stuttgart
243
3.6 Field bus systems
IAS
Industrial Ethernet – Topology for reduction of latency times:
- Introduction of automation cells
intra cell:
real-time mode
inter cell:
no real-time mode
- Enabling of a line topology within automation cells
No real-time behavior
Gateway
AT-cell with star
topology
© 2015 IAS, Universität Stuttgart
Gateway
AT-Computer
AT-Computer
AT-Computer
AT-Computer
AT-Computer
AT-Computer
AT-Cell
AT-cell with line
AT-Cell topology
244
3.6 Field bus systems
IAS
Industrial Ethernet – Protocol adaptations (1/2):
Possibility 1: Introduction of an isochronous transmission range:
– With Master-Slave method:
Cycle:
1. Master sends synchronization
2. Master requests Slaves to send
high priority messages
3. Master allows one Slave to send
asynchronous, low priority data
– With synchronous clocks (time slot method)
• isochronous phase: time triggered communication with
message schedule
• asynchronous phase: CSMA/CD
© 2015 IAS, Universität Stuttgart
245
3.6 Field bus systems
IAS
Industrial Ethernet – protocol adaptations (2/2):
Possibility 2: Implicit addressing of real-time critical process data within an
Ethernet frame
Ethernet Header
Data 1
Telegram 1
Data 2
Telegram 2
Data n
CRC
Telegram n
Hardware supported data processing without buffering
Special hardware driver necessary in each device
Synchronous clocks necessary in specific devices
© 2015 IAS, Universität Stuttgart
246
Chapter 3: Process Peripherals
IAS
© 2015 IAS, Universität Stuttgart
fml.mw.tum.de
usinenouvelle.com
chip-.de
yitran.com
Examples of wireless communication
Logistic
Networks
247
Chapter 3: Process Peripherals
IAS
Question referring to Chapter 3.6
Which of the following statements regarding to deterministic / random bus
access do you agree?
Answer
Using a deterministic bus access there is a fixed method for the access of
a participant
Using a random bus access each participant is able to write on the bus
any time
Using a deterministic bus access definite statements regarding to the
response behavior are possible
A deterministic bus access allows faster response times
The token-passing method is a method with random bus access
Using the random bus access a concurrent write process of several
participants onto the bus always results in a destruction of the
transmission
© 2015 IAS, Universität Stuttgart
248
Chapter 3: Preparation Task
IAS
Preparation Task to Chapter 3
Question 1: Bus Systems (ST 2004)
In an ASi (Actuator / Sensor Interface) power and information are transmitted
using a single line.
• What is the condition for that?
• Which problem will arise if this condition is not met?
Question 2: Bus Access (ST 2004)
While designing an automation system, two bus access methods are available:
the token passing method and the CSMA/CA (Carrier Sense Multiple Access /
Collision Avoidance) method. An important requirement on the system is the
avoidance of delays due to failures in individual bus participants. Explain how
the characteristics of each access method could influence the automation
system in what that requirement is concerned.
© 2015 IAS, Universität Stuttgart
249
Chapter 4: Real-Time Programming
§4
IAS
Real-Time Programming
Learning targets
–
to know what is meant by real-time programming
–
to know the requirements of real-time programming
–
to understand synchronous programming vs. asynchronous programming
–
to be able to explain tasks and their time synchronization
–
to be able to use semaphores
–
to understand scheduling methods and the way they work
–
to know what a schedulability test is
© 2015 IAS, Universität Stuttgart
250
IAS
§4
Real-time programming
4.1
Problem definition
4.2
Real-time programming methods
4.3
Tasks
4.4
Synchronization of tasks
4.5
Communication between tasks
4.6
Scheduling methods
© 2015 IAS, Universität Stuttgart
251
4.1 Problem definition
IAS
What is real-time programming?
Non-real-time computing
–
Correctness of the computational result
Real-time computing
–
Correctness of the computational result
–
Timeliness of the result
© 2015 IAS, Universität Stuttgart
252
4.1 Problem definition
IAS
NON-REAL-TIME Computing:
Input data
Data
Processing
Output data
REAL-TIME Computing:
Time
Time
Input data
© 2015 IAS, Universität Stuttgart
Time
Data
Processing
Output data
253
4.1 Problem definition
IAS
Real-Time Programming
Creation of programs in such a way that the time requirements on the
compilation of input data, on the processing and on the delivery of output data
are fulfilled.
Time requirements are dependent on the processes in the technical system
Real-time:
according to the real-time-sequences, no time expansion,
no time compression
Different kinds of requirements on the time behavior of the data processing
–
Requirements for timeliness
–
Requirements for concurrency
© 2015 IAS, Universität Stuttgart
254
4.1 Problem definition
IAS
Interaction technical process and automation system
Time dependent
output data
Technical
Time dependent
input data
process
Example:
Automation
system
Automation
system
Technical
process
© 2015 IAS, Universität Stuttgart
malfunction due to too early/
too late arriving sensor/actuator
values!
255
4.1 Problem definition
IAS
Differences between information and real-time systems
Information systems
Real-time systems
data-driven system
event/time driven system
complex data structure
simple data structure
great amount of input data
small amount of input data
I/O-intensive
computation-intensive
machine-independent
machine-dependent
© 2015 IAS, Universität Stuttgart
256
4.1 Problem definition
IAS
Important terms (1)
Hard real-time systems
Strict deadlines must not be missed in any case
Soft real-time system
A violation of deadlines can be tolerated
Utility
Deadline
hard real-time system
soft
real-time system
Time
© 2015 IAS, Universität Stuttgart
257
4.1 Problem definition
IAS
Requirements for timeliness
–
timely compilation of input data
–
timely data processing
–
timely delivery of output data
Time requirements regarding timeliness
–
Absolute time requirements
e.g.:
–
11:45 signal for departure
Relative time requirements
e.g.:
Turn off signal 10 seconds after a measured value
exceeds its threshold
© 2015 IAS, Universität Stuttgart
258
4.1 Problem definition
IAS
Classification of time requirements (1)
Execution of a function at fixed times t1, t2, t3 , t4
1
0
t1
t2
t3
t4
t
Execution of a function within a tolerance time range assigned to each time tn
tolerance time
1
0
t1
© 2015 IAS, Universität Stuttgart
t2
t
259
4.1 Problem definition
IAS
Classification of time requirements (2)
Execution of a function within an interval up to a latest time t1
1
0
t1
t
Execution of a function within an interval starting from an earliest time t1
1
0
t1
© 2015 IAS, Universität Stuttgart
t
260
4.1 Problem definition
IAS
Typical examples of applications with time requirements
Absolute time
requirements
Relative time
requirements
Execution of a function at
a fixed time
Recording of test values
Analysis of substances
in chemistry
Execution of a function
within a tolerance time
range
Recording of controlled
variables
Measured value
supervision on sliding
boundaries
Execution of a function
within an interval up to a
latest time
Recording of data
telegrams
Recording of cargo
indicator labels
Execution of a function
within an interval starting
from an earliest time
Sequence control in
batch processes
Recording of signals
of a light barrier
© 2015 IAS, Universität Stuttgart
261
4.1 Problem definition
IAS
Requirements for concurrency
Processes in the “real world” take place simultaneously
Real-time systems have to react to that simultaneously
Several computation tasks have to be executed
simultaneously
Examples:
–
Reaction to simultaneous trips of several trains
–
Processing of several simultaneously occurring measurements in
heating systems
–
Control motor and ABS system simultaneously
© 2015 IAS, Universität Stuttgart
262
4.1 Problem definition
IAS
Realization of concurrency
–
Each computation task is processed on a separate computer
–
One computer for all data processing tasks
Prerequisite:
Processes in the environment are slow in comparison to
the computation of the programs on the computer
© 2015 IAS, Universität Stuttgart
263
4.1 Problem definition
IAS
Requirements for determinism
Determinism = predictability of the system behavior
Parallel and quasi-parallel sequences are generally not predictable; time
shifts can lead to different execution sequences.
–
the time behavior is not deterministic
–
no guaranty of the safety of automation systems
© 2015 IAS, Universität Stuttgart
264
4.1 Problem definition
IAS
Deterministic real-time system
A real-time system is called deterministic if for each possible state and for
each set of input information there is a defined set of output information and a
defined following state.
Timely deterministic system
The response times for all output information are known
In a deterministic system it is guaranteed that the system can react at every
time. In a timely deterministic system it is additionally guaranteed at which
time the reaction will have taken place.
© 2015 IAS, Universität Stuttgart
265
4.1 Problem definition
IAS
Dialog systems
–
Input data from input mediums
Keyboard
Light pen
Mouse
–
Waiting for reply, i.e. output of results on an output medium
Screen
Printer
Examples of dialog systems
– Seat reservation systems of airline companies
– Account management in banks
– Storekeeping systems
Timeliness in dialog systems
© 2015 IAS, Universität Stuttgart
266
4.1 Problem definition
IAS
Industrial Automation Systems
Time reaction depends on the processes in the technical system
Timeliness in automation systems
Methods for real time programming are similar for
– Industrial Automation Systems
– Dialog systems
© 2015 IAS, Universität Stuttgart
267
Chapter 4: Real-Time Programming
IAS
Question referring to Chapter 4.1
Which kind of real-time systems are the following ones?
Answer
hard real-time
system
soft real-time
system
Newspaper printing device
car electrical window control
TV electron beam control
telephone switching control
CNC milling head control
aircraft turbine engine control
© 2015 IAS, Universität Stuttgart
268
IAS
§4
Real-time programming
4.1
Problem definition
4.2
Real-time programming methods
4.3
Tasks
4.4
Synchronization of tasks
4.5
Communication between tasks
4.6
Scheduling methods
© 2015 IAS, Universität Stuttgart
269
4.2 Real-time programming methods
IAS
Different methods
–
Synchronous programming:
Planning of the time sequence in advance of the execution of
programs
–
Asynchronous programming (parallel programming):
Organization of the time sequence during the execution of the
programs.
© 2015 IAS, Universität Stuttgart
270
4.2 Real-time programming methods
IAS
e.g.: Dentist's office as real-time system (live writing)
Patient
Automation Program
Execution Dentist and dentist’s chair
place
Organiser Dentist's assistant
Preplanning
Planning of the time sequence
before the treatment with a
appointment calendar
Liveplanning
Planning of the time sequence
during the treatment
(calls from the waiting room)
© 2015 IAS, Universität Stuttgart
271
4.2 Real-time programming methods
IAS
Synchronous programming method
Synchronous programming:
Planning of the time behavior of subprograms that have to be executed
cyclically, before their actual execution
–
Synchronization of the cyclical subprograms within time frames
–
Time frames are generated by a real-time clock
–
Interrupt signals for the call of subprograms
–
Predefined sequence of the execution of subprograms
© 2015 IAS, Universität Stuttgart
272
4.2 Real-time programming methods
IAS
Example: heating system
u1 (t)
controlled system 1
"heating circuit flat"
u2 (t)
controlled system 2
"heating circuit office"
room temperature
flat
y1 (t)
room
temperature
office
y2 (t)
preheatingtemperature
u3 (t)
controlled system 3 y3 (t)
"boiler"
analog-output
analog-input
process-signal-in/output
real-time
clock
© 2015 IAS, Universität Stuttgart
automation
computer
operating
terminal
273
4.2 Real-time programming methods
IAS
Technical (control engineering) conception
–
Design and calculation of the control algorithms and
control parameters
–
Determination of the sampling time for the control loop
T
=
real-time clock - cycle time
Ti
=
sampling time for control circuit i
T1
=
T
T2
=
2T
T3
=
5T
© 2015 IAS, Universität Stuttgart
274
4.2 Real-time programming methods
IAS
Assignment of the identifiers and sampling times to the
subprograms (control programs)
a subprogram for each control circuit
Subprogram
Identifier
(name)
Sampling time
(cycle time)
Temperature control for
subsystem “heating circuit: flat“
CONTROL 1
T1 = T
Temperature control for
subsystem “heating circuit: office“
CONTROL 2
T2 = 2T
Temperature control for
subsystem “heating circuit: boiler“
CONTROL 3
T3 = 5T
© 2015 IAS, Universität Stuttgart
275
4.2 Real-time programming methods
IAS
Preliminary design with synchronous programming
Start
Interrupt signals
from the real-time clock
with the cycle time T
invoke all T1 = T
CONTROL1
invoke all T2 = 2T
CONTROL2
invoke all T3 = 5T
CONTROL3
Wait loop
© 2015 IAS, Universität Stuttgart
276
4.2 Real-time programming methods
IAS
Final design of the control program according to the
synchronous programming method
START
Definition of the counter variables
Z2 and Z3
In time intervals T
successively appearing
interrupt signals
cause start at this point
Z2 := 1
Z3 := 1
initialize Z2 and Z3
CONTROL1
no
Z2=2
?
yes
CONTROL2
Z2 := Z2 + 1
Z2 := 1
no
Z3=5
?
yes
CONTROL3
Z3 := Z3 + 1
Z3 := 1
Wait loop
© 2015 IAS, Universität Stuttgart
277
4.2 Real-time programming methods
IAS
Time sequence of the synchronous programming method
ca. 5T
CONTROL3
2T
T
CONTROL2
CONTROL1
Control program
t/T
0
Assumption:
1
2
3
4
5
6
7
8
Interrupt signal of the real-time clock
9
10
- Computation time for subprograms is identical
- Sum of computation times of the three subprograms
is smaller than cycle time
© 2015 IAS, Universität Stuttgart
278
4.2 Real-time programming methods
IAS
Characteristics of the synchronous programming method (1)
–
Requirement for timeliness is approximately fulfilled
–
Requirement for concurrency is fulfilled, if cycle time T is small
compared to the time constants in the technical process
–
Synchronous programming is good for real-time systems with cyclic
program execution
–
Synchronous programming is not suitable for the reaction on timely
non-predictable (asynchronous) events
Increase of computation time due to constant polling
Delay of the reaction
© 2015 IAS, Universität Stuttgart
279
4.2 Real-time programming methods
IAS
Characteristics of the synchronous programming method (2)
–
Normally deterministic behavior
–
No complex programs for operation
–
More efforts for planning (development)
Disadvantage of synchronous programming:
Modification of the tasks causes modification of the complete program
structure!
© 2015 IAS, Universität Stuttgart
280
4.2 Real-time programming methods
IAS
Asynchronous programming method
(parallel programming)
Organization program (real-time operating system) controls the timely
execution of subprograms at run-time
–
Execution of subprograms, when time requirements are fulfilled
–
Simultaneous execution is sequentialized according to a certain strategy
Assignment of priority numbers
The smaller the priority number, the higher the priority
© 2015 IAS, Universität Stuttgart
281
4.2 Real-time programming methods
IAS
Example: heating system
u2(t)
u3 (t)
Analog-Output
Controlled
system
1
y1 (t)
Controlled
system
2
Warning
lamp
y2 (t)
Controlled
system
3
Burner failure signal
u1 (t)
y3 (t)
Analog-Input
Digital
Output
Digital
Input
Process unit
Realtime
clock
© 2015 IAS, Universität Stuttgart
Automation
computer
system
Operating terminal
Printer
282
4.2 Real-time programming methods
IAS
Assignment of identifiers, sampling times and priority
Subprogram
Sampling
time
Priority
number
Priority
ALARM
Reaction
on burner failure
with alarm
message
–
1
highest
CONTROL 1
Temperature
control unit for
heating circuit 1
T1 = T
2
second
highest
CONTROL 2
Temperature
control unit for
heating circuit 2
T2 = 2T
3
third
highest
CONTROL 3
Temperature
control unit for
heating circuit 3
T3 = 5T
4
lowest
Identifier-Name
© 2015 IAS, Universität Stuttgart
283
4.2 Real-time programming methods
IAS
Time sequence of the four subprograms
a)
Desired course
CONTROL3
(Priority 4)
CONTROL2
(Priority 3)
CONTROL1
(Priority 2)
ALARM
(Priority 1)
T
t
Burner
failure
signal
real-time clock
b)
Actual course
T3(1)
CONTROL3
CONTROL2
T1(1)
T2(3)
T2(2)
T2(1)
T1(2)
T1(3)
T2(4)
T1(4)
CONTROL1
ALARM
Operating
system
t
0
T
2T
© 2015 IAS, Universität Stuttgart
3T
4T
5T
6T
7T
8T
284
4.2 Real-time programming methods
IAS
Characteristics of the asynchronous programming method
–
Requirements for timeliness only approximately fulfilled
–
Time conditions are controlled by the priority of the corresponding
subprogram (higher priority for execution)
–
Actual execution can delay and not meet the targeted time frame
–
The sequence of the subprograms is not deterministic, but is
computed dynamically
–
At the time of program development it cannot be defined which
of the subprograms will run at which point of time
simple development
complex operation / management program
program sequence is not obvious
© 2015 IAS, Universität Stuttgart
285
4.2 Real-time programming methods
IAS
Event-driven architectures
–
–
–
–
all activities as sequences of events
activation of tasks
transmission of messages
support through real-time operating systems
non-deterministic behavior
flexible regarding modifications
Time-driven architectures
–
periodical execution of all tasks and communication actions
–
sampling of external variable at determined times
–
low flexibility in case of modifications
–
easy to analyze
© 2015 IAS, Universität Stuttgart
286
Chapter 4: Real-Time Programming
IAS
Question referring to Chapter 4.2
Which of the following statements regarding to real-time programming do
you agree?
Answer
In real-time programming only the timeline of an event is in center.
Real-time means „as fast as possible“.
In soft real-time systems timelines do not have to be fulfilled.
The asynchronous programming method is more flexible regarding to outer
events than a synchronous programming method.
A synchronous programming requires cyclic program flow.
The synchronous programming method does not fulfill the requirement for
concurrency.
© 2015 IAS, Universität Stuttgart
287
IAS
§4
Real-time programming
4.1
Problem definition
4.2
Real-time programming methods
4.3
Tasks
4.4
Synchronization of tasks
4.5
Communication between tasks
4.6
Scheduling methods
© 2015 IAS, Universität Stuttgart
288
4.3 Tasks
IAS
Distinction
–
Program (sequence of commands)
–
Execution of the program (a single execution of the command
sequence of a program)
–
Task
Invocation of subprograms
–
Execution of the invoking program is interrupted
–
Execution of the subprogram
–
Continuation of the invoking program
Invocation of a task
–
Simultaneous execution of the invoking program and of the invoked
task
© 2015 IAS, Universität Stuttgart
289
4.3 Tasks
IAS
Task
A task is the procedure of execution of a sequential program controlled by a
real time operating system
–
Task starts with entry in a list of the real-time operating system and
ends with the deletion from that list
–
Task does not exist only during the execution of the commands,
but also during planned and forced waiting times
© 2015 IAS, Universität Stuttgart
290
4.3 Tasks
IAS
Differences between task and thread
Task
Thread
Owner of resources
Cannot own resources besides the
processor,
accesses all resources of the task,
to which it belongs
Own address space
Address space of the task, to which
it belongs
Contains one or several threads
Element of a task
Communication beyond the
task boundaries, preferred
via messages
Communication between threads,
preferred via shared data
© 2015 IAS, Universität Stuttgart
291
4.3 Tasks
IAS
Four basic states
– State “running”
the task is processed
– State “runnable” or “ready”
all time conditions for the process are fulfilled
what is missing is the start from the operating system
– State “suspended”
task is waiting for the occurrence of an event
as soon as event occurs transition from state “suspended” to “ready”
– State “dormant”
task is not ready because time conditions or other conditions are not
fulfilled
© 2015 IAS, Universität Stuttgart
292
4.3 Tasks
IAS
State diagram of a task
Dec
lara
tion
of t
he t
ask
sk
Planning of tasks
f ta
no
o
i
t
e
Del
–
Invocation of a task cyclically
or at certain times
–
“Planning” is the transition
from the state “dormant” into
the state “runnable”
"dormant"
"runnable"
"suspended"
"running"
© 2015 IAS, Universität Stuttgart
293
4.3 Tasks
IAS
Course of the task “Control 3”
in the asynchronous programming method
The task
Control 3
is:
running
(active)
suspended
runnable
(ready)
dormant
0
T
© 2015 IAS, Universität Stuttgart
2T
3T
4T
5T
6T
7T
294
4.3 Tasks
IAS
Assignment of priorities for tasks
–
static priority assignment
–
dynamic priority assignment (use of deadlines)
Time parameters of a task :
A:
Arrival time
R:
Request time
S:
Start time
C:
Completion time
D:
Deadline
E(t):
Execution time
P:
Period time
L(t):
Laxity
F(t):
Flow time
RF(t):
Remaining flow time
© 2015 IAS, Universität Stuttgart
295
4.3 Tasks
IAS
Appearance of the time parameters of a task
flow time F(t)
remaining flow time RF(t)
period time P
A: Arrival time
R: Request time
S: Start time
C: Completion time
D: Deadline
states of a task
laxity L(t)
execution time E(t)
"running"
Eold (t)
Enew(t)
„suspended"
„runnable"
"dormant"
A
R
S
C
time of viewing
© 2015 IAS, Universität Stuttgart
D
t
296
4.3 Tasks
IAS
Correlation between the time parameters of a task
A <= R <= S <= C - E <= D - E
E(t) = Eold (t) + Enew (t)
Eold (t):
present execution time at time of viewing
Enew (t):
remaining execution time
for the execution of a task
L=D-S-E
© 2015 IAS, Universität Stuttgart
297
Chapter 4: Real-Time Programming
IAS
Question referring to Chapter 4.3
With which of the following statements regarding the four basic task states
do you agree?
Answer
A task in the state “runnable” is being processed.
The task state can directly move from “running” to “dormant”.
A task in the state “suspended” can move directly to “running”.
In the state “dormant” a task is not ready because time conditions or other
conditions are not fulfilled.
A task in the state “suspended” is waiting for the occurrence of an event.
© 2015 IAS, Universität Stuttgart
298
IAS
§4
Real-time programming
4.1
Problem definition
4.2
Real-time programming methods
4.3
Tasks
4.4
Synchronization of tasks
4.5
Communication between tasks
4.6
Scheduling methods
© 2015 IAS, Universität Stuttgart
299
4.4 Synchronization of tasks
IAS
Classification of the actions of a task
–
Two actions of tasks are called parallel if they can run
simultaneously
–
Two actions are called sequential if they are arranged in a certain
sequential order
–
Two actions of two different tasks are called concurrent if they can
run simultaneously (outer parallelism)
–
Two actions of one task are called simultaneous, if they can run
at the same time
© 2015 IAS, Universität Stuttgart
300
4.4 Synchronization of tasks
IAS
Requirement on the execution of tasks
Synchronicity between tasks and the technical process
Dependencies between tasks
–
Logical dependency because of the technical process
–
Dependencies through the use of shared resources
© 2015 IAS, Universität Stuttgart
301
4.4 Synchronization of tasks
IAS
Example
the dependencies of tasks
due to shared resources
Shared resources:
– report printer
– analog-input
© 2015 IAS, Universität Stuttgart
Task
MEASUREMENTS
Task
PROCESS SUPERVISION
Use analoginput
Use of driver
program
program for
for
report printer
Input and
conversion of
measurements
Output error
message on
report printer
Use of driver
program for
report printer
Use analoginput
Printmeasurements
and time
Input and
monitor process
variables
302
4.4 Synchronization of tasks
IAS
Problems of dependency
Deadlock:
Two or more tasks block themselves mutually
Permanent blocking (livelock, starvation)
A conspiracy of tasks block a task
Time coordination of the tasks
=
synchronization of tasks
=
limitation of the free parallel execution
© 2015 IAS, Universität Stuttgart
303
4.4 Synchronization of tasks
IAS
Example for a deadlock
Road crossing without traffic lights.
Traffic rule is “right before left“.
© 2015 IAS, Universität Stuttgart
304
4.4 Synchronization of tasks
IAS
Example for a livelock: “ The Dining Philosophers”
- every philosopher needs 2 chopsticks to eat
- no chopstick can be reserved
© 2015 IAS, Universität Stuttgart
305
4.4 Synchronization of tasks
IAS
Main forms of synchronization
Logical synchronization
(task oriented or process oriented synchronization)
–
Adaptation of the sequence of actions of a task to the
sequence of operations in the technical process.
–
Synchronization means
Fulfillment of requirements regarding the sequence of
actions
Consideration of given times and/or time intervals
Reaction to the interrupt messages from the technical
process
Resource-oriented synchronization
–
Fulfillment of requirements regarding the use of shared
resources
© 2015 IAS, Universität Stuttgart
306
4.4 Synchronization of tasks
IAS
Synchronization methods
–
–
–
Semaphore
Critical regions
Rendezvous concept
Basic idea of all synchronization methods
–
Task has to wait until a certain signal or event occurs
–
Use of waiting conditions at critical places
© 2015 IAS, Universität Stuttgart
307
4.4 Synchronization of tasks
IAS
Semaphore concept
Synchronization of tasks through signals (Dijkstra)
Semaphore variable:
positive integer value
semaphore operations: V(S) und P(S)
V(Si):
P(Si):
Operation V(Si) increases the value of the semaphore
variable Si by 1
Operation P(Si) determines the value of Si
if value of Si > 0
decrease Si by 1
if Si = 0 it has to be waited,
until Si > 0
© 2015 IAS, Universität Stuttgart
308
4.4 Synchronization of tasks
IAS
Example 1: Railroad traffic with single-track route
in
A
tra
in
B
tra
track magnet
Direction of the trains
P(S1)
track magnet
P(S1)
signal
S1
V(S1)
track magnet
in
tra
tra
© 2015 IAS, Universität Stuttgart
B
in
track magnet
A
V(S1)
0
1
309
4.4 Synchronization of tasks
IAS
AA
nn
aai i
TTrr
Track
Track magnet
magnet
TTrr
aai i
nn
BB
Example 2: Railroad traffic with single-track route
Track
Track magnet
magnet
trains
thetrains
ofthe
Direction
Directionof
P(S1)
P(S1)
P(S2)
P(S2)
Signal
Signal
S1
S1
1
0
0
0
1
0
V(S1)
V(S1)
Track
Track magnet
magnet
Track
Track magnet
magnet
TTrr
aai i
nn
AA
V(S2)
V(S2)
Signal
Signal
S2
S2
BB
nn
aai i
TTrr
© 2015 IAS, Universität Stuttgart
310
4.4 Synchronization of tasks
t
© 2015 IAS, Universität Stuttgart
S2 = 0
P (S1)
S1 = 0
V(S2)
S2 = 1
Task B
operations on two tasks,
that always run
alternately
S1 = 1
Task A
Example:
IAS
P (S1)
S1 = 0
V(S2)
S2 = 1
P (S2)
S2 = 0
V(S1)
S1 = 1
P (S2)
S2 = 0
t
311
Chapter 4: Real-Time Programming
IAS
Question referring to Chapter 4.4
a) Two tasks access the same temperature sensor in an automation
system.
b) A control algorithm is divided into three tasks: „input of actual value“,
„calculation of control variable“ and „output of control variable“. These
tasks always have to be executed in this sequence.
Which type of synchronization has to be used respectively ?
How many semaphore variables are necessary in each case ?
Answer
© 2015 IAS, Universität Stuttgart
312
IAS
§4
Real-time programming
4.1
Problem definition
4.2
Real-time programming methods
4.3
Tasks
4.4
Synchronization of tasks
4.5
Communication between tasks
4.6
Scheduling methods
© 2015 IAS, Universität Stuttgart
313
4.5 Communication between tasks
IAS
Definition
Synchronization =
Fulfillment of time related and logical conditions in the parallel run of tasks
Communication =
Exchange of data between parallel running tasks
© 2015 IAS, Universität Stuttgart
314
4.5 Communication between tasks
IAS
Possibilities of data communication
–
Shared memory (commonly used memory)
common variable
common complex data structure
–
Sending of messages
transmission of messages from a task to another (message
passing)
especially in distributed systems
© 2015 IAS, Universität Stuttgart
315
4.5 Communication between tasks
IAS
Different kinds of communication
–
Synchronous communication
Sending and receiving processes communicate
at a certain predefined position in the program flow
–
Asynchronous communication
Data are buffered
© 2015 IAS, Universität Stuttgart
316
Chapter 4: Real-Time Programming
IAS
Question referring to Chapter 4.5
With which of the following statements regarding asynchronous
communication between tasks do you agree?
Answer
Sent messages can be buffered.
Sending tasks are blocked after sending a message.
Receiving tasks are blocked after reception, until they respond to the
message.
When using asynchronous communication, sending and receiving tasks
don’t have to wait for each other.
© 2015 IAS, Universität Stuttgart
317
IAS
§4
Real-time programming
4.1
Problem definition
4.2
Real-time programming methods
4.3
Tasks
4.4
Synchronization of tasks
4.5
Communication between tasks
4.6
Scheduling methods
© 2015 IAS, Universität Stuttgart
318
4.6 Scheduling methods
IAS
Scheduling problem
–
Tasks need resources
(processor, device etc.)
–
Number of resources is limited
–
Tasks compete for resources
–
Allocation of resources has to be managed
© 2015 IAS, Universität Stuttgart
319
4.6 Scheduling methods
IAS
Scheduling:
Allocation of the processor to runnable tasks according to a predefined
algorithm (Scheduling-method)
Problem:
1.
Is there an executable schedule for a set of tasks?
2.
Is there an algorithm that can find an executable schedule?
© 2015 IAS, Universität Stuttgart
320
4.6 Scheduling methods
IAS
Classification dependent on the time of the planning
–
Static scheduling
Planning of the execution sequence of the tasks is done before the
actual execution (dispatching table)
Consideration of information on task set, deadlines, execution
times, sequential relations, resources
Dispatcher carries out the allocation according to dispatching table
Runtime overhead minimal
Deterministic behavior
–
Dynamic scheduling
Organization of the execution sequence during the execution of
the tasks
Considerable runtime overhead
© 2015 IAS, Universität Stuttgart
321
4.6 Scheduling methods
IAS
Classification according to the kind of execution
–
Preemptive scheduling
running task can be interrupted
higher priority tasks replace lower priority tasks
–
Non-preemptive scheduling
running task cannot be interrupted
processor-deallocation by the task itself
© 2015 IAS, Universität Stuttgart
322
4.6 Scheduling methods
IAS
Scheduling methods
–
FIFO scheduling (first-in-first-out)
–
Round-Robin-Method (Time-Slice-Method)
–
Scheduling with fixed (invariable) priorities
–
Rate-Monotonic scheduling
–
Earliest-Deadline-First method
–
Method of minimal laxity (least laxity)
© 2015 IAS, Universität Stuttgart
323
4.6 Scheduling methods
IAS
FIFO scheduling
–
Non-preemptive scheduling
–
The processor is allocated to the task with the longest delayed planning
–
Simple implementation
Example: FIFO scheduling
Task A runnable
Task B runnable
Task C runnable
Task D runnable
t
The tasks are executed in the order in which they become runnable
A
B
C
D
t
© 2015 IAS, Universität Stuttgart
324
4.6 Scheduling methods
IAS
Round-Robin-Method (Time-Slice-Method)
–
Each task has a determined time slot in which the processor is
allocated to it
–
Sequence is determined statically
–
Execution of a task “step by step”
–
Used in dialog systems (multi-tasking systems)
© 2015 IAS, Universität Stuttgart
325
4.6 Scheduling methods
IAS
Example: Round-Robin-Method
Each time slice has 10ms and the tasks were arranged in the following
order: A-B-C-D.
Execution time of the tasks:
Task A:
Task B:
Task C:
Task D:
A
25ms
20ms
30ms
20ms
B
C
D
10 20
© 2015 IAS, Universität Stuttgart
A
B
C
D
A C
t/ms
326
4.6 Scheduling methods
IAS
Scheduling with fixed priorities
–
Priorities are assigned statically
–
The processor is allocated to the task with the highest priority
–
Preemptive and non-preemptive strategy is possible
–
Simple implementation
© 2015 IAS, Universität Stuttgart
327
4.6 Scheduling methods
IAS
Example: Fixed priorities
Task
A
Priority
1
B
C
D
E
1
2
3
3
Highest
Priority
If priority of some tasks is identical, another subordinate rule is
necessary
A*
B
C
D
E
t
© 2015 IAS, Universität Stuttgart
328
4.6 Scheduling methods
IAS
Rate-Monotonic Scheduling
–
Special case of scheduling with fixed priorities for cyclic tasks
–
The shorter the period, the higher the priority
–
Task with the shortest period has the highest priority
–
Pre-emptive strategy
© 2015 IAS, Universität Stuttgart
329
4.6 Scheduling methods
IAS
Example: Rate-Monotonic Scheduling
Task
Execution
time
Period
Priority
A
B
C
D
10 ms
20 ms
10 ms
20 ms
40 ms
50 ms
80 ms
100 ms
1
2
3
4
First scheduled call of all tasks at t = 0 ms.
Afterwards the tasks have to be repeated cyclically.
A1
0
B1
10
20
C1 A2
30
© 2015 IAS, Universität Stuttgart
40
B2
50
60
D1a A3 C2
70
80
90
B3
A4 D1b
100 110 120 130
t / ms
330
4.6 Scheduling methods
IAS
Earliest-Deadline-First-Method
(Minimal-remaining-flow-time-method)
–
The processor is allocated to the task with the shortest
remaining flow time
–
Preemptive method
–
High computation effort for the scheduling
–
Compliance with requirements on time is specially supported
© 2015 IAS, Universität Stuttgart
331
4.6 Scheduling methods
IAS
Example: Earliest-Deadline-First-Method
Task
Execution Time
Tmin
Tmax
A
10 ms
0 ms
40 ms
B
10 ms
0 ms
30 ms
C
30 ms
30 ms
100 ms
D
40 ms
50 ms
200 ms
E
10 ms
70 ms
90 ms
Tmin:
earliest time to start
Tmax:
latest time to finish
= deadline
Execution sequence:
B
A
C
D*
E
D
t/ms
10
20
30
© 2015 IAS, Universität Stuttgart
40
50
60
70
80
90
100
110
120
332
4.6 Scheduling methods
IAS
Least laxity method
–
Processor is allocated to the task with the smallest laxity
–
Consideration of deadlines and of the execution time
–
Very expensive method
(see slide 301)
© 2015 IAS, Universität Stuttgart
333
4.6 Scheduling-Methods
IAS
Example: Least laxity method
Task
Execution Time
Activation
TD
A
30 ms
0 ms
40 ms
B
10 ms
0 ms
30 ms
C
30 ms
30 ms
100 ms
D
40 ms
50 ms
200 ms
E
10 ms
70 ms
90 ms
TD: Deadline
Execution Sequence
B
Aa
10
20
Ab
30
© 2015 IAS, Universität Stuttgart
C
E
D
t/ms
40
50
60
70
80
90
100
110
120
334
4.6 Scheduling methods
IAS
Schedulability test
A schedulability test is a mechanism to proof whenever a set of tasks can be
scheduled in such a manner that the deadlines are not missed.
Being a mathematical proof, it is important to differentiate between:
–
necessary condition
–
sufficient condition
–
necessary and sufficient condition
© 2015 IAS, Universität Stuttgart
335
4.6 Scheduling methods
IAS
Theorem of Liu und Layland (Part I)
Any given set of tasks (Deadline = Period) can be executed by the preemptive
Earliest-Deadline-First-Method when:
n
i 1
Ci
Ti
© 2015 IAS, Universität Stuttgart
1
Where:
Ci : Execution time of task i
Ti : Period of task i
n: Number of tasks
336
4.6 Scheduling methods
IAS
Theorem of Liu und Layland (Part II)
Any given set of tasks (Deadline = Period) can be executed by the
Rate-Monotonic method when:
n
i 1
U 1*
Ci
Ti
U n*
0,828
U 3*
0,779
U*
ln 2
1 , n 1, 2,...
Where:
1,0
*
2
U
n 2
1
n
Ci : Execution time of task i
Ti : Period of task i
Un*: Utilisation of processor with n tasks
n: Number of tasks
0,693
© 2015 IAS, Universität Stuttgart
337
Chapter 4: Real-Time Programming
IAS
Question referring to Chapter 4.6
In the so called „shortest-job-first“-scheduling method, the task with the
shortest execution time is selected for processing at run-time. However,
running tasks cannot be interrupted by other tasks.
Which type of scheduling method is this ?
Answer
Remark:
The “shortest-job-first” method determines a schedule, that minimizes the
average flow-time.
© 2015 IAS, Universität Stuttgart
338
Chapter 4: Preparation Task
IAS
Preparation Task to Chapter 4
Question 1: Deadlocks (WT 2003/2004)
A programmer states that a system with shared resources, but without
additional safety mechanisms (e.g. Priority Ceiling Protocol), automatically
reaches a deadlock state.
Do you agree with that? Justify your answer.
Question 2: Shared resources (WT 2003/2004)
Assume a system with five tasks (named from T1 to T5). The tasks have fixed
priorities according to their indices; i.e. task T1 has the highest priority and task
T5 the lowest priority. The schedule is made using the Priority Inheritance
Protocol. For their execution the tasks require three shared resources, even
though a task can not use more than one resource at once. The maximum
holding time of each shared resource is 100ms. What is the maximum blocking
time that can appear for T1 and T5 due to a needed resource? Justify your
answer.
© 2015 IAS, Universität Stuttgart
339
Chapter 5: Real-Time Operating Systems
§5
IAS
Real-Time Operating Systems
Learning targets
–
to know what an operating system and resources do
–
to know what interrupts are
–
to be able to explain how the memory management is working
–
to know the development process and composition of a mini real-time
operating system
–
to know how the mini real-time operating system is working and how it can
be extended
–
to get an overview of real-time operating systems
© 2015 IAS, Universität Stuttgart
340
IAS
§5
Real-time operating systems
5.1
Definition
5.2
Organization tasks of a real-time operating system
5.3
Development of a mini real-time operating system
5.4
Software system design of the mini real-time operating system
5.5
Examples for real-time operating systems
© 2015 IAS, Universität Stuttgart
341
5.1 Definition
IAS
What is an operating system?
Definition DIN 44300:
Operating systems are programs of a digital computer system that
together with the characteristics of the computer hardware form the
basis of the possible operating modes of the digital computer system
and especially control and supervise the handling of programs.
Operating system
–
Systematically built up collection of control programs and tools
–
Allocation of the existing resources to the competing computation
tasks
–
Simplification of the operating and programming of the computer and
its attached devices for the user
© 2015 IAS, Universität Stuttgart
342
5.1 Definition
IAS
Characteristic of operating systems
–
Realization of the hardware-dependent operations
–
In many cases enclosing from the producer of the computer
efficient operating system requires exact knowledge on the
hardware structure
often for entire computer lines
amortization of the high development costs of an operating
system
–
Size
–
Integration of classical operating systems modules in form of
semiconductor chips
© 2015 IAS, Universität Stuttgart
343
5.1 Definition
IAS
Resources
–
Objects necessary for the execution of the computation tasks and for
which allocation the computation task has to wait
–
Device units
Processors
Memory
Peripheral devices like printers
–
System programs
© 2015 IAS, Universität Stuttgart
344
5.1 Definition
IAS
Categories of real-time operating systems (1)
–
Real-time – UNIX / POSIX-conform systems
Portable Operating System Interface: IEEE 1003 / IEC 9945standard for interface between application and OS
Compatible to UNIX-System V
IEEE 1003.1 defines extended real-time functionalities
Used in process control systems
–
Real-time - kernels
UNIX-compatible micro-kernel with
Memory management,
Interrupt handling,
Scheduler,
Task management,
Interfaces on basis of TCP/IP
Optimally adapted to real-time requirements
Well optimized code for different platforms
© 2015 IAS, Universität Stuttgart
345
5.1 Definition
IAS
Categories of real-time operating systems (2)
–
Real-time operating system extensions
Extension of non-real-time operating systems
Library for the compliance with real time conditions
–
Real-time operating systems
Very efficient
Flexibly configurable
Oriented on UNIX (structure / appearance)
Usually specially adapted to a problem field
© 2015 IAS, Universität Stuttgart
346
5.1 Definition
IAS
Question referring to Chapter 5.1
What are the objectives of the task administration of an operating system?
Answer
Creation of new tasks if requested by the operating system.
Creation of new tasks if requested by other tasks.
Removal of tasks from the system.
Enabling the communication between tasks.
© 2015 IAS, Universität Stuttgart
347
Industrial Automation
§5
Real-time operating systems
5.1
Definition
5.2
Organization tasks of a real-time operating system
5.3
Development of a mini real-time operating system
5.4
Software system design of the mini real-time operating system
5.5
Examples for real-time operating systems
© 2015 IAS, Universität Stuttgart
IAS
348
5.2 Organization tasks of a real-time operating system
IAS
Tasks of a real-time operating system
Management of computer processes and resources in compliance with the
requirements for timeliness, concurrency and efficiency
Functions of a real-time operating system
–
Organization of the execution of the computation processes
(Scheduling)
–
Organization of the interrupt handling
–
Organization of the memory management
–
Organization of the input/output
–
Organization of the processes in case of irregular operating states and
start-up/restart
© 2015 IAS, Universität Stuttgart
349
5.2 Organization tasks of a real-time operating system
IAS
Layer-architecture of an automation computer system
Automation programs
computation
process 1
computation
process 2
computation
process n
Resources
resources 1
resources 2
resources n
Real-time operating system
Management of
computation processes:
Management of
resources :
© 2015 IAS, Universität Stuttgart
register,
instruct,
planning,
terminate,
etc.
announce,
create,
request,
occupy,
release,
etc.
350
5.2 Organization tasks of a real-time operating system
IAS
Computation process management
Different kinds of computation processes
Application processes
System processes
Tasks of the computation process management
Coordination of the execution of application and system
processes
Parallel operation of as many resources as possible
Handling of queues for resources
Synchronization of application and system processes
Avoidance, identification and elimination of deadlocks
© 2015 IAS, Universität Stuttgart
351
5.2 Organization tasks of a real-time operating system
IAS
Interrupt handling
–
Interruption of the planned program sequence
–
Start of a service routine
Planned program sequence: (without interrupts)
control program
t
increasing
priority
Actual operational sequence: (with interrupts)
Interrupt 1
control program
ISR 1
control program
t
© 2015 IAS, Universität Stuttgart
352
5.2 Organization tasks of a real-time operating system
IAS
Interrupt handling
–
Creation and processing of interrupts
–
Start of an interrupt service routine while simultaneously interrupting
the presently running computation process
–
Prioritization of interrupts
–
Hardware functions for interrupt handling
(within the range of micro-seconds)
© 2015 IAS, Universität Stuttgart
353
5.2 Organization tasks of a real-time operating system
IAS
Memory management
The cost of memory space is proportional to the access speed
Memory hierarchy levels
–
–
–
–
Cache memory (extremely fast semiconductor memory)
Main memory
Hard disc memory
Floppy disc
Tasks of the memory management
–
–
–
–
Optimal usage of the “fast” memories
Coordination of the access on a shared memory area
Protection of the memory area of different computer processes
against false accesses
Assignment of physical memory addresses for the logical names in
application programs
© 2015 IAS, Universität Stuttgart
354
5.2 Organization tasks of a real-time operating system
IAS
Input/output control
Different kinds of input/output devices
–
–
Distinction in speed
Distinction in data formats
Realization of the input/output control
–
–
Hardware-independent level for the data management and the data
transport
Hardware-dependent level, that takes into account all device specific
characteristics (driver programs)
© 2015 IAS, Universität Stuttgart
355
5.2 Organization tasks of a real-time operating system
IAS
Error Handling
Classification of errors (1)
–
Faulty user inputs
Non-valid inputs have to be rejected with error message
–
Faulty application programs
Guaranty, that a faulty application program does not
affect other programs
© 2015 IAS, Universität Stuttgart
356
5.2 Organization tasks of a real-time operating system
IAS
Classification of errors (2)
–
Hardware faults and hardware failures
Recognition of hardware faults and failures
Reconfiguration without the faulty parts
Shut-down sequences in case of power failures
–
Deadlocks based on dynamic constellations
Reliable avoidance of deadlocks is not possible
© 2015 IAS, Universität Stuttgart
357
5.2 Organization tasks of a real-time operating system
IAS
Question referring to Chapter 5.2
Consider two different automation systems:
• an event-driven system (e.g. a control of a coffee machine)
• a time-driven system (e.g. a trajectory control of a robot)
For which type of system is the interrupt handling of an operating system
more important?
Answer
© 2015 IAS, Universität Stuttgart
358
Industrial Automation
§5
Real-time operating systems
5.1
Definition
5.2
Organization tasks of a real-time operating system
5.3
Development of a mini real-time operating system
5.4
Software system design of the mini real-time operating system
5.5
Examples for real-time operating systems
© 2015 IAS, Universität Stuttgart
IAS
359
5.3 Development of a mini real-time operating system
IAS
Objective
–
Presentation of the structure and the mode of operation of a real-time
operating system in strongly simplified form
–
Gradual withdrawal of the taken simplifications
Development process
–
Clarification of the problem formulation, determination of the
requirements
–
Technical solution concept
–
Software system design
–
Implementation
© 2015 IAS, Universität Stuttgart
360
5.3 Development of a mini real-time operating system
IAS
Procedure of the development of the mini real-time
operating system
Software System Design
clarification
and
determination
of
requirements
requirement
specification
technical
solution
concept
functional
specification
© 2015 IAS, Universität Stuttgart
preliminary
design of the
program
system
block
diagram
final design
of the
program
system
flow
diagram
implementation
programs
in a programming
language
361
5.3 Development of a mini real-time operating system
IAS
Clarification and determination of the problem formulation
and the requirements
–
Management of a maximum of n computer processes
m
k
–
Computer processes cyclic
Computer processes through interrupt signals
i.e.
n=m+k
One processor for the execution of operations
No optimization of the processes through simultaneous
execution of computation operations and I/O operations
–
Time signal for cyclic activities through internal clock generator
Clock impulses at fixed intervals T (i.e.: T = 20ms)
Different cycle times for the cyclic processes
© 2015 IAS, Universität Stuttgart
362
5.3 Development of a mini real-time operating system
IAS
Simplifications that will be withdrawn at a later point
The sum of all computing times of the computation processes
is smaller that the interval T
Assurance that all computation processes are finished
at the next clock pulse.
No tasks that are started by interrupt
No resource management
Input/output times are negligibly short
© 2015 IAS, Universität Stuttgart
363
5.3 Development of a mini real-time operating system
IAS
Design of a solution concept
Asynchronous programming method
–
Asynchronous instruction of the individual computer processes
–
No fixed sequence of tasks
–
Conflict strategy according to priority numbers
Sub-solution
–
Creation of cycle time
Derivation of the different cyclic times of the tasks from the
clock impulse
–
State management of the tasks
Instruction of the tasks at the corresponding cyclic times and
defined termination
–
Start of the tasks
Start of the task, which turn it is
© 2015 IAS, Universität Stuttgart
364
5.3 Development of a mini real-time operating system
IAS
Solution concept of the mini operating system
Sub-solution 1: creation of
cycle time
creation of the
cycle times
T1, T2, ..., Tm
Subsolution 2:
state management
of the tasks
instruction of the
computer
processes at the
times T1, ..., Tm,
and ending of the
instruction
© 2015 IAS, Universität Stuttgart
Substart of
solution 3: the tasks
start of the
instructed
task
according to
priorities
365
5.3 Development of a mini real-time operating system
IAS
Creation of cycle time
Task:
1.
Creation of the correlation between the cycle times
Ti (i = 1,2,...,m) and the interval T
Assumption:
=>
Ti >> T
Ti = ai T
ai Integral cycle time factors (i=1,2,...,m)
2.
Interval variable Zi (i=1,2,...,m)
Arrival of the clock impulse reduces Zi by 1
Zi = 0:
Cycle time Ti is over
=>
Reset of Zi to initial value ai
© 2015 IAS, Universität Stuttgart
366
5.3 Development of a mini real-time operating system
Sub-solution 1:
creation of
cycle time
IAS
introduction of dimensionless, integral cycle time factors
T1 = a1 T
a1 =
T2 = a2 T
a2 =
Tm = am T
am =
T1
T
T2
T
Tm
T
definition of (dimensionless) interval variables z1, z2, ..., zm with the
initial values
z1 = a 1
z2 = a 2
zm = a m
clock
impulse
at each arrival of clock impulse with interval T:
decremention of the variable zi (decrement by 1), i.e. formation of :
z1 := z1 - 1
z2 := z2 - 1
zm := zm-1
© 2015 IAS, Universität Stuttgart
367
5.3 Development of a mini real-time operating system
IAS
Sub-solution 1:
creation of
cycle time
as soon as a variable turns zi = 0 the corresponding cycle time
Ti is reached. Therefore this result is transfered to the solution
component 2, that is in charge of instructing the process i (putting
the state into "ready").
to/ from
subsolution 2
Reset of the corresponding interval variables to the initial value
zi := ai, Continuation with solution component 2.
to subsolution 2
© 2015 IAS, Universität Stuttgart
368
5.3 Development of a mini real-time operating system
IAS
State management of the computation processes
Task:
–
Management of the states of the computation processes
dormant
ready
running
–
Bookkeeping on the respective states of each process
–
Execution of state transitions
© 2015 IAS, Universität Stuttgart
369
5.3 Development of a mini real-time operating system
Sub-solution 2:
State
From submanagement solution 1
of the
to
computation Back
subsolution 1
processes
From subsolution 1,
if all
interval
variables
are
processed
© 2015 IAS, Universität Stuttgart
IAS
In case of arrival of a message
that the cycle time Ti is over:
Instruction of the computer
processes in question
(putting into the state "ready").
Determine the computer
process in state "ready" with
the highest priority from the list
List of the current
states of the
computer processes
Message to solution
component 3 (start of the
concerning task)
Start message
to
subsolution 3
After the execution of a computer process:
Write down the state "dormant" in the state list
End message
from
subsolution 3
370
5.3 Development of a mini real-time operating system
IAS
Start of the computation processes
Task:
– Determination of the start address
– Starting of the computation processes
– Supervision of the termination of the computer process
© 2015 IAS, Universität Stuttgart
371
5.3 Development of a mini real-time operating system
IAS
Sub-solution 3: Starting of the computation processes
Start message
from
sub-solution 2
After the notification from sub-solution 2:
Determine start address of the computation process in
question
Starting of the computation process in question
(sub-program - jump to start address)
End message
to
sub-solution 2
Notification of sub-component 2 that the computer process
is finished.
© 2015 IAS, Universität Stuttgart
372
5.3 Development of a mini real-time operating system
IAS
Question referring to Chapter 5.3
What actions have to be performed when starting a task?
Answer
The current state of the task has to be determined.
It has to be checked whether the task has the highest priority.
The start address of the task has to be determined.
© 2015 IAS, Universität Stuttgart
373
IAS
§5
Real-time operating systems
5.1
Definition
5.2
Organization tasks of a real-time operating system
5.3
Development of a mini real-time operating system
5.4
Software system design of the mini real-time operating system
5.5
Examples for real-time operating systems
© 2015 IAS, Universität Stuttgart
374
5.4 Software system design of the mini real-time operating system
IAS
Software system design based on strongly simplified
formulation
Principle of the stepwise refinement
Decomposition of the mini operating system in program routines,
that are individually refined as well.
© 2015 IAS, Universität Stuttgart
375
5.4 Software system design of the mini real-time operating system
IAS
Decomposition of the mini real-time operating system program
–
Sub-program TIME ADMINISTRATION
for the formation of the different cyclic times
–
Sub-program TASK ADMINISTRATION
for the administration of the computer processes
–
Sub-program PROCESSOR ADMINISTRATION
allocation of the resource “processor”
starting of the computer processes
MINI REAL TIME
OPERATING
SYSTEM
TIME
ADMINISTRATION
TASK
ADMINISTRATION
© 2015 IAS, Universität Stuttgart
Level 1
PROCESSOR
ADMINISTRATION
Level 2
376
5.4 Software system design of the mini real-time operating system
IAS
Interaction of the sub-programs of the mini real-time
operating system
MINI REAL-TIME OPERATING SYSTEM
TIME
TASK
PROCESSOR
ADMINISTRATION ADMINISTRATION ADMINISTRATION
CLOCK
IMPULSE
Start of a computer
process
End of a computer
process
Symbols
Kick-off (control flow)
Data transfer (data flow)
Program resp. program routine
List of data, e.g. single values (data)
© 2015 IAS, Universität Stuttgart
377
5.4 Software system design of the mini real-time operating system
IAS
Lists necessary for the TIME ADMINISTRATION (1)
–
Time span variable Zi for cyclic time formation
List TIME COUNTER
Filing of the time-span variables zi
z1
z2
m spaces
z3
…
zm
© 2015 IAS, Universität Stuttgart
378
5.4 Software system design of the mini real-time operating system
IAS
Lists necessary for the TIME ADMINISTRATION (2)
–
Cyclic time Ti for each computer process
List CYCLE
Provision of the cyclic time factors a i:
a1
a2
a3
…
m spaces
am
© 2015 IAS, Universität Stuttgart
379
5.4 Software system design of the mini real-time operating system
IAS
Block chart of the sub-program TIME ADMINISTRATION
CLOCK
IMPULSE
CYCLE
© 2015 IAS, Universität Stuttgart
TIME
ADMINISTRATION
Kick-off
TASK ADMINISTRATION
TIME
COUNTER
380
5.4 Software system design of the mini real-time operating system
IAS
List necessary for the TASK ADMINISTRATION and
PROCESSOR ADMINISTRATION
Status and base address of the computer process list
ADMINISTRATION BLOCK
Structure of the list for the administration of computer processes
ADMINISTRATION BLOCK
m spaces
B1
Start address 1
B2
Start address 2
B3
Start address 3
B4
Start address 4
Bm
Start address m
Status bits Bi
Bi = 0: ready
Bi = 1: dormant
© 2015 IAS, Universität Stuttgart
Base address of the code
assigned to the computer
process i (i = 1, 2, ..., m)
381
5.4 Software system design of the mini real-time operating system
IAS
Decomposition of the sub-program TASK ADMINISTRATION
TASK
ADMINISTRATION
ACTIVATION
© 2015 IAS, Universität Stuttgart
SEARCH
LEVEL 2
DEACTIVATION
LEVEL 3
382
5.4 Software system design of the mini real-time operating system
IAS
Block chart of the TASK ADMINISTRATION
from/ to
TIME
ADMINISTRATION
ACTIVATION
SEARCH
ADMINISTRATION
BLOCK
to the PROCESSOR
ADMINISTRATION
Selection of the
start address by
the PROCESSOR
ADMINISTRATION
DEACTIVATION
End of the computer
process in question
© 2015 IAS, Universität Stuttgart
from the PROCESSOR
ADMINISTRATION
383
5.4 Software system design of the mini real-time operating system
ACTIVATION:
Modification of the status bits into “ready”
DEACTIVATION:
Modification of the status bits into “dormant”
SEARCH:
Check if there´s a task in state “ready”
•
Organizing the list ADMINISTRATION BLOCK allows a simple
prioritization.
•
Decomposition of PROCESSOR ADMINISTRATION is not necessary.
© 2015 IAS, Universität Stuttgart
IAS
384
5.4 Software system design of the mini real-time operating system
IAS
Overall block chart of the mini real time operating system
CLOCK
IMPULSE
SEARCH
ADMINISTRATION
BLOCK
CYCLE
TIME COUNTER
TIME ADMINISTRATION
© 2015 IAS, Universität Stuttgart
computer porcess code
ACTIVATION
PROCESSOR ADMINISTRATION
TIME
DEACTIVATION
TASK ADMINISTRATION
385
5.4 Software system design of the mini real-time operating system
IAS
Detail design in form of a flow diagram
CLOCK
IMPULSE
TIME
ADMINISTRATION
l=1
Flow diagram TIME
ADMINISTRATION
TIME COUNTER (I) =
TIME COUNTER (I) -1
TIME COUNTER (I)
= 0?
no
I = M?
yes
TIME COUNTER (I)
= CYCLE (I)
yes
ACTIVATION
no
l=I+1
search
© 2015 IAS, Universität Stuttgart
386
5.4 Software system design of the mini real-time operating system
IAS
Flow diagram of the program TASK ADMINISTRATION
ACTIVATION
ACTIVATION (I)
Address part from
ADMINISTRATION
BLOCK (I)
= 0?
yes
Inquiry if computer
process is available at
all
no
Set STATUS BIT (I) IN
ADMINISTRATION
BLOCK (I) = 0
ERROR
MESSAGE
Reentry
© 2015 IAS, Universität Stuttgart
387
5.4 Software system design of the mini real-time operating system
IAS
Deactivation
Search
SEARCH
I=1
DEACTIVATION (I)
STATUS BIT (I) from
ADMINISTRATION
BLOCK (I)
= 0?
yes
Set STATUS BIT (I)
in ADMINISTRATION
BLOCK (I) = 1
no
I = M?
yes
SEARCH
no
I= I+1
PROCESSOR
ADMINISTRATION (I)
© 2015 IAS, Universität Stuttgart
388
5.4 Software system design of the mini real-time operating system
IAS
Flow diagram of the PROCESSOR ADMINISTRATION
PROCESSOR
ADMINISTRATION (I)
Start computer
process over start
adress in
ADMINISTRATION
BLOCK (I),
i.e. invoke as subprogram
DEACTIVATION (I)
© 2015 IAS, Universität Stuttgart
389
5.4 Software system design of the mini real-time operating system
IAS
First extension of the system design
Admission of longer computing times for tasks
In case of the arrival of a clock impulse it might be necessary to
interrupt a (still) running computer process featuring a longer
execution time and lower priority, in order to start a computer process
with a higher priority.
Program for the interruption administration
© 2015 IAS, Universität Stuttgart
390
5.4 Software system design of the mini real-time operating system
IAS
Sub-program INTERRUPTION ADMINISTRATION
Task:
Rescue of the registers of the processor of a still running task
–
–
–
–
Program counter
Accumulator
Status register
Working register
© 2015 IAS, Universität Stuttgart
391
5.4 Software system design of the mini real-time operating system
IAS
Extended hierarchy chart after the admission of longer
computing times in computer processes
MINI-REAL-TIME OPERATING
SYSTEM
(Extension1)
INTERRUPT
ADMINISTRATION
TIME
ADMINISTRATION
© 2015 IAS, Universität Stuttgart
TASK
ADMINISTRATION
PROCESSOR
ADMINISTRATION
392
5.4 Software system design of the mini real-time operating system
Extension of the list
ADMINISTRATION BLOCK
B1
–
Start address after an
interruption
Register memory
location
Base address 1
Start address (program counter contents)
Register contents 1
Task 1
–
IAS
Register contents 2
Register contents k
B2
Base address 2
Start address (program counter contents)
Register contents 1
Task 2
Register contents 2
Register contents k
B m Base address m
Start address (program counter contents)
Register contents 1
Task m
Register contents 2
Register contents k
© 2015 IAS, Universität Stuttgart
393
5.4 Software system design of the mini real-time operating system
IAS
Extension of the sub-program PROCESSOR
ADMINISTRATION
–
Right before the start of a ready task the register with
the contents of the list of the ADMINISTRATION BLOCK has to be
loaded.
Extension of the sub-program DEACTIVATION
–
After the computer process is finished, its base address is loaded into
the cell START ADDRESS and the register contents in the
ADMINISTRATION BLOCK are to be initialized.
© 2015 IAS, Universität Stuttgart
394
5.4 Software system design of the mini real-time operating system
IAS
Overall chart of the mini real-time operating system
First extension: Admission of longer computing times for computer processes
SEARCH
ADMINIS
TRATION
BLOCK
CLOCK
IMPULSE
CYCLE
INTERRUPT
ADMINISTRATION
ACTIVATION
Computer process code
TIME
TIME
COUNTER
TIME
ADMINISTRATION
© 2015 IAS, Universität Stuttgart
DEACTIVATION
TASK
ADMINISTRATION
PROCESSOR
ADMINISTRATION
395
5.4 Software system design of the mini real-time operating system
IAS
Second extension of the software system design
Having the possibility of alarm interrupts in mind
–
Up to k computer processes, whose activation is triggered by alarm
interrupts that are not predictable from the point of view of time.
Extension of the INTERRUPTION ADMINISTRATION
–
–
–
–
register rescue
in case of clock impulse interrupts triggering of TIME
ADMINISTRATION
in case of alarm interrupts invoking of the ACTIVATION, in order to
put the corresponding response program in the state “ready”
kick-off SEARCH
© 2015 IAS, Universität Stuttgart
396
5.4 Software system design of the mini real-time operating system
IAS
Overall chart for the mini operating system
Having the possibility of alarm interrupts in mind
external Interrupts
CLOCK
IMPULSE
INTERRUPT
ACTIVATION
TIME
SEARCH
Computer process code
Second extension:
ADMINISTRATION
BLOCK
INTERRUPT1
INTERRUPT2
CYCLE
TIME
COUNTER
DEACTIV
ATION
INTERRUPT K
INTERRUPT
ADMINISTRATION
TIME
ADMINISTRATION
© 2015 IAS, Universität Stuttgart
TASK
ADMINISTRATION
PROCESSOR
ADMINISTRATION
397
5.4 Software system design of the mini real-time operating system
IAS
Third extension of the software system design
Operating resource administration for input/output devices
In/output operation are slower than
– analog to digital converter > 20 ms
Introduction of a administration program Input/Output-ADMINISTRATION
Task:
Organization of slow input/output operations
– Task is stopped.
– Processor is able to work on other tasks.
– Finishing the input/output operations allows the continuation
of accompanying tasks.
© 2015 IAS, Universität Stuttgart
398
5.4 Software system design of the mini real-time operating system
IAS
Hierarchical chart of the mini operating system
MINI-REAL-TIME
OPERATING SYSTEM
(Extension 3)
IN/OUTPUT
ADMINISTRATION
INTERRUPT
ADMINISTRATION
© 2015 IAS, Universität Stuttgart
TIME
ADMINISTRATION
TASK
ADMINISTRATION
PROCESSOR
ADMINISTRATION
399
5.4 Software system design of the mini real-time operating system
IAS
Abolition of the simplifications
–
Operating system programs themselves are not interruptible.
–
The multiple activation of a tasks, i.e. new activation before the actual
end of a task is impossible.
–
A mutual activation of tasks is not possible.
–
A synchronization of tasks, i.e. through semaphore operations,
is not possible.
–
No data communication between the tasks, i.e. no interchange of
data, no common use of data.
–
No dynamical modifications of the priorities of the tasks during
program execution.
–
Tasks are located in the working memory, secondary memories are
not available.
© 2015 IAS, Universität Stuttgart
400
5.4 Software system design of the mini real-time operating system
IAS
Question referring to Chapter 5.4
Scheduling methods for the allocation of the processor are very important
in real-time operating systems.
a) What is the purpose of those methods ?
b) In which module of the mini operating system presented in the lecture a
scheduling method is used?
How is it called ?
Answer
© 2015 IAS, Universität Stuttgart
401
Chapter 5: Preparation Task
IAS
Preparation Task to Chapter 5.4
Question 1: Mini Operating System (ST 2006)
a)
Why does the mini operating system presented in the lecture work in its
first extension with less than 4 states?
b)
Which states of the state model of computation tasks are not needed?
Why?
© 2015 IAS, Universität Stuttgart
402
Industrial Automation
§5
Real-time operating systems
5.1
Definition
5.2
Organization tasks of a real-time operating system
5.3
Development of a mini real-time operating system
5.4
Software system design of the mini real-time operating system
5.5
Examples for real-time operating systems
5.6
Multi-core processors
© 2015 IAS, Universität Stuttgart
IAS
403
5.5 Examples for real-time operating systems
IAS
General components of an operating system
An operating system consists of an operating system core, kernel and an
access layer to the hardware. The available system resources and libraries play
an import role in fulfilling the real-time requirements, since there are many
different realizations available.
Application layer
system library
Scheduler
I/Oand
Interupt
Manager
MemoryManager
Devicedriver
Hardware-Abstraktionsschicht (HAL)
hardware
© 2015 IAS, Universität Stuttgart
Further
equipment
Units
Kernel organizes the System
libraries and hardware access
Access layer isolates hardware
from software
Processors and chips of a
hardware architecture
404
5.5 Examples for real-time operating systems
IAS
Market survey
Criteria of the selection of real-time operating systems
–
–
–
Development and target environment
Modularity and kernel size
Performance data
Amount of tasks
Priority levels
Task switch times
Interrupt latency time
–
–
Adaptation to special target environments
General characteristics
Scheduling method
Inter-task communication
Network communication
Design of user interface
© 2015 IAS, Universität Stuttgart
405
5.5 Examples for real-time operating systems
IAS
Selection of commercial real-time operating systems
Product
ERCOS
Lynx-OS
Company
ETAS
GmbH
Lynx
Microware
ENEA
ARS
Real-Time
DATA AB Integrated
System
Systems
inc.
Type
Embedded
Target
8016x,
architecture PowerPC
680x0,
80x86,
PowerPC,
88000,
i860,
MIPS,
SPARC,
RS6000
OS/9
OSE Delta
pSOS
PXROS
QNX
VRTX32
VxWorks
Windows CE
HighTec
EDVSysteme
QNX
Software
Systems
LTD
Microtec
Research
WindRiver
Microsoft
RTOS, RT RT Kernel, RTOS, RT RT Kernel, RTOS, RT RTOS, RT RTOS, RT
Kernel, Embedded Kernel, Embedded Kernel,
Kernel,
Kernel,
Embedded
Embedded
Embedded Embedded Embedded
RTOS
Embedded
680x0,
680x0,
80x86,
PowerPC,
PowerPC, CPU32,
CPU32
AMD29k
680x0,
80x86,
8016x,
PowerPC,
CPU32,
i960,
Hitachi
SH, MIPS
80x86,
8016x,
PowerPC
680x0,
80x86,
SPARC,
CPU32,
AMD29k,
i960
680x0,
80x86,
PowerPC,
CPU32,
i960,
MIPS,
SPARC,
AMD29k,
Hitachi SH
Pentium
80x86, i486
PowerPC
MIPS
Hitachi S4,
ARM
QNX
UNIX,
SUN,
Windows
UNIX,
Win95,
NT
Windows CE
Win 95
NT
Hostsystem
UNIX,
Win95,
NT
UNIX
UNIX,
Windows
Language
ANSI-C,
OLT
Specificati
on
Language
ANSI-C,
C++,
Pascal,
Ada,
Modula,
Fortran
ANSI-C,
C++
C, C++
ASM,
ANSI-C,
C++,
Pascal,
Ada
ANSI-C,
C++
Watcom
C, C++,
Inline
ASM
ASM,
ANSI-C,
C++
ANSI-C,
C++, Java,
Ada
Visual C++
Visual Basic
Visual J++
Data
system
no
UNIX,
FAT, NFS,
Real-Time
Filesystem
FAT
UNIX,
FAT
UNIX,
FAT, NFS,
Real-Time
Filesystem
UNIX,
FAT
UNIX,
FAT,
ISO9660
UNIX,
FAT
UNIX,
FAT
FAT
© 2015 IAS, Universität Stuttgart
UNIX,
UNIX,
UNIX,
Windows,
SUN,
SUN,
NT
Windows, Windows,
NT, OS/2 NT, OS/2
i386,i486,
Pentium,
80286(16
bit)
406
5.5 Examples for real-time operating systems
Product
ERCOS
Network
Field bus
Others
CAN
IAS
Lynx-OS
OS/9
OSE Delta
pSOS
PXROS
QNX
VRTX32
VxWorks
Windows
CE
TCP/IP,
NFS
TCP/IP,
OS/9-net,
NeWLink
TCP/IP,
PPP,
SNMP
TCP/IP,
Netware,
OSI 1-7,
SNMP
CMIP,
X.25
TCP/IP,
NFS
TCP/IP,
NFS,
SNMP,
Streams
TCP/IP,
Netware
TCP/IP,
NFS,
SNMP,
Streams
TCP/IP,
PPP bzw.
SLIP
CAN
CAN,
PROFIBUS
CAN,
PROFIBUS,
Interbus-S
CAN,
PROFIBUS, LON
ROM-able ROM-able, ROM-able, ROM-able, ROM-able, ROM-able, ROM-able, ROM-able ROM-able, ROM-able
Multiproces
MultiMultiMultiMultiMultiMultisor, selfprocessor
processor processor, processor processor,
processor,
hosted
fehlertolera
POSIX
POSIX
nt
1003
1003
compliant
compliant
Scheduling preemptive, preemptive, preemptive, preemptive, preemptive, preemptive, preemptive, preemptive, preemptive, preemptive,
copriority
copriority
priority
priority
priority
priority
priority
operative, controlled, operative,
controlled, controlled controlled, controlled, controlled, controlled
priority
Roundpriority
RoundRoundRoundRoundcontrolled
Robin
controlled,
Robin
Robin
Robin
Robin
RoundRobin
Task
switch
time
< 54 s
8016x (20
MHz)
© 2015 IAS, Universität Stuttgart
4,7 s
Pentium
166,
11,1us
486DX4
(100MHz),
74
17 s
100 s
407
5.5 Examples for real-time operating systems
IAS
Question referring to Chapter 5.5
Which criteria are relevant, when selecting the real-time operating system
of a micro-controller based washing machine?
Answer
The target system.
The file system.
The network support of the controller.
The capability to be loaded and run from a ROM.
© 2015 IAS, Universität Stuttgart
408
Industrial Automation
§5
Real-time operating systems
5.1
Definition
5.2
Organization tasks of a real-time operating system
5.3
Development of a mini real-time operating system
5.4
Software system design of the mini real-time operating system
5.5
Examples for real-time operating systems
5.6
Multi-core processors
© 2015 IAS, Universität Stuttgart
IAS
409
5.6 Multi-core processors
IAS
Employment of multi-core processors
program execution
The performance of the software can be increased by dividing programs into
tasks that can be executed on more than one core.
alternate
execution on a
core
concurrent or parallel
execution on multiple
cores
How can multi-core processors be employed in the automation technology to
speed up the program execution?
© 2015 IAS, Universität Stuttgart
410
Citation: http://searchdatacenter.techtarget.com/definition/multi-core-processor
5.6 Multi-core processors
IAS
Multi-core processors
Definition:
A multi-core processor is an integrated circuit to which two or more
processors have been attached for enhanced performance, reduced
power consumption, and more efficient simultaneous processing of
multiple tasks.
Advantages
Performance increase by concurrent or parallel applications
Opportunity for further development of hardware with stagnating clock
frequency in order to increase the performance of the software
Reduction in electricity consumption (lower clock speed)
Disadvantages
complicated programming, adaptation to core structure necessary
adaptation of existing hardware/software required
computing power due to cascaded cache structure is not always
deterministic
© 2015 IAS, Universität Stuttgart
411
5.6 Multi-core processors
IAS
Amdahl's law
Model for the acceleration of programs by parallelized execution. It was
developed by Gene Amdahl in 1967. The increase of the performance is
defined as the maximum acceleration of a thread, which can be reached
through the use of multiple cores.
© 2015 IAS, Universität Stuttgart
412
5.6 Multi-core processors
IAS
Example for Amdahl's law
© 2015 IAS, Universität Stuttgart
413
5.6 Multi-core processors
IAS
Limits of parallel computing
Example:
10% of a program is written in a serial code, hence, only a maximum reduction
of the execution time to 10% of the sequential time is possible. This is
independent of the number of cores.
Rational
execution time
number of cores
Parallel ratio:
© 2015 IAS, Universität Stuttgart
414
5.6 Multi-core processors
IAS
Symmetric multiprocessing systems (SMP)
Two or more identical processors share a common address space.
A central operating system assigns the cores and other resources.
Memory
Task 1
System memory is available
to all cores.
Task 2
Task 3
Task 4
Operating System
T1
T1
T2
CPU 1
CPU 2
CPU 3
IOs
Cache
T3
T4
CPU 4
Tasks can dynamically be
distributed across multiple
cores.
Scheduler ensures an as
even as possible distribution
of processes.
Operating system manages
inputs and outputs, and
interrupts
*T1 = Task 1
© 2015 IAS, Universität Stuttgart
415
5.6 Multi-core processors
IAS
Real time in symmetric multiprocessing systems
Manually static assignment of tasks on a SMP architecture for application
domains with hard real time requirements
Equal distribution of processes to multiple cores depends highly on the
application and its parallelization from
Real-time requirements such as temporal predictability due to hierarchical
cache saving and bandwidth limitation on memory access is difficult in
practice
Inter-process communication and asynchronous events make the
scheduling and debugging complex
Limited use for application domains with hard real-time requirements
© 2015 IAS, Universität Stuttgart
416
5.6 Multi-core processors
IAS
Asymmetric multiprocessor systems (AMP)
Each task (or combination of several tasks) has its own operating system
and its own resources
Inputs, outputs and interrupts are directly associated with applications
Memory
Task 1
Memory
Task 2
OS 1
OS 2
T1
T2
CPU 1
I/O
Cache
Memory
Memory
Task 3
Task 4
OS 3
OS 4
T3
T4
CPU 2
CPU 3
CPU 4
I/O
I/O
I/O
Cache
© 2015 IAS, Universität Stuttgart
Cache
Cache
Fixed assignment of
tasks to the sub-systems
(e.g. embedded
systems)
*OS = operating system
*T1 = Task 1
*I/O = Input/Output
417
5.6 Multi-core processors
IAS
Real-time in asymmetric multiprocessor systems
Advantage: well-defined environment and a predictable time behavior
Ensures that the result of a program does not depend on the temporal
behavior of its operations
Other computer processes must not be interrupted due to a direct
assignment of inputs, outputs and interrupts
However, many parallel applications requires a communication between
each processes
Good method for real-time applications, due to the explicit assignment of
each task
© 2015 IAS, Universität Stuttgart
418
5.6 Multi-core processors
IAS
Homogeneous multiprocessor systems
All cores of a processor are identical, equally clocked
Various cache memory and shared memory which is managed by a memory
controller
Widespread at the moment
CPU
core
core
LEVEL1-Cache
LEVEL1-Cache
LEVEL2-Cache
LEVEL2-Cache
LEVEL3-Cache
Memory
© 2015 IAS, Universität Stuttgart
419
5.6 Multi-core processors
IAS
Heterogeneous multiprocessor systems
Different cores for different tasks (e.g. operating system, decoding, encryption,
calculation of vector graphics)
Certain cores are designated to specific applications and run the same tasks
repeatedly.
source: cis.upenn.edu
Example: CELL Processor from Sony-Toshiba-IBM for graphic rendering / games
SPE
SPE
SPE
SPE
SPE
SPE
SPE
SPE
SPU
SPU
SPU
SPU
SPU
SPU
SPU
SPU
LM
LM
LM
LM
LM
LM
LM
LM
DMA
DMA
DMA
DMA
DMA
DMA
DMA
DMA
PPE
L
2
L
1
Power
Core
MemoryController
1 main core (control)
8 Co-cores
(calculation and data
transfer)
BUS-interfaceController
SPE = Synergistic Processing Element, SPU = Synergistic Processing Unit with SIMD (Single Instruction Multiple
Data), LM = Local Memory, DMA = Direct Memory Access (with Memory Flow Controller), L1/L2 = Caches
© 2015 IAS, Universität Stuttgart
420
5.6 Multi-core processors
IAS
Heterogeneous networked systems
using an example of the vehicle
Previously distributed, independent
automation systems (ABS, engine
control, ...)
Networks with control devices as
nodes e.g. to exchange measurement
data
Example Daimler (E-Class)
No.
92 control
units
Distribution of computing processes on
the network possible
15
14 bus systems
2
1995
(W219)
© 2015 IAS, Universität Stuttgart
2002
(W211)
2009 2013
(W221) (W212
MOPF)
421
5.6 Multi-core processors
IAS
Approaches for future multiprocessor systems
Basic principles:
Differentiation between global and local resources
Scheduling of global resources is taken over from the operating system and
the local resources of a software component
Split resources are used by applications exclusively, or they can be shared
Scheduling within a software component by a scheduler
© 2015 IAS, Universität Stuttgart
422
5.6 Multi-core processors
IAS
Approaches for future multiprocessor systems
Examples:
parallelized application in
a network
Task A
Task B
Load-Balancing in the
internet of things and
services
Infrastructure, operating system and methods?
swarm intelligence
© 2015 IAS, Universität Stuttgart
423
Chapter 6: Programming Languages for Process Automation
IAS
§ 6 Programming Languages for Process Automation
Learning targets
–
to know the procedure for developing process automation programs
–
to be able to differ programming languages referring to the language level
–
to know the programming languages for PLC
–
to program simple examples using PLC-languages
–
to know the most important real-time concepts for programming
languages
–
to know how real-time concepts are realized in Ada 95
–
to be able to design a real-time program in Ada 95
–
to be able to rank C/C++ referring to real-time aspects
–
to know what the fundamentals of the portability of Java
–
to understand the real-time extensions of Java
© 2015 IAS, Universität Stuttgart
424
IAS
§ 6 Programming Languages for
Process Automation
6.1
Basic Terms
6.2
Programming Programmable Logic Controllers (PLC)
6.3
Universal Programming Languages for Industrial Automation
6.4
Concepts of parallel programming
© 2015 IAS, Universität Stuttgart
425
6.1 Basic Terms
IAS
Means for programming
Programmable Logic Controllers
–
Textual programming languages
–
Graphical programming languages
Micro controller
–
Assembler
–
Low machine-independent programming languages
PC and IPC
–
–
Software package
Universal real-time programming language
Process control system
–
Functional module technology
© 2015 IAS, Universität Stuttgart
426
6.1 Basic Terms
IAS
Programming language types
Classification according to notation type
–
textual programming languages
–
graphical programming languages
Ada, C, PLC instruction list
PLC ladder diagram
Classification according to programming language paradigm
–
procedural programming languages
C, Ada 83
–
functional programming languages
LISP
–
logical programming languages
PROLOG
–
object-oriented programming languages
C++, Smalltalk, Ada 95
Classification according to language level
–
high:
focus on the understandability for the user
–
low:
focus on the hardware characteristics of a computer
© 2015 IAS, Universität Stuttgart
427
6.1 Basic Terms
IAS
Classification according to language level
Program generators
Language level
Application-specific
programming languages
Universal programming
languages
Macro assembler
languages
Assembler languages
Machine languages
Microprogramming
languages
© 2015 IAS, Universität Stuttgart
Machineindependent
programming languages
Machineoriented
programming languages
Machine
languages
428
6.1 Basic Terms
IAS
Microprogramming languages
–
Sequence control realization for the execution of
machine commands
Permanently wired logic elements
Microprograms (firmware)
Machine languages
–
Commands and data in form of bit patterns, which can be
executed on the hardware of the Automation Computer
Assembler languages
–
Replacement of the operation part of the machine language commands
by symbolic, mnemonic convenient letter abbreviations
–
Introduction of a symbolic name instead of the numerical depiction of the
address part
–
Dependency on device-technical characteristics of the corresponding
computer
© 2015 IAS, Universität Stuttgart
429
6.1 Basic Terms
IAS
Macro assembler languages (macro languages)
–
Further auxiliary means for simpler handling: macros
–
Distinction
Macro definition
Macro call
Macro expansion
–
Non-ambiguous assignment of macro assembler commands to
commands of the machine language
–
One macro command corresponds to several machine commands
–
Each time a macro is called it is expanded.
Classification of macros
–
Standard macros:
predefined (fix)
–
User macros:
the user is able to define macros for instruction
sequences that are needed often
© 2015 IAS, Universität Stuttgart
430
6.1 Basic Terms
IAS
Advantages and disadvantages of assembler programming
+
memory and computing time efficiency
-
higher program development costs
-
lower maintainability
-
problems concerning reliability
-
bad readability, low documentation value
-
missing portability
Operation of assembler languages
yes:
automation of devices or machines with serial or mass application,
small programs
no:
long-lasting, huge processes that ought to be automated,
extensive programs
© 2015 IAS, Universität Stuttgart
431
6.1 Basic Terms
IAS
Universal programming languages
Universal
not focused on one specific application area
Universal low programming languages
–
Purpose:
Generation of system programs
Compiler
Operating systems
Editors
Driver programs
–
Objective:
1. Utilization of the hardware characteristics
2. Portability
–
Example:
C
Universal higher programming languages
–
Purpose :
Generation of general/common programs
–
Objective :
1. Simple formulation
2. Extensive compiler checks
3. Portability
–
Example :
Ada, Java, Smalltalk
© 2015 IAS, Universität Stuttgart
432
6.1 Basic Terms
IAS
Development
of programming languages
Eclipse
2005
2000
Java 2
Ada2005
Java
Ada95
C#
1995
Python
Ruby
PEARL 90
1990
C++
Eiffel
1985
TKL/TK
1980
Ada
Small
talk 80
Mehrrechner PEARL
C
1975
PEARL
1970
Pascal
Simula
1965
PL/1
CORAL 66
BASIC
1960
COBOL
FORTRAN
1955
© 2015 IAS, Universität Stuttgart
ALGOL 68
ALGOL60
Legend:
object-oriented programming
language
real-time programming
language
higher level programming
languages
433
6.1 Basic Terms
IAS
Application-specific languages
Synonyms: Descriptive languages, non-procedural higher languages, very high
level languages
Difference to procedural languages:
–
No description of the solution approach,
instead: description of the problem definition
–
Limited to certain application areas:
e.g.:
SFC
LD
IL
EXAPT
ATLAS
Sequential Function Chart
Ladder Diagram
Instruction List
For machine tool control
For automatic device tester
Advantages/disadvantages:
© 2015 IAS, Universität Stuttgart
434
6.1 Basic Terms
IAS
Program generator (fill-in-the-blanks-languages)
–
Formulation method for programs
–
User replies to questions in the form of menus on screen (user
configuration)
–
Conversion of the answers in an executable program through the
program generator
–
Advantage:
–
Disadvantage: Limitation to certain application areas
no programming skills necessary
Dependency in regard to a certain manufacturer
Application areas in industrial automation:
–
Instrumentation and control systems in energy and process engineering
© 2015 IAS, Universität Stuttgart
435
6.1 Basic Terms
IAS
Difficulties regarding real-time programming
–
High-level programming languages like BASIC, FORTRAN, COBOL
and PASCAL are not suited for real-time programming:
no real-time language features
no single bit operations
no instructions for process input/output
–
The operation of higher programming languages in comparison to
assembler languages also causes higher demands on memory and
computing times:
Product automation: memory usage and computing times are
critical
Plant automation:
computing times might be
critical
Prerequisite:
© 2015 IAS, Universität Stuttgart
436
6.1 Basic Terms
IAS
Proportion of the application of higher
level programming languages
Deployment comparison of higher programming languages
100%
Higher level
programming languages
for technical, scientific
and commercial
applications
Higher level
programming languages
for process automation
0%
1950
1960
© 2015 IAS, Universität Stuttgart
1970
1980
1990
2000
t
437
6.1 Basic Terms
IAS
Question referring to Chapter 6.1
With which of the following statements concerning the language level do
you agree?
Answer
Machine languages are well suited for application programming.
The programming language C is an universal programming language.
The PLC Ladder Diagram (LD) is a machine language.
Program generators require high programming skills.
Programming languages with a low language level focus on the hardware
characteristics of a computer.
All universal programming languages are machine-independent
programming languages.
© 2015 IAS, Universität Stuttgart
438
IAS
§ 6 Programming Languages for
Process Automation
6.1
Basic Terms
6.2
Programming Programmable Logic Controllers (PLC)
6.3
Universal Programming Languages for Industrial Automation
6.4
Concepts of parallel programming
© 2015 IAS, Universität Stuttgart
439
6.2 Programming Programmable Logic Controls
IAS
Programming Languages for PLC-Systems (1)
– no fixed programming languages for PLC-systems
– different kinds of programming, also depending on the manufacturer
– IEC 61131 is defining graphical and text-based basic-languages
Programming Languages of PLC (IEC 61131-1/3)
text-based representation
graphical representation
state - oriented
Instruction List
IL
A I 5.3
A I 2.6
O Q
2.1
ON M
23.1
= Q 2.4
Structured
Text
ST
Function block
Diagram (FBD)
I5.3
I2.6
IF A&B = 1
THEN ...
ELSE ...
Ladder Diagram
LD I5.3 I2.6
Q2.4
( )
&
>=1
flow - oriented
Q2.1
Q2.1
M23.1
Sequential Flow
Chart (SFC)
S1
T1
S2
Q2.4
T8
S8
M23.1
T2
T9
– IEC 61131 is not defining any instructions!
as well german as english identifiers for operators
© 2015 IAS, Universität Stuttgart
440
6.2 Programming Programmable Logic Controls
IAS
Programming Languages for PLC-Systems (2)
– base of all programming languages are logical connections
– addition of possibilities for time processing
– suitable kind of representation depends on problem
• state-oriented program parts are more suitable for FBD or LD
• flow-oriented program parts are more suitable for IL or SFC
– the different representations can be converted into each other
Be aware:
Some operations can only be programmed using IL (e.g. bit shifting)!
Example:
Exit 1 (exit1) and exit 2 (exit2) are only true, if either entry 3 (entry3) is true or
if both entries 1 (entry1) and 2 (entry2) are simultaneously true
© 2015 IAS, Universität Stuttgart
441
6.2 Programming Programmable Logic Controls
IAS
Instruction List (IL)
– similar to assembler
– all functionality of a PLC can be programmed using IL
– consistent structure of every statement
Mark(opt.):
Operator Operand
Comment(opt.)
– the programming is done by connecting signals
Realization of the example using IL (live writing)
© 2015 IAS, Universität Stuttgart
442
6.2 Programming Programmable Logic Controls
IAS
Structured Text (ST)
– high-level language, similar to Pascal
• declarations
e.g.:
alarm := on AND off;
• sub program calls
e.g.:
alarmlamp(S:=on, R:=off);
• control statements
e.g.:
IF alarm
THEN alarmlamp(S:=on, R:=off);
END_IF;
– additional language constructs for time processing and process data access
– suitable for programming large systems
Realization of the example using ST
© 2015 IAS, Universität Stuttgart
443
6.2 Programming Programmable Logic Controls
IAS
Ladder Diagram (LD)
– simple illustration
– similar to the circuit diagram of the relay technology
– symbols for „normally open contact“, „normally closed contact“, and „relay
coil“ (output)
normally
open
contact
normally
closed
contact
relay coil
– symbolized current flow from left to right
– I/O states are mapped onto switch-states
– the program is read from top to bottom
Realization of the example using LD
© 2015 IAS, Universität Stuttgart
444
6.2 Programming Programmable Logic Controls
IAS
Function Block Diagram (FBD)
– similar to the well known symbols for function blocks (DIN40900)
– amount of symbols is not confined to logical basic elements
memory marks, counter, timer and freely definable blocks possible
– I/O states are directly used as Input-/Output signals
– clearly arranged representation
Realization of the example using FBD
© 2015 IAS, Universität Stuttgart
445
6.2 Programming Programmable Logic Controls
IAS
Question referring to Chapter 6.2
In the programming of a Programmable Logic Controller (PLC), the so
called programming devices are used. What are they and why are they
necessary?
Answer
© 2015 IAS, Universität Stuttgart
446
IAS
§ 6 Programming Languages for
Process Automation
6.1
Basic Terms
6.2
Programming Programmable Logic Controllers (PLC)
6.3
Universal Programming Languages for Industrial Automation
6.4
Concepts of parallel programming
© 2015 IAS, Universität Stuttgart
447
6.3 Universal Programming Languages for Industrial Automation
IAS
Development objectives for C and C++
C:
–
–
–
–
–
efficient system programming language for hardware
flexible like assembler
control flow possibilities of higher programming languages
universal usability
restricted language size
C++:
–
–
–
C is enhanced with object orientation
the efficiency of C is kept
improvement of productivity and quality
Concurrent C:
© 2015 IAS, Universität Stuttgart
C is enhanced with concepts dealing with realtime processing.
448
6.3 Universal Programming Languages for Industrial Automation
IAS
Language concepts of C
–
Four data types: char, int, float, double
–
Combination of data :
vectors, structures
–
Control structures:
if, switch, while, do-while, for,
continue, break, exit, goto
–
Input/Output:
–
Large variety of bit manipulation possibilities
–
Weak type concept
–
Separate compiling of source files
–
Weak exception handling
–
No explicit support for parallel processing by the language
© 2015 IAS, Universität Stuttgart
Library functions
449
6.3 Universal Programming Languages for Industrial Automation
IAS
Language concepts of C++
–
Class
Data structure with data and methods (member function)
–
Constructor
Creation of an instance of a class (object)
–
Destructor
Release of class objects
–
Overloading of functions
–
Encapsulation of data
–
Inheritance
–
Polymorphism
Triggering of different processing steps by messages
© 2015 IAS, Universität Stuttgart
450
6.3 Universal Programming Languages for Industrial Automation
IAS
Suitability of C and C++ for real-time systems (1)
–
C and C++ contain no real-time language constructs.
–
Deployment of real-time operating system to realize real-time
systems.
–
Libraries are provided.
© 2015 IAS, Universität Stuttgart
451
6.3 Universal Programming Languages for Industrial Automation
IAS
Suitability of C and C++ for real-time systems (2)
Programming languages C and C++
Most frequently used programming languages for real-time applications
Great number and variety on support tools
Well extended programming environment
Compilers are available for most micro processors
Connection to real-time operating systems like
QNX, OS9, RTS, VxWorks
Caution with object-oriented language tools:
© 2015 IAS, Universität Stuttgart
452
6.3 Universal Programming Languages for Industrial Automation
IAS
Java as universal programming language
–
Object-oriented concepts
–
Interpretation of the code
fast development cycle
bad run-time behavior and high demand on storage space
higher portability
–
A storage manager is provided.
–
Conventional pointer methods were not integrated.
–
Strict type control at compile and run-time
–
Lightweight processes
–
GUI class library
© 2015 IAS, Universität Stuttgart
453
6.3 Universal Programming Languages for Industrial Automation
IAS
Differences to C++
–
No pre-processor instructions like #define or #include
–
No typedef clauses
–
Structures and unions in the form of classes
–
No functions
–
No multiple inheritance
–
No goto
–
No overloading of operators
–
Extensive class libraries
Base classes (object, float, integer)
GUI classes
Classes for input/output
Classes for network support
© 2015 IAS, Universität Stuttgart
454
6.3 Universal Programming Languages for Industrial Automation
IAS
Execution of Java-Programs (1)
Java C
Compiler
Java Source Code
C Code
Java Class Compiler
Java Bytecode
Application
AOT Compiler
C Compiler
Objectcode
Objectcode
Application
Application
incl. Runtime Env
incl. Runtime Env.
OS
OS
target system
target system
Application
Application
Java API
Java API
JVM
JIT Compiler
Java API
Java OS
OS
target system
OS
target system
JVM – Java Virtual Machine
© 2015 IAS, Universität Stuttgart
Java target
system
JIT – Just-In-Time-Compiler
AOT – Ahead-Of-Time-Compiler
455
6.3 Universal Programming Languages for Industrial Automation
IAS
Execution of Java-Programs (2)
Two-stage translation process:
1. Step:
2. Step
development system
target system
development system
- interpretation
- just-in-time compilation
- direct execution on Java
Hardware
- ahead-of-time
compilation
- translation to C
portability:
on bytecode level
on source code level
memory
consumption:
interpreter / JIT Compiler
complete class libraries
runtime environment
necessary class libraries
Runtime:
interpretation / just-in-time
compilation
direct execution
© 2015 IAS, Universität Stuttgart
456
6.3 Universal Programming Languages for Industrial Automation
IAS
Suitability of Java for the development of real-time systems
Application fields
–
rapid prototyping in client/server area
–
multimedia presentations
(video, sound, animation)
–
intranet applications
–
real-time applications
© 2015 IAS, Universität Stuttgart
457
6.3 Universal Programming Languages for Industrial Automation
IAS
Real-time language constructs in Java
–
Input and output of process values
comparable with C/ C++
–
Parallelism
no process support
lightweight processes
Round Robin Method
–
Synchronization
monitors
semaphore variables
–
Inter-process communication
only for lightweight processes on common data
Bit operations
comparable with C/ C++
–
© 2015 IAS, Universität Stuttgart
458
6.3 Universal Programming Languages for Industrial Automation
IAS
Real-Time Java
Extension in the Java language, to realize real-time requirements
Extensions (1)
– 1. Scheduling:
Ensure the timely or predictable execution of sequences of schedulable
objects
– 2. Memory management:
Extend the memory model in order to allow real-time code to deliver
deterministic behaviour
– 3. Synchronisation:
Specification of the dispatching algorithms; avoidance to the priority
inversion problem; support to priority inheritance and priority ceiling
policies.
– 4. Asynchronous Event Handling:
Ensure that the program can cope with a large number (ten of thousands)
of simultaneous events
© 2015 IAS, Universität Stuttgart
459
6.3 Universal Programming Languages for Industrial Automation
IAS
Extensions (2)
– 5. Asynchronous Transfer of Control (ATC):
Possibility to transfer the control from a thread upon an asynchronous
event, e.g. a timer going off
– 6. Asynchronous Thread Termination :
Ensure an orderly clean up and termination of threads without danger of
deadlocks
– 7. Physical Memory Access :
Special API to directly access memory areas
– 8. Exceptions:
Definition of new exceptions and new treatment of exceptions surrounding
ATC and memory allocators
© 2015 IAS, Universität Stuttgart
460
6.3 Universal Programming Languages for Industrial Automation
IAS
Question referring to Chapter 6.3
Compared to C, what problems concerning real-time requirements have to
be considered when using C++?
Answer
Pointers
Polymorphism
Exceptions
Encapsulation
© 2015 IAS, Universität Stuttgart
461
6.3 Universal Programming Languages for Industrial Automation
IAS
Question referring to Chapter 6.3
To which statements concerning the garbage collection mechanism of
Java do you agree?
Answer
The execution of the garbage collection mechanism has to be triggered
manually.
Used resources should be released in the destructor of a class.
The same system conditions can lead to different timely behavior due to
the garbage collection mechanism.
© 2015 IAS, Universität Stuttgart
462
IAS
§ 6 Programming Languages for
Process Automation
6.1
Basic Terms
6.2
Programming Programmable Logic Controllers (PLC)
6.3
Universal Programming Languages for Industrial Automation
6.4
Concepts of parallel programming
© 2015 IAS, Universität Stuttgart
463
Source: http://gcn.com/Articles/2008/04/11/The-return-of-Ada.aspx?Page=1 on16.03.2014
6.4 Concepts of parallel programming
IAS
Last fall, contractor Lockheed Martin delivered an update to the Federal Aviation Administration's next-generation flight
data air traffic control system ' ahead of schedule and under budget, which is something you don't often hear about
in government circles.
…
Military developers stuck with the venerable C programming language they knew well, or they moved to the up-andcoming C++. A few years later, Java took hold, as did Web application languages such as JavaScript.
However, Ada never vanished completely. In fact, in certain communities, notably aviation software, it has remained the
programming language of choice.
…
© 2015 IAS, Universität Stuttgart
464
6.4 Concepts of parallel programming
IAS
Characteristics of Ada in the sense of real time programming
– Real time specific features
Fulfillment of absolute and relative time requirements
Execution of parallel activities
Prioritization and scheduling of parallel activities
– Extensive validation of each Ada95 compiler against compliance standards
Several thousand test programs
© 2015 IAS, Universität Stuttgart
465
6.4 Concepts of parallel programming
IAS
Concurrent programming concepts
– Requirement to enable the reaction to simultaneous events
Concept of parallel tasks to perform parallel activities
– Support of concurrent programming
Task unit
– Task as a concurrent, parallel running sequences of commands
– Task as an encapsulated unit
Declarations made within a task are not visible outside it
– Communication between task units
© 2015 IAS, Universität Stuttgart
466
6.4 Concepts of parallel programming
IAS
Realization of tasks
– Declaration and implementation of tasks in a package or directly in the
program unit
Packet
packet integration;
Task1;
Task2;
main routine
Task3;
Commands in Task3;
Packet body
commands in Task1;
program code of the main
routine
Commands in Task2;
planning of T3
© 2015 IAS, Universität Stuttgart
467
6.4 Concepts of parallel programming
IAS
Task types and objects
– Task types provide a template for the instantiation of task objects
– Tasks of the same type have similar properties and functionality
– Individual task objects can be parameterized during instantiation
General
task-type monitorValue;
commands in
monitorValue;
Integration of General
Task objects
declaration
main routine
M1 of task-type monitorValue;
M2 of task-type monitorValue;
M3 of task-type monitorValue;
Task type
specification /
implementation
© 2015 IAS, Universität Stuttgart
program code of the main
routine
468
6.4 Concepts of parallel programming
IAS
Synchronization of tasks
Synchronization concepts in Ada 95
– Logical synchronization
Establish a timely sequence of the tasks’ execution
– Resource oriented synchronization
Establish rules to access shared resources
© 2015 IAS, Universität Stuttgart
469
6.4 Concepts of parallel programming
IAS
The rendezvous concept (1)
– Handshake method
• Definition of timely synchronization points between the tasks
• Mutual wait of the tasks
– Rendezvous has on the calling side the form of a procedure call
– Definition of calling declaration (entry) and calling point (accept)
Caller
Receiver
If necessary, data transfer
Call of the synchronization
If necessary, data transfer
© 2015 IAS, Universität Stuttgart
Caller waits
for confirmation
by recipient
Both tasks start synchron
470
6.4 Concepts of parallel programming
IAS
The rendezvous concept (2)
– Declaration of entry points declared in the task’s specification
– Calls and accept statements in the tasks’ implementation code
– Function principle: task calls the entry point another task
Task1 with entry
condition
Task2 with entry
condition
Task3 with entry
condition
Commands in Task1;
Commands in Task2;
Commands in Task3;
Own calling
point;
Own calling
point;
Own calling
point;
Call of task’s T2
calling point;
Call of task’s T3
calling point;
Call of task’s T1
calling point;
Further commands;
Further commands;
Further commands;
© 2015 IAS, Universität Stuttgart
471
6.4 Concepts of parallel programming
Dynamic run of
the multitask
program
example
T1
IAS
T2
T3
accept sync;
accept sync;
Waiting
Waiting
T2.sync;
accept sync;
Waiting
T3.sync;
T1.sync;
© 2015 IAS, Universität Stuttgart
472
6.4 Concepts of parallel programming
IAS
Protected units and resource synchronization (1)
– Problem of accessing shared variables
– Monitors for exclusive access
Protected
operations
Request
from a task
– Interface as protected operation
– Access to the shared variable
…
controlled by a intern monitor
Protected operations are not
executed in parallel
Sequential ordering of
Monitor
© 2015 IAS, Universität Stuttgart
Shared
variable
simultaneous requests
473
6.4 Concepts of parallel programming
IAS
Protected units and resource synchronization (2)
Protected
operations
Protected
Input function;
procedure;
functions;
call agreement;
Packet boy of Protected
– Protected operations are mutually
exclusive
– All variables of a protected unit have to
be declared private
– A procedure can manipulate the shared
variable in any way
– The entries are protected operations
Body of the input
function;
Commitment of the
call agreements;
Commands;
© 2015 IAS, Universität Stuttgart
474
6.4 Concepts of parallel programming
IAS
Communication between tasks
– Synchronous communication
• Extension of the rendezvous synchronization with data exchange
Mutual wait
Data exchange during the rendezvous
Data only valid within the rendezvous
– Asynchronous communication
• Data exchange via shared variables
Protected operation for access
No waiting/ blockage during communication
© 2015 IAS, Universität Stuttgart
475
6.4 Concepts of parallel programming
IAS
Time operations
– Possible delay of the execution
Until a defined point in time
For a fixed time period
– Ada 95 statements delay and delay until
– Time units and operations defined in the core packages
For standard applications, second
For real time applications ms, μs, ns
Operations
Add and subtract time variables
Read the current system time
– During a delay, the processor is occupied by another process ready to run
– After a delay, a task may have to wait to receive the processor
© 2015 IAS, Universität Stuttgart
476
6.4 Concepts of parallel programming
IAS
Example of time operations
T1 with agreements;
T2 with agreements;
Agreement for a time
duration of 1 ms;
Agreement for a time duration of 1 ms;
Agreement of the following call
next_call;
Call of a function;
Delay of 10*1 ms;
loop
Current time
next_call dependent of Clock;
Call of a function read_sensor;
Delay to next_call;
read_sensor
execution
running
blocked
32
t
15
5
5
22
– Task T1 activates read_sensor after a 10ms time delay
10 12
20
t
The subprogram activation time is relative to the previous execution
– Task T2 activates the read_sensor every 10ms
The subprogram is activated at fixed times
© 2015 IAS, Universität Stuttgart
477
6.4 Concepts of parallel programming
IAS
Modularized exception handling
– Exceptions due to irregular operations possible
Treatment of exceptions (exception handling)
Ada 95 exception handling concept:
– Exception handling blocks are implemented as part of the unit’s code
– If an exception occurs, control is given to the exception handling blocks
– Several exceptions can be handled in a single handling block
– Any exception not handled is propagated to the calling unit, if there is any
– Exceptions are raised by the runtime environment or by the program code
© 2015 IAS, Universität Stuttgart
478
6.4 Concepts of parallel programming
IAS
Real time extensions (1)
– Tasks with dynamic priorities
Base priority is established on its specification
Actual priority can differ from the above
– Hint: In Ada, a lower number means a lower priority!
Specification
Implementation
Task1 with priority 10;
Commands in Task 1;
T1 calls T2
Base priority
Task2 with priority 1;
T1 calls T2’s
entry point;
Commands in Task 2;
T2 executes
here with
T1’s priority
Own calling point;
Dynamic base
priority change
© 2015 IAS, Universität Stuttgart
Set own priority;
479
6.4 Concepts of parallel programming
IAS
Real time extensions (2)
– Scheduling methods
The method used to schedule tasks can be specified
Pragma Task_Dispatching_Policy
Default method: fixed priorities; FIFO within the priorities
Further scheduling methods can be implemented and used
– Access to protected units and the Priority Ceiling Protocol
Ceiling priority of protected units can be defined in its specification
Default value: system’s highest priority
Ceiling priority rules guarantee that there is no chance of deadlock
© 2015 IAS, Universität Stuttgart
480
Chapter 6: Programming Languages for Process Automation
IAS
Crossword Puzzle
© 2015 IAS, Universität Stuttgart
481
Chapter 6: Programming Languages for Process Automation
IAS
Crossword Puzzle
Across
3
4
6
9
12
14
15
18
20
21
22
24
27
29
30
31
32
35
37
39
41
42
43
44
Physically distributed (13)
A stalemate that occurs when two (or more) tasks are each waiting resources held by each
other (8)
Interruptible processor allocation (10)
Situation in which a task can not realize its duty, even if it continues to run (8)
Process to avoid data package collision on CAN bus (11)
Real time programming language (3)
Abbreviation of a PLC programming language which uses building blocks (3)
Low-level programming language (9)
Graphical representation of technical processes, similar to block diagram (9)
Ada concept for synchronization (10)
Process type of manufacturing of parts (14)
Process in which the physical parameters are recorded and influenced by technical means (17)
Basis for the machine independence of Java (3)
Device used to influence process variables (8)
Principle of data transmission in the Interbus-S (13)
Connection between systems (9)
Denomination of systems which have to be in synchrony with activities happening in an external
system (14)
Simultaneous reaction to various events (16)
Latest execution time point of a task (8)
Auxiliary mean to simplify assembler languages (5)
Term used for sensors with integrated connection to bus system, self-calibration and self-test (11)
Definition of timely synchronization points between the tasks (9)
Representation of a PLC program similar to a circuit diagram (13)
Set of all tasks controlled by a scheduler (6)
© 2015 IAS, Universität Stuttgart
482
Chapter 6: Programming Languages for Process Automation
IAS
Crossword Puzzle
Down
1
2
3
5
6
7
8
10
11
13
15
16
17
19
23
25
26
28
30
33
34
36
38
40
Circuit for comparison of currents (10)
Specific message to assign the right to send messages (5)
Heterogeneity of software with identical functionality (9)
Communication system for the data exchange in the field area (8)
Program unit of Ada (7)
Organization of timely execution of subprograms at runtime (12)
Duplication of hardware or software elements with the same functionality (10)
Automation technical analog to "tactical level" (20)
Allocation of processor resources to tasks ready to execute (10)
Preservation of the functionality despite occurrence of errors (14)
Execution of activities according to their arrival (4)
Term describing the extent in which a process is automated (18)
Transition from the state "dormant" into the state "runnable" (8)
One chip computer (15)
Reaction to an event right on time (10)
Bus system with an hybrid communication (8)
Device used to measure process variables (6)
Simultaneous transmission of data on several lines (8)
Term for activities that are ordered in a specific order (10)
Synchronization construct (9)
Time impulse generator (5)
Element with control rights in a deterministic bus access method (6)
Abbreviation for computers specially designed for usage in industrial fields (3)
Method with random bus access (4)
© 2015 IAS, Universität Stuttgart
483
IAS
Index (1)
acatech
Activation
Actuator
Actuator sensor interface
Amdahl's law
Analog to digital conversion
Assembler
asymmetric multiprocessor systems (AMP)
Asynchronous communication
Asynchronous programming
Automation hierarchy
43
384
*169*
155
412
*180*
430, *431*
417
316
270, *281*
126
CAN
Centralized structure
Concurrency
Concurrent
cyber-physisches System
Cycle time
*227*
120
262
300
43
364, 369
Deactivation
Deadline
384
295
© 2015 IAS, Universität Stuttgart
484
IAS
Index (2)
Deadlock
Decentralized structure
Delay
Delay until
Determinism
Deterministic
Digital input
Digital output
Distributed automation system
Diversity software
Dual slope method
Dynamic scheduling
*303*
121
476
476
*264*
265
204
206
133
147
194
321
Earliest deadline first
Error
Event-driven
Exception handling
Execution time
*331*
356
286
478
295
Fault tolerance
Field area
139
*212*
© 2015 IAS, Universität Stuttgart
485
IAS
Index (3)
Field bus system
Field devices
FIFO
Firmware
First extension (RTOS)
Fixed priorities
Flow time
Function Block Diagram
*212*
*212*
*324*
429
390
*327*
295
*445*
Garbage collection
457
Handshake method
Hard real-time
Heterogener Multicore-Prozessor
homogeneous multicore processor
*470*
257
420
419
IEC 1131
Industrial PC
Instruction List
Intelligent sensor
Interbus-S
440
105
*442*
163
*239*
© 2015 IAS, Universität Stuttgart
486
IAS
Index (4)
Interface
Internet of the Things
Interrupt handling
Interrupt vector
152
423
*352*
353
Kernel
345
Ladder Diagram
Laxity
Least laxity
Livelock
*444*
295
*333*
*303*
Machine independent
Machine language
Machine oriented
Macro assembler
Memory management
Microcontroller
Microprogramming
428
428
428
*430*
354
*101*
*429*
Non-preemptive
322
© 2015 IAS, Universität Stuttgart
487
IAS
Index (5)
Object orientation
Operating system
452, 453
342
Parallel
Parallel bus
Period time
Planning
Preemptive
Priority
Priority Ceiling Protocol
Priority inheritance
Process control system
Process signal
PROFIBUS
Program generation
Programmable Logic Controller
Programming paradigm
Protected unit
300
215
295
293
322
295
480
479
110
173
*237*
426
92
427
*473*, 474
Rate monotonic
Real time Java
*329*
459
© 2015 IAS, Universität Stuttgart
488
IAS
Index (6)
Real-time computing
Redundancy
Rendezvous concept
Resources
Round-Robin
*252*
138
469, *470*, 471
344
*325*
Sampling time
Schedulability test
Scheduling
Search
Second extension (RTOS)
Semaphore
Sensor
Sequential
Serial bus
Shared variable
Simultaneous
Soft real-time
Software redundancy
Static scheduling
Structured Text
283
*335*
320
384
396
*308*
*161*
300
215
315
300
257
146
321
*443*
© 2015 IAS, Universität Stuttgart
489
IAS
Index (7)
Swarm
swarm intelligence
Symmetric multiprocessing systems (SMP)
Synchronization
Synchronous communication
Synchronous programming
System process
44
423
415
306
316, *475*
270, *272*
351
Task
Task state
Task states
Task type
Third extension (RTOS)
Thread
Time controlled architecture
Time-driven
Topologies of communication
*290*, 291
293
292
468
398
291
232
286
213
Ubiquitous Computing
43
© 2015 IAS, Universität Stuttgart
490