EE522
Advanced Embedded Systems
Sources: [Introduction to Embedded Systems, Edward A.
Lee and Sanjit A. Seshia, UC Berkeley.
Embedded Networked Systems, Kai Huang, TU Munich]
Introduction 2-1
Modeling, Design, Analysis
Modeling is the process of
gaining a deeper understanding
of a system through imitation.
Models specify what a system does.
Design is the structured creation of
artifacts. It specifies how a system does
what it does. This includes optimization.
Analysis is the process of gaining a deeper understanding
of a system through dissection.
It specifies why a system does what it does
(or fails to do what a model says it should do).
What is Modeling?
Developing insight about a system, process,
or artifact through imitation.
A model is the artifact that imitates the
system, process, or artifact of interest.
A mathematical model is model in the form
of a set of definitions and mathematical
formulas/objects.
Models vs. Reality
Solomon Golomb: Mathematical models – Uses and
limitations. Aeronautical Journal 1968
You will never strike
oil by drilling through
the map!
Solomon Wolf Golomb (1932)
mathematician and engineer and a professor
of electrical engineering at the University of
Southern California. Best known to the
general public and fans of mathematical
games as the inventor of polyominoes, the
inspiration for the computer game Tetris. He
has specialized in problems
of combinatorial analysis, number theory,
coding theory and communications.
Butthis does not, in any way,
diminish the value of a map!
The Kopetz Principle
Many (predictive) properties that we assert
about systems (determinism, timeliness, reliability,
safety) are in fact not properties of an
implemented system, but rather properties of a
model of the system.
We can make definitive statements about
models, from which we can infer properties of
system realizations. The validity of this inference
depends on model fidelity, which is always
approximate.
Prof. Dr. Hermann Kopetz
(paraphrased)
What is Model-Based Design?
1. Create a mathematical model of all the parts of
the embedded system
Physical world
Control system
Different sub-systems,
Software environment different approaches to
Hardware platform modeling
Network
Sensors and actuators
2. Construct the implementation from the model
Goal: automate this construction, like a compiler
In practice, only portions are automatically constructed
Modeling Techniques in this Course
Models that are abstractions of system dynamics
(how things change over time)
Examples:
Modeling physical phenomena – ODEs
Feedback control systems – time-domain modeling
Modeling modal behavior – FSMs, hybrid automata
Modeling sensors and actuators – calibration, noise
Modeling software – concurrency, real-time models
Modeling networks – latencies, error rates, packet loss
Modeling of Continuous Dynamics
Ordinary differential equations, Laplace
transforms, feedback control systems, stability
analysis, robustness analysis, …
An Example: Modeling
Helicopter Dynamics
Modeling Physical Motion
Six degrees of freedom:
Position: x, y, z
Orientation: pitch, yaw, roll
Notation
Notation
Newton’s Second Law
Orientation
Angular version of force is Torque.
For a point mass rotating around a
fixed axis:
Ty(t ) = r f (t )
angular momentum, momentum
Justas force is a push or a pull, a torque is a twist.
Units: newton-meters/radian, Joules/radian
Note that radians are meters/meter (2p meters of circumference per 1 meter
of radius), so as units, are optional.
Rotational Version of Newton’s
Second Law
Simple Example
Feedback Control Problem
A helicopter without a tail rotor, like
the one below, will spin
uncontrollably due to the torque
induced by friction in the rotor shaft.
Control system
problem: Apply torque
using the tail rotor to
counterbalance the
torque of the top rotor.
Actor Model of Systems
A system is a function that
accepts an input signal and
yields an output signal.
The domain and range of
the system function are sets
of signals, which themselves
are functions.
Parameters may affect the
definition of the function S.
Actor Model of the Helicopter
Input is the net torque of
the tail rotor and the top
rotor. Output is the angular
velocity around the y axis.
Parameters of the model
are shown in the box.
The input and output
relation is given by the
equation to the right.
Composition of Actor
Models
Actor Models with Multiple Inputs
Proportional Controller
desired error net
angular signal torque
velocity
Note that the angular
velocity appears on
both sides, so this
equation is not trivial
to solve.
Behavior of the Controller
Desired angular velocity:
Simplifies differential
equation to:
Which can be solved as
follows (see textbook):
Exercise
Reformulate the helicopter model so that it has
two inputs, the torque of the top rotor and the
torque of the tail rotor.
Show (by simulation) that if the top rotor applies a
constant torque, then our controller cannot keep
the helicopter from rotating. Increasing the
feedback gain, however, reduces the rate of
rotation.
Other Modeling Techniques we will
talk about
State machines
sequential decision logic
Synchronous/reactive concurrent composition
concurrent computation
composes well with state machines
Dataflow models
exploitable parallelism
well suited to signal processing
Discrete-event models
explicit about time
Time-driven
suitable for periodic, timed actions
Continuous-time models
models of physical dynamics
extended to “hybrid systems” to embrace computation
Discretized Model
A Step Towards Software
Numerical integration techniques provided sophisticated ways to
get from the continuous idealizations to computable algorithms.
Discrete-time signal processing techniques offer the same
sophisticated stability analysis as continuous-time methods.
But it’s not accurate for software controllers (fails on correctness)
Hybrid Systems –
Union of Continuous
& Discrete
A good starting point, but
has limitations.
E.g. Consider building a
hybrid system model for
software running under a
multitasking real-time OS.
Understanding Models can be very Challenging
An example has two controllers sharing a CPU
under an RTOS. Under preemptive multitasking,
only one can be made stable (depending on the
relative priorities). Under non-preemptive
multitasking, both can be made stable.
Theory for this is lacking, so designers
resort to simulation and testing.
Key Concepts in Model-Based
Design
Models describe physical dynamics.
Specifications are executable models.
Models are composed to form designs.
Models evolve during design.
Deployed code may be (partially) generated from models.
Modeling languages have semantics.
Modeling languages themselves may be modeled (meta models)
For embedded systems, this is about
o Time
o Concurrency
o Dynamics