The State Automata Formalism Untimed models of discrete event - - PowerPoint PPT Presentation

the state automata formalism
SMART_READER_LITE
LIVE PREVIEW

The State Automata Formalism Untimed models of discrete event - - PowerPoint PPT Presentation

The State Automata Formalism Untimed models of discrete event systems Languages Regular Expressions Automata (Deterministic) Finite State Automata Nondeterministic Finite State Automata State Aggregation


slide-1
SLIDE 1

The State Automata Formalism

  • Untimed models of discrete event systems
  • Languages
  • Regular Expressions
  • Automata

– (Deterministic) Finite State Automata – Nondeterministic Finite State Automata – State Aggregation – Discrete Event Systems as State Automata

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 1/31

slide-2
SLIDE 2

Untimed models

  • Level of specification: I/O System (state based, deterministic)
  • Time Base =

(time

progression index)

  • Dynamic but

– only sequence (order) of states traversed matters – not when in state or how long in state

  • Discrete Event: event set E

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 2/31

slide-3
SLIDE 3

Languages – Regular Expressions – Automata

  • language L, defined over alphabet E (events)

set of strings formed from E

  • Example: all possible input behaviours:

L

✂ ☎

ε

ARR

DEP

ARR ARR DEP

✆✞✝ ✝ ✝ ✟
  • Regular expression: shorthand notation for a regular language

ARR DEP

ARR

DEP

✠ ✆ ✡

DEP

ARR

☞ ✠

Concatenation, Alternatives (

), Kleene closure (

).

  • Finite State Automaton (model): generate/accept a language

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 3/31

slide-4
SLIDE 4

Finite State Automaton

E

X

f

x0

F

  • E is a finite alphabet
  • X is a finite state set
  • f is a state transition function,

f : X

E

X

  • x0 is an initial state, x0

X

  • F is the set of final states

Dynamics (x

is next state):

x

✏ ✂

f

x

e

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 4/31

slide-5
SLIDE 5

FSA recognizes Language

  • extended transition function:

f : X

E

✠ ✍

X f

x

ue

☞ ✂

f

f

x

u

☞ ✆

e

  • A string u over the alphabet E is recognized by a FSA

E

X

f

x0

F

if f

x0

u

☞ ✂

x where x

F.

  • The language L

A

recognized by a FSA A

✂ ✡

E

X

f

x0

F

is the set of strings

u : f

x0

u

☞ ✎

F

.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 5/31

slide-6
SLIDE 6

FSA graphical notation: State Transition Diagram

Init End_1 End_0 1 1 1

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 6/31

slide-7
SLIDE 7

Simulation steps

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 7/31

slide-8
SLIDE 8

Init End_1 End_0 1 1 1 Current State Init End_1 End_0 1 1 1 Current State Init End_1 End_0 1 1 1 Current State Init End_1 End_0 1 1 1 Current State

Rule 1 Rule 2 Rule 2 Rule 2 Final Action

"Accept Input"

input 0 input 1 input 0 end of input

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 8/31

slide-9
SLIDE 9

FSA Operational Semantics

/ <ANY> <ANY> <ANY> Current State 2 4 3 1 / <COPIED> <COPIED> <COPIED> Current State 2 4 3 1 <ANY> 1 / <ANY> <ANY> <ANY> <ANY> Current State 2 4 3 5 1

/ <COPIED> <COPIED> <COPIED> <COPIED> Current State 2 4 3 5 1

::= ::= ::=

Rule 1 (priority 3) Rule 2 (priority 1) Rule 3 (priority 2) Locate Initial Current State State Transition Local State Transition condition: matched(4).input == input[0] action: remove(input[0]) condition: matched(4).input == input[0] action: remove(input[0])

<COPIED> Current State 3 1 2

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 9/31

slide-10
SLIDE 10

Nondeterministic Finite State Automaton

NFA

✂ ✡

E

X

f

x0

F

f : X

E

2X

  • Monte Carlo simulation (if probabilities added)
  • Transform to equivalent FSA (aka DFA)

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 10/31

slide-11
SLIDE 11

Nondeterministic Finite State Automaton

Idle Coffee Tea drinkC drinkT thirsty thirsty Button Button TDrunk Cdrunk

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 11/31

slide-12
SLIDE 12

Constructed Deterministic Finite State Automaton

Idle Coffee$Tea drinkC$drinkT thirsty Button Cdrunk TDrunk

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 12/31

slide-13
SLIDE 13

Transformation Rules

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 13/31

slide-14
SLIDE 14

Rule LHS

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 14/31

slide-15
SLIDE 15

Rule RHS

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 15/31

slide-16
SLIDE 16

Managing Complexity: State Aggregation

E

X

f

x0

F

R

X R consists of equivalent states with respect to F

if for any x

y

R

x

✒ ✂

