Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Papyrus/UserGuide/ModelExecution

< Papyrus
Revision as of 04:43, 30 September 2016 by Jeremie.tatibouet.cea.fr (Talk | contribs) (Improvements)

Moka Overview

Moka is a Papyrus module for execution of UML models, which natively includes an execution engine complying with OMG standards foundational UML (fUML [1]) and Precise Semantics of UML Composite Structures (PSCS [2]). These standards deal with execution semantics of UML. Moka is integrated with the Eclipse debug framework to provide control, observation and animation facilities over executions. Moka can be easily extended to support alternative execution semantics, and thereby be adapted to multiple usage scenarios and domains. The key features of Moka are:

Based on standards

Moka provides basic execution and debugging facilities for fUML and its extension PSCS, which capture an executable subset of UML with precise and standard semantics. This subset is expressive enough to model structure and behavior of systems involving concurrent communicating entities, independently of technological platform details.

Interactive executions

Moka provides debug and animation facilities through a contribution and an extension to the Eclipse debug API. It is thereby possible to control execution of models(e.g., suspending/resuming executions after breakpoints have been encountered) as well as to observing states of executed models at runtime (e.g., emphasizing graphical views of model elements on which execution has suspended, retrieving and displaying any state information about the runtime manifestation of these model elements).

Extensible framework

Moka can be easily extended to address new execution semantics. This can be done through extension points enabling registration of executable model libraries (e.g., new MoCs, trace libraries, etc.) or simply tool-level extensions of the execution engine.

Moka Releases

Neon

Update sites

Important.png
Moka Papryus and Eclipse
Since Neon version Moka became a Papyrus component. It is now evolving on its repository and provides its own update site. This situation is different from previous Eclipse versions where Moka was released directly through Papyrus. Hence if you use Eclipse Neon and want to install Moka the you must use the update site provided below. In any other case (i.e., you use a previous version of Eclipse) then you must install Moka by using the Papyrus update site.

Improvements

Note.png
Availability
Only available for the Moka version developed for Neon
  • Moka Core:
    • Improved rendering of animation.
    • Improved debugging environment.
  • Moka tools:
    • Simex: Set of accelerators to ease specification of executable models.
  • Moka FMI
    • FMI importer: Enables to import any FMU and give it a representation in a UML model
    • FMI exporter: Enables to export FMUs from UML models (with some restrictions on the kind of supported model elements, and no support for rollback)
    • FMI profile: Used for the representation of FMUs, and FMU assemblies
    • FMI master : A generic master algorithm, capable of co-simulating a mix of imported/assembled FMUs and UML components (with behaviors specified as regular UML activities and/or state machines)

Getting started with Moka

Installation

Moka is available as an additional Papyrus components. See screenshots below to install it.

PapyrusAdditionalComponents.png

Moka.png

Your first executable model

This tutorial is based on a simple executable model. It consists in an active class, with a classifier behavior that indefinitely increments a counter. The corresponding Papyrus model is available here File:BasicActiveObjectExample.zip. Download it, define a project in your workspace, and then import the model in this project. Once the model is imported and open in Papyrus, the Increment class should look like:

0 - ActiveClassDiagram.png

The behaviors associated with this class (i.e., IncrementClassifierBehavior, which is the classifier behavior, and incrementMethod, which is the implementation of operation increment) are specified by activity diagrams. Corresponding activities are executable, according to the semantics given in OMG standards fUML and PSCS. Anyway, in fUML and PSCS, the execution of a model usually starts by executing a kind of "main" activity, which is responsible for instantiating objects, and stimulate them if needed (through signals or operation calls). Moka provides some facilities to generate this kind of activities. Just right click on class Increment, then go to Moka / Modeling Utils / Generate Factory.

2 - GenerateFactory.png

A factory activity for class Increment (Increment_Factory in the figure below) is then generated. This activity will be used in the next steps of this tutorial to actually start the execution of the model. Do not forget to save your model, otherwise the factory will not be visible in the launch configuration definition step described below in this tutorial.

3 - modelExplorer Create.png

Note 24/07/2014: In Papyrus 1.0, this generation step does not work correctly if validation rules for UML models are activated. The problem is fixed in the nightly build. If you don't want to use the nigtly build version, a possible workaround is to deactivate the validateUMLModel contraints before generating. This can be done through the model explorer contextual menu, or through Eclipse preferences.

Selecting the execution engine

Since Moka is an extensible execution framework, multiple execution engines can be registered in your environment. Before starting an execution, you should make sure that the appropriate execution engine is selected. To do so, go to Eclipse preferences, as shown in the figure below.

1 - Window Preferences.png

