Customization > SySim- SysML model execution > Working with a SySim model execution > Concepts and Reference > SySim model execution event handling (SySim)
  
SySim model execution event handling (SySim)
You can create Operations on a SySim Control Block that are triggered by a SySim model execution being ready to start, started or ended; and Operations that are triggered by the input latch, time advance and output publish phases of a SySim model execution loop. These Operations can then define how the SySim Control Block behaves to the relevant triggers.
When you create Operations to handle SySim model execution events, you can use either ASAL (a PTC structured action language) or Visual Basic to describe the behavior when triggered through the Body property of the Operation. If you want to use ASAL, apply the «ACSImplementation» stereotype to the Operation and set the tagged value of the Implementation Language tag definition to ASAL.
SySim model execution ready to start trigger
SySim sends this trigger when a SySim model execution is launched. With this trigger the SySim Framework interrogates all the parts of the SySim model execution to determine if they are ready to run.
This operation is invoked repeatedly on all SySim Control Blocks instances in a SySim model execution until all the SySim Control Blocks are ready to run. When all the SySim Control Blocks in a simulation are ready to run, the SySim model execution can be started, that is, the Simulation Start/Resume button on the SySim Control Bar becomes available. For signalling that a SySim Control Block is not ready to run, increment the value of the Rejections parameter of the handling operation.
To create an Operation that is triggered by the SySim model execution ready to start trigger: right-click the SySim Control Block, point to New, point to SySim Handle Event, and then click Ready To Start. The tagged value of the VB EvHandles tag definition is set to SimCore.OnReadyToStart.
SySim model execution started trigger
SySim sends this trigger when a SySim model execution is started through the Simulation Start/Resume button on the SySim Control Bar.
This operation is invoked when the SySim model execution is stopped and the Simulation Start/Resume button on the SySim Control Bar is clicked.
To create an Operation that is triggered by the SySim model execution being started: right-click the SySim Control Block, point to New, point to SySim Handle Event, and then click Simulation Start. The tagged value of the VB EvHandles tag definition is set to SimCore.OnSimulationStart.
SySim model execution stopped trigger
SySim sends this trigger when a SySim model execution is stopped through the Simulation Stop button on the SySim Control Bar.
This operation is invoked when the SySim model execution is stopped through the Simulation Stop button on the SySim Control Bar.
To create an Operation that is triggered by the SySim model execution being stopped: right-click the SySim Control Block, point to New, point to SySim Handle Event, and then click Simulation End. The tagged value of the VB EvHandles tag definition is set to SimCore.OnSimulationEnd.
Input latch trigger
SySim sends this trigger when a SySim model execution executes the Input Latch phase.
This operation is invoked during each execution of the simulation loop, at the time port values are propagated from the external to the internal side of the ports. The operation can be used, for example, for interrogating an external (non-SySim) piece of simulation software that is participating in the simulation.
To create an Operation that is triggered by the Input Latch phase of a SySim model execution loop: right-click the SySim Control Block, point to New, point to SySim Handle Event, and then click Input Latch. The tagged value of the VB EvHandles tag definition is set to SimCore.OnReadInputs.
Time advance trigger
SySim sends this trigger when a SySim model execution executes the Time Advance phase.
This operation can be used for updating the internal status of the SySim Control Block with the computations required for the current simulated time, passed as a parameter
To create an Operation that is triggered by the Time Advance phase of a SySim model execution loop: right-click the SySim Control Block, point to New, point to SySim Handle Event, and then click Time Advance. The tagged value of the VB EvHandles tag definition is set to SimCore.OnAdvanceTo.
Publish trigger
SySim sends this trigger when a SySim model execution executes the Publish phase.
This operation is invoked during each execution of the simulation loop, at the time port values are propagated from the output ports to the connected input ports. The operation can be used, for example, for transmitting information to an external (non-SySim) piece of simulation software that is participating in the simulation.
To create an Operation that is triggered by the Publish phase of a SySim model execution loop: right-click the SySim Control Block, point to New, point to SySim Handle Event, and then click Output Publish. The tagged value of the VB EvHandles tag definition is set to SimCore.OnWriteOutputs.
Concepts and Reference