Difference between pages "D23 UML-B" and "D32 Code generation"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Colin
 
imported>Andy
 
Line 1: Line 1:
=== Overview ===
+
'''THIS DOCUMENT IS NOT YET COMPLETE !!!'''
This part of the deliverable describes improvements to the UML-B plug-in feature, which is the responsibility of University of Southampton.
 
  
A new plug-in feature has been developed to provide animation of UML-B state-machine diagrams. This feature was developed by University of Southampton.
+
== General Overview ==
  
The longer term development of UML-B relies on an EMF representation of Event-B. The development of a new EMF Event-B plugin-in feature is also described in this section. This feature was initially developed by University of Southampton, Heinrich-Heine University, Düsseldorf and University of Newcastle. It is now mostly maintained and developed by University of Southampton.
+
The code generation activity has been undertaken at the University of Southampton. This has been a new line of work for DEPLOY that was not identified in the original Description of Work for the project. The development of the approach, and the tools to support, it involved a number of team members at Southampton; and also at other institutions. This work draws on our recent experience with technologies such as ''Shared Event Decomposition'' [[http://wiki.event-b.org/index.php/Event_Model_Decomposition]], and the ''EMF Framework for Event-B'' [[http://wiki.event-b.org/index.php/EMF_framework_for_Event-B]]. There was collaboration at an early stage with Newcastle University, where we explored the commonalities between their flow plug-in [[http://wiki.event-b.org/index.php/Flows]] and the algorithmic structures used in our approach. Collaboration with the University of York was also established since we chose to use their ''Epsilon'' [[http://www.eclipse.org/gmt/epsilon/]] model-to-model transformation technology.
  
=== Motivations ===
+
== Motivations ==
  
====UML-B Support for State machine Refinement====
+
The decision was taken in 2009 [[http://wiki.event-b.org/index.php/D23_Code_Generation]] to include code generation as a project goal. It had been recognised that support for generation of code from refined Event-B models would be an important factor in ensuring eventual deployment of the DEPLOY approach within their organisations. This was especially true for Bosch and Space Systems Finland (SSF). After receiving more detailed requirements from Bosch and SSF, it became clear we should focus our efforts on supporting the generation of code for typical real-time embedded control software.
  
The current version of the UML-B tool has been improved to support the refinement of state-machines. At the last deliverable, refinement of classes was supported and state-machine refinement was beginning to be investigated. The investigation has experimented several notation and methodological alternatives. The design has now been finalised and an implementation has been achieved. State-machines can be refined by adding nested state-machines inside states. Some of the transitions in the nested state-machine do not represent new events but contribute to the refinements of existing transitions in the parent state-machine. A concept of ''transition elaboration'' has been invented to represent this relationship.
+
== Choices / Decisions ==
 +
=== Strategic Overview ===
 +
During the last year we have focussed on supporting the generation of code for typical real-time embedded control software. To this end we have evolved a multi-tasking approach which is conceptually similar to that of the Ada tasking model. Individual tasks are treated as sequential programs; these tasks are modelled by an extension to Event-B, called ''Tasking Machines''.  Tasks have mutually exclusive access to state variables through the use of protected resources. The protected resources correspond to Event-B machines. For real-time control, periodic and one-shot activation is currently supported; and it is planned to support aperiodic tasks in the near future. Tasks have priorities to ensure appropriate responsiveness of the control software. For the DEPLOY project, it was regarded as sufficient to support construction of programs with a fixed number of tasks and a fixed number of shared variables – no dynamic creation of processes or objects has been accommodated.  
  
====UML-B General Improvements====
+
Our main goal this year has been to devise an approach for, and provide tool support for, code generation. In accord with the resources available during the year it was decided to limit the provision of tool support to that of a demonstrator tool. The tool is a proof-of-concept only, and lacks the productivity enhancements expected in a more mature tool. Nevertheless much insight has been gained in undertaking this work; it lays a foundation for future research, and will be useful since it will allow interested parties to explore the approach.
Many other minor improvements have been made to the UML-B tool including:
 
* collapsing empty compartments on diagrams,
 
* improved navigation between diagrams,
 
* improved properties views,
 
* ability to order classes and class-types in the output translation,
 
* support for theorems everywhere (i.e. invariants and axioms can now be designated as theorems).
 
  
====UML-B State-machine Animation====
+
=== Deliverable ===
This feature was developed in response to a requirement from Siemens Transportation. Several state-machines can be selected (representing refinements and hierarchical nesting) for simultaneous animation. The animation relies on Pro-B animation of the corresponding Event-B models (that have been automatically generated by UML-B). The animated diagrams show the currently active states and the enabled transitions. Events can be 'fired' by clicking on the enabled transition. Where the state-machine belongs to a class, instances of the class can be seen moving from state to state.
+
The demonstrator tool was released on 30 November 2010, and is available from https://sourceforge.net/projects/codegenerationd/files as an update site or bundled Rodin package. Sources are available from https://codegenerationd.svn.sourceforge.net/svnroot/codegenerationd
  
The screenshot below shows a statemachine (top left) and its refinement (top right) being animated in parallel with the nested statemachines (bottom left and right) that are contained in the refined states. Two class instances are currently active; one models an ATM that is not available (e.g. in maintenace) and the other is in the process of validating a card. Transitions that are enabled for one or other of the class instances are emboldened. (The instance to be used when a transition is fired is selected when the transitions is clicked upon.
+
The tool is based on a build of Rodin 1.3.1 (not Rodin 2.0.0 due to dependency conflicts).
  
[[Image:SmAnimScreenshot.png]]
+
* The Code Generation tool consists of,
 +
** a tasking Development Generator.
 +
** a tasking Development Editor (Based on an EMF Tree Editor).
 +
** a translator, from Tasking Development to Common Language Model (IL1).
 +
** a translator, from the Tasking Development to Event-B model of the implementation.
 +
** a pretty-printer for the Tasking Development.
 +
** a pretty-printer for Common Language Model, which generates Ada Source Code.
  
====EMF Framework for Event-B====
+
== Available Documentation ==
  
An EMF (Eclipse Modelling Framework) based representation of Event-B was developed and made available as a plug-in feature for Rodin. This enables Event-B machines and contexts to be loaded into EMF based tools. Serialisation (i.e. loading and saving) is performed via the Rodin API. This feature can be viewed as an ''enabling technology''. Hence motivation derives from several sources including:
+
pre study
* A Text editor was requested by several industrial and academic partners - A fully-featured EMF based text editor ('''Camille''') has been developed by Düsseldorf and is now available.
+
http://eprints.ecs.soton.ac.uk/20826/
* Team-working facilities are required by all industrial partners (particularly Bosch and SSF) - EMF Compare/merge tools are now under investigation to support a '''teamworking''' repository plug-in feature.
 
* '''UML-B integration''' - since UML-B is based on EMF, the development of an EMF representation of Event-B enables UML-B concepts to be added as extensions.
 
  
=== Choices / Decisions ===
+
paper
 +
http://eprints.ecs.soton.ac.uk/20824/
  
 +
wiki page
 +
http://wiki.event-b.org/index.php/Code_Generation_Activity
  
====UML-B Support for State machine Refinement====
+
tutorial
The methods and modelling notations for refinement in UML-B were developed by experimentation using a case study of an ATM. The use of hierarchical nested state-machines (which were already available in UML-B) as a technique for adding detail in refinement was quickly adapted by making changes to the meta-model and translation. This technique was found to be suitable. Some further experimentation was needed in order to understand the need to link transitions of the nested state-machines with those in their parent. A concept of ''elaboration'' was introduced, whereby an elaborating  transition contributes guards and actions to the event produced from the elaborated parent transition. Transition splitting (analogous to event splitting in Event-B refinements) is a natural consequence of refinement of states. An idea to ''bundle'' the split transitions in the parent state-machine so that the correspondence with the abstract refined state-machine is more obvious has not been pursued for now since it would add complication to the tooling.
+
http://wiki.event-b.org/index.php/Code_Generation_Tutorial
  
====UML-B State-machine Animation====
+
technical notes
Initially, we attempted to model the animation state information as an extension to the UML-B meta-model. We discovered technological difficulties in extending EMF models in this way. Therefore,  we adopted an alternative solution using an independent meta-model of animation diagrams. These replicate parts of the structure of UML-B but add meta-properties to model the animation. When a model is to be animated, an animation model is constructed programmatically to match the UML-B model. Thereafter, the animation runs independently of UML-B. This has the additional benefit that the diagram can be simplified and tailored to better suit animation. For example, removing the editing palette.
+
http://wiki.event-b.org/images/Translation.pdf
  
====EMF Framework for Event-B====
 
The structure of the EMF meta-model for Event-B was studied in great detail. Various options for  sub-packaging the model were tried but it has been found that it is more convenient for users to keep a simple package structure. Currently this consists of three packages; a ''core'' package containing abstract basis and project level meta-model, a ''machine'' package and a ''context'' package. A flexible abstract basis has been derived through experimentation. The abstract basis consists of an inheritance hierarchy of abstract meta-classes which provide great flexibility for writing code that deals with the meta-model in as generic a manner as possible. A driving factor in the design was to support both project level tools and component level tools. The latter should be able to manipulate a single machine or context without loading referenced components. This was achieved customising the EMF proxies (used in references) so that they are calculated lazily (when a request to resolve is received).
 
  
=== Available Documentation ===
+
This paragraph shall give pointers to the available wiki pages or related publications. This documentation may contain:
  
UML-B Refinement is described in a paper which was presented at the FM2009 conference in Eindhoven. It is available here:
+
    * Requirements.
:[http://eprints.ecs.soton.ac.uk/18268 Language and Tool Support for Class and State Machine Refinement in UML-B]
+
    * Pre-studies (states of the art, proposals, discussions).
 +
    * Technical details (specifications).
 +
    * Teaching materials (tutorials).
 +
    * User's guides.  
  
A tutorial on how to refine state-machines is available on the wiki:
+
A distinction shall be made on the one hand between these different categories, and on the other hand between documentation written for developers and documentation written for end-users.
:[http://wiki.event-b.org/index.php/Refinement_of_Statemachines Refinement of Statemachines]
 
  
State-machine animation is described on the wiki here:
+
== Planning ==
:[http://wiki.event-b.org/index.php/UML-B_-_Statemachine_Animation UML-B - Statemachine Animation]
 
It is also available as a short paper here:
 
:[http://eprints.ecs.soton.ac.uk/18261 Animation of UML-B State-machines]
 
  
The EMF Framework for Event-B is described on the wiki here:
+
This paragraph shall give a timeline and current status (as of 28 Jan 2011).
:[http://wiki.event-b.org/index.php/EMF_framework_for_Event-B EMF framework for Event-B]
 
It is also available as a short paper here:
 
:[http://eprints.ecs.soton.ac.uk/18262 An EMF Framework for Event-B]
 
 
 
=== Planning ===
 
UML-B integration:
 
* Develop extensibility mechanisms for EMF Event-B framework via experimentation with structured data (records) plug-in.
 
* Re-engineer UML-B context diagrams as a diagrammatic view of records.
 
* Re-engineer UML-B package diagram based on EMF Event-B framework.
 
 
 
[[Category:D23 Deliverable]]
 

Revision as of 15:48, 1 December 2010

THIS DOCUMENT IS NOT YET COMPLETE !!!

General Overview

The code generation activity has been undertaken at the University of Southampton. This has been a new line of work for DEPLOY that was not identified in the original Description of Work for the project. The development of the approach, and the tools to support, it involved a number of team members at Southampton; and also at other institutions. This work draws on our recent experience with technologies such as Shared Event Decomposition [[1]], and the EMF Framework for Event-B [[2]]. There was collaboration at an early stage with Newcastle University, where we explored the commonalities between their flow plug-in [[3]] and the algorithmic structures used in our approach. Collaboration with the University of York was also established since we chose to use their Epsilon [[4]] model-to-model transformation technology.

Motivations

The decision was taken in 2009 [[5]] to include code generation as a project goal. It had been recognised that support for generation of code from refined Event-B models would be an important factor in ensuring eventual deployment of the DEPLOY approach within their organisations. This was especially true for Bosch and Space Systems Finland (SSF). After receiving more detailed requirements from Bosch and SSF, it became clear we should focus our efforts on supporting the generation of code for typical real-time embedded control software.

Choices / Decisions

Strategic Overview

During the last year we have focussed on supporting the generation of code for typical real-time embedded control software. To this end we have evolved a multi-tasking approach which is conceptually similar to that of the Ada tasking model. Individual tasks are treated as sequential programs; these tasks are modelled by an extension to Event-B, called Tasking Machines. Tasks have mutually exclusive access to state variables through the use of protected resources. The protected resources correspond to Event-B machines. For real-time control, periodic and one-shot activation is currently supported; and it is planned to support aperiodic tasks in the near future. Tasks have priorities to ensure appropriate responsiveness of the control software. For the DEPLOY project, it was regarded as sufficient to support construction of programs with a fixed number of tasks and a fixed number of shared variables – no dynamic creation of processes or objects has been accommodated.

Our main goal this year has been to devise an approach for, and provide tool support for, code generation. In accord with the resources available during the year it was decided to limit the provision of tool support to that of a demonstrator tool. The tool is a proof-of-concept only, and lacks the productivity enhancements expected in a more mature tool. Nevertheless much insight has been gained in undertaking this work; it lays a foundation for future research, and will be useful since it will allow interested parties to explore the approach.

Deliverable

The demonstrator tool was released on 30 November 2010, and is available from https://sourceforge.net/projects/codegenerationd/files as an update site or bundled Rodin package. Sources are available from https://codegenerationd.svn.sourceforge.net/svnroot/codegenerationd

The tool is based on a build of Rodin 1.3.1 (not Rodin 2.0.0 due to dependency conflicts).

  • The Code Generation tool consists of,
    • a tasking Development Generator.
    • a tasking Development Editor (Based on an EMF Tree Editor).
    • a translator, from Tasking Development to Common Language Model (IL1).
    • a translator, from the Tasking Development to Event-B model of the implementation.
    • a pretty-printer for the Tasking Development.
    • a pretty-printer for Common Language Model, which generates Ada Source Code.

Available Documentation

pre study http://eprints.ecs.soton.ac.uk/20826/

paper http://eprints.ecs.soton.ac.uk/20824/

wiki page http://wiki.event-b.org/index.php/Code_Generation_Activity

tutorial http://wiki.event-b.org/index.php/Code_Generation_Tutorial

technical notes http://wiki.event-b.org/images/Translation.pdf


This paragraph shall give pointers to the available wiki pages or related publications. This documentation may contain:

   * Requirements.
   * Pre-studies (states of the art, proposals, discussions).
   * Technical details (specifications).
   * Teaching materials (tutorials).
   * User's guides. 

A distinction shall be made on the one hand between these different categories, and on the other hand between documentation written for developers and documentation written for end-users.

Planning

This paragraph shall give a timeline and current status (as of 28 Jan 2011).