Upload
hope-york
View
215
Download
0
Embed Size (px)
Citation preview
11
SFWR ENG 3KO4SFWR ENG 3KO4 Software Development Software Development
Statemate I-CASE Tool for Statemate I-CASE Tool for Designing Software Systems Designing Software Systems
from Different Views from Different Views
Dr. Kamran Sartipi
Dept. Computing and Software Dept. Computing and Software McMaster UniversityMcMaster University
Hamilton, ON, CanadaHamilton, ON, Canada
22OutlineOutline
IntroductionIntroduction Language of the StatemateLanguage of the Statemate Design Example: Design Example: Fast-Food Restaurant SystemFast-Food Restaurant System ConclusionConclusion
33
Graphical EditorsGraphical Editors Data DictionaryData Dictionary Check ModelCheck Model SimulatorSimulator Code GeneratorCode Generator Panel GeneratorPanel Generator Project Manager Project Manager
A A CASE CASE Tool For Designing Reactive Systems Tool For Designing Reactive Systems
Reactive systems receive a large number of external and internal signals of the form Event or Condition, hence they are sometimes called event driven systems. The system reacts to the signals and performs different tasks accordingly. The examples of such systems include: avionic systems, telephone and communication controller, robots, etc.
44Three Specification Views of a SystemThree Specification Views of a System
FunctionalFunctional
BehavioralBehavioral
StructuralStructural
Conceptual Model
Functional ViewFunctional View
WhatWhatCapabilities & Flow of dataCapabilities & Flow of data
Behavioral ViewBehavioral View
WhenWhen
Control & TimingControl & Timing
Physical Model
Structural ViewStructural View
HowHow
Modules & CommModules & Comm..
Introduction . .
55The Language of The Language of
ModuleName:Description:----------------------------------------------------------------------------------------
ModuleName:Description:----------------------------------------------------------------------------------------
ModuleName:Description:----------------------------------------------------------------------------------------
Statecharts
Activity-Charts
Module-Charts
: Functional View: Functional View
: Behavioral View: Behavioral View
: Structural View: Structural View
Data Dictionary Forms:Data Dictionary Forms:
66The Language of Statecharts
State, Transition, StepState, Transition, Step TimingTiming HierarchyHierarchy ConcurrencyConcurrency SynchronizationSynchronization InterruptInterrupt Declutter & MergeDeclutter & Merge
ModuleName:Description:----------------------------------------------------------------------------------------
ModuleName:Description:----------------------------------------------------------------------------------------
ModuleName:Description:----------------------------------------------------------------------------------------
Statecharts
Activity-Charts
Module-Charts
Concepts of:Concepts of:
77The Syntax of
Chart Basic State
Or - State
and - State
Transition
Event [Condition] / ActionEvent [Condition] / ActionEvent [Condition] / ActionEvent [Condition] / Action
88Timing in Statecharts
IDLEIDLE
DATE_TIME_S>DATE_TIME_S>
tm(en(IDLE),2)tm(en(IDLE),2)
A transition may occur on A transition may occur on time-out bases.time-out bases.
tm(e,n)tm(e,n)
e:e: event, event, n:n: System time-unitSystem time-unit
99Hierarchy in Statecharts
Previous Step:Previous Step: State S1 was active.State S1 was active. Event E1 was triggered.Event E1 was triggered.
Current Step:Current Step: State S2 is active.State S2 is active.
(S2 is a hierarchical state)(S2 is a hierarchical state)
State A is active.State A is active.
1010
Hierarchy in Statecharts ...
Previous step:Previous step: State A was activeState A was active Condition C1 was FalseCondition C1 was False
Current Step:Current Step: State S1 becomes activeState S1 becomes active
1111Concurrency in Statecharts
All concurrent componentsbecome active:
1212Concurrency in Statecharts ...
All Concurrent componentsbecome inactive:
1313Synchronization in Statecharts
Using Using joint transition,joint transition,Concurrent states or Concurrent states or independent Statechartsindependent Statechartscan be synchronizedcan be synchronized
Sequence of events:Sequence of events:(S1) [C1] (S1) [C1] (S1, A) (S1, A) (S2, A) E1 (S2, A) E1 (S3,B) en(S3) (S3,B) en(S3) (S3,A) E1 (S3,A) E1 (S2, B) (S2, B) (S1)(S1)
1414Synchronization in Statecharts ...
Activation of the state Activation of the state S1 is synchronized S1 is synchronized with the activation of with the activation of States S2 and B.States S2 and B.
1515Interrupt in Statecharts
Interrupt Interrupt handeling using handeling using historyhistory and and deep-history deep-history connectorsconnectors
1616
Interrupt in Statecharts ...
Event Event CONTCONTINUEINUE is triggered is triggered C1 and D1 activateC1 and D1 activate
1717
Interrupt in Statecharts ...
ConditionCondition C1 C1 is False is False AND state S3 isAND state S3 isDeactivated Deactivated B1 is activeB1 is active
1818
E1 is triggered E1 is triggered State B2 is active.State B2 is active.
Interrupt in Statecharts ...
An external device An external device requests a service requests a service by triggering the by triggering the event event INT_REQ.INT_REQ.
1919
Control is Control is transferred to the transferred to the interrupt handler.interrupt handler.
Interrupt in Statecharts ...
2020
Entrance through Entrance through historyhistory connector connector activates the state in its activates the state in its own level, which was own level, which was active: S1active: S1
Entrance through Entrance through deep deep historyhistory activates the activates the deepest state which was deepest state which was active: B2active: B2
Interrupt request has Interrupt request has been serviced, and the been serviced, and the signal signal INTAINTA is generated. is generated.
Interrupt in Statecharts ...
2121Decluttering in Statecharts
Decluttering Decluttering mechanism mechanism permits to define the permits to define the details of any boxdetails of any boxin a separate off-page box.in a separate off-page box.
2222
Decluttering in Statecharts ...
The decluttered state isThe decluttered state iscalledcalled Box-is-Chart,Box-is-Chart,and its named is prefixed and its named is prefixed by a @ sign.by a @ sign.
2323
Logical Diving to a Box-is-Chart fetches the chart fetches the chart associated to the associated to the box. box.
Diagram connectors Diagram connectors mark the entry mark the entry or exit points of the or exit points of the transitions.transitions.
Decluttering in Statecharts ...
2424Merge in Statecharts
Merging is the opposite concept of Merging is the opposite concept of declutteringdecluttering
Charts C and D have been merged Charts C and D have been merged into the chart S1. into the chart S1.
2525
ModuleName:Description:----------------------------------------------------------------------------------------
ModuleName:Description:----------------------------------------------------------------------------------------
ModuleName:Description:----------------------------------------------------------------------------------------
Statecharts
Activity-Charts
Module-Charts
Defines the functionality of the system.Defines the functionality of the system. Involves the concepts such as:Involves the concepts such as:
Control-Activity.Control-Activity. External-Activity. External-Activity. Mini-Specification. Mini-Specification. Hierarchical construct.Hierarchical construct. Decluttering and Merging.Decluttering and Merging. Data storesData stores
The Language of
2626
The Syntax of Activity-Charts
Activity IN
OUT
@ SYSTEMPOWER_On/OFF
EXECUTE
INIT
A
OPERATE
RESET
B
Z
Activity
Control-Activity Control-Flow
Data-StoreData -Flow
External- Activity
Chart
2727
Designing a large Reactive System with
Requirement analysis and System Specification.Requirement analysis and System Specification.(Requirement Traceability)(Requirement Traceability)
High-level Design & Test.High-level Design & Test.(Graphical Editors & Simulator)(Graphical Editors & Simulator)
Detailed Design & Test.Detailed Design & Test.(Box-is-Chart Concept)(Box-is-Chart Concept)
Data-Structure Design. Data-Structure Design. (Data Dictionary(Data Dictionary))
Functional and Behavioral Design. Functional and Behavioral Design. (Graphical Editors)(Graphical Editors)
User-Interface Design. User-Interface Design. (Panel Generator)(Panel Generator)
Implementation. Implementation. (Code Generator)(Code Generator)
Team Project & Version Control. Team Project & Version Control. (Project Management)(Project Management)
2828Design Example:
Order-Taking unit.Order-Taking unit. Assembling unit.Assembling unit. Preparation unit.Preparation unit. Inventory unit.Inventory unit. Management unit.Management unit.
System Specification: System Specification:
This System controls different activities in a typical Fast-Food This System controls different activities in a typical Fast-Food Restaurant, and consists of Five communicating units:Restaurant, and consists of Five communicating units:
(OT)(OT)
(ASM)(ASM)
(PREP)(PREP)
(MGR)(MGR)
(INV)(INV)
2929
Detailed Design: User-Interface
Order-Taker screen consists Order-Taker screen consists of 40 buttons to generate of 40 buttons to generate events as inputs and 18 text-events as inputs and 18 text-displays as outputs . displays as outputs .
User-Interface design of User-Interface design of a reactive system is crucial.a reactive system is crucial.
Bindings of the Bindings of the Panel-Elements to the to the Variablesof the charts are performed of the charts are performed in the Data-Dictionary Forms.in the Data-Dictionary Forms.
3030
PRODUCER_AND_CONSUMER
Inter process communication
Distributed control Distributed control mechanism for private mechanism for private access to the shared-access to the shared-memory memory
WINNER:=1;
WINNER:=3; WINNER:=2;
fs!(D_USED)
An example of An example of producer-consumerproducer-consumer
Key point: atomic Key point: atomic execution of the actions in execution of the actions in one transitionone transition
3131Inter Process Communication ...
WINNER:=1;
WINNER:=3; WINNER:=2;
fs!(D_USED)
Conditions Conditions D_USED & D_USED & BUF_F BUF_F control the control the Producer and ConsumersProducer and Consumersto enter their critical to enter their critical sections respectively.sections respectively.
Variable Variable WINNER WINNER determines which determines which consumer can access to the consumer can access to the shared buffer.shared buffer.(Consumer C2)(Consumer C2)
3232Instantiation in the
An independent An independent Generic-Chart produces copies of a statechart or produces copies of a statechart or activity-chart (Reusability). activity-chart (Reusability).
To create an instance of a generic-chart, an activity or a state with a To create an instance of a generic-chart, an activity or a state with a special naming pattern is used. special naming pattern is used.
Name of Instance < Name of generic-chartName of Instance < Name of generic-chart
Formal-ParametersFormal-Parameters & & Actual-ParametersActual-Parameters are the are the means for communicating the values of variables. means for communicating the values of variables.
3333
Instantiation in the ...Instantiation in the ...
Producer & Consumer exampleProducer & Consumer example
fs!(DATA_CONSUMED;fs!(DATA_CONSUMED;
WINNER_ID:= CONSUMER_ID;WINNER_ID:= CONSUMER_ID;
CONSUMERCONSUMER
Generic-ChartGeneric-Chart
Instances of theInstances of theGeneric_ChartGeneric_Chart
Off-Page ChartOff-Page Chart
Box-is-ChartBox-is-Chart
3434
Order-Taking Stations, Assembling Stations, and Order-Taking Stations, Assembling Stations, and Preparation Stations are Instances of different Preparation Stations are Instances of different Generic activity-charts. Generic activity-charts.
For each instance, binding of the panel elements For each instance, binding of the panel elements to theto the actual-parameters actual-parameters is done in Data-is done in Data-Dictionary.Dictionary.
Instantiation in the Restaurant System
3535Conclusion
Statemate has shortcomings in:Statemate has shortcomings in: Semantics of module-chartsSemantics of module-charts Data Types and dynamic memory allocationData Types and dynamic memory allocation Parametric InstantiationParametric Instantiation User-interface generatorUser-interface generator
Statemate is good for modeling and simulating the Statemate is good for modeling and simulating the System behavioural. The System functionality can System behavioural. The System functionality can then be implemented in C or Ada languagesthen be implemented in C or Ada languages
Statemate has a long learning curve.Statemate has a long learning curve.