Once the preference page is open, go to Papyrus/Moka. Moka is released with 3 execution engines. There are two versions of the PSCS execution engine (one is multi-threaded, with on thread per active object, and the other one is single-threaded). There is also an implementation of the fUML execution engine.

2 - Papyrus Moka ExecutionEngines.png

To make sure that the Increment example properly executes, you should select one of the two PSCS engines, press Apply and then OK.

Starting an execution with a launch configuration

Moka is integrated with the Eclipse Debug Framework. It implies that, in order to start an execution, a launch configuration has to be defined. A launch configuration can be created by clicking on the "Debug As" tool from the Eclipse tool bar, and then by pressing Debug Configurations.

1 - Debug Configuration.png

Then create a new Moka launch configuration, as shown in the figure below.

2 - New Configuration.png

A Moka launch configuration requires two pieces of information: the UML model from which the execution will be started, and the actual model element to be executed.

3 - EmptyLaunchConfiguration.png

Press the Browse button to select a UML model from your workspace (a .uml file shall be selected). Then, select the actual model element to be executed in the list "Element to be executed". This list is sorted alphabetically, by qualified names. Note that, in the case of the fUML and PSCS execution engines provided by Moka, the "Element to be executed" shall be an Activity. Your launch configuration should now look like:

6 - Setup launch configuration.png

To start the execution, simply press the Debug button. In our example, according to the semantics of PSCS, the effect of executing activity Increment_Factory will be to instantiate an Increment object, to construct this object (please refer to the default construction strategy described in the PSCS specification), and then start its classifier behavior. Our increment object will start to increment, and will go on until you stop the execution.

Note that a Launch configuration is a persistent artifact, so that, if you close Papyrus and then open it again, your launch configuration will still be available, and you will be able to relaunch it.

Managing breakpoints

In order to easily observe and control the state of you model at some specific points of the execution, Moka lets you associate breakpoints with model elements. This can be done through the contextual menu Moka/Debug, which is available from the model explorer and from diagrams.

5 - ToggleBreakpointModelExplorer.png

1 - ToggleBreakpoint.png

Once a breakpoint has been created, a small icon (blue circle) appears on top of the corresponding model element.

2 - BreakpointDiagramView.png

Using the Moka/Debug menu, an existing breakpoing can also be de-activated (without being removed), using the "Toggle breakpoint activation" button. In this case, it will be depicted by a small white circle on top of the corresponding model element.

3 - ToogleBreakpointActivation.png

The set of existing breakpoints (as well as their status - Enabled / Disabled) is given in the breakpoint control panel, which is usually located in the upper, righ-hand part of the Debug perspective.

7 - BreakpointsView.png

The breakpoint control panel more generally lets you enable, disable and remove breakpoints. Just right click in the panel, as depicted in the figure below.

8 - RemoveBreakpoints.png

From an execution standpoint, it is important to note that the selected execution engine (see section on "Selecting the execution engine") is responsible for interpreting breakpoints. In the case of the fUML and PSCS execution engines provided by Moka, only breakpoints associated with activity nodes or edges will be taken into account (even if Moka lets you associate breakpoints with any kind of model element). Other breakpoints are simply ignored.

Controlling Executions

Executions can be controlled using the execution control panel, provided by the Eclipse Debug perspective.

2 - ThreadStatusView empty.png

It is thereby possible to resume, suspend, stop, or even do step-by-step executions. Note also that, when execution is suspended, variables may be observable in the variable panel.

7 - VariableView.png

The selected execution engine is responsible to determine what the visible variables are in the context of an execution. In the case of the fUML and PSCS engines provided by Moka, visible variables are properties of the context object in which in the suspended activity is executing (in our example, the suspended activity is the classifier behavior of class Increment, which executes in the context of a particular Increment object, which holds a value for property counter).

Configuring animation

By default, Moka is configured to animate diagrams during executions, without automatically giving focus / making visible a diagram where a model element being executed has a graphical representation. This can be configured in the Animation control panel, which is available in the Debug perspective.

6 - AnimationConfiguration.png

The slide bar enables to control the artificial animation delay between two animation steps. Note that option "Open diagrams automatically" may decrease performances of the execution engine. By default, Moka is released with some default animation styles, which determine the emphasis style to be applied to graphical elements when the execution is suspended, or more generally for animation. This default style can be overloaded per diagram, by attaching a CSS style sheet, as depicted in the figures below.

2 - PropertiesView EmptyStyleSheets.png

3 - NewStyleSheets.png

4 - MyStyleSheets.png

Available model libraries

A generic controller for Active Objects

Stimulate your active objects with signals and observe their reactions

Back to the top