M2M
The Model2Model transformation tool allows to design a model to model transformation which is executed in Rhapsody by the M2M Engine.
The workflows below show you can use M2M to transform SysML into an AUTOSAR (UML) model, based on the IBM AUTOSAR profile.
The AUTOSAR model can be transformed by M2M into an ArUML model, based on the SodiusWillert AUTOSAR profiles.
The ARXF-CP allows you to implement Internal Behavior for your SWCs.
Extensive M2M Documentation can be found online.
M2M comes with sample rulesets which you can use to transform:
- an example SysML model InteriorLight.
This SysML model is part of this product and can be found at <ARXF_CP_V8.0.1 installation folder>\ARXF_CP_V8.0.1\Samples\Autosar\Model\InteriorLight\SysML
- the resulting AUTOSAR model, based on the IBM AUTOSAR profile, which you can transform into an ArUML model.
The ArUML model result of the example ruleset does not contain Internal Behavior.
An ArUML model where Internal Behavior is implemented can be found at <ARXF_CP_V8.0.1 installation folder>\ARXF_CP_V8.0.1\Samples\Autosar\Model\InteriorLight\ArUML
Architecture
When designing Architecture, we can use Rhapsody to model in SysML, UML or both.
With M2M one can transform a SysML model into a UML model or vice versa.
The design does not need to know about AUTOSAR: we can use M2M to transform a model into an AUTOSAR model.
The AUTOSAR model will be based on the IBM AUTOSAR profile.
Development
When developing, we can use Rhapsody to model in ArUML and use code generation.
For code generation we use Rhapsody and the SodiusWillert AUTOSAR profiles.
The input and output must be AUTOSAR compliant:
-
the input is RTE contracts for SWCs.
These contracts are created by an AUTOSAR authoring tool.
Such contract or configuration of Basic Software and RTE for SWCs defines:
-
names of SWCs and if an SWC supports multiple instantiation or not
-
names of runnables used by each SWC.
The ARXF-CP needs a few runnables per SWC ('init' and 'eventDispatcher').
Other runnables will be used for communication, data reception, etc.
All communication between SW-Cs is done via AUTOSAR ports and handled by RTE APIs. The use of Basic Software is via RTE APIs.
Sending UML events between SWCs is not supported yet. This is a feature which will be implemented later.
-
exclusive areas used by the ARXF-CP: two for an SWC plus one per active class inside an SWC.
-
inter-runnable variables used by the ARXF-CP: one for an SWC plus one per active class inside an SWC.
Further AUTOSAR artifacts required are: OS tasks and RTE triggers.
We need one OS task per SWC and one per active class inside an SWC.
-
the output is generated C code.
This code must be build in an AUTOSAR environment.
The code is fully AUTOSAR compliant.
The model used for code generation can be based on:
-
the AUTOSAR model from the Architecture phase.
We can use M2M to transform the AUTOSAR model based on the IBM AUTOSAR profile into an ArUML model based on the SodiusWillert AUTOSAR profiles.
The RTE contracts for SWCs are generated by an AUTOSAR authoring tool.
We use in Rhapsody the AUTOSAR model from the Architecture phase and export ArXML.
Depending on the language (SysML) and model, we must use M2M to concentrate on some parts of the architectural model and transform things into a UML model based on the IBM AUTOSAR profile.
The exported ArXML is then imported in the AUTOSAR authoring tool.
In that tool, the Basic Software and RTE must be configured and the SWC contracts must be generate.
-
on the AUTOSAR model from the AUTOSAR authoring tool.
We export ArXML from that tool.
That ArXML is imported in a Rhapsody project based on the IBM AUTOSAR profile.
We use M2M to concentrate on some parts and extract from the AUTOSAR model an ArUML model based on the SodiusWillert AUTOSAR profiles.
The RTE contracts for SWCs are generated by the AUTOSAR authoring tool.
AUTOSAR model from the Architecture phase
The code which is generated from the Rhapsody UML model based on the SodiusWillert profiles must be build within an AUTOSAR build environment
Project based on IBM AUTOSAR Profile
New Project
Although you can also update a project, we will show how to start a new project based on the IBM Autosar Profile.
Create a new project based on the AUTOSAR version which matches the ArXML you need to import later:
- select File | New and specify project name and location
- for Project Type: select the AUTOSAR version
- for Project Settings: AutosarAuthoring
ArXML Import
Now we can import the ArXML.
- select Tools | AUTOSAR | Import AUTOSAR XML Document
- on the General tab, browse to the ArXML file.
If you enable Import selected ArPackages the ArXML file will be opened first and scanned for ArPackages,
so you must be patient.
Reduce the scope of the IBM AUTOSAR Profile
AUTOSAR is huge and sometimes it is necessary to reduce the scope of the profile for a specific designer role.
In Rhapsody, it is possible to enable a specific list of metaclass which can created in a specific project, and disable others.
For that, you need to use the property AUTOSAR_Authoring_UserRole, and choose a specific User Role.
By default you have:
- All so everything is enabled
- ApplicationInterfaces for the Interfaces designer role
- SWArchitect for the Software Architect Role
To introduce a new User Role, follow instructions below:
- Add this package to your project: "Rhapsody\Share\Settings\AUTOSARAuthoring\AutosarAuthoring.sbs"
- Open Features dialog the project and check if the
property AUTOSAR_Authoring_UserRole can be displayed:
- open with a text editor "Rhapsody\Share\Settings\AUTOSARAuthoring\AutosarAuthoring.prp"
and add ‘SWCDesigner’ on line 3, and the property ‘SWCDesignerInclude’ property (from line 4 to line 24):
- save and reload the project
The Add New menu and the toolbar of the diagrams display only AUTOSAR elements which are in the property
‘SWCDesignerInclude’.