Excel tables_rows → SysML Blocks_Instances.
The objective of this exercise is to generate Rhapsody SysML blocks and instances from an Excel spreadsheet. Many organizations store data about products in such databases and it is desirable to be able to import this data into the SysML model. In this exercise, we will use the Excel table created in the previous example and import this information back into an empty model in Rhapsody.
- As in tutorials Windchill Product Structure → SysML, Teamcenter Product Structure → SysML and MySQL tables_rows → SysML Blocks_Instances., create a new Rhapsody SysML project with an empty package and the Syndeia profile.
- Name the empty package Tutorial_2_09.
- Right-click on Tutorial_2_09 and open the Syndeia dashboard.
- Expand Syndeia Excel Files in the Connection Manager tab to show the worksheets and tables within the Excel_Testbed.xlsx spreadsheet. In this example, we are using the component table in the component worksheet.
In the first exercise, we will create a block in SysML linked to the table component in Excel. Set the Connection Type to Model Transform. Drag the table component into the Tutorial_2_09 package in the SysML model. Click Yes on the dialog box. When complete, component appears as a block in the SysML model panel. Note that while the component block contains the structure of the component table, it does not contain any of the data about specific components. That is the object of the next step.
Set the Connection Type to Data Map. Select several of the individual records under the component table in the right-hand panel. Drag them into the Tutorial_2_09 package in the left panel. A dialog box will appear. Check the "As Specialization" checkbox and click Yes. The new SysML instances are shown. The names of the instances correspond to the rows in the Excel worksheet from which they originated.
- Explore other options for creating transferring Excel records to the SysML model
- Create a new package in the SysML project and drag some Excel records into it. They will still be treated as instances (or specializations) of the component block even if they are not in the same package.
- In the Filter query box (upper left corner) of the Connection Manager, enter a valid MySQL syntax query, for example, Select * from component where Mass < '3'. Only those records satisfying the query will be displayed and can be dragged into the SysML model.
- Erase the current contents of the Tutorial_2_09 package in Rhapsody, including all connections. Drag some Excel records into it. Note that a component block is created automatically, along with the instances (or specializations) corresponding to the individual records.
In the next part of the exercise, we will make change to the data in the database and update the SysML model from Excel. Go to Excel and modify some details of the connected rows. For example, see the figure below where the left side shows the components table before making changes and the right side show the changes. The cost of the Communication Controller was reduced from 50 to 25 and the mass of the Atmospheric Sensor was decreased from 2 to 1.5.
Now multiple select (using Ctrl key) connections C23 and C26 that correspond to the 2 modified rows. Right click and select Sync Target → SysML.
- The Syndeia log window will show messages similar to below:
[19:35:40] INFO Processing 2 connections...
[19:35:40] INFO Updating SysML block from Excel table row for connection C2.
[19:35:40] WARN The value type of property Cost is String but the value being set is of type java.lang.Double
[19:35:40] INFO Default value of value property Cost is changed from 50.0 to 25.0
[19:35:40] INFO C2 connected sources (SysML) updated.
- In the Rhapsody Features window, you can see that the appropriate initialvalues have been updated.
- Similarly, you can change the SysML intial value in Rhapsody and sync to Excel by right-clicking the appropriate connection and selecting Sync SysML → Target.