Condition Triggered Transition

The transition is executed when the condition becomes true. If the agent has continuously changing variables, the numeric engine constantly monitors the condition. In purely discrete models the condition is tested when something changes in the agent, i.e. when onChange() is called. 

Condition triggered transition is depicted by the icon .

 To define a condition triggered transition

  1. Select the transition in the graphical editor or in the Projects view.
  2. In the Properties view, choose Condition from the Triggered by drop-down list.
  3. Specify the condition in the Condition edit box below.

A transition with such a trigger is enabled when the specified Boolean expression is true. If by the time the statechart comes to the source state of such transition the expression is true already, the transition becomes enabled immediately. Otherwise, it becomes enabled as soon as the expression becomes true – e.g., as a result of equation solving, as a change event may contain variables changing continuously according to a set of differential and algebraic equations. When the expression becomes true, AnyLogic determines the switch point – the moment when the expression becomes true – with the accuracy set by the user.

When specifying a change event, you should keep in mind the so-called sensitivity problem. Let the transition wait for the Boolean expression x>=5, and let x changes continuously in time as shown in the figure below: 


Sensitivity problem

As the numeric equation solver works by steps, it may happen that x will exceed the value 5 and get back in between the two steps. In this case the change event will not be detected. You should be aware of such situations when modeling systems where such error might be critical. If you encounter such a problem, you should make numerical method accuracies smaller.

Related topics



 Triggering a transition