COPY-Test Exercise 2.1 - SysML to Excel.

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, 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.

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

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

  3. 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.

      Figure 2 Add Local File System Repository

      Figure 3 Complete Repository Link

    2. Give the repository link a descriptive name and browse to set the Root to the folder that will contain the Excel file.

  4. 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.

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

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

  6. 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.

  7. Confirm table generation as shown in Figure 5.

    Figure 5 Confirming table generation

  8. 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.

    Figure 6 Connection Manager after generation of new table, component

  9. 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.

    Figure 7 Connection Summary tab shows link between SysML block and Excel table
    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.

    Figure 8 Named table component created in Excel_Testbed.xlsx 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.

  10. 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.

    Figure 9 Generating a table row from the Atmospheric Sensor block

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

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

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

    Figure 11 Generating a table row from the Atmospheric Sensor block

  13. 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.

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

  14. 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.

    Figure 13 Comparison Summary after updating SysML value to Excel table

  15. 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.

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

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

    Figure 15 Excel table component

    Â