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 comparing/syncing 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, 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

Tutorial: From SysML Magicdraw to Simulink

Demonstration 1: Simple Setting

1 Open the SysML project Syndeia_Simulink_Examples (get it here - https://intercax.atlassian.net/wiki/spaces/SYN34/pages/2407364009), and launch the Syndeia dashboard from Model Generation.

Figure 1: Launching the Syndeia dashboard from the Model Generation package

2 Settings in Syndeia Dashboard for Simple are as below. Click Apply.

Figure 2: SysML from/to Simulink model generation level set to SIMPLE in Settings tab of Syndeia Dashboard

3 Select the SysML Block System under Bus Model Package for Model Transform.

4 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.

Click OK to Generate Simulink Model.

5 The Syndeia dashboard will appear now and a System.slx is created under the Sim33 folder or your folder of choice.

6 In Simulink, the model appears as Launch from Syndeia Dashboard directly.

 

7 As with Simple Setting generated in Simulink model is System.slx

8 Compare and Sync to Verify the Simple Setting.

Now go to Connections Search Tab in Syndeia and Click Get All to see the connections. Select Compare Source and Target.

9 You can observe the Simple Setting Model Transformation.

10 Now, add a port under System Block in SysML MagicDraw 'p1' as Flow Port and specifications as shown below.

11 This modified System is now compared and we will sync the same with Simulink.

12 Compare this and the absence of p1 will be highlighted as shown.

13 Now Sync p1, and can verify compare again.

14 In Simulink now port p1 appears.

15 In Simulink Model now port p1 appears.

16 Now we delete p1 from SysML Model Block System and compare and sync again.

17 Compare the connection now and p1 is not in SysML but present in Simulink Model. This can be seen in the Comparison Result tab below.

18 Sync the connection now as before, and Compare the connection again in the Connections Search tab in Syndeia Dashboard. It now appears in Sync now. The result can be seen in the Comparison Result below.

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 System Block with Immediate settings.

2A) Apply setting of Model Reference with Immediate and Click Apply

1 Apply the Settings as shown here.

2 It appears in Settings as shown here.

3 Perform Model Transform and Drag Drop SysML Block System from under Bus Models Package as shown here.

4 This appears after Model Transform as below.

5 Now go to the Connections Search Tab in Syndeia and Click Get All to see the connections generated.

6 Open the model System. slx in the Simulink folder of your local machine and observe it as a Model References block as per the setting selected.

7 Also, Ports are generated under the Model References Block as required by the Immediate Settings.


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 In the Syndeia dashboard Connection Manager tab this appears as below.

5 Open Simulink model System.slx and it will appear in Simulink as a Subsystem now.


Demonstration 3: Recursive Setting

1 Apply Settings as Recursive and Select Model Transform.

 

2 Select Generate Simulink Model and Model Transform.

3 Now go to the Connections Search Tab in Syndeia and Click Get All to see the connections.

4 This appears in the Syndeia Dashboard Connection Manager tab as shown 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 to Simulink Model Transformation were enumerated.

Three different settings of Simple, Immediate, and Recursive were introduced and demonstrated.

Features such as Compare, and Sync are common to all settings.