0% found this document useful (0 votes)
58 views19 pages

SYST611 Week 5 - Extended State Machines

Uploaded by

Amar Gopi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views19 pages

SYST611 Week 5 - Extended State Machines

Uploaded by

Amar Gopi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

SYST 611

SYSTEM METHODOLOGY AND MODELING


Week 5

Extended State Machines

Abbas K. Zaidi

Outline

• State Machines with Output


• Extended Finite State Machines
• Timed Automata

ExtendedSM - 2

ESM - 1
Discrete Event Systems

• Dynamics • Type of Variables and Linearity


– Static – Finite
– Dynamic – (Infinite) Discrete
• Driving Type – Continuous linear
– Time-driven – Continuous nonlinear
– Event-driven – Hybrid
– Fully-driven • Time
• Randomness – Continuous-time
– Deterministic – Discrete-time
– Stochastic

ExtendedSM - 3

An Informal Review

(States, Inputs, Output, update, initialState)

ExtendedSM - 4

ESM - 2
Finite State Machines with
Output

• Types of Finite State Machines with Output


– Mealy Machine: output associated with transition
» In the diagram, transitions and outputs are indicated with arrows
labeled with the pair of input and output such as xk/yh.
– Moore Machine: output associated with states
» In the diagram, transitions are indicated with arrows labeled with
the input, and the outputs are shown next to the states.
» The output corresponding to the input string x=x1x2...xk is the
string y=g(q0)g(q1)...g(qk) where qi=f(qi-1, xi) for i=1,2,...,k.

ExtendedSM - 5

Transition Diagram

• Notation: Mealy Machine

Input/output

ExtendedSM - 6

ESM - 3
Transition Diagram

• Notation: Moore Machine

Input

output

ExtendedSM - 7

Demonstration – Mealy Machine

Tutorial Examples from http://jflap.com/tutorial/


Example: This Mealy machine has four states, 0c, 5c, 10c, and 15c, each describing
the amount of money inserted in the vending machine, 0¢, 5¢, 10¢, and 15¢. Its input
alphabet of n, d, and q, denotes the insertion of nickels, dimes, and quarters
respectively. In its output alphabet, λ denotes the vending machine doing nothing, the
machine also dispenses candy and excess money as change.

© AKZ v. 1.0
2/18/2020 ExtendedSM - 8

ESM - 4
Demonstration – Moore Machine

Tutorial Examples from http://jflap.com/tutorial/


Example: This Moore machine inverts the input bit string.

© AKZ v. 1.0
2/18/2020 ExtendedSM - 9

Garage Counter: Mealy Machine

Consider a system that counts the number of cars that enter and leave a parking
garage in order to keep track of how many cars are in the garage at any time. We
ignore the sensors that detect the entry or departure of cars. We simply assume
that the ArrivalDetector actor produces an event when a car arrives, and the
DepartureDetector actor produces an event when a car departs. The Counter
actor keeps a running count, starting from an initial value i. Each time the count
changes, it produces an output event that updates a display.

ExtendedSM - 10

ESM - 5
Garage Counter: Moore Machine

ExtendedSM - 11

Mealy and Moore


Equivalence
• Note that the two machines are not equivalent:
– Suppose that on the first reaction, up   down. The output of
Moore machine will be 0 and 1 for Mealy machine.
– The output of the Moore machine represents the number of cars
in the garage at the time of the arrival of a new car, not the
number of cars after the arrival of the new car.
• The Moore machine, when it reacts, always reports the output
associated with the current state.
• The Mealy machine does not produce any output unless there is a
transition explicitly denoting that output.

ExtendedSM - 12

ESM - 6
Mealy and Moore
Equivalence
• Any Moore machine may be converted to an equivalent Mealy
machine.
• A Mealy machine may be converted to an almost equivalent Moore
machine that differs only in that the output is produced on the next
reaction rather than on the current one.
• Mealy machines are more compact (requiring fewer states to
represent the same functionality)

ExtendedSM - 13

Extended State Machines

• The State Machine of Garage Counter will become very large with M.
That is the reason for using the informal notation of ‘…’ on the
transition diagrams.
• An extended state machine solves this problem by augmenting the
FSM model with variables that may be read and written as part of
taking a transition between states.

Extended FSM of
Garage Counter Example

ExtendedSM - 14

ESM - 7
General Notation of ESM

Explicit declarations of variables, inputs,


and outputs to help distinguish the three.

