The Design Language of Statecharts

1 / 40

# The Design Language of Statecharts - PowerPoint PPT Presentation

The Design Language of Statecharts. Simple Statechart. Finite State Machine. R, S, T – States a, b, c, d - Events Arrows - State transitions (source-less arrow denotes an initial state). Transition Events. Syntax. Events. {a, b, c, .... } atomic events:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## The Design Language of Statecharts

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### The Design Language of Statecharts

Vered Gafni, 2005

Simple Statechart

Finite State

Machine

R, S, T – States

a, b, c, d - Events

Arrows - State transitions

(source-less arrow denotes an initial state).

Vered Gafni, 2005

Transition Events

Syntax

Vered Gafni, 2005

Events

{a, b, c, .... } atomic events:

a or b a occurs or b occurs

a and b a occurs and b occurs

not(a) a does not occur

tm(a,t) t time-units after the occurrence of a

tr( C ) condition C becomes true

fs( C ) condition C becomes false

en(S) state S is entered

ex(S) state S is exited

Vered Gafni, 2005

Conditions

A, B,.... atomic conditions:

A or B A is true or B is true

A and B A is true and B is true

not(A) A is false

in(S) True while the system is in state S

X=Y, X<Y,…. Boolean relations

Vered Gafni, 2005

Actions

a,b,… atomic actions

tr!(C) make condition C True

fs!(C) make condition C False

wr!(V) write variable V

 atomic actions also considered event generation

Vered Gafni, 2005

Transition Connectors

Vered Gafni, 2005

Controller

Valve command

H

Water-level sensor

valve

L

Vered Gafni, 2005

Sub-States: Sequential Refinement
• S is a super-state w.r.t {S1, S2, S3 }
• Super-state transitions (priority)
• History entrance (H* -deep history)

Vered Gafni, 2005

Example of Sequential Refinement

Equivalence

up to priorities

Vered Gafni, 2005

Sub-states:Parallel Refinement

Events

Vered Gafni, 2005

Automatic Cruise Control

Vered Gafni, 2005

Operating

Vered Gafni, 2005

Vered Gafni, 2005

Using Timeout
• Delay
• Periodic activation

Vered Gafni, 2005

Timeout as Delay
• To activate the furnace open the oil valve, and after 3 seconds operate ignition

Activate/Open_oil_valve

Idle

Ignition_delay

tm(Activate,3sec)/Ignite

Furnace_Active

Vered Gafni, 2005

Timeout for Periodic Activation
• Execute control loop at 10Hz rate

/tick

WaitTick

RTC

tick

Control

Loop

tm(tick,100mls)/tick

done

Vered Gafni, 2005

• Whenever train enters XR, gate should be closed within 10 seconds; otherwise an alarm will be activated

Tin/CloseGate

WaitTrain

GateClosed

Closing

FailClosing

tm(en(Closing),10sec)/Alarm

Closed

Vered Gafni, 2005

Transition Functions

[K]  true[K] where ‘true’ is an event that occurs at every time instant

Vered Gafni, 2005

Magnum

A Real-Time Design Tool

• Provides for representation of 3 system views:
• What:
• - the activities the system should do, and inter-activities
• data flow
• When:
• - the timing and synchronization of activities activation and
• data transfer
• Where:
• - in what subsystem the each activity should be implemented

Vered Gafni, 2005

A

E3

A1

u

f

C

h

e

A2

r

A3

E1

E2

CC

v

w

q

s

A2_1

A2_2

x

Basic Components

Vered Gafni, 2005