Post on 11-Feb-2022
ENGG4420: LECTURE 3 -- CHARACTERISTICS OF
REAL-TIME SYSTEMS
TIME CONSTRAINTS: every real-time task is
associated with some time constraints: a)
Deadline associated with tasks -- common
constraint; b) Delay; c) Duration
A.
It is the responsibility of the Real-Time Operating
System (RTOS) to ensure that all tasks meet their
respective time constraints.
A logically correct result produced after the
deadline would be considered incorrect.
a.
CORRECTNESS CRITERION: correctness in real-
time system implies both logical correctness of
results, and correctness of time at which the
results are produced.
B.
Safe system is one that does not cause any
damage even when it fails
a.
Reliable system is one that can operate for
long durations of time without any failure
b.
SAFETY-CRITICALITY: In many real-time systems
the issues related to safety and reliability are
bounded together to generate safety-critical
systems -- safety-critical system is required to be
highly reliable.
C.
CHAPTER 1 By Radu Muresan University of Guelph Page 1
Sensor data may be sensed periodically,
aperiodically -- therefore real-time systems must
process data from all the sensors concurrently,
otherwise signals may be lost and the system may
malfunction
a.
These systems can be considered non-
deterministic, since the behaviour of the system
depends on the exact timing of its inputs
b.
A non-deterministic computation is one in which
two runs using the same set of input data can
produce two distinct sets of output data.
c.
CONCURRENCY: a real-time system usually needs to
respond to several independent events within very
short and strict time bounds
D.
STABILITY -- under overload conditions, real-time
systems need to continue to meet the deadlines of
the most critical tasks, though the deadlines of non-
critical tasks may not be met
E.
CHAPTER 1 By Radu Muresan University of Guelph Page 2
The different events of interest arise at
geographically separated locations
○
There is need to handle locally the events and
responses produced to them to prevent
overloading of the communication network
○
Therefore, the sensors and the actuators may be
located at places where the events are
generated -- example is a petroleum refinery plant.
○
Many distributed as well as centralized real-time
systems have a feedback structure as shown below
○
DISTRIBUTED AND FEEBACK STRUCTURE -- in many
real-time systems, the different components of the
system are naturally distributed across widely
geographic area.
F.
CHAPTER 1 By Radu Muresan University of Guelph Page 3
Criticality of a task is determined by examining
how critical are the results produced by the task
to the proper functionality of the system.
○
The higher the criticality of a task the more reliable it
should be made
�
Criticality of tasks needs to be taken in
consideration when we design for fault-tolerance
○
If a highly critical task fails, immediate failure
detection and recovery are important
○
Note that task priority is a different concept then
task criticality and the priority of a task should
not be determined solely based on its criticality
○
TASK CRITICALITY: is a measure of the cost of failure
of a task
G.
Ex: in a chemical plant that is setup to work non-
stop taking corrective actions on a failure
becomes difficult in the absents of operators
○
Even if corrective actions cannot be immediately
taken it is important that a failure does not result
in a catastrophic situation.
○
A failure needs to be detected and the system
should continue to function in a graceful
degraded mode, rather then shut down abruptly.
○
EXCEPTION HANDLING -- many real-time systems
work round-the-clock.
H.
CHAPTER 1 By Radu Muresan University of Guelph Page 4
REACTIVE: a reactive system is one in which an
ongoing interaction between the computer and
the environment is maintained.
I.
Traditional systems compute the output data as
some function of the input data (without
controlling the environment)
○
In each interaction step, the results computed are used
to carry out some actions on the environment.
�
The reaction of the environment is sampled and is fed
back to the system -- the computations in real-time
system can be considered non-terminating.
�
In contrast real-time systems do not produce any
output data but enter into an ongoing interaction
with their environment
○
CUSTOM HARDWARE: a real-time system is often
implemented on custom hardware that is
specifically designed and developed for the
purpose.
J.
Ex: cell phones use various custom components,
the MPFI use specialized embedded processor.
○
CHAPTER 1 By Radu Muresan University of Guelph Page 5
REAL-TIME EMBEDDED COMPUTERS -- are
computers that implement one or more
functional elements of a real-time system and is
not a stand-alone computing machine
K.
Connection to the environment through a wide
range of interface devices, and
�
Receive and send variety of stimuli�
Example of an embedded system is the Multi-Point
Fuel Injection (MPFI) system.
�
Common features of real-time systems and
embedded computers are:
○
Complex due to its environment interaction○
Difficult to test during the design process○
Need to use plant models and environment
models in order to develop a functional design
○
LabView is a program that is very useful in
simulating environment, modeling plants, testing,
and implementing support software.
○
Majority of the 41x designs that I supervise have
used LabView to demonstrate proof of concept
for their embedded applications (real-time or
not).
○
DESIGN OF REAL-TIME EMBEDDED SYSTEMS
CHAPTER 1 By Radu Muresan University of Guelph Page 6
TEST ARCHITECTURES
CHAPTER 1 By Radu Muresan University of Guelph Page 7
CLASSIFICATIONS OF REAL-TIME SYSTEMS BASED
ON SYNCHRONIZATION
Tasks are internal actions carried by the computer○
External processes have their own time scale○
Tasks are connected by physical devices to external
processes. We need to consider that:
•
Computer tasks operate in real-time if their actions
are related to the time-scales of the external
processes.
•
Operations are carried out according to a time schedule�
Clock based -- based on passage of time or actual
time of the day
○
Event based -- the events determine the
synchronization -- Ex. Closure of a switch ...
○
Ex. a set of operations should be completed within
a predetermined time.
�
Interactive -- relationship between actions in the
computer and processes is loosely defined.
○
Synchronization types between external processes
and the tasks (internal actions) are:
•
IMPORTANCE OF PLANT CHARACTERISTIC
The time constant of a plant is a measure of the
time taken by the plant to respond to a change in
input or load and is called the plant characteristic
•
For feedback control the required sampling rate is
dependent on the time constant of the process.
•
CHAPTER 1 By Radu Muresan University of Guelph Page 8
Real-time requirements -- computer used for control
must be able to carry out all the required operations
(i.e., measurement, control, actuation) within each
sampling interval.
•
Synchronization is obtained by adding a real-time
clock to the computer system and using interrupts
from this clock to carry out operations.
•
The task is to run once per period T, or it is to run
at exactly T unit intervals
○
CLOCK BASED TASKS -- are referred to as cyclic or
periodic
Ex: turning off a pump, closing a valve, or switching
a motor off in response to the closure of a position
microswitch.
�
Event based systems are also used extensively to
indicate alarm conditions and initiate alarm actions
in industrial processes.
�
Actions are performed in response to some event ○
The general real-time requirement for event-
based systems is that the system responds within
a given maximum time to an event.
○
EVENT BASED TASKS -- events occur at non-
deterministic intervals -- also called aperiodic tasks
CHAPTER 1 By Radu Muresan University of Guelph Page 9
Interrupts -- to inform the computer that action
is required
○
Polling -- the computer periodically asks (polls)
the various sensors to see if action is required.
○
Implementation of event based systems•
Example: a task may be required to start within 0.5
seconds or produce an output within 0.5 seconds
of an event occurring
�
Such tasks may have deadlines expressed in
terms of start or finish times (or even both).
○
Events based tasks are called aperiodic tasks --
events occur at non-deterministic intervals
•
The real-time requirement for these system is
usually expressed in terms such as: the average
response time should not exceed 20 seconds
○
INTERACTIVE SYSTEMS -- reservation system for
airlines, hotels, etc. Or a bank teller system.
Interactive versus event based -- interactive systems
respond at a time determined by the internal state
of the computer and without reference to the
environment.
•
Interactive versus clock based -- clock based are
tightly synchronized to an external process through
a clock while interactive are not.
•
CHAPTER 1 By Radu Muresan University of Guelph Page 10
TYPES OF REAL-TIME SYSTEMS AND TASKS
Using the deadline constraint we can have two major
categories of real-time tasks: hard real-time and soft
real-time.
•
Hard, soft, or firm real-time task○
Some authors divide the real-time tasks based on
the consequences of a task missing a deadline in:
•
Within a real-time system it is not necessary to have
all task belonging to the same category.
•
The system is considered to have failed whenever
any of its hard real-time tasks does not produce
its required results before their deadlines.
○
Robot system -- a robot cyclically carries out various
tasks such as communication with the host, logging
all completed activities, sensing the environment to
detect any obstacle, tracking the object of interest,
path planning, effecting next move.
�
Consider that a robot suddenly encounters an
obstacle -- the robot needs to detect it and try to
escape colliding with it quickly -- if concerned tasks
are not completed in time then collision takes place
and the robot would be considered to have failed.
�
Examples:○
HARD REAL-TIME TASKS -- it is a task that is
constrained to produce its results within certain
predefined time bounds
CHAPTER 1 By Radu Muresan University of Guelph Page 11
APPLICATIONS that have hard real-time tasks
are normally safety-critical.
•
Any failure in a hard real-time task would
result in a severe consequence for the
application.
•
As a result, the hard real-time tasks are
extremely critical
•
Extremely critical to not so critical○
Criticality of a task can range from:•
Task criticality is a different dimension than
hard or soft characterization of a task.
•
Criticality of a task is a measure of the cost of
a failure.
•
Q: Give an example of a hard real-time
system that is not safety-critical??
CHAPTER 1 By Radu Muresan University of Guelph Page 12
OTHER examples of hard real-time systems is the
anti-missile system, etc.
•
HOMEWORK: 1) describe why the anti-missile
system is a hard real-time system; 2) think of other
examples that are real-time hard system and why?
In practical system the time bounds for hard real-
time tasks usually range from several micro-seconds
to a few milliseconds.
•
There is no reward in completing it ahead of its
deadline
○
It should be noted that a hard real-time task does
not need to be completed within the shortest
possible time but within the specified time bound
•
FIRM REAL-TIME TASKS -- the results of a firm real-
time task is associated with a predefined deadline,
but unlike a hard real-time task if a firm task does
not complete before its deadline the system does
not fail (the late results are discarded)
CHAPTER 1 By Radu Muresan University of Guelph Page 13
Firm real-time tasks are typically encountered in
multimedia applications
•
The system takes pictures of an enemy territory
and beams it to a ground station computer frame
by frame
�
The ground computer proceeds to find positional
difference of various objects of interest with
respect to previous frames
�
When the computer is overloaded a new image
could be received before an old one has been
processed -- in this case the old one can be
discarded
�
Satellite-Based Tracking of Enemy Movements○
Video Conferencing -- HOMEWORK -- explain why this
application is a firm real-time system.
○
Examples:•
The associated time bounds for firm real-time tasks
range typically from a few milliseconds to several
hundreds of milliseconds.
•
SOFT REAL-TIME TASKS: these tasks also have time
bounds associated with them but the timing constraints
of soft real-time tasks are not expressed as absolute
value -- instead, the constraints are expressed in terms
of the average response times required.
CHAPTER 1 By Radu Muresan University of Guelph Page 14
Once a request for reservation is made, the
response should occur within 20 seconds on an
average
�
Response result may be in the form of a printed
ticket or an apology on an unavailability ticket
�
Alternatively, we might state the constraint on the
ticketing task as: at least in case of 95% of
reservation requests, the ticket should be processed
and printed in less than 20 sec.
�
Railway seat reservation system○
Using the above example -- if the ticket is printed in
about 20 sec, we feel that the system is working
fine and have a feel of obtaining instant results
�
Missed deadlines of soft real-time tasks do not
result in system failure. However, the utility of the
result produced by a soft real-time task falls
continually with time after the deadline expired
�
IMPACT of the deadline failure in a soft real time task○
Examples of Soft Real-Time Systems•
CHAPTER 1 By Radu Muresan University of Guelph Page 15
In practical applications, the time bounds for typical
soft real-time tasks usually range form a fraction of
a second to a few seconds
•
NON-REAL-TIME TASKS: a non real-time task is not
associated with any time bounds
Most interactive computations we perform
nowadays are handled by soft-real time tasks.
•
A few examples of non-real time tasks could be
batch processing jobs, e-mail, background tasks, etc.
•
But, we could argue that even these tasks could be
considered soft real-time to some degree.
•
WHAT IS THEN THE DIFFERENCE BETWEEN a non-
real time tasks and a soft real-time tasks??
For non-real-time tasks the associated time bounds
are typically of the order of a few minutes, hours, or
even days.
•
In contrast for the soft real-time tasks the time
bounds are the most of the order of a few seconds.
•
CHAPTER 1 By Radu Muresan University of Guelph Page 16
SUMMARY OF TASK CLASSIFICATION BASED ON
TIME BOUNDS
Hard real-time task -- time bounds associated
to the task deadlines are from several µs to a
few ms.
1.
Firm real-time tasks -- time bounds associated
to task deadlines range from a few ms to
several hundreds of ms.
2.
Soft real-time tasks -- time bounds usually
range from a fraction of a second to a few
seconds.
3.
Non-real-time tasks -- the associated time
bounds are typically in the order of a few
minutes , hours or even days.
4.
CHAPTER 1 By Radu Muresan University of Guelph Page 17
ENGG4420. CHAPTER 1: Real-Time Computer Control. Developed by Radu Muresan, Univesity of Guelph 17
Hard Soft
Periodic(Cyclic)
A periodic(Event)
Periodic(Cyclic)
A periodic(Event)
ee Tit ≤)(atit sc ±=)( ∑=
±=n
i
asc tit1
)(n
1
stTn /=
∑=
≤n
i
ae Tit1
)(n
1
stTn /=
tc(i) the interval between the i and i – 1 cycles,te(i) the response time to the ith occurrence of event e,ts the desired periodic (cyclic) interval,Te the maximum permitted response time to event e,Ta the average permitted response time to event e measured over
some time interval T,n the number of occurrences of event e within the time interval T,
or the number of cyclic repetitions during the time interval T,a a small timing tolerance.
FORMAL CLASSIFICATION OF REAL-TIME TASKS
CHAPTER 1 By Radu Muresan University of Guelph Page 18
CLASSIFICATION OF PROGRAMS
Real-time tasks and non-real-time tasks.○
Subdivide the real-time tasks into hard and soft○
It is important to separate the computer control
activities into:
•
The division of software into small, coherent
modules is an important design technique.
•
Verification of the applications ...�
Sequential -- actions are strictly ordered as a time
sequence. The behaviour of the program depends
only on the effects on the individual actions and
their order.
○
Processes or tasks are partly sequential but are executed
concurrently -- communicate through shared variables
and synchronization signals.
�
Verification of the applications ...�
Multi-tasking -- the actions required to perform
are not necessarily disjoint in time (concurrency).
Such programs can be built from a number of
parts called processes or tasks.
○
Verification -- need models of environment.�
Real-Time -- in addition to its action not
necessarily being disjoint in time, the sequence of
some of its action is determined by the
environment
○
Types of programming•
CHAPTER 1 By Radu Muresan University of Guelph Page 19
DESIGN OF REAL-TIME SYSTEMS, GENERAL
INTRODUCTION
Design Example•
Single-Program Approach•
Foreground/Background System•
Multi-Tasking Approach•
CHAPTER 1 By Radu Muresan University of Guelph Page 20
DESIGN EXAMPLE -- REAL-TIME COMPUTER
CONTROL FOR HOT-AIR BLOWER SYSTEM
The approach to the design of real-time control
systems is no different in outline from that
required for any computer-based system.
○
The planning phase -- is concerned with interpreting
user requirements to produce a detailed specification of
the system to be developed and an outline plan of
resources, people, time, equipment, costs-required to
carry out the development. At this stage preliminary
decisions regarding the division of functions between
hardware and software will be made -- The outcome of
this stage will be a specification or requirement
document.
�
The development phase -- is composed of various
stages such as: preliminary stage, design stage, and
testing stage. During these stages there is need for
extensive cooperation between hardware and software
designers.
�
The work can be divided into two main sections:○
CHAPTER 1 By Radu Muresan University of Guelph Page 21
HOT AIR BLOWER PLANT -- MAIN PLANT OF THE
SYSTEM EXAMPLE
BridgeCircuit
& Amplifier
FullyOpen
ThyristorUnit
TubeAir Flow
PowerInput
A
Computer
B
TemperatureMeasurement
(0-10V)
Auto Man
Air Inlet Heater
ManualFullyClosed
Air Inlet Position
On/OffClockwise/
Anticlockwise
Blower
MotorControl
Operator
VariableAir Inlet
centrifugal fan (blower),○
thermistor,○
heating element,○
reversible motor,○
potentiometer wiper for inlet air,○
microswitches,○
slider potentiometer for the reference temperature,○
operator panel.○
This plant example (a hot-air blower) is presented in order
to illustrate the various operations of a computer control
system. As seen from the diagram, the components of the
hot-air blower plant are:
CHAPTER 1 By Radu Muresan University of Guelph Page 22
COMPONENTS DESCRIPTION
Centrifugal fan -- blows air over a heating element and into a
tube.
•
The thermistor bead -- placed at the outlet end of the tube
forms one arm of a bridge circuit (a common configuration
used to measure small resistor variations). The amplifier output
of the bridge circuit is available at B and provides a voltage, in
the range 0 to 10 volts, proportional to temperature.
•
The current supplied to the heating element can be varied by
supplying a DC voltage in the range 0 to 10 volts to point A.
•
The position of the air-inlet cover to the fan is adjusted by
means of a reversible motor (can be adjusted by the operator
or computer). The motor operates at constant speed and is
turned on or off by a logic signal applied to its controller; a
second logic signal determines the direction of rotation.
•
A potentiometer wiper is attached to the air-inlet cover and
the output voltage is proportional to the position of the cover.
•
Microswitches are used to detect when the cover is fully open
and fully closed.
•
In manual mode the heat output and fan cover position can
be adjusted using potentiometers. Switches are provided to
operate the fan and heater.
•
Panel lights indicate fan on, heater on, cover fully open,
cover fully closed, and auto/manual status.
•
The operator panel: automatic and manual control•
The desired output temperature is known as the set point and
is set by the operator using a slider potentiometer. The
computer can read this setting.
•
The question is: how do we implement a system like this?•
CHAPTER 1 By Radu Muresan University of Guelph Page 23
FEATURES OF THE PLANT
Panel lights: fan on; heater on; cover fully open;
cover fully closed; and auto/manual status
•
Set point for the control system -- the desired
output temperature is set by the operator and it can
be read by the computer.
•
In manual mode the heat output and fan cover
position can be adjusted by the operator using
potentiometers.
•
Switches are provided to operate the fan and the
heater.
•
COMPUTER CONTROL FEATURES
Monitoring of the plant,○
Control of the plant,○
Actuation of the plant,○
And communication to the operator.○
The operation of the plant requires that software be
provided to support:
•
CHAPTER 1 By Radu Muresan University of Guelph Page 24
COMPUTER CONTROL OF A HOT-AIR BLOWER
Digital Input
ADC
Computer
DAC Digital Output
BridgeCircuit
Air InletPosition
Heater Circuit
Motor Control
OperatorPanel
AirFlow
Thermistor
AirInlet
Close
AirInlet Open
Blower
HeaterElement
DirectionAuto/Manual
ToOperator
Panel
On/Off
AirInlet
Air Inlet Motor
A general schematic of the system is shown above. The
computer interacts with the digital input and output interfaces
and with the ADC and DAC. The interfaces are directly
connected to the plant. Complex micro-processors incorporate
many I/O interfaces on the same chip with the ALU.
Many of these interfaces are part of the embedded processor.
CHAPTER 1 By Radu Muresan University of Guelph Page 25
MONITORING FUNCTION
Monitoring involves obtaining information about
the current state of the plant.
•
Analog signals: air temperature, fan-inlet cover
position, temperature reference.
○
Digital (logic) signals: fan-inlet cover position
(i.e., fully open, fully closed); status signals (i.e.,
auto/manual, fan motor on, heater on).
○
In our example, the information is available from
the plant instruments in the following two forms:
•
ACTUATION REQUIREMENTS
The provision of a voltage proportional to the
demanded heat output to drive the heater control;
•
Logic signals indicating on/off and the direction in
which the fan-inlet cover is to be moved;
•
Logic signals for the operator display.•
CHAPTER 1 By Radu Muresan University of Guelph Page 26
CONTROL -- involves parallel logic operations,
time-sequential control and timing of operation.
Specifically we need to implement:
The temperature, and ○
The position of the fan-inlet cover.○
The digital equivalent of continuous feedback
control (direct digital control DDC) for control of:
•
For example, the heater should not be on if
the fan is not running.
○
Sequence and interlock control operations are
also required
•
The change over needs to be done without
disturbing the temperature of the air at the
output of the tube -- bumpless transfer.
○
The computer needs also to handle automatic
change-over from simply tracking (monitoring)
the manual control operations to controlling the
system when the operator requests a change
from manual to automatic control:
•
BUMPLESS TRANSFER -- a change from manual
to auto mode such that no disturbance in the
plant output is caused.
CHAPTER 1 By Radu Muresan University of Guelph Page 27