dr. vered gafni – real time systems development by the formal approach 1 the design language of...

32
Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Upload: kaylie-foden

Post on 14-Dec-2015

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 1

The Design Language of Statecharts

Page 2: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 2

The Design Language of Statecharts

Finite State Machine • R, S, T – States• a, b, c, d - Events• Arrows - State transitions

Event: a, b, c, ... a or/and b not a dly(t), tm(a,t) tr(C)/fs(C)

Conditions: A, B,... A or/and B not(A) in(S) x=y, x<y,….

Actions: a,b,… tr!(C)/fs!(C) x := vrd!(x)

Initial state

optional

Page 3: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 3

Examples

Split on condition

Page 4: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 4

Sub-States: Sequential Refinement

• S is a super-state w.r.t {S1, S2, S3 }

• Super-state transitions (priority)

• History entrance (H* -deep history)

Page 5: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 5

Example of Sequential Refinement

Equivalence

up to priorities

done[B]/fs!(B)

A

Failure

done[A]\fs!(A)

B

C

fail/tr!(A)fail/tr!(B)

fail/tr!(C)

done[C]/fs!(C)

/fs!(A),fs!(B),fs!(C)

A

Failure

doneB

C fail

H

Page 6: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 6

Sub-states: Parallel Refinement

Events broadcasting

S3.A

S1 S2

S3

S

S2.A

S1.A

S1.B

S1.C

S2.B

S3.B

a

b\m

c\tr!(C)

m

tm(m,3sec)

tr(C)

f

Page 7: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 7

• Delay: To turn on the furnace open the oil valve, and after 3 seconds activate ignition

Specification of Time Constraints

RTC tick

Dly(100mls)/tick Wait Period

Control loop

done

• RTC: Execute control loop at 10Hz rate

Page 8: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 8

Delay as Deadline

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

Page 9: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 9

Where Timeout is useful?

Far

Nearexit

enter

tm(enter,3)/close_cmdOpen

Close

dly(15)/open_cmd

Page 10: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 10

Synchronization Techniques I

R

S

P

A

B

T

a

b

C/end; ff

Page 11: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 11

Synchronization Techniques II

R

S

P

A

B

b

fc/tr!(K)

Q

g

a

C

[K]

U [not(K)]

Page 12: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 12

Synchronization Techniques III

Page 13: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 13

Controllertrain-in train-out

go,

stop close,

open

position

Example: Railroad crossing

Page 14: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 14

Crossing Control: Sequential Design

Page 15: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 15

Crossing Control: Parallel Design

Page 16: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 16

 Example: Automatic Cruise Control

on off

ACC

Car Motion ProcessSpeed Throttle

resumebutton

gas/brakespedals

masterswitch

command lever

Engine

IMD

RPM Gear

Page 17: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 17

Automatic Cruise Control

ACC

Disabled

Enabled

Inactive

Active

engine-onengine-off

Operating

Suspended

start-acc

stop-acc

abort

resume

Page 18: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 18

State Operating (sub-state of Active)

CommandMonitor

SpeedControl

GearControl

Operating

Page 19: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 19

State CommandMonitor (component of Operating)

Page 20: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 20

SpecialNormallow

drive

2 1tr(rpm<=3K) tr(rpm<=1K)/low

tr(rpm>1k) tr(rpm>3K)/driveDrive

[rpm<=1K]/low[rpm>3K]

[rpm<=3K and rpm>1K]

c

CommandMonitor

GearControl

SpeedControl

Operating

Page 21: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 21

StatemateA 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

Page 22: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 22

Page 23: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 23

Basic Components

A

A1

A2

A3

C

A2_1

A2_2

E1E2

E3

CC

u

v wq

e

f

h

r

x

s

fff

Page 24: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 24

Page 25: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 25

Page 26: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 26

Page 27: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 27

Page 28: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 28

Page 29: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 29

Page 30: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 30

Page 31: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 31

Page 32: Dr. Vered Gafni – Real time systems development by the formal approach 1 The Design Language of Statecharts

Dr. Vered Gafni – Real time systems development by the formal approach 32