• The state of an extended state machine includes the information about the
state node and the values of the variable(s).
• The number of possible states can be quite large, or even infinite.

n = no. discrete states


m = no. of variables each of which can have one of p possible values

ExtendedSM - 15

Timed Automata

Alur and Dill (1994),

ExtendedSM - 16

ESM - 8
Example: Traffic Light Controller at a
Pedestrian Crossing

• Time Triggered Machine (i.e. one reaction/second)

An ordinary transition has priority


over a default transition. When both
have guards that evaluate to true,
the ordinary transition prevails.

ExtendedSM - 17

Other Topics of Interest in ESM


Non-determinism

• Non-deterministic ESM
(States, Inputs, Output, possibleUpdates, initialStates)

Uses of Non-determinism
• Environment Modeling: hide irrelevant details about how an
environment operates, resulting in a non-deterministic FSM.
• Specifications: System specifications impose requirements on some
system features, while leaving other features unconstrained.
Note:
The nondeterministic FSM makes no statement about how likely the
various reactions are. A model that specifies likelihoods (in the form of
probabilities) is a stochastic model, distinct from a nondeterministic
model.
ExtendedSM - 18

ESM - 9
Other Topics of Interest in ESM
Composition

• Side-by-side Composition
M1

M2

• Cascade Composition

M1 M2

• Feedback Composition M1

ExtendedSM - 19

Other Topics of Interest in ESM


Composition

• Side-by-Side
– Synchronous
– Asynchronous

ExtendedSM - 20

ESM - 10
Synchronous Composition

ExtendedSM - 21

Asynchronous Composition

• One Definition

ExtendedSM - 22

ESM - 11
Composition

• Cascade Composition

ExtendedSM - 23

Cascade Composition
• Example – B: Model of a Traffic Light
– A: Model of a Pedestrian Controller at a Pedestrian
Crossing Light Crossing

ExtendedSM - 24

ESM - 12
Cascade Composition

Pedestrian Light with Traffic Light

ExtendedSM - 25

Cascade Composition

Pedestrian Light with Traffic Light


(Synchronous Composition)

ExtendedSM - 26

ESM - 13
Demonstration – Stateflow
Toolbox, Simulink

© AKZ v. 1.0
2/18/2020 ExtendedSM - 27

Demonstration – Stateflow
Toolbox, Simulink

© AKZ v. 1.0
2/18/2020 Examples from The MathWorks (http://www.mathworks.com/) ExtendedSM - 28

ESM - 14
Demonstration – Stateflow
Toolbox. Simulink

© AKZ v. 1.0
2/18/2020 Examples from The MathWorks (http://www.mathworks.com/) ExtendedSM - 29

Demonstration – Stateflow
Toolbox, Simulink

© AKZ v. 1.0
2/18/2020 ExtendedSM - 30

ESM - 15
DEVS
(Zeigler, 1976)

• Discrete Event System Specification (DEVS)

• Formal M&S framework


• Supports full range of dynamic system representation capability –
both discrete event and continuous system modeling and simulation.

• Supports hierarchical, modular model development

ExtendedSM - 31

Definition*

ExtendedSM - 32
* http://www.acims.arizona.edu/EDUCATION/ECE575Fall03/Note/

ESM - 16
Basic Concepts*

ExtendedSM - 33
* http://www.acims.arizona.edu/EDUCATION/ECE575Fall03/Note/

DEVS Tools
• Tools Developed at ACIMS, Univ. of Arizona:
– ADEVS
– DEVSJAVA
– DEVS/CORBA
– DEVS/Grid
– DEVS/P2P
– DEVS/SOA
– DEVS/HLA
– DEVS/RMI
• CD++ (Carleton Univ.)
• GALATEA (USB – Venezuela)
• GDEVS (Aix-Marseille III, France)
• JDEVS (Universite de Corse – France)
• PyDEVS (McGill)
• SimBeams (Univ of Linz – Austria)

ExtendedSM - 34

ESM - 17
Applications

ExtendedSM - 35

Applications

• Use of DEVS requires knowledge of


– Differential Equations
– State Machines
– Programming

ExtendedSM - 36

ESM - 18
References

– The material on Extended Finite State Machines is taken from


the lecture notes/textbook by:

ExtendedSM - 37

DEVS Resources

• University of Arizona: http://www.acims.arizona.edu/


• UC Berkeley: http://leeseshia.org/
• KAIST, ROK: http://smslab.kaist.ac.kr/M5_1.htm

ExtendedSM - 38

ESM - 19

You might also like