Overview of SySim (SySim)
Modeler SySim (SySim) provides a mechanism for validating complex system behavior defined in a Modeler SysML model. A SysML model specifies what the system should do; through SySim, you can test, verify and simulate a SysML model, and then refine that model accordingly.
SySim validates a SysML model through a SySim model execution. When you run a SySim model execution, you can set input values for the system and view output values from the system using intuitive controls such as sliders and switches. After setting input values you can see how the system responds through output controls such as text boxes, meters and graphs.
To create and work with a SySim model execution, you perform the following steps:
• Prepare the SySim model for use with SySim.
• Model the SySim model execution through a SySim Simulation Scenario.
• Generate and build the SySim model execution application.
• Start and work with the SySim model execution.
Learning to use SySim
If you are using the SySim for the first time, you will gain a good understanding of how to work with SySim by going through the Modeler SySim Tutorial.
For information about downloading and opening the Modeler SySim Tutorial, refer to
Windchill Modeler tutorials.
To help you understand how to model a SySim model execution in a SysML model, the following SySim example models are provided in the Examples database:
• Speed Controller
• Traffic Lights - SySim
For procedural information about creating and working with a SySim model execution, see the tasks in the following sections of the Modeler SySim help:
• Preparing a SySim Model for SySim
• Modeling a SySim Model Execution
• Generating and Building a SySim Model Execution
• Working with a SySim Model Execution
Additional concept and reference information can be found in the
Concepts and Reference section of the Modeler SySim Help.
Prerequisites for using SySim
To use SySim, you require the following licenses and software:
• Modeler licenses for Modeler, SysML Profile, ACS and Modeler SySim.
• Microsoft Visual Studio. For information about the supported versions, see the Release Notes.
• Microsoft Excel, if you want to record data from a SySim model execution. Microsoft Excel must have the .NET Programmability Support option installed.
• MATLAB Simulink, if you want to reference Simulink models to model the behavior of SySim Control Blocks.
You will need to be able to use ASAL (a PTC structured action language) in Event Action Blocks used in State Diagrams, and optionally in the Body property of Operations (when the «ACSImplementation» stereotype is applied and the tagged value of the Implementation Language tag definition is set to ASAL).
Preparing a SysML model for SySim
A SysML model typically contains many subsystems, each of which is modeled through a SysML Block. These Blocks may use different ways of describing the system behavior, such as textual descriptions.
For SySim to interact with a Block (subsystem) in a SysML model, the behavior of that SysML Block it is best to model system behavior through child State Diagrams that use ASAL (a PTC structured action language) to describe how Block input port values are read and processed, and how Block output port values are set.
ASAL is a PTC UML Action Language that is suitable for specifying executable algorithms in a target language independent way.
SySim does not support Full Ports. SySim does not support state machine event handling based on Event Item Flows, and Operations on Flow Port's type. If any of these methods are used in the SysML model, for SySim to interact with the SysML model you will have to change your SysML model to use a supported method of state machine event handling. See
SysML state machine event handling.
In addition, SysML model behavior can be modeled through referenced Simulink models. See
Working with Simulink .
Modeling the SySim model execution
After adding the SySim profile to a model you can create the SySim items and diagrams required to model a SySim model execution. You may want to create a new Package to contain the SySim items and diagrams you create. Typically, only those items that are stereotyped by a SySim stereotype are included in the SySim model execution.
The most important SySim items are as follows:
• The SySim Simulator item, which models a SySim Simulation Scenario that is generated as a SySim model execution application. You create a SySim Simulator by creating a SysML Block and applying the «SySim Simulator» stereotype to it.
• SySim Control Block items, which typically model an input or output control in the SySim model execution including the processing of input and output data. In addition, to include a SysML Block in the SySim model execution, you must apply the «SySim ControlBlock» stereotype to that Block.
In addition, you can create your own SySim Control Blocks to define input and output controls, or just to define SySim behavior.
• SySim Port items, which are used to input values to a SySim Control Block and output values from a SySim Control Block. A SySim Port can be a SysML Full Port, Proxy Port or Flow Port, or a standard UML Port that has been stereotyped by a «SySim OutputPort», «SySim InputPort» or «SySim InputOutputPort» stereotype. Any SysML Port used in the SySim Simulation Scenario must be stereotyped by one of the preceding Stereotypes.
The SySim model execution behavior is defined by reading and setting the values of SySim Ports.
You include a SysML Block (subsystem) or SySim Control Block in a SySim Simulation Scenario by dragging that item to the SySim Simulation Scenario's child Internal Block Diagram. You define the interaction between the SysML Blocks and SySim Control Blocks through Connectors or Binding Connectors that link ports on the Block Properties that are created on the diagram for the dragged SysML Blocks and SySim Control Blocks.
When defining the behavior of the SySim Control Blocks, you can make use of the following:
• Child State Machines and State Diagrams.
Behavior in Event Action Blocks that interact with the SySim model execution must be defined using ASAL. ASAL is a PTC UML action language that is suitable for specifying executable algorithms in a target language independent way.
• Child event handling Operations.
Behavior defined in event handling Operations can be defined using ASAL or Visual Basic. To use ASAL, you must apply the «ACSImplementation» stereotype to the Operation and set the tagged value of the Implementation Language tag definition to ASAL.
Any item that is used as a type for a SySim Port that is used in the SySim model execution must be stereotyped by the «SySim DataType» stereotype. Any Class that is used as a type for a standard port that is used in the SySim model execution must be stereotyped by the «SySim PortClass» stereotype.
Generating and building the SySim model execution application
SySim uses a SySim Simulation Scenario to generate a SySim model execution application (a Visual Basic application), which you can run to validate and test your SysML model. A SySim Simulation Scenario maps to a Visual Basic form. A SySim Control Blocks maps to a control on the Visual Basic form.
The process for generating and building the SySim model execution application is as follows:
• Through SySim, you generate a Visual Studio project from the SySim Simulation Scenario.
• Through Visual Basic, you design the layout of the Visual Basic form that is generated in the Visual Studio project. The SySim Control Blocks are generated as controls in the Visual Basic toolbox and these controls can be dragged on to the Visual Basic form. Some controls may need setting up in Visual Basic, for example, the data ranges of meters.
• Through Visual Basic, you build the SySim model execution application.
The Make Model Executable And Run button in SySim generates the Visual Basic Project, builds the SySim model execution application and starts the SySim model execution application. Alternatively, there are individual buttons in SySim to generate Visual Basic Project, build the SySim model execution application, and run the SySim model execution application.
Note that you can build the run the SySim model execution application from Visual Basic.
Starting and working with the SySim model execution
After generating the SySim model execution application, you can run that SySim model execution application and interact with it using the input and output controls you defined in the SySim Simulation Scenario.
You can simulate the State Diagrams in your model while running the SySim model execution.
Through the Simulation Log button on the Simulation Control Bar, you can record data from the SySim model execution in a Microsoft Excel Spreadsheet.
For procedural information for starting and working with a SySim model execution, see
Working with Simulink
You can use Simulink to model the behavior of SySim Control Blocks in the SysML model.
To use a Simulink model to model the behavior for a SySim Control Block, you apply the «SySim SimulinkBlock» stereotype to the SySim Control Block, and then reference the Simulink model you want to use through the tagged value of the SySim SimulinkModelPathName tag definition.
In the Simulink model, you must create ports whose names match the SySim ports of the referencing SySim Control Block. The Ports for exchanging data with Simulink models must be of a numeric type that is convertible to and from Double, which includes Single, Decimal and any other floating point type. In addition, the Ports must carry only one single value, that is, data exchange through arrays is not supported.
When using a referenced Simulink model, you must build a Simulink shell from that Simulink model and start that Simulink shell simulation before you can start the SySim model execution. You build the Simulink shell from SySim.
Working with PTC ThingWorx
You can include generated ThingWorx-ready code that can be used in SySim model executions, use ThingWorx Mashups to control a SySim model execution.