EMBEDDED SYSTEM DESIGN
Model Based Design
Doan Duy, Ph. D.
Email: duyd@[Link]
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 1
Objectives
▪ Understanding the concept of model
▪ Understanding problems of applying
model to CPS
▪ Brief of Model of Continuous Dynamics
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 2
Contents
1. Introduction to Model
2. Model Design with Cyber-Physical System
3. Model of Continuous Dynamics
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 3
1. Introduction to Model
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 4
Modeling, Design, Analysis:
An Iterative Process
❑ 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).
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 5
Models
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 6
Models vs. Reality
The model:
equation, function
code, schematic
Fidelity is how well
the model and its
The target target match
(the thing
being
modeled).
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 7
Why is model…
Engineers often confuse the model with its target
You will never strike oil by
drilling through the map!
But this does not in any way
diminish the value of a map!
Solomon Wolf Golomb
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 8
Determinacy
Some of the most valuable models are
deterministic.
A model is deterministic if, given the initial state and the
inputs, the model defines exactly one behavior.
Deterministic models have proven extremely valuable in the
past.
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 9
A simple CPS
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 10
2. Model Design for CPS
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 11
Model vs. CPS
Do deterministic models make sense for Cyber-physical
systems?
Packet losses Unknowable delays
Uncontrollable scheduling
Unknowable
execution times
Physical noise
Parts failures Imperfect actuation
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 12
Model need
A Model Need not be True to be Useful
“Essentially, all models are wrong,
but some are useful.”
Box, G. E. P. and N. R. Draper, 1987: Empirical Model-Building and Response
Surfaces. Wiley Series in Probability and Statistics, Wiley.
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 13
Kinds of models
What kinds of models should we use?
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 14
Software Models
Physical System Model
Single-threaded imperative programs
are deterministic models
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 15
Hardware Abstracts
Instruction Set Architectures (ISAs)
are deterministic models
Physical System Model
Waterman, et al., The RISC-V Instruction Set Manual,
Image: Wikimedia Commons
UCB/EECS-2011-62, 2011
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 16
Schematic models
Physical System Model
Synchronous digital logic
is a deterministic model
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 17
Equation
Physical System Model
Signal Signal
Image: Wikimedia Commons
Differential Equations
are deterministic models
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 18
Problem of modelling for CPS
Combinations of Deterministic Models are Nondeterministic
Signal Signal
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 19
Example: Problem with WCET
A war story:
Ferdinand et al. [2001] determine the WCET of astonishingly simple
avionics code from Airbus running on a Motorola ColdFire 5307, a
pipelined CPU with a unified code and data cache. Despite the
software consisting of a fixed set of non-interacting tasks containing
only simple control structures, their solution required detailed
modeling of the seven-stage pipeline and its precise interaction with
the cache, generating a large integer linear programming problem.
Fundamentally, the ISA of the processor has failed to provide an
adequate abstraction. And the problem has gotten worse since 2001!
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 20
Timing is not Part of Software and Network Semantics
Correct execution of a program in all widely used
programming languages, and correct delivery of a network
message in all general-purpose networks has nothing to do
with how long it takes to do anything.
Programmers have to step outside the
programming abstractions to specify timing
behavior.
Embedded software designers
have no map!
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 21
Determinism? Really?
CPS applications operate in an intrinsically nondeterministic
world.
Does it really make sense to insist on deterministic models?
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 22
Value of Models
◼In science, the value of a model lies in how well its
behavior matches that of the physical system.
◼In engineering, the value of the physical system lies in
how well its behavior matches that of the model.
For a model to be useful, it is necessary
(but not sufficient) to be able to be able to
construct a faithful physical realization.
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 23
Model
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 24
Physical Realization
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 25
Model Fidelity
◼ To a scientist, the model is flawed.
◼ To an engineer, the realization is flawed.
I’m an engineer…
Changing question…
The question is not whether deterministic models can describe
the behavior of cyber-physical systems (with high fidelity).
The question is whether we can build cyber-physical systems
whose behavior matches that of a deterministic model (with
high probability).
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 26
Determinism vs. Resilience and Adaptability
Deterministic models do not eliminate the need for robust,
fault-tolerant designs.
In fact, they enable such designs, because they make it much
clearer what it means to have a fault!
We have to fix the models!
But how?
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 27
3. Models of Continuous Dynamic
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 28
Modeling Techniques
◼ Models that are abstractions of system dynamics
◼ (how system behavior changes over time)
Modeling physical phenomena – differential equations
Feedback control systems – time-domain modeling
Modeling modal behavior – FSMs, hybrid automata, …
Modeling sensors and actuators –calibration, noise, …
Hardware and software – concurrency, timing, power, …
Networks – latencies, error rates, packet losses, …
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 29
Actor Models with Single Input
x y
S
x: R → R
y: R → R
S: (R→ R) → (R→ R)
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 30
Thermal Sensor
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 31
Actor Models with Multiple Inputs
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 32
Opamp
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 33
Model of PID Control
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 34
Q&A
8/23/2023 Copyrights 2020 CE-UIT. All Rights Reserved. 35