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 MagicDraw and then update that table when values change in the SysML model.

Preparation

This exercise assumes the student has

  • Cameo System Modeler 18.0 - 19.0 (or MagicDraw with SysML plug-in) installed correctly on his or her machine with a valid license for use, and

  • Syndeia 3.3 installed as a plugin for Cameo/MagicDraw 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.

Exercise

  1. We will use the collection of blocks in the Excel_Tutorial Part 1 package in the MagicDraw model supplied, Syndeia Tutorial Testbed.mdzip (get it here - ). 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.mdzip

  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

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

      Figure 3: Complete Repository Link

  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.

    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.

    Figure 8: Named table component created in Excel_Testbed.xlsx

  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

    Â