Working with Simulink (SySim)
You can use Simulink to model the behavior of SySim Control Blocks in the SysML model.
To reference a Simulink model from a SySim Control Block: apply the «SySim SimulinkBlock» stereotype to the SySim Control Block, and then set the tagged value of the SySim SimulinkModelPathName tag definition to the path and file name of the Simulink mdl or slx file.
When you reference a Simulink mdl or slx file through the SimulinkModelPathName tag definition, SySim ignores the content of the SySim Control Block in the model (except for its ports), and uses the behavior defined in the referenced Simulink mdl or slx file.
In the Simulink mdl or slx file you can model behavior using any Simulink content, including standard Simulink library sub blocks and nested Simulink blocks. However, the following restrictions apply:
• SySim supports ports having only one dimension and carrying only one element.
• The names of the ports defined in the Simulink model must match the names of the ports defined on the referencing SySim Control Block in the model.
• The SySim ports must be typed by a numeric type that is convertible to and from Double, which includes Single, Decimal and any other floating point type.
Having modeled SySim Control Block behavior through referenced Simulink mdl or slx models, you must build a Simulink shell (a Simulink model) for the Simulink model and then start the Simulink shell simulation after starting a SySim model execution application and before clicking the Simulation Start/Resume button:
• To build the Simulink shell: After generating the Visual Studio project for the SySim Simulation Scenario, from SySim click the
Build Simulation Shell button.
Simulink creates the Simulink shell model in the folder that owns the referenced Simulink model. The name of the Simulink shell model matches the name of the SySim Simulator's part that uses the SySim Control Block that references the Simulink model.
• To start the Simulink shell simulation: In Simulink, open the Simulink shell model, set the time period for the simulation, and then click the
Start Simulation button.
After starting the SySim model execution application, the
Simulation Start/Resume button on the SySim model execution application becomes available.
Parent topic