Title: Modelling and Code Generation for Real-Time Embedded Systems with UML-RT and Papyrus-RT.
Authors: Nicolas Hili, Juergen Dingel, and Alain Beaulieu
This tutorial discusses the Model-Driven Engineering (MDE) of Real-Time Embedded (RTE) systems with soft real-time constraints using UML for Real-Time (UML-RT) and Eclipse Papyrus for Real-Time. UML-RT is a profile of UML specifically designed for RTE systems. It has a long, successful track record of application and tool support via, e.g., IBM Rational RoseRT, IBM RSA-RTE, and now Papyrus-RT. Papyrus-RT is an Eclipse-based, open-source modeling development environment for UML-RT systems. It allows the generation of complete, executable code from models and advances the state-of-art via support for model representation with mixed graphical/textual notations and an extensible code generator.
The tutorial introduces the central modeling concepts of UML-RT and features of Papyrus-RT. It also presents some advanced features of Papyrus-RT such mixed graphical/textual modeling, code generation, and code-assist. The material will be illustrated with a sequence of examples that will also be used for short, ‘hands-on’ exercises to give attendees some practical experience with Papyrus-RT. At the end, a larger example, such as a model of a Rover or a Computer system, will be discussed. A goal of the tutorial is to give attendees a better understanding of the state-of-the-art in UML-based MDE including its strengths, weaknesses, and opportunities.
Slides of the TB are available here.
Supporting Material
In order to prepare the hand’s sessions, we invite the attendees to install Papyrus-RT and set up their environment. It is done by following the steps below:
Requirements:
- Java 8 JRE or JDK
- The Papyrus-RT runtime environment (i.e., the implementation of the underlying infrastructure to, e.g., create capsules, timers, and timeouts, and deliver messages) runs on Linux. So, if you’re installing Papyrus-RT into a Linux environment, you will not need anything extra to be able to compile and run the code generated by Papyrus-RT from the model. However, to do that in a Windows or macOS environment you will need additional software:
- Windows: you also need to install either (1) Cygwin, or (2) a Virtual Machine Manager (a.k.a., ‘hypervisor’) such as VirtualBox or VMWare together with the Vagrant virtual development environment. If you are feeling adventurous, you can try the ‘Bash on Ubuntu on Windows’ in Windows 10 which apparently allows you to run Linux applications; however, I have no more information on this.
- macOS: as for Windows, you can use a hypervisor and Vagrant
Installing Papyrus-RT:
- Get the last version of the Papyrus-RT RCP from the Papyrus-RT download page
- Extract the archive and double-click on Papyrus-RT.
- Papyrus-RT will prompt you to enter a workspace path. Select the path that you want.
You are all set and ready to use Papyrus-RT !
Preparing the environment for building:
Preparing the environments for building is not a requirement for using Papyrus-RT and generating code. It is however required if you want to compile and test the code you generated with the tool. To do it, several steps has to be followed. Below is a digest version of the instructions that are available on the Papyrus-RT wiki.
- On Linux:
- Open a console and locate the folder <YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts
- Execute the make command to compile the Papyrus-RT runtime environment
- Get the absolute path of the <YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts folder using pwd
- Export the UMLRTS_ROOT variable as following (alternatively, you can add it to your .bashrc file):
$ export UMLRTS_ROOT="<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts"
- On Windows (Using Cygwin):
- Open Cygwin and locate the folder /cygdrive/c/<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts
- Get the absolute path of the /cygdrive/c/<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts folder using pwd
- Export the UMLRTS_ROOT variable as following (alternatively, you can add it to your .bashrc file):
$ export UMLRTS_ROOT="/cygdrive/c/<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts"
For additional information, or for Vagrant users, please follow the instructions here.
Importing the models:
The models that will be used during the TB are available for download here: ICSE2017-Papyrus-RT-Models.
- Once the archive is downloaded (you do not have to extract it), open Papyrus-RT and select `File > Import…’ from the top menu bar
- Select `General / Existing Projects into Workspace‘ and hit `Next‘
- Check the second radio button `Select archive file’ and hit `Browse‘
- Locate the archive and hit `OK‘
- Select all the projects and hit `Finish‘
Building the PingPong model:
Generating code from a model and compiling an application with Papyrus-RT is very simple. Instructions below give you an example on how to generate and compile code on the different platforms:
- Generating code (all platforms):
- Make sure that the Papyrus perspective is selected (visible on the top right corner of Eclipse). If not, select `Open perspective‘ and choose `Papyrus‘
- Open the PingPong model using the Project Explorer
- In the Model Explorer, right-click on the RootElement and hit `Generate all code‘
- A new project called PingPong_CDTProject will be created and imported into your workspace
- Compiling on Linux:
- Using the console, locate the folder containing the generated code (it should have the following name: PingPong_CDTProject)
- Go the the `src’ folder
- Execute the make command:
$ make
- Compiling on Windows (using Cygwin):
- Using Cygwin, locate the folder containing the generated code (it should have the following name: PingPong_CDTProject)
- Create a build folder using the following command:
$ mkdir build
- Go the the `build’ folder
- Execute the cmake command as follow:
$ cmake ../src
- Execute the make command:
$ make
For additional information, or for Vagrant users, please follow the instructions here.