Exercise 10.6 - Simulink -> SysML with model generation level settings

Objective

This tutorial demonstrates Simulink to SysML model generation level using the model generation and compare/sync between SysML and Simulink models. The three settings are as follows:

Sets the level of 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, 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

This model will be sent to SysML using the three settings of Simple, Immediate, and Recursive.

The Simulink model is shown here.

Figure 1: System Model in Simulink

The Target SysML Model and Package are in Syndeia_Simulink_Examples.mdzip (get it here - https://intercax.atlassian.net/wiki/spaces/SYN34/pages/2407364009) as shown here.

Figure 2: Target SysML model and packages

Demonstration 1: Simple Settings

1A) Select SysML type: Full Port

1 Set SysML port type when generating from Simulink setting to FULL_PORT under MATLAB/Simulink category in Syndeia settings, and click the Apply button.

2 In Syndeia dashboard perform Model Transformation. Send System.slx to SysML Package From_Simulink>Simple>FullPort

3 Updated SysMl package with data from Simulink

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

5 Ports are shown on both SysML as well as Simulink. This can be seen in the Comparison Result tab as shown below.

6 Now in Simulink Model we add a new port ‘p1’ and remove the port in1 and further replace ‘in1’ with p1.

So Part A has p1 coming in.

7 Again going to Connections Search Tab in Syndeia, Compare the connection. The Comparison Result will be shown below.

8 Here p1 is shown on Simulink Side and in1 in on the SysML side.

9 Now in the Connections Search tab select Sync Target and Source on the connection.

10 Again in the Connection Search tab do Compare the connection. The Comparison Result will show the result below.

11 Observe p1 is appeared both on SysML and Simulink side.

12 In SysML MagicDraw Model it is seen as below.


1B) Generate SysML blocks with Proxy Ports and Apply

1 Set SysML port type when generating from Simulink setting to PROXY_PORT under MATLAB/Simulink category in Syndeia settings, and click the Apply button.

2 In the Syndeia dashboard perform Model Transformation. Send System.slx to SysML Package From_Simulink>Simple>ProxyPort

3 In Syndeia it appears as below.

4 Do Compare in the Connection Search tab for the connection, it appears as Proxy Port as shown below.

5 In SysML Containment Tree it is seen as Proxy Port as shown below.

Demonstration 2: Immediate Settings

2A) Generate SysML blocks with Full Ports and Apply

1 Set SysML port type when generating from Simulink setting to FULL_PORT under MATLAB/Simulink category in Syndeia settings, and click the Apply button.

2 Apply Settings as shown here.

3 In Syndeia dashboard select the System.slx and perform Model Transformation to SysML Package From_Simulink>Immediate Package>FullPort

4 In Syndeia Dashboard it appears as below.

5 In the Connections Search tab select Get All. Now all new connections are generated as shown. Do Compare Source and Target as shown below.

6 In the Comparison Result tab this shows as below.

7 In SysML Magicdraw this looks as showing Full Ports.


2B) Generate SysML blocks with Proxy Ports and Apply

1 Set SysML port type when generating from Simulink setting to PROXY_PORT under MATLAB/Simulink category in Syndeia settings, and click the Apply button.

2 Perform Model Transform in Syndeia Dashboard. Send System.slx to SysML Package From_Simulink>Immediate>ProxyPort

 

3 In Syndeia Dashboard in Connection Manager tab, this appears as below.

 

4 Now in the Connection Search tab click Get All. This will show all connections generated. Select Compare Source and Target on the connection as shown below.

5 In the Comparison Result tab the result is shown below.

6 In Syndeia Dashboard in Containment Tree this is shown as below.

 


Demonstration 3: Recursive Settings

3A) Generate SysML blocks with Full Ports and Apply

1 Set SysML port type when generating from Simulink setting to FULL_PORT under MATLAB/Simulink category in Syndeia settings, and click the Apply button.

2 In Syndeia Dashboard perform Model Transform.Send System.slx to SysML Package From_Simulink>Recursive>FullPort

3 In Syndeia Dashboard this appears as below.

4 In the Connections Search tab click Get All. The connections generated are displayed. Select Compare Source and Target on the connection as shown below.

5 The Comparison Result tab shows the result as below.

6 In SysML Containment Tree it appears as Full Port.

 


3B) Generate SysML blocks with Proxy Ports and Apply

1 Set SysML port type when generating from Simulink setting to PROXY_PORT under MATLAB/Simulink category in Syndeia settings, and click the Apply button.

 

2 In Syndeia Dashboard perform Model Transform.Send System.slx to SysML Package From_Simulink>Recursive>ProxyPort

 

3 In Syndeia Dashboard in Connection Manager this appears as below.

 

4 In the Connections Search tab click Get All. The connections generated are displayed. Select Compare Source and Target as shown below.

 

5 In the Comparison Result tab the result is shown below.

 

6 In SysML Containment Tree it appears as Full Port.

 


Summary

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

Drag-and-drop from Simulink to SysML and show the resulting SysML model based on that setting. Note that the setting for generating a full/proxy port will be used to decide the type of port generated on the SysML block.

Compare, Sync operation is common to all three settings.