Generating Simulink model from SysML block

Follow the instructions below to generate Simulink model structure from a SysML block structure.

  1. Open the model Syndeia Simulink Examples in MagicDraw.

  2. The Model Generation package is the main package and it contains the following three sub-packages, each of which have a SysML block model (Blocks package) and SysML activity model (Activity package).
    1. Basic Models – SysML block and activity models with primitive / atomic flows
    2. Bus Models – SysML block and activity models with complex / non-atomic flows
    3. LibBlock Models – SysML block and activity models using Simulink library blocks


    Figure 138: SysML block and activity model examples for Simulink model generation 

  3. The instructions presented below are for generating Simulink models from SysML block model in Model Generation::Basic Models::Blocks package.

  4. Open the Internal Block Diagram (IBD) in the System block, as shown in Figure 139 below. It is a multi-level block structure where blocks PartA, PartB, and PartC are further decomposed and have their own internal structures.


    Figure 139: SysML IBD for the System block

  5. Launch the Syndeia Dashboard for the Blocks package. Select a Local File System Repository on the RHS, as shown in Figure 140 below.
  6. Select Model Transform connection type (middle panel), and drag-n-drop the System block to a folder in the local file system repository (RHS), as shown in Figure 140 below.


    Figure 140: Drag-n-drop a SysML block to a folder to generate a Simulink model

  7. Select Generate Simulink model option in the dialog box and click Yes to continue.


     Figure 141: Selection option to generate a Simulink model


    Figure 142: Selection option to generate a Simulink model

  8. Wait for Simulink model to be generated. The log window in the Syndeia dashboard will show several messages as shown below.


    Figure 143: Selection option to generate a Simulink model

  9. Syndeia will finish generating Simulink model structure based on the internal structure of SysML block, as shown in Figure 144 below. Expand top-level model file (System.slx) to view the structure of the Simulink model that is generated. This will load the model using Simulink. Then expand the Simulink model System to see the internal details and compare with the SysML block structure (LHS).


    Figure 144: Simulink model structure generated from SysML block structure

  10. Syndeia uses the following mapping to generate Simulink model structure from the SysML block structure.

    SysML block -> Simulink model
    SysML block part properties -> Simulink model references
    SysML block ports (full, proxy, flow) -> Simulink ports
    SysML block connectors between ports -> Simulink lines with signal/bus flows

    As see in Figure 144 above, a Simulink model were generated for each SysML block in the context of the System block structure. Part properties pA, pB, and pC of the System block were generated as model references with the same name in the Simulink model. Full, proxy, and flow ports of the System block were generated as Simulink ports, and connectors were generated as lines with signal flows.  
     
  11. Right click on the System.slx file or the System Simulink model in the Syndeia Dashboard and select Open. This will open the newly generated Simulink model in Simulink, as shown in Figure 145 below—after re-arranging the layout to match SysML IBD in Figure 139.


    Figure 145: Simulink model opened in Simulink
     
     
  12. Click on the Connection Browser tab in the Syndeia Dashboard, right click on the Blocks package and select Refresh. Then, right click on the Blocks package again and select Expand All. You should see a model transform connection created between each block in the structure and the corresponding Simulink model that has been generated. These connections can be used for downstream compare and (potentially) synchronization of SysML and Simulink models.

Figure 146: Syndeia generates model transform connections between SysML blocks and Simulink models

Copyright 2018 Intercax.