The objective of this exercise is 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. The following exercise shows this process in reverse. We will use the collection of blocks in the Tutorial_2_08 package in the Rhapsody model supplied, Syndeia Tutorial Testbed. In Figure 67 the figure below 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.
Figure 67 Contents of Tutorial_2_08 package in Syndeia Tutorial Testbed
- Launch the Syndeia dashboard from the Tutorial_2_08 package in the SysML model.
- 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.
- In the Repository Manager tab, right-click on Local Files System Repository and select Add… as in Figure 68.
Give the repository link a descriptive name and browse to set the Root to the folder that will contain the Excel file.
Figure 68 Add Local File System RepositoryFigure 69 Complete Repository Link
- 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.
- The Syndeia Dashboard Connection Manager should appear similar to Figure 70
Figure 70 Syndeia Dashboard, Connection Manager showing link to Excel file in Local File Systemthe figure below.
- The first step is to create the table in Excel. Set the Connection Type to Model Transform, as shown in Figure 70. Drag the parent block, component, from SysML to the workbook, Excel_Testbed.
Figure 71 Confirming table generation
Confirm table generation as shown in Figure 71.
- 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 72.
Figure 72 Connection Manager after generation of new table, component
Figure 73 Connection Summary tab shows link between SysML block and Excel table
- The Connection Summary , as shown in Figure 73, 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 74. 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 74 Named cell "component" created in Excel_Testbed.xlsx
The next step is to create a row in the table in Excel. Set the Connection Type to Data Map, as shown in Figure 75. Drag the child block, Atmospheric Sensor, from SysML to the table component in Excel.
Figure 75 Generating a table row from the Atmospheric Sensor blockWhen complete, the Connection Manager will appear as shown in Figure 76.
Figure 76 Generating a table row from the Atmospheric Sensor block (final)
Figure 77 Generating a table row from the Atmospheric Sensor block- The table viewed Excel should appear as in Figure 77. Be sure to close the Excel file again before proceeding.
Before completing the table, we will demonstrate how to compare and synchronize the parameter values between the SysML model and the Excel table. In Rhapsody, modify the initial value of the cost value property of the Atmospheric Sensor block, from 100 to 50. In the Connection Browser, right click on the connection from the Atmospheric Sensor block and select Compare SysML & Target, as shown in Figure 78.
Figure 78 Creating a Comparison Summary between SysML and Excel parameter valuesTo update the parameter value in Excel, right-click on the same connection and select Synch SysML to Target and confirm. When complete, the Comparison Summary will appear as shown in Figure 79. The changed value of Atmospheric Sensor.Mass can also be observed directly using Excel.
Figure 79 Comparison Summary after updating SysML value to Excel tableThe 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 80.
Figure 80Connection Browser after dragging all components to Excel table.Figure 82 below shows the final table in Excel. The Defined Name reference to component now comprises B2:D14 to include all the table rows. Note the warnings on each value that numbers are being stored as text. This is normal for Rhapsody which stores all initial values as text.
Figure 81 Excel table component