Sync Simulink -> SysML
This section describes the process for syncing changes in Simulink back to the connected block in SysML.
- Open Syndeia Simulink Examples model with connections saved after following steps in tutorial Generating Simulink model from SysML block and launch Syndeia from Model Generation::Basic Models::Blocks package, then navigate to the Connection Browser tab and expand the System block to see the connection and right-click > Compare SysML & Target.
- Click Yes.
- Comparison Results tab should show that all elements are in sync.
- Open the System Simulink model in MATLAB/Simulink environment
- Add the following to System Simulink model then save:
- Port out3 with type boolean – as a shortcut: copy/paste existing out2
- Model Reference Block pD : PartD – Copy/Paste Simulink model PartC in the folder, rename to PartD, open, and delete all elements except for in1 and out2. Then in Simulink model, copy/paste pC, change name to pD, open its Parameters window and change Model name to PartD)
- Lines [pA.out1 – pD.in1] & [pD.out1 – out3]
- Port out3 with type boolean – as a shortcut: copy/paste existing out2
- Delete the following from System Simulink model:
- Lines to and from pB
- Model Reference Block pB : PartB
- Inport in2
- Compare SysML & Target
- Sync Target -> SysML
- Current workaround needed: Display related elements on the new IBD by right-clicking the diagram and selecting Related Elements > Display Ports, expand pD : PartD, check the boxes for in1 : Real and out2 : ~Boolean, and click OK.
- At this point, later versions of MagicDraw may show an incorrect validation error for the new delegation connector between pD.out2 and out3 as shown below. To clear this, close the dashboard, save the model, close it, and reopen:
- Compare again in the dashboard, and note that all changes were synced correctly.
- If you have changes made in a multi-level block structure, you should sync leaf-level blocks BEFORE syncing parent models (except in the case of a new child being added that is not yet connected as shown with pD : PartD above). For instance, if you add and/or delete ports on PartC block, which is used as part property pC in System, you should compare and sync PartC to resolve changes, then compare and sync the parent block, System.