Exercise 12.2 - SysML to Stateflow Compare and Sync
Objectives
The new learning objectives of this exercise are to compare and update state machine structures in SysML and Stateflow.
Preparation
This exercise assumes the student has
Cameo System Modeler 18.0 - 19.0 (or MagicDraw with SysML plug-in) installed correctly on his or her machine with a valid license for use, and
Syndeia 3.3 installed as a plugin for Cameo/MagicDraw with a valid license for use
Syndeia Stateflow interface, correctly installed with a valid license for user.
MATLAB/Simulink/Stateflow installed, licensed and available to the user,
A local operating system network connection in the Syndeia Repository Manager
The user can use any local operating system network connection they have available. It is generally advisable to carry out these exercises in a non-production repository, a "sandbox", set up for training and practice purposes.
Completed Exercise 12.1 and either still has the SysML model open or has saved and reopened it.
Exercise
We start from the Syndeia Tutorial Testbed.mdzip (get it here - SysML Models, Profiles and Mappings) model at the end of Exercise 12.1. If you have not saved the connections created in this exercise, repeat the exercise. Save and close the Simulink model.
Modify the SysML state machine by adding a new state and two transitions, as shown in Figure 1.
Figure 1 Cameo System Modeler showing ThreeStates state machine diagram after modification
From the Syndeia Connection Browser (Figure 2), find the ThreeStates connection, right-click and select Compare Source & Target.
Figure 2Â Syndeia Dashboard, Connection Browser tab
The Comparison Result tab should appear as shown in Figure 3.
Figure 3Â Syndeia Dashboard, Comparison Results tab
Back in the Syndeia Connection Browser (Figure 2), find the ThreeStates connection, right-click and select Sync Source -> Target (make sure Simulink model is saved and closed before updating). Re-open the Simulink ThreeStates.slx model and double-click the state chart symbol to see the updated states and transitions (Figure 4).
Figure 4 ThreeStates state machine after first update.
Syndeia 3.3 can update SysML state machines from Stateflow. Modify the ThreeStates model in StateFlow as shown in Figure 5 by moving the outgoing transition of the Standby state from the On state to the FailState state. Save the StateFlow model.
Figure 5Â ThreeStates state machine after second update
Back in the Syndeia Connection Browser, find the ThreeStates connection, right-click and select Sync Target -> SysML.
In MagicDraw/Cameo System Modeler, observe that the Transition:[Standby -> FailState] has been created in the containment browser. Drag it into the state machine diagram to display it and the final result should be similar to Figure 6
Figure 6Â Cameo System Modeler showing ThreeStates state machine diagram after modification
Â