Getting Started with Connector for Capella and Simulink®

During the system architecture design, system architects always must make compromise, find the right balance and to secure the system definition.
To do so the use of simulation is useful to get tangible information to make justified design choices on each specific topics, to early integrate, verify and validate the system definition and much more.
Hence, going through all this design process they will require to run multitude of simulations, all of them somehow linked to the system definition captured in Capella.

Furthermore the system architecture definition model must be kept updated during the Product Lifecycle.
Hence it must be easy to sychronize this model with the detailed design models built in Simulink®.

In this context, the challenge is to ensure the consistency of the system definition model and the simulation models.

The connector is exactly intended to make this model transformation easier and to ensure models consistency.

Table of Contents

  1. Generic Transformation Workflow
    1. Select Elements to Transform
    2. Select Type of Transformation
    3. Configure Transformation Options
    4. Export Elements in a File
    5. Import Elements in MATLAB
      1. Import Elements in MATLAB Programmatically
      2. Import Elements from MATLAB Project
  2. Related Topics

Generic Transformation Workflow

The generic transformation workflow is:

  1. Select Elements to Transform
  2. Select Type of Transformation
  3. Configure Transformation Options
  4. Export Elements in a File
  5. Import Elements in MATLAB

Select the elements you want to transform

As the first step of the transformation workflow, select the Capella model elements you want to perform. The elements can be selected from the Capella Project Explorer. To select several elements keep the CTRL button pressed while selecting the elements.

When all the elements you want to transform are selected then right click on one of the selected element and choose the "Export to Simulink®" option.

Workflow1 - Select elements.gif

At any time in the "Capella Export to Simulink®" GUI you can skip all the remaining steps to generate the export file.

Select Type of Transformation

Once the Export menu is opened, select the transformation you want to perform and click "Next":

Configure Transformation Options

Depending on the type of transformation selected there are a few options. See the dedicated page for more information about these options.

Export Elements in a File

When the transformation configuration is set then click "Finish" to generate the export file.

The exported file is named the same than your Capella Project with the extension .mlcore and stored at the root level of the Capella Project.

It is good practice to rename this file to make it more explicit.

A known limitation is that it is not possible to define the name or location of the export file before generation.

Import Elements in MATLAB

The elements can be imported in the MATLAB environment programmaticaly or via MATLAB Project shortcut.

Import Elements in MATLAB Programmatically

To import elements in MATLAB environment programmaticaly run the following command
CapSLBridge.import
This command opens an Explorer window to select the mlcore file you want to import.
By default, this command creates a new MATLAB Project based on the MATLAB Project template "Cap2SL" provided by this toolbox. The project is created in the folder userpath/<CapellaProjectName> and the project name is the Capella Project name. The import of all the elements populates several files in the various project folders. These files are then initialized with elements representing exported Capella elements.

See CapSLBridge.import for more information.

See Cap2SL Project Template Overview to know how to work with this project.

Import Elements from MATLAB Project

From an existing MATLAB Project created from the Cap2SL Project template, paste the .mlcore file in the "capellaData" folder and click on the "Import Capella elements" project shortcut. If there are more than one .mlcore file in this folder, then you are prompted to select which one you want to use for the import.

Workflow6 - Import elements in MATLAB.gif