Generating Simulink model from SysML block
Follow the instructions below to generate Simulink model structure from a SysML block structure.
- Open the model Syndeia Simulink Examples in MagicDraw.
- The Model Generation package is the main package and it contains the following three sub-packages, each of which have a SysML block model (Blocks package) and SysML activity model (Activity package).
- Basic Models – SysML block and activity models with primitive / atomic flows
- Bus Models – SysML block and activity models with complex / non-atomic flows
- LibBlock Models – SysML block and activity models using Simulink library blocks
- The instructions presented below are for generating Simulink models from SysML block model in Model Generation::Basic Models::Blocks package.
- Open the Internal Block Diagram (IBD) in the System block. It is a multi-level block structure where blocks PartA, PartB, and PartC are further decomposed and have their own internal structures.
- Launch the Syndeia Dashboard for the Blocks package. Select a Local File System Repository on the RHS.
- Select Model Transform connection type (middle panel), and drag-n-drop the System block to a folder in the local file system repository (RHS).
- Select Generate Simulink model option in the dialog box and click Yes to continue.
- Wait for Simulink model to be generated. The log window in the Syndeia dashboard will show several messages as shown below.
- Syndeia will finish generating Simulink model structure based on the internal structure of SysML block. Expand top-level model file (System.slx) to view the structure of the Simulink model that is generated. This will load the model using Simulink. Then expand the Simulink model System to see the internal details and compare with the SysML block structure (LHS).
- Syndeia uses the following mapping to generate Simulink model structure from the SysML block structure.
SysML block -> Simulink model
SysML block part properties -> Simulink model references
SysML block ports (full, proxy, flow) -> Simulink ports
SysML block connectors between ports -> Simulink lines with signal/bus flows
A Simulink model was generated for each SysML block in the context of the System block structure. Part properties pA, pB, and pC of the System block were generated as model references with the same name in the Simulink model. Full, proxy, and flow ports of the System block were generated as Simulink ports, and connectors were generated as lines with signal flows.
- Right click on the System.slx file or the System Simulink model in the Syndeia Dashboard and select Open. This will open the newly generated Simulink model in Simulink—after re-arranging the layout to match SysML IBD.
- Click on the Connection Browser tab in the Syndeia Dashboard, right click on the Blocks package and select Refresh. Then, right click on the Blocks package again and select Expand All. You should see a model transform connection created between each block in the structure and the corresponding Simulink model that has been generated. These connections can be used for downstream compare and (potentially) synchronization of SysML and Simulink models.