SysML Blocks_Instances → MySQL tables_rows.
The objective of this exercise is to generate a table in a MySQL database 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_06 package in the Rhapsody model supplied, Syndeia Tutorial Testbed. 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; Rhapsody and Syndeia support both.
For users unfamiliar with MySQL databases, Appendix 3 describes how to access the databases directly using the MySQL Workbench, where the user can create, modify, and view schemas, tables and table rows directly.
- Launch the Syndeia dashboard from the Tutorial_2_06 package in the SysML model.
- Set up the repository link to the MySQL repository using the Repository Manager, if this was not completed in Tutorial 2.1. The MySQL repository should contain a schema to which you have write privileges. In our example, this is named demo_tutorial. See Appendix 3 for more information on creating schemas in MySQL.
- The first step is to create the table in MySQL. Go to the Connection Manager tab. Set the Connection Type to Model Transform, as shown in Syndeia Dashboard, Connection Manager tab, showing MySQl repository. Drag the parent block, component, from SysML to demo_tutorial in MySQL.
- Confirm table generation.
- When complete, the Connection Manager should show a new table, component, under demo_tutorial.
- The Connection Summary shows the connection created between the SysML block and the MySQL table.
- The next step is to create a row in the table in MySQL. Set the Connection Type to Data Map. Drag the child block, Atmospheric Sensor, from SysML to component in MySQL.
When complete, the Connection Manager will appear
Before completing the table, we will demonstrate how to compare and synchronize the parameter values between the SysML model and the MySQL database. In Rhapsody, modify the default 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.
To update the parameter value in MySQL, right-click on the same connection and select Synch SysML to Target and confirm. When complete, the Comparison Summary will appear. The changed value of Atmospheric Sensor.Mass can also be observed directly using the MySQL Workbench.
The remaining SysML specialized blocks can be dragged over in one step my 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.
Copyright 2018 Intercax.