Dynamic Systems Modeling in Mechanics
Dynamic Systems Modeling in Mechanics
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 1 / 100
Newtonian Mechanics (review)
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 2 / 100
Newtonian Mechanics (review)
x(t) ∈ R3 , x : R → R3 .
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 3 / 100
Newtonian Mechanics (review)
where F(t) ∈ R3 is the applied force vector, M is the mass of the object, and ẍ(t) denotes the acceleration.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 4 / 100
Newtonian Mechanics (review)
For the Rotational dynamics, the torque T relates to angular acceleration:
d
T(t) = (I(t)θ̇(t))
dt
where T is the torque vector in three axes and I(t) is the moment of inertia tensor of the object.
T(t) = I θ̈(t)
Angular motion:
1 t
Z
θ̇(t) = θ̇(0) + T(τ ) dτ (2) Figure: Relationship between force F , torque
I 0
τ , linear momentum p, and angular
1 t τ momentum L in a system which has rotation
Z Z
θ(t) = θ(0) + t θ̇(0) + T(α) dα dτ (3) constrained to only one plane.
I 0 0
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 5 / 100
Example: Modeling helicopter
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 6 / 100
Example: Reduced order Helicopter model
The reduced-order dynamic model is given by:
Ty (t)
θ̈y (t) =
Iyy
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 7 / 100
Actor Models
A physical system can be modeled by a differential or integral equation that relates:
x : R → R, y :R→R
The domain R represents time, and the codomain is the signal value.
We may use R+ if the system starts operating at t = 0.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 8 / 100
System as a Mapping Between Signals
S : X → Y, where X = Y = RR
Sp,q or S(p, q)
A block like this, with function-valued inputs and outputs, is called an actor.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 9 / 100
Actor model for the helicopter
The input and output are both continuous-time functions. The parameters
of the actor are the initial angular velocity θ̇y (0) and the moment of
inertia Iyy . The function of the actor is defined by (4).
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 10 / 100
Composition of Actor Models
Cascade composition:
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 11 / 100
Composition of Actor Models
Exercise: servomechanism canonical form
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 12 / 100
Composition of Actor Models
Exercise: servomechanism canonical form
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 13 / 100
Composition of Actor Models
Exercise: servomechanism canonical form
We have
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 14 / 100
Properties of Systems: Causal systems
A system is causal if its output depends only on current and past inputs.
Let x|t≤τ represent a function called the restriction in time that is only defined for times
t ≤ τ , and where it is defined, x|t≤τ (t) = x(t). Hence if x is an input to a system, then
x|t≤τ is the ”current and past inputs” at time τ .
Causal systems
Consider a continuous-time system S : X → Y , where X = AR and Y = B R for some
sets A and B. This system is causal if for all x1 , x2 ∈ X and τ ∈ R,
That is, the system is causal if for two possible inputs x1 and x2 that are identical up to
(and including) time τ , the outputs are identical up to (and including) time τ .
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 15 / 100
Properties of Systems: Strictly causal systems
That is, the system is strictly causal if for two possible inputs x1 and x2 that
are identical up to (and not including) time τ , the outputs are identical up
to (and including) time τ . The output at time t of a strictly causal system
does not depend on its input at time t.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 16 / 100
Properties of Systems: Memoryless systems
Memoryless systems
Consider a continuous time system S : X → Y , where X = AR and
Y = B R for some sets A and B. Formally, system S is memoryless if there
exists a function f : A → B such that for all x ∈ X ,
(S(x))(t) = f (x(t))
for all t ∈ R. That is, the output (S(x))(t) at time t depends only on the
input x(t) at time t.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 17 / 100
Properties of Systems: Linearity
It is easy to see that the helicopter system defined in our example is linear
if and only if the initial angular velocity θ̇y (0) = 0.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 18 / 100
Properties of Systems: Time invariance
To define time invariance, we first define a specialized continuous-time actor
called a delay. Let Dτ : X → Y , where X and Y are sets of continuous-time
signals, be defined by
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 20 / 100
From ODEs to Transfer Functions
y (n) (t)+an−1 y (n−1) (t)+· · ·+a1 ẏ (t)+a0 y (t) = bm u (m) (t)+· · ·+b1 u̇(t)+b0 u(t).
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 21 / 100
Step 1: Apply Laplace Transform
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 22 / 100
Step 2: Define Transfer Function
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 23 / 100
Step 3: Poles and Zeros
(s − z1 )(s − z2 ) · · · (s − zm )
G (s) = K · .
(s − p1 )(s − p2 ) · · · (s − pn )
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 24 / 100
Example
ODE:
y (3) + 6y (2) + 11ẏ + 6y = 2u (3) + 16u (2) + 22u̇ − 40u.
2s 3 + 16s 2 + 22s − 40
G (s) = .
s 3 + 6s 2 + 11s + 6
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 25 / 100
Properties of Systems: LTI System Characterization
The response of an LTI system is described by the transfer function G (s):
Y (s) = G (s)U(s)
y (t) = g (t)
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 27 / 100
Properties of Systems: Stability
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 28 / 100
Properties of Systems: Stability
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 29 / 100
Proof of Theorem 1: Sufficiency
R∞
Assume 0 |g (t)|dt ≤ kg and |u(t)| ≤ ku .
Z t
|y (t)| = g (τ )u(t − τ )dτ
0
Z t
≤ |g (τ )||u(t − τ )|dτ
0
Z t
≤ ku |g (τ )|dτ ≤ ku kg
0
⇒ Output is bounded.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 30 / 100
Proof of Theorem 1: Necessity (by Contradiction)
R∞
Assume system is BIBO stable but 0 |g (t)|dt = ∞.
Then ∃t1 s.t. Z t1
ky
|g (t)|dt >
0 ku
Construct input:
ku
g (t) > 0
u(t1 − t) = 0 g (t) = 0
−ku g (t) < 0
Then, Z t1
y (t1 ) = ku |g (t)|dt > ky
0
Contradiction: output is unbounded.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 31 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
The first step in applying the Routh-Hurwitz criterion is to construct the Routh table from
the coefficients of an nth degree polynomial:
1 Set up the first two rows: The table has n + 1 rows, labeled from s n down to s 0 .
The coefficients of the first two rows are taken directly from the polynomial in a
zig-zag pattern.
sn 1 an−2 an−4 . . .
s n−1 an−1 an−3 an−5 . . .
2 Calculate subsequent rows: All other coefficients in the table are calculated from
the two rows immediately preceding them. For example, the elements of the s n−2
row (b1 , b2 , . . . ) are calculated using the following determinant formula:
1 1 an−2 1 1 an−4
b1 = − , b2 = − , ...
an−1 an−1 an−3 an−1 an−1 an−5
This pattern of calculation continues row by row until the table is complete down to
the s 0 row.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 32 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 33 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
s4 1 5 10
Construction of Routh table is constructed as s3 4 12
follows: s2 ... ...
s1 ...
s0 ...
The coefficients for the s 2 row:
1 1 5 1
b1 = − = − (12 − 20) = 2
4 4 12 4
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 34 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 35 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
Once the Routh table is fully constructed, the stability of the system is
determined by examining the signs of the elements in the first column.
Stable System: The roots of the polynomial have negative real parts
if and only if all the elements of the first column are positive. A
necessary condition for this to be true is that all coefficients of the
original polynomial must be positive.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 36 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
The standard procedure for interpreting the Routh table assumes that no
element in the first column is zero. If a zero does appear, one of two
special cases must be handled.
Case 1: An Entire Row is Zero This situation indicates that an even
polynomial is a factor of the original polynomial. The roots
of an even polynomial are symmetric with respect to the
origin of the complex plane.
Procedure: Form an auxiliary polynomial using the
coefficients from the row immediately above the row of
zeros. The power of s for the first term corresponds to the
row’s label, and subsequent powers decrease by two [9].
Analyzing the roots of this auxiliary polynomial is necessary
to determine if the system is marginally stable or unstable [9,
10].
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 37 / 100
Properties of Systems: Stability
The Routh-Hurwitz Stability Criterion
The standard procedure for interpreting the Routh table assumes that no
element in the first column is zero. If a zero does appear, one of two
special cases must be handled.
Case 2: A Zero in the First Column Only This occurs when the first
element of a row is zero, but at least one other element in
that same row is nonzero.
Procedure: To proceed, replace the zero in the first column
with a small positive constant ϵ and continue calculating
the rest of the table as usual. After the table is complete,
determine the signs of the first-column elements by taking
the limit as ϵ → 0. The number of sign changes will reveal
the number of roots in the right-half plane.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 38 / 100
Example: Is the Delay System Stable?
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 39 / 100
Marginal Stability and Imaginary Poles
If G (s) has simple poles on the imaginary axis (e.g., s = ±jω) and others
in Left-Half Plane (LHP):
Then:
System is not BIBO stable
Impulse response is bounded
Output may be bounded for some inputs
Example:
s +1 1 1 1
G (s) = ⇒ g (t) = + sin ωt − cos ωt 1(t)
s(s 2 + ω 2 ) ω2 ω ω2
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 40 / 100
Special Case: Input Matching Pole
Z t
1
G (s) = ⇒ y (t) = u(τ )dτ
s 0
If u(t) = 1(t) (step), then:
1
If a signalR has a zero DC component, it means that the average value of the signal
T
is zero i.e. T1 0 x(t) dt = 0 where x(t) is the signal, and T is the period of the signal.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 41 / 100
Exercise: Helicopter Model
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 42 / 100
Feedback Control
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 43 / 100
Feedback Control
Substituting the control input Ty (t) = Ke(t), and the error signal e(t) = ψ(t) − θ̇y (t), the
equation becomes:
Z t
K
θ̇y (t) = θ̇y (0) + ψ(τ ) − θ̇y (τ ) dτ (7)
Iyy 0
Thus, we can express the control system in terms of the error signal e(t) and the control input
Ty (t):
e(t) = ψ(t) − θ̇y (t), and Ty (t) = Ke(t)
For simplicity, we assume that ψ(t) = 0 for all t, meaning that we wish to control the helicopter
to keep it from rotating at all. Thus, the desired angular velocity is zero. In this case, equation
(7) simplifies to: Z t
K
θ̇y (t) = θ̇y (0) − θ̇y (τ ) dτ (8)
Iyy 0
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 44 / 100
Feedback Control
Using the fact from calculus that, for t ≥ 0,
Z t
ae aτ dτ = e at u(t) − 1 (9)
0
This means that prior to time zero, there is no torque applied to the system, and starting
at time zero, we apply a torque of unit magnitude. This input is clearly bounded. It never
exceeds one in magnitude. However, the output grows without bound. Thus, we can infer
that the solution to (8) is
θ̇y (t) = θ̇y (0)e −Kt/Iyy u(t). (10)
(Note that although it is easy to verify that this solution is correct, deriving the solution
is not so easy. For this purpose, Laplace transforms provide a far better mechanism.) We
can see from (10) that the angular velocity approaches the desired angular velocity (zero)
as t gets large as long as K is positive. For larger K , it will approach more quickly. For
negative K , the system is unstable, and angular velocity will grow without bound.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 45 / 100
Remark on Helicopter Torque Control
Remark
The previous example is somewhat unrealistic because we cannot indepen-
dently control the net torque of the helicopter. In particular, the net torque
Ty is the sum of the torque Tt from the top rotor and the torque Tr from
the tail rotor:
∀t ∈ R, Ty (t) = Tt (t) + Tr (t).
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 46 / 100
Modified Helicopter Model
Setup: Assumptions:
Consider the helicopter model with two Torque from top rotor is given by
inputs:
Tt : torque from top rotor (treated as Tt = b u(t)
external input),
Tr : torque from tail rotor (controlled for constant b and step input u(t).
input). Helicopter starts from rest.
Feedback control system only controls Goal: analyze how well this system performs
Tr . under disturbance Tt .
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 47 / 100
Modified Helicopter Model
Setup: Assumptions:
Consider the helicopter model with two Torque from top rotor is given by
inputs:
Tt : torque from top rotor (treated as Tt = b u(t)
external input),
Tr : torque from tail rotor (controlled for constant b and step input u(t).
input). Helicopter starts from rest.
Feedback control system only controls Goal: analyze how well this system performs
Tr . under disturbance Tt .
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 47 / 100
Modified Helicopter Model
Setup: Assumptions:
Consider the helicopter model with two Torque from top rotor is given by
inputs:
Tt : torque from top rotor (treated as Tt = b u(t)
external input),
Tr : torque from tail rotor (controlled for constant b and step input u(t).
input). Helicopter starts from rest.
Feedback control system only controls Goal: analyze how well this system performs
Tr . under disturbance Tt .
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 47 / 100
Example: Model Transformation
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 48 / 100
Example: Model Transformation
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 49 / 100
Example: Input to Control System
Desired Output:
ψ(t) = 0
Input to control system:
Tt (t) b
x(t) = ψ(t) + = u(t)
K K
Exploiting the previous system response in equation (10), we obtain:
b
θ̇y (t) = u(t) 1 − e −Kt/Iyy
K
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 50 / 100
Example: Input to Control System
Desired Output:
ψ(t) = 0
Input to control system:
Tt (t) b
x(t) = ψ(t) + = u(t)
K K
Exploiting the previous system response in equation (10), we obtain:
b
θ̇y (t) = u(t) 1 − e −Kt/Iyy
K
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 50 / 100
Example: Input to Control System
Desired Output:
ψ(t) = 0
Input to control system:
Tt (t) b
x(t) = ψ(t) + = u(t)
K K
Exploiting the previous system response in equation (10), we obtain:
b
θ̇y (t) = u(t) 1 − e −Kt/Iyy
K
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 50 / 100
Discrete-time system
y (k + n) = − an−1 y (k + n − 1) − · · · − a0 y (k)
+ bn u(k + n) + · · · + b0 u(k)
where u is the input, y is the output, and k is the discrete time variable (k
= 0, 1, 2,...).
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 51 / 100
The Z-Transform
Definition
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 52 / 100
Key Properties of the Z-Transform
Linearity:
Time Shift by n:
n−1
" #
X
Z{x(k + n)} = z n X (z) − x(i)z −i
i=0
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 53 / 100
Key Properties of the Z-Transform
Final Value Theorem: If all poles of (z − 1)X (z) are inside the unit
circle, then the final value of the signal x(k) can be found from its
transform X (z).
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 54 / 100
Discrete-Time Transfer Functions
bn z n + bn−1 z n−1 + · · · + b0
G (z) =
z n + an−1 z n−1 + · · · + a0
The roots of the numerator polynomial N(z) are the zeros of G (z),
and the roots of the denominator polynomial D(z) are the poles of
G (z).
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 55 / 100
Z-transform
Remarks
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 56 / 100
Stability Condition
Theorem
A discrete-time system represented by a rational proper transfer function
G (z) is stable if and only if all poles of G (z) are inside the unit circle; that
is, |pi | < 1 for all poles pi .
Key Idea
For discrete-time systems, the stability boundary is the unit circle in the
z-plane, whereas for continuous-time systems, it is the imaginary axis in
the s-plane.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 57 / 100
Discrete Systems
Definition and Characteristics
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 58 / 100
Discrete systems
Example Parking Garage Counter
Model of a system that keeps track of the number of cars in a parking garage
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 59 / 100
Discrete systems
Modeling Parking Garage Counter as FSM
p q p∧q p∨q ¬p
0 0 0 0 1
0 1 0 1 1
1 0 0 1 0
1 1 1 1 0
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 61 / 100
Discrete Systems
Contrast with Continuous Systems and Modeling
Modeling Approach:
Discrete components are not conveniently modeled by ordinary
differential equations (ODEs).
Instead, state machines are used to model discrete dynamics, often
combined with continuous dynamics in hybrid system models.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 62 / 100
Discrete Systems
State Machine
Σ = (X, X0 , U, F , Y, h),
where
X is the set of states,
X0 is the set initial states,
U is the set of inputs,
Visual notation for a finite state machine
Y is the set of outputs, The guards is a boolean condition that
F ⊆ X × U × X is the transition must evaluate to true for a specific state
relation, generally defined by a transition to occur after a trigger event is
received. The action specifies what out-
difference equation of the form,
puts are produced on each reaction.
x(k + 1) = F (x(k), u(k))
Definition
A Mealy machine is a finite state machine where the output depends on both
the current state and current input.
M = (X, X0 , U, Y, F , ω)
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 64 / 100
State Machines
Moore Machines
Definition
A Moore machine is a finite state machine where the output depends only on
the current state, not the current input.
M = (X, X0 , U, Y, F , ω)
X: finite set of states
X0 ∈ X: initial state
U: input alphabet
Y: output alphabet
F : X × U → X: state transition
function
ω : X → Y: output function
(depends only on state) Moore Machine
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 65 / 100
Discrete systems
Properties of State Machines
Deterministic:
A state machine is deterministic if, for each state, there is at most one
transition enabled by each input value.
Receptiveness:
A state machine is receptive if, for each state, there is at least one transition
possible on each input symbol.
Deterministic and Receptive: If a state machine is both deterministic and
receptive, then for every state, there is exactly one transition possible on
each input value.
Nondeterministic: A state machine is nondeterministic if, there exist a
state, for which at least two transitions enabled by the same input value.
Mealy vs. Moore Machines:
Mealy machines produce outputs when a transition is taken.
Moore machines produce outputs when the machine is in a state.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 66 / 100
State Machine
Exercise
Design a state diagram for a Mealy machine that must recognize the
sequence “1101”.
It has a single output ‘0’ as long as the sequence is not detected and
‘1’ as soon as the sequence is detected.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 67 / 100
State Machine
Mealy Machine for Sequence 1101
Mealy Machine
Mealy Machine for sequence 1101
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 68 / 100
Extended State Machine
Overcoming State-Space Limitations
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 69 / 100
Extended State Machine
Extended State Machines: Notation
Semantics:
Guard and output actions behave as in stan-
dard FSMs, but may reference variables.
Set actions update variables after guard
evaluation and output production.
Multiple set actions are executed sequen- Notation for extended state
tially. machines
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 70 / 100
Extended State Machines
Size of State Space
Let:
n := number of discrete states,
m := number of variables,
p := number of possible values for each variable,
then the size of the state space of the state machine is
|States| = n · p m
What is the size of the state space for the garage counter example?
What is the size of the state space for the traffic light controller
example?
In the traffic light controller, are all the states reachable?
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 71 / 100
Extended State Machine
Traffic Light Controller
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 72 / 100
Behaviors and Traces
Signals, Behaviors and languages
Signals:
For each port p of a state machine, its signal is a sequence of values
over time, represented as a function sp : N → Vp ∪ {absent}.
This function captures the value on the port at each reaction (if it’s
present or indicates its absence).
Behavior:
A behavior of a state machine is an assignment of such a signal to
each port such that the signal on any output port is the output
sequence produced for the given input signals.
Language of a State Machine (L(M)):
The language of a state machine M is defined as the set of all possible
behaviors for that state machine.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 73 / 100
Behaviors and Traces
Observation and execution trace
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 74 / 100
Hybrid Systems
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 75 / 100
Modal Models
Actor Model for State Machines
Input ports i1 , . . . , in .
Output ports o1 , . . . , on .
Ports have signals that are
either pure or valued.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 76 / 100
Modal Models
Continuous-Time Inputs & State refinement
when the system is in some abstract state (say Active), that state itself contains a refined
model - a sub-state machine (or refined dynamics) - that governs how inputs are mapped
to outputs while the system remains in that state.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 77 / 100
Hybrid Systems
Definition
A hybrid system:
Associates with each state of an FSM a
dynamic behavior.
Each state is associated with a state
refinement labeled in the figure as a
“time-based system”.
The state refinement defines dynamic
behavior of the outputs and (possibly)
additional continuous state variables
Each transition can optionally specify set
actions, which set the values of such
additional state variables when a
transition is taken
Notation for hybrid systems
A hybrid system is sometimes called a modal model because it has a finite number of modes,
one for each state of the FSM, and when it is in a mode, it has dynamics specified by the state
refinement.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 78 / 100
Hybrid Systems
A thermostat modeled as an FSM with a continuous-time input signal
This example models a thermostat as a state machine that interacts with a continuous-time
signal, a key concept in hybrid systems.
States (Σ): The thermostat has two
modes: {heating, cooling}.
Input: It receives a continuous-time
signal τ : R → R, where τ (t) is the
temperature at time t. This is a
generalization from discrete-event
inputs seen in earlier models.
Outputs: The system produces pure
signals, heatOn and heatOff, which
are present only at the instant a
transition is taken. A thermostat modeled as an FSM with a
Behavior: It uses hysteresis to avoid continuous-time input signal
rapid on/off switching (”chattering”)
near the setpoint temperature.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 79 / 100
Hybrid Systems
Timed Automata
Timed automata are modal models, where the time-based refinements have very simple
dynamics; all they do is measure the passage of time.
Core Concept: FSMs with Clocks
Each state refinement has a clock.
The states of the FSM are often referred to as
modes to distinguish them from the continuous
state variables.
The dynamic behavior within each mode
measures the passage of time.
A clock s is typically modeled by a first-order
differential equation like ṡ(t) = a, where a is a
constant.
Key Mechanisms:
Guards: Transitions between modes are A timed automaton modeling a thermo-
governed by guards that can incorporate stat with a single temperature thresh-
conditions based on the values of continuous old, 20, and minimum times Tc and Th
clock variables. in each mode. The notation := is an
Set Actions: When a transition is taken, it can assignment.
include set actions that reset clock variables.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 80 / 100
Hybrid systems
Timed Automata
(a) A temperature input to the hybrid system (Thermosta) (b) The output h, and (c) The
refinement state s
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 81 / 100
Hybrid systems
Timed Automaton
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 83 / 100
Hybrid systems
Supervisory Control
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 84 / 100
Hybrid systems
Example: Automated Guided Vehicle (AGV) Control
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 85 / 100
Exercise: Automated Guided Vehicle
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 86 / 100
Hybrid system
Automated Guided Vehicle with supervisory controller
Automatic guided vehicle with four modes: stop, straight, left, right.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 87 / 100
Hybrid systems
Supervisory Control
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 88 / 100
Composition of State Machines
What is Synchrony?
The term ”synchronous” generally means occurring or existing at the same time or
moving or operating at the same rate. However, its interpretation varies significantly
across different engineering and computer science domains:
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 89 / 100
Composition of State Machines
What is Synchrony?
Circuit Design:
Involves a global clock that drives latches to record inputs on clock edges.
Similar to SR models, assuming zero delay between latches and
simultaneous/instantaneous execution due to the global clock.
Signal Processing:
Signals have the same sample rate, or their rates are fixed multiples of one another.
Synchronous Dataflow (SDF): Refers to fixed production and consumption rates of
tokens, *not* a global clock or instantaneous execution in the SR sense.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 90 / 100
Composition of State Machines
Side-by-Side Synchronous Composition
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 91 / 100
Composition of State Machines
Side-by-Side Composition
Synchronous Composition:
A reaction of the composed system is
a simultaneous reaction of all
component machines.
Conceptually, all components react
instantaneously at each global ”tick”.
Properties:
If component state machines are
deterministic, the synchronous
composition is also deterministic.
The composed system itself is a Example of side-by-side
FSM.
composition of two actors.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 92 / 100
Composition of State Machines
Side-by-Side Asynchronous Composition
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 93 / 100
Modeling Two Servers with Shared Request Queue
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 94 / 100
Composition of State Machines
Side-by-Side Asynchronous Composition
Model of two servers with a shared task queue, assuming asynchronous composition under
semantics 1.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 95 / 100
Composition of State Machines
Cascade composition
Vo1 ⊆ Vi2
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 97 / 100
Composition of State Machines
Hierarchical State Machines
Reaction Order: In one common semantic model, reactions occur in a depth-first fashion.
The deepest refinement of the current state reacts first, followed by its container, and so on
up the hierarchy.
Preemptive Transitions: To avoid subtleties, a preemptive transition can be used. Its
guard is evaluated before the refinement reacts. If the transition is taken, the refinement
does not react at all.
Entry Transitions: How a container state is entered determines the initial state of its
refinement.
Reset Transition: Indicated with a hollow arrowhead, this transition resets the refinement to
its initial state (e.g., entering B always goes to C).
History Transition: Indicated with a solid arrowhead (sometimes marked ”H”), this transition
causes the refinement to resume in whatever state it was last in.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 98 / 100
Extended State Machines
Remarks
FSMs provide
1 A way to represent the system for mathematical analysis, so that a
computer program can manipulate it.
2 A way to model the environment of a system.
3 A way to represent what the system must do and must not do - (i.e.,
its specification).
4 A way to check whether the system satisfies its specification in its
operating environment. For example, using reachability analysis, one
can determine that some unsafe state is not reachable.
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 99 / 100
Sadek Belamfedel Alaoui (UM6P-CC) Embedded systems September 22, 2025 100 / 100