Вы находитесь на странице: 1из 20

TOPCASED 5.

1 - Simulation tutorial

Agenda

TOPCASED simulation concepts


Simulation of a simple automaton Presentation and usage of simulation options Modelling of extended behaviour

Topcased simulation tutorial

TOPCASED simulation concepts Principle

Aim : From Papyrus models, propose the animation of :


Activity diagrams State Machine diagrams

Visualization of current states and enabled transitions or actions

Topcased simulation tutorial

TOPCASED simulation concepts Principle

Topcased simulation tutorial

TOPCASED simulation concepts Presentation of GUI

Graphical view of the current state

Control panel

Tree view of the current state


5 Topcased simulation tutorial

Detailed information about selected element in the tree view


5

TOPCASED simulation concepts Requisites for effective simulation

All transition must be triggered by an event


Events must be declared in the model (as UML events) A state machine must have one initial state per region All guards must be expressed in OCL State machine animation must be deterministic An activity diagram :

must have at least one initial state, must have a path to reach a final node, should not contain deadlock states.

Other constraints will be detailed later

Topcased simulation tutorial

TOPCASED simulation concepts Anexecutable model

Definition of model structure

Composition between instances

A sample example with a model defining a turn signal :

Move UP => turn RIGHT


7 Topcased simulation tutorial 7

Move DOWN=> turn LEFT

TOPCASED simulation concepts Anexecutable model

Impacted elements 2 transitions are available (in green)

Topcased simulation tutorial

TOPCASED simulation concepts Anexecutable model

Available transitions

Topcased simulation tutorial

TOPCASED simulation concepts Anexecutable model

Transition has been passed

New position is TOP Right signal is Active / ON Left signal is still Inactive

10

Topcased simulation tutorial

10

Usage of simulation control

Launch of the simulation :


Right click on the .uml or .di model file First dialog box : only the interactive mode works with UML Second dialog box : allow to chose instances of the model that will be used in the simulation Start the simulation Store an event in the event queue of an instance Step over : execute an event and all sub-events if any Step into : execute the selected event but not its sub event Step return : execute an event and all events that have the same father

Simulation control :

11

Topcased simulation tutorial

11

Modelling of extended behaviour activity concepts executable

Activity graph contains two types of nodes :


Action nodes : consume incoming tokens and produce outgoing tokens Control nodes : used to control the execution flow

Actions nodes available in the simulation :

Opaque action : does nothing but produce control token on output control flows. ReadSelf : return the current instance object on his outgoing pin. ReadStructuralFeature :return the value of an attribute. The target object must be received on the object pin. The feature to be read must be referenced by the property structural feature. The result is returned on the outgoing pin. AddStructuralFetureValue : modifies the content of an attribute. Works the same way as ReadStructuralFeature. The new value is received on a input pin. The property ReplaceAll should be false only if the attribute is a list. ReadVariable and AddVariableValue : works the same way bu for local variables

12

Topcased simulation tutorial

12

Modelling of extended behaviour activity concepts executable

CreateObject : Creates a new object and put it on its outgoing pin. The type of the object is defined by the property Classifier DestroyObject : Removes the object received on its input pin from the simulation SendSignal : sends a signal to the object received on the port target BroadcastSignal : sends a signal to all active instances CallBehavior : call a behaviour, generally an activity. Parameters of the activity must correspond to pins of the call behaviour action CallOperation : works the same way as CallBehavior but the object executing the action is received on an input pin target. Initial node : creates the first token Final node : terminates the activity Decision and merge nodes : used to describe alternative paths Join and fork nodes : used to model parallel paths

Control nodes available :

13

Topcased simulation tutorial

13

TOPCASED simulation concepts Activities behind states

When activating Step into during previous transition (Medium UP-> Top)
14 Topcased simulation tutorial 14

TOPCASED simulation concepts Activities behind states

List of available actions is displayed

Step over
15 Topcased simulation tutorial 15

TOPCASED simulation concepts Activities behind states

Current state for Right turn signal

One available action

Current state for Left turn signal

16

Topcased simulation tutorial

16

TOPCASED simulation concepts Activities behind states

Step over
17 Topcased simulation tutorial 17

TOPCASED simulation concepts Activities behind states

New step, new available action

18

Topcased simulation tutorial

18

Some sample models for simulation

2 sample models are available :

TurnSignalTest : Modelling of a turn signal ( move up -> turn right , move down -> turn left)

TestActivity : An exhaustive example of all Activity diagram simulation possibilities

19

Topcased simulation tutorial

19

More information

TOPCASED tutorials and examples

http://www.topcased.org/index.php?documentsSynthesis=y&Itemid=59

Acceleo documentation available online http://wiki.eclipse.org/Acceleo Contacts


TOPCASED user mailing lists Jean-francois.rolland@atos.net Stephane.duprat@atos.net Raphael.faudou@atos.net

20

Topcased simulation tutorial

20

Вам также может понравиться