real time systems advanced state machines. behaviour (part 2) - 2 outline simple and composite...

17
Real Time Systems Advanced State Machines

Upload: lorena-clark

Post on 14-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Real Time Systems

Advanced State Machines

Page 2: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 2

Outline

Simple and Composite States

Transition Segments and Junction Points

Run-to-Completion

Group Transitions and History

Self & Internal Transitions

Exercise

Page 3: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 3

Simple and Composite States

compositesimple

external view

??

Page 4: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 4

Simple and Composite States

internal view

What triggersthese transitions?

Page 5: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 5

Transition Segments

transition segments => a transition chain single trigger

State?

Page 6: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 6

Junction Points - 2 types

Termination (history)extension

Page 7: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 7

Design Tip:Unnamed Transitions / Segments

Do not leave these “unnamed” transitions in your models!!!

Page 8: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 8

Run-to Completion

a capsule exhibits run-to-completion semantics: meaning that a capsule will not be interrupted by

the run-time services library while it is executing a run-to-completion step.

when a message is received by a capsule, the entire transition chain executes (before another message is delivered);

data sent with a message is only accessible until the end of the run-to completion a local copy must be made to preserve the data

Page 9: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 9

Run-to Completion

consider event “done” while in sub-state “paint”. what is the sequence of execution code?

“Workstation” state “producing” sub-state

Page 10: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 10

Group Transitions

transitions from hierarchical states that are common to all sub-states example: “error” while in the sub-state “paint” what is the sequence of execution code?

Page 11: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 11

History (*deep)

the deepest sub-state when the containing state was last active. example: “reset” what is the sequence of execution code ?

Page 12: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 12

Self-transition

a transition “out-of” and “back-into” a state what are the consequences of getting a status

message while in the “paint” sub-state?

Page 13: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 13

Internal-transition

a self-transition which never exits the state does not fire all entry / exit code up & down the

state hierarchy; example: the new “status” transition

Page 14: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 14

Behaviour Exercise – part 1

Go to the RoseRT on-line Help Complete the animated Concept Tutorial

entitled: Capsule Hierarchical State Machines

{if you have not already done so}

Page 15: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 15

Behaviour Exercise – part 2

Refer to the following 2 state diagrams: Television Satellite Receiver – Top State Television Satellite Receiver – Operate Sub-state

Assume that initially you are in the Locked sub-state. After that follow the state machine wherever the transition chains take you: doDiagnostics followed by changeChannel followed by orderMovie followed by status followed by diag_timeout signal;

assume EvaluateTest = false

Page 16: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 16

Television Satellite Receiver – Top State

changeChannel,

Page 17: Real Time Systems Advanced State Machines. Behaviour (part 2) - 2 Outline  Simple and Composite States  Transition Segments and Junction Points  Run-to-Completion

Behaviour (part 2) - 17

Television Satellite Receiver – Operate Sub-state