# Vered Gafni, 20051 The Design Language of Statecharts.

## Presentation on theme: "Vered Gafni, 20051 The Design Language of Statecharts."— Presentation transcript:

Vered Gafni, 20051 The Design Language of Statecharts

Vered Gafni, 20052 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, 20053 Transition Events Syntax

Vered Gafni, 20054 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, 20055 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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/12/3379185/slides/slide_5.jpg", "name": "Vered Gafni, 20055 Conditions A, B,....", "description": "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

Vered Gafni, 20056 Actions a,b,… atomic actions tr!(C) make condition C True fs!(C) make condition C False wr!(V) write variable V rd!(V) read variable V  atomic actions also considered event generation

Vered Gafni, 20057 Example of Compound Transition

Vered Gafni, 20058 Transition Connectors

Vered Gafni, 20059 L H valv e Water-level sensor Controller Valve command

Vered Gafni, 200510 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, 200511 Example of Sequential Refinement Equivalence up to priorities

Vered Gafni, 200512 Sub-states: Parallel Refinement Events broadcasting

Vered Gafni, 200513 דוגמא - בקר שיוט רכב Automatic Cruise Control

Vered Gafni, 200514 Automatic Cruise Control

Vered Gafni, 200515 Operating

Vered Gafni, 200516

Vered Gafni, 200517

Vered Gafni, 200518 Railroad Crossing Control

Vered Gafni, 200519 Crossing Control: Sequential Design

Vered Gafni, 200520 Crossing Control: Parallel Design

Vered Gafni, 200521 Using Timeout Delay Periodic activation deadline

Vered Gafni, 200522 Timeout as Delay To activate the furnace open the oil valve, and after 3 seconds operate ignition Idle Ignition_ delay Furnace _Active Activate/Open_oil_valve tm(Activate,3sec)/Ignite

Vered Gafni, 200523 Timeout for Periodic Activation Execute control loop at 10Hz rate RTC /tick tm(tick,100mls)/tick WaitTick Control Loop tick done

Vered Gafni, 200524 Timeout as Deadline Whenever train enters XR, gate should be closed within 10 seconds; otherwise an alarm will be activated WaitTrain Tin/CloseGate tm(en(Closing),10sec)/Alarm Closed Closing GateClosed FailClosing

Vered Gafni, 200525 Synchronization Techniques I

Vered Gafni, 200526 Synchronization Techniques II

Vered Gafni, 200527 Synchronization Techniques III

Vered Gafni, 200528 Transition Functions [K]  true[K] where ‘true’ is an event that occurs at every time instant

Vered Gafni, 200529 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, 200530

Vered Gafni, 200531 Basic Components A A1 A2 A3 C A2_1 A2_2 E1 E2 E3 CC u vw q e f h r x s

Vered Gafni, 200532

Vered Gafni, 200533

Vered Gafni, 200534

Vered Gafni, 200535

Vered Gafni, 200536

Vered Gafni, 200537

Vered Gafni, 200538

Vered Gafni, 200539

Vered Gafni, 200540