Exercise 12.1 SysML to Stateflow
Objectives
The new learning objectives of this exercise are to generate a state machine structure in a Stateflow from a state machine in a MagicDraw SysML model. Stateflow to SysML model generation is covered in Exercise 12.3.
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.
An empty destination folder in the local operating system to receive the model.
Exercise
Open the Syndeia Tutorial Testbed.mdzip (get it here - SysML Models, Profiles and Mappings) model. We will demonstrate the Syndeia Stateflow interface using the Three States State Machine in the Three State Model package shown in Figure 1.
Figure 1 Cameo System Modeler showing ThreeStates state machine diagram
Launch the Syndeia dashboard from the ThreeStates package in the MagicDraw containment browser, select a Syndeia Cloud project if necessary, and go to the Connection Manager tab. Expand your SysML model in the left column to show the ThreeStates state machine and your local operating system network connection on the right side to show the empty destination folder (1_Demo_ Stateflow in Figure 2).
Figure 2Â Syndeia Dashboard, Connection Manager tab
Select Model Transform for Connection Type in the central column. Drag and drop the ThreeStates state machine onto the destination folder in the local operating system. Click Yes to confirm. When complete, expand the newly-created Simulink Model to view the new Stateflow State Chart and its contents, as shown in Figure 3.
Figure 3Â Syndeia Dashboard, Connection Manager tab, after generation of state machine structure in the local file system (red highlight shows ThreeStates.slx Simulink model).
In the Connection Manager, right-click the ThreeStates.slx Simulink model (see red highlight in Figure 3) and choose Open. Double-click the state chart symbol (left side, Figure 4) to see the states and transitions (right side, Figure 4).
Figure 4 Simulink with Stateflow diagram symbol on left. Double-click the ThreeStates symbol to open state machine, as shown on right
Rearrange the states and transitions as in Figure 5. The model is ready to add triggers, state behaviors and other stateflow elements. Save and close Simulink model when done.
Figure 5 Stateflow state chart, final.