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:
SysML from/to Simulink model generation level
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, 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 use the Simulink Model developed Exercise 10.5 - SysML -> Simulink with model generation level settings. in Demonstration 3 using Recursive settings.
This model will be sent to SysML using the three settings of Simple, Immediate, and Recursive.
The Simulink model is as shown here.
The Target SysML Model and Package are in Syndeia_Simulink_Examples.rpyx (Get it here - SysML Models, Profiles and Mappings.) as shown here.
Demonstration 1: Simple Settings
1A) Generate SysML blocks with full ports
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 Rhaspody Package FromSimulink>Simple>FullPort
3 In Rhapsody SysML Full Ports are generated as per type selected.
4. Now going to 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
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 Compare the connection again as in Step 4 above and see the result in Comparison Result.
Here p1 is shown on Simulink Side and in1 in on SysML side.
8 Now Sync Target and Source from Connections Search as shown below for the connection.
9 Again do Compare and can see p1 is appeared both on SysML and Simulink side.
10 In SysML Rhapsody 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 FromSimulink>Simple>ProxyPort
3 In Syndeia it appears as below.
4 In Connections Search Tab in Syndeia again Select Compare for the connection, it appears as Proxy Port.
5 In SysML Rhapsody it is seen as Proxy Port.
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 Perform Model Transform in Syndeia Dashboard. Send System.slx to SysML Package FromSimulink>Immediate>Full Port Im
3 In Syndeia Dashboard it appears as below.
4 Now going to Connections Search Tab in Syndeia and Click Get All to see the connections. Select Compare Source and Target.
5 In Comparison Result this appears as below.
6 In SysML Rhapsody 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 FromSimulink>Immediate>Proxy Port Im
3 In Syndeia Dashboard this appears as below.
4 Now going to Connections Search Tab in Syndeia and Click Get All to see the connections. Select Compare Source and Target and result will appear in Comparison Result as below.
5 In SysML Rhapsody it appears as Proxy Port as shown 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 FromSimulink>Recursive>Full Port Rc
3 In Syndeia this looks like as shown below.
4 Now going to Connections Search Tab in Syndeia and Click Get All to see the connections. Select Compare Source and Target.
5 Comparison Result shows as below.
6 In Rhapsody this appears as Full Ports as shown below.
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 FromSimulink>Recursive>Proxy Port Rc
3 In Syndeia Dashboard appears as below.
4 Now going to Connections Search Tab in Syndeia and Click Get All to see the connections. Select Compare Source and Target.
5 Compare Result shows as below in the Comparison Result tab.
6 In Rhapsody this appears as below.
Summary
Three different settings of Simple, Immediate, and Recursive were introduced and demonstrated.
Drag-and-drop from Simulink to SysML Rhapsody and showing the resulting SysML Rhapsody model based on that setting. Note that the setting for generating full/proxy port will be used to decide the type of port generated on the SysML Rhapsody block.
Compare, Sync operation is common to all three settings.