Topic
Prev Next

Triggers

Triggers represent signals and events that can activate transitions leaving the current state(s). A trigger might represent a real world signal or event such as:

  • A button being pressed
  • A message being received
  • A pedal being depressed
  • A switch being thrown
  • A state in a concurrent region being entered or exited

For a trigger to have an effect

  • Transitions have to be defined which will fire when the simulation receives the signal / event
  • The current simulation state(s) or its parent(s) must have an outgoing transition that accepts that trigger
  • The transition activated must be unguarded or have a guard which will evaluate to true

Managing Triggers

Action

Detail

See also

Creating Triggers

Triggers are either created as an instance of a Signal element or as an anonymous event. Triggers are connected to Transitions in the 'Transition Properties' dialog as shown here. In this example a Trigger named 'Pushdown' has been defined based on the Signal 'Signal_Pushdown'.

  • Omitting the Type and Specification details results in a simple anonymous Trigger.
  • If parameters are needed, these are defined on the Signal and must be supplied at the time the event fires

A trigger will appear in the Project Browser as illustrated here:

Simulation Events Window Transition Trigger

Using Triggers

Triggers are deployed by connecting them to transitions, as in the earlier example, and are used during simulation by 'firing' them into the running simulation as required.

When using triggers these points should be taken into account:

  • A 'triggered' transition can not take place until its effective trigger is signalled or fired
  • When a trigger is received it will activate all current waiting transitions dependent on that trigger (that is, the trigger is broadcast)
  • Triggers are evaluated on all transitions for all parents of a current child state; this allows a parent state to exit all child states if necessary
  • Once used in a simulation, a trigger is consumed and must be re-fired if needed again
  • Sets of triggers can be saved and either manually or automatically fired to facilitate automated model simulation under different event models
Connector Type-Specific Options Re-Signal Triggers

Firing Triggers

Firing triggers means to signal or activate a trigger within the current simulation. This could activate zero, one or many waiting transitions depending on the state and concurrency of the current simulation.

Firing triggers can be achieved in many ways. The most efficient is the 'Waiting Triggers' list.

During the course of model simulation, if the simulator reaches an impasse due to required triggers not being available (fired), the list of all possible candidate triggers is shown in the 'Waiting Triggers' list of the Simulation Events window.

Double-clicking a trigger in this list will fire it into the simulation. Other ways to fire a trigger include:

  1. Double-click an un-signalled trigger in the Events window.



    You can also use the context menu on the events above to either signal an un-signalled event, or to re-signal an event which has already been fired previously.
  2. Use the context menu of the Transition required to fire and select the 'Signal Trigger in Simulation' menu option.
Simulation Events Window Connector Type-Specific Options

Learn more