FSM tests

Finite State Machines

Below different formats to document automatically a finite state machine description.

The nicest diagrams are often produced through PlantUML. Sometimes you must tinker with the declaration order of the state to improve the layout result.

Finite State Machine bbv

fsm-bbv States

Name Context Description Final Initial Composite Entry Action Exit Action

Root

-

true

true

true

-

-

Off

Root

false

true

false

Entry action of Off state

ExitOffstate

Maintenance

Root

false

false

false

On

Root

false

false

true

FM

On

false

false

true

entryFM

exitFM

DAB

On

false

true

false

Play

FM

false

true

false

entryPlay

exitPlay

AutoTune

FM

false

false

false

fsm-bbv Transitions

Start State End State Description Local Guard Action

Off

Maintenance

Off → TogglePower

false

Maintenance is On

log transition Off to Maintenance

Off

On

Off → On

false

Maintenance Off

OfftoOn

Maintenance

Off

Maintenance → Off

false

MaintainedtoOff

On

Off

TogglePower → On

false

OntoOff

FM

DAB

FM → DAB

false

FMtoDAB

DAB

DAB

DAB → DAB

true

DAB

FM

DAB → FM

false

DABtoFM

Play

Play

Play → Play

true

Play

AutoTune

Play → AutoTune

false

PlaytoAutoTune

AutoTune

Play

AutoTune → Play

false

AutoTunetoPlay

Graphical Representation with dot

fsm-bbv-dot

Graphical Representation with PlantUml

fsm-bbv-plantuml

Graphical Representation with mermaid

fsm-bbv-mermaid

Graphical Representation with State Machine Cat

fsm bbv smcat

Finite State Machine Test

Below different formats to document automatically a finite state machine description.

fsm-test States

Name Context Description Final Initial Composite Entry Action Exit Action

Root

-

true

true

true

-

-

A

Root

State A

false

true

true

-

-

AA

A

State AA

false

true

false

-

-

AB

A

State AB

false

false

false

-

-

B

Root

false

false

true

-

-

BA

B

State BA

false

false

false

-

-

BB

B

State BB

false

true

false

-

-

C

Root

true

false

false

-

-

fsm-test Transitions

Start State End State Description Local Guard Action

A

C

A → C when A_C

false

AA

AA

Local transition AA → AA when (AA_AA)

true

AA

AB

AA → AB when AA_AB

false

AA

B

AA → B when AA_B

false

AA

BB

AA → BB when (AA_BB)

false

AB

AA

AB → AA when AB_AA

false

AB

AB

AB → AB when AB_AB

false

B

C

B → C when B_C

false

BA

A

BA → A when BA_C

false

BA

BB

BA → BB when BA_BB

false

BB

BB

Local transition BB → BB when BB_BB

true

BB

BA

false

VV → BA when BB_BA

BB

C

BB → C when BB_C

false

Graphical Representation with dot

fsm-test-dot

Graphical Representation with PlantUml

fsm-test-plantuml

Graphical Representation with mermaid

fsm-test-mermaid

Graphical Representation with State Machine Cat

fsm test smcat

Finite State Machine Washer

Below different formats to document automatically a finite state machine description.

fsm-washer States

Name Context Description Final Initial Composite Entry Action Exit Action

Root

-

true

true

true

-

-

Running

Root

Running State

false

true

true

-

-

End

Root

State End

true

false

false

-

-

Washing

Running

Washing State

false

true

false

-

-

Rinsing

Running

Rising State

false

false

false

-

-

Drying

Running

Drying State

true

false

false

-

-

PowerOff

Root

PowerOff State

false

false

false

-

-

fsm-washer Transitions

Start State End State Description Local Guard Action

Running

End

Running → End

false

Running

PowerOff

Running → PowerOff

false

Washing

Rinsing

Washing → Rinsing

false

Rinsing

Drying

Rinsing → Drying

false

PowerOff

Running

PowerOff → Running

false

Graphical Representation with dot

fsm-washer-dot

Graphical Representation with PlantUml

fsm-washer-plantuml

Graphical Representation with mermaid

fsm-washer-plantuml

Graphical Representation with State Machine Cat

fsm washer smcat