Professional Documents
Culture Documents
Chapter 3:离散动力学之有限状态机
Chapter 3:离散动力学之有限状态机
Chapter 3
Discrete
Dynamics
What is Modeling?
. Concurrency
. Time
. Dynamics: discrete and continuous
Modeling Techniques
Discrete actor:
Counter : (R → {absent, present}){up,down} → (R → {absent ∪
Inputs and Outputs at Reaction
States = {0 , 1 , 2 , . . . , M }
3.3 Finite State Machine (FSM)
w dwn / 1 w dwn / M
which means
g = {{ up}} .
Inputs(up) = present and Inputs(down) = absent
3.3 FSM: Thermostat
input: :R
outputs pure
18 / heaton
temperature≥22/heatoff
UP A down / 1
down up / 0
up
down∧ up / M - 1
Mealy
Machine
Moore
Machine
Garage Counter Mathematical Model
/M
-1
► Deterministic (given the same inputs it will always produce the same
outputs)
. if, for each state, there is at most one transition enabled by each input value.
. formal definition of an FSM ensures that it is deterministic, since update is a function.
nt al set act
lon
3.4 Extended FSM for the Garage Counter
augments the FSM model
varlable: c : …M} with variables that may be
pure read and written as part of
taking a transition between
…M} states
down A Up 人 c
c : 0 >0/c
c · c 1
Example of Thermostat
When does a reaction occur?
trueIsigG
true lsigR / · 7
rue s/ g
7
3.6 FSM Behaviors
uw dwn / 1 uw dwn / M
Input seqeuence
sup= (present, absent, present, absent,...)
sdown = (present, absent, absent,
3.6 FSM Behaviors
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.