Exercise 10.5 - SysML -> Simulink with model generation level settings.
Objective
This tutorial demonstrates SysML from/to Simulink model generation level using the model generation and compare/sync between SysML and Simulink models. The three settings are as follows:
(1) SIMPLE
SysML → Simulink: Generate a Simulink model based on the SysML Block/Activity. Only ports are generated. No internal structure is generated.
Simulink → SysML: Generate a SysML Block/Activity based on the Simulink model. Only ports are generated. No internal structure is generated.
(2) IMMEDIATE
SysML → Simulink: Generate a Simulink model based on the SysML Block/Activity. Simulink model will have ports corresponding to the SysML Block/Activity, and Simulink blocks and signal/bus flows corresponding to the immediate structure (1 level only) of the SysML Block/Activity, i.e. immediate part/reference/shared properties of the SysML Block, or immediate call behavior actions of the SysML Activity.
Simulink → SysML: Generate a SysML Block/Activity based on the Simulink model. SysML model will have ports (or pins) corresponding to the Simulink model, and part properties (or call behavior actions) and connectors (or object flows) corresponding to the immediate blocks (1 level only) and signal/bus flows in the Simulink model.
(3) RECURSIVE (default)
SysML → Simulink: Generate a Simulink model based on the SysML Block/Activity. Simulink model will have ports corresponding to the SysML Block/Activity, and Simulink blocks and signal/bus flows corresponding to all the part/reference/shared properties (or call behavior actions) in the multi-level SysML Block/Activity hierarchy.
Simulink → SysML: Generate a SysML Block/Activity based on the Simulink model. SysML model will have ports (or pins) corresponding to the Simulink model, and part properties (or call behavior actions) and connectors (or object flows) corresponding to all the blocks in the multi-level Simulink model hierarchy.
Preparation
This exercise assumes the student has
Rhapsody supported version installed correctly on his or her machine with a valid license for use.
Syndeia installed as a plugin for Rhapsody with a valid license for use.
Syndeia Simulink interface, correctly installed with a valid license for use.
MATLAB/Simulink R2016b or later installed correctly on his or her machine with a valid license for use.
In this tutorial, we will see the Rhapsody model available as Syndeia_Simulink_Examples.rpyx (Get it here - SysML Models, Profiles and Mappings.)
Tutorial: From SysML Rhapsody to Simulink
Demonstration 1: Simple Setting
1 Open the SysML project Syndeia_Simulink_Examples.rpyx (Get it here - SysML Models, Profiles and Mappings.), and launch the Syndeia dashboard from Model Generation.
2 This will open Syndeia Dashboard.
3 Settings in Syndeia Dashboard for Simple as shown below.
4 Select the SysML Block System under Bus Model Package for Model Transform.
5 In Syndeia Dashboard Perform Model Transform. Drag Drop SysML Block System from under Bus Models Package as shown here to the Simulink folder Sim33 or folder of your choice.
6 Click OK to Generate Simulink Model in folder Sim33 or folder on your local machine.
7 The Syndeia dashboard will appear now and a System.slx is created under the Sim33 folder or your folder of choice.
8 As with Simple Setting generated in Simulink model is System.slx
9 Compare and Sync to Verify the Simple Setting.
From Connections Search Tab in Syndeia and Click Get All to see the connections. Select Compare Source and Target.
10 The Compare result is shown as below in the Comparison Result tab.
11 Now, add a port under System Block in SysML Rhapsody 'p1' as Flow Port and specifications as shown below.
12 Compare this and the absence of p1 will be highlighted as shown.
13 Now Sync p1, and can verify compare again from the Connections Search tab as shown below.
14 This now shows in Comparison Result as below.
15 In Simulink it shows as below.
16 Now we delete p1 from SysML Model Block System and compare and sync again.
17 Now Compare from Connections Search Tab.
18 Sync the connection now as before and in Syndeia Dashboard it appears in Sync.
19 Open now the Simulink Model now has no ‘p1’ port it gets updated when the sync is done with SysML Model.
Demonstration 2: Immediate Setting
Using the Same Model of SysML Rhapsody System Block with Immediate settings.
2A) Apply setting of Model Reference with Immediate and Click Apply
1 Apply the Settings as shown here.
2 Perform Model Transform and Drag Drop SysML Block System from under Bus Models Package as shown here.
3 This appears after Model Transform as below.
4 In Simulink this appears as below.
5 The connections are generated as shown below. From Connections Search tab click Get ALL to get these connections.
2B) Apply setting of Subsystem with Immediate and Click Apply
1 Apply Settings as Immediate and Subsystem.
2 Select Model Transform and Generate Simulink Model.
3 Now going to Connections Search Tab in Syndeia and Click Get All to see the connections.
4 Open Simulink Model it should appear as below.
Demonstration 3: Recursive Setting
1 Apply Settings as Recursive and Select Recursive and Select Model Transform.
2 Select Generate Simulink Model and Model Transform.
3 Now going to Connections Search Tab in Syndeia and Click Get All to see the connections.
4 In Syndeia Dashboard it appears as below.
5 Open System.slx in Simulink as it will show all multi-level hierarchy being generated.
Summary
In this Tutorial page features of SysML Rhapsody to Simulink Model Transformation were enumerated.
Three different settings of Simple, Immediate, and Recursive were introduced and demonstrated.
Features such as Compare, Sync are common to all settings.