Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Syndeia 3.3 (Plugin for Rhapsody)
Tutorial Exercise 2.1
Transforming SysML Blocks/Instances to Excel Tables/Rows

Image Added

47 Perimeter Ctr E, Suite 410
Atlanta, GA 303046, USA
Voice: +1-404-592-6897
Web: www.intercax.com
Email: info@intercax.com


Revision Date: July 5, 2020

Objectives

The new learning objectives of this exercise are to generate a table in an Excel workbook from a collection of blocks in Rhapsody and then update that table when values change in the SysML model.

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

The specific instructions call for creating connections to an Excel workbook on the local file system, so no additional interface beyond the Syndeia base module is required.
Caution: Rhapsody has, by default, restrictions on the naming of SysML elements, which can create problems when Syndeia tries to create Rhapsody model elements that violate these restriction, e.g. beginning a SysML block name with a number. We recommend modifying any Rhapsody models you create to relax these restrictions. Modify the properties of the top-level package of the model under General::Model::NamesRegExp with the following string and save.
^(([a-zA-Z0-9_][a-zA-Z0-9_ ():-]*)|(operator.+))$

Exercise

  1. We will use the collection of blocks in the Excel_Tutorial Part 1 package in the Rhapsody model supplied,
    Anchor
    _Hlk41810954
    _Hlk41810954
    Syndeia Tutorial Testbed.rpy. In Figure 1 we see a component block with 12 specializations. We will use the parent component block to generate the table structure, using the value properties as column headers, and the specialized blocks to generate the table rows, with the default values as the column entries in each row. The same process works if the 12 blocks are instances rather than specializations of the component block. Whether the modeler uses instances or specializations to capture actual parameter values is a methodology question; MagicDraw and Syndeia support both.


Image Added

Anchor
_Ref388940445
_Ref388940445
Figure 1 Contents of Excel_Tutorial Part 1 package in Syndeia Tutorial Testbed.rpy

 

  1. Launch the Syndeia dashboard from the Excel_Tutorial Part 1 package in the SysML model. Select a Syndeia Cloud project, if necessary.


  1. Set up the repository link to the file folder holding the Excel file using the Repository Manager. In our example, this is named Syndeia Excel Files.
    1. In the Repository Manager tab, right-click on Local Files System Repository and select Add… as in Figure 2.
    2. Give the repository link a descriptive name and browse to set the Root to the folder that will contain the Excel file.


Image Added

Image Added

Anchor
_Ref388973013
_Ref388973013
Figure 2 Add Local File System Repository

Figure 3 Complete Repository Link

  1. Create an empty Excel file in this folder (in our example, Excel_Testbed.xlsx). Close this file. Syndeia cannot write to an open Excel file.


  1. The Syndeia Dashboard Connection Manager should appear similar to Figure 4


Image Added

Anchor
_Ref388973657
_Ref388973657
Figure 4 Syndeia Dashboard, Connection Manager showing link to Excel file in Local File System


  1. The first step is to create the table in Excel. Set the Connection Type to Model Transform, as shown in Figure 4. Drag the parent block, component, from SysML to the workbook, Excel_Testbed.


Image Added

Anchor
_Ref388940611
_Ref388940611
Figure 5 Confirming table generation

  1. Confirm table generation as shown in Figure 5.


  1. When complete, the Connection Manager should show a new table, component, in a new worksheet, component, in the Excel file, Excel_Testbed , as shown in Figure 6.


Image Added

Anchor
_Ref388940625
_Ref388940625
Figure 6 Connection Manager after generation of new table, component

Image Added

Anchor
_Ref388940646
_Ref388940646
Figure 7 Connection Summary tab shows link between SysML block and Excel table


  1. The Connection Search tab, as shown in Figure 7, shows the connection created between the SysML block and the Excel table. The connection number assigned may be different in your exercise.


Discussion: Tables are created in MS Excel using the Named Cell feature. If you open the Excel file, the worksheet component will appear as in Figure 8. The cells comprising B2:D3 have been identified with the name component and Syndeia recognizes them as a table. When initially created by Syndeia, the table will always start in cell B2.
When initially formed, the table has a header row and one empty row. Additional rows are added automatically by Syndeia as the table is filled with data, or they can be added to the named cells manually using the Excel Names Manager.
Alternatively, the table could have been created in an existing worksheet by dragging the block component onto, for example, Sheet1. Note that two tables created in the same worksheet in this fashion will overlap starting at B2, so it is safer to create each new table in its own worksheet.
Close the Excel file before proceeding.

Image Added

Anchor
_Ref388975068
_Ref388975068
Figure 8 Named table component created in Excel_Testbed.xlsx


  1. The next step is to create a row in the table in Excel. Set the Connection Type to Data Map, as shown in Figure 9. Drag the child block, Atmospheric Sensor, from SysML to the table component in Excel.

    Image Added

    Anchor
    _Ref388940663
    _Ref388940663
    Figure 9 Generating a table row from the Atmospheric Sensor block

  2. When complete, the Connection Manager will appear as shown in Figure 10.

    Image Added

    Anchor
    _Ref388940677
    _Ref388940677
    Figure 10 Generating a table row from the Atmospheric Sensor block (final)

    Image Added

    Anchor
    _Ref388940696
    _Ref388940696
    Figure 11 Generating a table row from the Atmospheric Sensor block

  3. The table viewed Excel should appear as in Figure 11. Be sure to close the Excel file again before proceeding.


  1. Before completing the table, we will demonstrate how to compare and synchronize the parameter values between the SysML model and the Excel table. In MagicDraw, modify the default value of the cost value property of the Atmospheric Sensor block, from 50 to 100. In the Connection Browser, right click on the connection from the Atmospheric Sensor block and select Compare Source & Target, as shown in Figure 12.

    Image Added

    Anchor
    _Ref388940713
    _Ref388940713
    Figure 12 Creating a Comparison Summary between SysML and Excel parameter values

  2. To update the parameter value in Excel, right-click on the same connection and select Sync Source to Target and confirm. When complete, the Comparison Summary will appear as shown in Figure 13. The changed value of Atmospheric Sensor.Mass can also be observed directly using Excel.

    Image Added

    Anchor
    _Ref388940729
    _Ref388940729
    Figure 13 Comparison Summary after updating SysML value to Excel table

  3. The remaining SysML specialized blocks can be dragged over in one step by multiple-selecting the blocks on the left side of the Connection Manager tab and dragging them onto the component table on the right. When complete, the Connection Manager will appear as shown in Figure 14.

    Image Added

    Anchor
    _Ref388940740
    _Ref388940740
    Figure 14 Connection Browser after dragging all components to Excel table.


  4. Figure 15 shows the final table in Excel. The Defined Name reference to component now comprises B2:D14 to include all the table rows.

    Image Added

    Anchor
    _Ref41405643
    _Ref41405643
    Figure 15 Excel table component