Reaves.dev

v0.1.0

built using

Phoenix v1.7.12

Behavior Modeling

Stephen M. Reaves

::

2023-10-24

Notes about Lesson 9 of CS-6310

Summary

Structural vs Behavioral

Structural models express properties that are always true.

Behavioral models express how the system responds to external stimuli.

States

State := abstract description of a system at a given time

State Space := set of all possible states

State space increases multiplicatively

TicTacToe has 19683 states

Events

Event := a single, instantaneous, noticeable occurrence

Events can be sync or async

UML Event Taxonomy

Behavioral Modeling

Reactive Systems := systems that respond to events

Modeling Techniques:

Combinatorial Modeling

Expresses logic of simple combinatorial systems

Only inputs determine subsequent states, and not the history of events

Decision Tables

Conditions are called inputs, responses are called outputs

Workshop has 3 switches, 2 output devices and 1 master switch. Switches can either be on or off.

MasterLight SwitchPower SwitchLightsMotor
ONONONONON
ONONOFFONOFF

\vdots

Decision Tree

Graphical form of decision table where decisions are made sequentially

Diamonds are decisions, rectangles are actions

flowchart TD M{Master Controller On} M –>|No| oo[Light Off / Motor Off] M –>|Yes| lso{Light Switch On?} lso –>|No| loffp{Power Switch On?} lso –>|Yes| lonp{Power Switch On?} loffp –>|No| loffpoff[Light Off / Motor Off] loffp –>|Yes| loffpon[Light Off / Motor On] lonp –>|No| lonpoff[Light On / Motor Off] lonp –>|Yes| lonpon[Light On/ Motor On]

Sequential Systems

Sequential systems have “memory” of previous system activities

Also called “Finite State Systems” or “Finite State Machines”

State Transition Table

Rows are states

Columns are:

Current stateInputActionNext State
Door closed, motor offButton pressedStart motorMotor running up
Motor running upDoor open detectedStop motorDoor open, motor off
Motor running upButton pressedStop motorDoor partially open, motor off
Door partially open, motor offButton pressedStart motorMotor running down
Door open, motor offButton pressedStart motorMotor running down
Motor running downDoor closed detectedStop motorDoor closed, motor off
Motor running downButton pressedStop motorDoor partially closed, motor off
Door partially closed, motor offButton pressedStart motorMotor running up

State Transition Diagram

Graphical representation of FSM

Button pressed / start motor

Door closed, motor off

Motor running up

etc.