y and any string u, f

x

u

☞ ✎

F

f

y

u

☞ ✎

F x and y are equivalent for as far as “accepting/rejecting” input strings is

concerned.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 16/31

slide-17
SLIDE 17

State Aggregation Algorithm

  • 1. Mark

x

y

for all x

F

y

✒ ✎

F

  • 2. For every pair

x

y

not marked in previous step: (a) If

f

x

e

☞ ✆

f

y

e

☞ ☞

is marked for some e

E, then:

  • i. Mark

x

y

  • ii. Mark all unmarked pairs

w

z

in the list of

x

y

. Repeat this step for each

w

z

until no more markings possible. (b) If no

f

x

e

☞ ✆

f

y

e

☞ ☞

is marked, the for every e

E:

  • i. If f

x

e

☞ ✒ ✂

f

y

e

then add

x

y

to the list of f

x

e

☞ ✒ ✂

f

y

e

Pair which remain unmarked are in equivalence set

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 17/31

slide-18
SLIDE 18

digit sequence (123) detector FSA

x_1 x_12 x_123 x_3 x_2 1 1 1 3 2 3 3 2 2 2 1 1 3 3 2

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 18/31

slide-19
SLIDE 19

State Reduced FSA

x_1 x_12 x_123 x_0 1 1 1 3 2 3 2 2 1 3 3 2

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 19/31

slide-20
SLIDE 20

State Automata to model Discrete Event Systems

  • X is state space
✔ ✔

Q

  • All inputs are strings from an alphabet E (the events)
✔ ✔

X

  • State transition function x
✏ ✂

f

x

e

☞ ✔ ✔

δ

  • Allow X and E to be countable rather than finite
  • Introduce feasible events

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 20/31

slide-21
SLIDE 21

State Automaton

E

X

Γ

f

x0

  • E is a countable event set
  • X is a countable state space
  • Γ

x

is the set of feasible or enabled events

x

X

Γ

x

☞ ✎

E

  • f is a state transition function,

f : X

E

X, only defined for e

Γ

x

  • x0 is an initial state, x0

X

E

X

Γ

f

  • mits x0 and describes a class of State Automata.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 21/31

slide-22
SLIDE 22

Feasible/Enabled Events

  • On transition diagram: not feasibe

not marked

  • Meaning: ignore non-feasible events
  • Why not f

x

e

☞ ✂

x for non-feasible events ?

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 22/31

slide-23
SLIDE 23

State Automata for Queueing Systems

Physical View Queue Cashier Departure Arrival Departure Queue Abstract View Cashier [ST distribution] [IAT distribution] Arrival

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 23/31

slide-24
SLIDE 24

State Automata for Queueing Systems: customer centered

...

1 2 3 4 5

a d a d a d a d a d a d

E

✂ ☎

a

d

X

✂ ☎ ✆

1

2

✆✞✝ ✝ ✝ ✟

Γ

x

☞ ✂ ☎

a

d

✟ ✆✗✖

x

✘ ✆

Γ

✡ ☞ ✂ ☎

a

f

x

a

☞ ✂

x

1

✆✗✖

x

f

x

d

☞ ✂

x

1

✆✗✖

x

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 24/31

slide-25
SLIDE 25

State Automata for Queueing Systems: server centered (with breakdown) I B

s c b r

D

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 25/31

slide-26
SLIDE 26

State Automata for Queueing Systems: server centered (with breakdown)

E

✂ ☎

s

c

b

r

Events: s denotes service starts, c denotes service completes, b denotes breakdown, r denotes repair.

X

✂ ☎

I

B

D

State: I denotes idle, B denotes busy, D denotes broken down.

Γ

I

☞ ✂ ☎

s

✟ ✆

Γ

B

☞ ✂ ☎

c

b

✟ ✆

Γ

D

☞ ✂ ☎

r

f

I

s

☞ ✂

B

f

B

c

☞ ✂

I

f

B

b

☞ ✂

D

f

D

r

☞ ✂

I

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 26/31

slide-27
SLIDE 27

Interpretations/Uses

  • Generate all possible behaviours.
  • Accept all allowed input sequences

code generation.

  • Verification of properties.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 27/31

slide-28
SLIDE 28

State Automata with Output

E

X

Γ

f

x0

Y

g

  • Y is a countable output set,
  • g is an output function

g : X

E

Y

e

Γ

x

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 28/31

slide-29
SLIDE 29

State Automata for Adventure Games

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 29/31

slide-30
SLIDE 30

State Automata (later: Statecharts) for Graphical User Interface Specification

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 30/31

slide-31
SLIDE 31

Limitiations/extensions of State Automata

  • Adding time ?
  • Hierarchical modelling ?
  • Concurrency by means of
  • States are represented explicitly
  • Specifying control logic, synchronisation ?

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Finite State Automata 31/31