Exercise 10.3 - SysML Simulink Compare Sync.

Objectives

The new learning objectives of this exercise are to compare SysML and Simulink models, update a SysML block structure from a modified Simulink model, and update a Simulink model from a modified SysML block structure. The same processes apply to SysML activity models.

Preparation

This exercise assumes the student has

  • IBM Rational Rhapsody 8.2 installed correctly on his or her machine with a valid license for use, and

  • Syndeia 3.3 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. We also assume the student is sufficiently familiar with Simulink to modify the Simulink model in Steps 6 and 7 below without detailed instructions.
    We will use the provided MagicDraw project Syndeia Tutorial Testbed.rpy. We assume the user has completed Exercise 10.1.

Exercise

  1. If not already open from the previous exercises, open Syndeia Tutorial Testbed.rpy and launch the Syndeia dashboard from the Simulink_Tutorial Part 2 package. Select a Syndeia Cloud project, if required.

  2. Navigate to the Connection Browser tab, expand the System block to see the connection, and right-click > Compare Source & Target as shown in Figure 1. Click yes to confirm. Be careful to work with models and connections in Simulink_Tutorial Part 2, those created in Exercise 10.2.

    Figure 1 Syndeia Connection Browser, compare initial models

  3. Comparison Results tab should show that all elements are in sync, as shown in Figure 2.

    Figure 2 Comparison results for initial SysML and Simulink models, before changes.

  4. Open the System Simulink model in MATLAB/Simulink environment (Figure 3).

    Figure 3 System Simulink model before changes

     

  5. Add the following to System Simulink model.

    1. Port out3 with type Boolean (as a shortcut, copy/paste existing out2)

    2. Model Reference Block pD : PartD

      1. Copy/Paste Simulink model PartC in the folder, rename to PartD, open and delete all elements inside PartD except for in1 and out2 ports.

      2. In the System Simulink model, copy/paste pC, change name to pD, open its Parameters window and change Model name to PartD.

    3. Lines [pA.out1 – pD.in1] & [pD.out1 – out3]

    4. Save the intermediate model. It should appear similar to Figure 4.

      Figure 4 System Simulink model, partially modified

  6. Delete the following from System Simulink model

    1. Lines to and from pB

    2. Model Reference Block pB : PartB

    3. Port in2 on the System block

    4. Save the final model. It should appear similar to Figure 5.

      Figure 5 System Simulink model, fully modified

  7. Repeat Step 3 to Compare SysML & Target. The results should appear as in Figure 6.

    Figure 6 Comparison results after Simulink model changes 

     

  8. Update the SysML model from the modified Simulink model

    1. In the Connection Manager, right-click the System block connection (as in Step 8 above) and choose Sync Target -> Source.

    2. Go to the SysML IBD for the System block. Right-click inside the diagram and select Display Parts/Ports (Figure 7).

      Figure 7 Simulink model opened in Simulink

    3. Check pD:PartD, its ports in1 and out2, and the new System block port out3, as shown.

    4. After rearrangement, the SysML IBD should appear similar to Figure 8.

      Caution: When making changes in a multi-level block structure, you should sync leaf-level blocks BEFORE syncing parent models. For example, if you add and/or delete ports on PartC block, which is used as part property pC in System, you should compare and sync PartC to resolve changes, before comparing and syncing the parent block, System. This is not necessary for a new child being added that is not yet connected, as shown with pD : PartD in this example.

  9. Save and close the Simulink model.

  10. Add the following to the System block in the Rhapsody SysML model:

    1. Copy PartC to create PartC1 in the Syndeia_Simulink Part 2 package.

    2. Create a part pC1:PartC1 in System and drag into IBD.

    3. Create a connector between pC1.out2 and pC.in2

  11. Delete the following from the System block (be sure to delete them from the model, not just the diagram; Syndeia always works from the model):

    1. Part Property pA : PartA (three connectors: in1 - pA.in1, pA.out1 - pC.in1, and pA.out1-pD.in1, should be deleted automatically)

    2. The final System IBD should appear similar to Figure 8.

      Figure 8 System SysML model, modified after completion of Step 11

       

  12. Repeat Step 3 to Compare Source & Target. The results should appear similar to Figure 9.

    Figure 9 Comparison results after SysML model changes 

     

  13. Update the Simulink model from the modified SysML model

    1. In the Connection Manager, right-click the System block connection (as in Step 8 above) and choose Sync Source to Target.

    2. Open the Simulink model which should appear similar to Figure 10.

      Figure 10 Simulink model, final

Caution: As noted before, when making changes in a multi-level block structure, you should sync leaf-level blocks BEFORE syncing parent models.