400 likes | 473 Views
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:
E N D
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 rd!(V) read variable V atomic actions also considered event generation Vered Gafni, 2005
Example of Compound Transition 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 broadcasting Vered Gafni, 2005
דוגמא - בקר שיוט רכבAutomatic Cruise Control Vered Gafni, 2005
Automatic Cruise Control Vered Gafni, 2005
Operating Vered Gafni, 2005
Railroad Crossing Control Vered Gafni, 2005
Crossing Control: Sequential Design Vered Gafni, 2005
Crossing Control: Parallel Design Vered Gafni, 2005
Using Timeout • Delay • Periodic activation • deadline 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
Timeout as Deadline • 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
Synchronization Techniques I Vered Gafni, 2005
Synchronization Techniques II Vered Gafni, 2005
Synchronization Techniques III 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