Preconditions

Each transition in a simulation may define zero or more preconditions which must be satisfied before the transition is eligible for execution. Each precondition is simply a boolean expression which is evaluated in the transition's local scope — if the expression evaluates to true then the precondition is satisfied; if it evaluates to false then the precondition fails.

Since a precondition contains a single expression (not a statement) it can have no side-effects.

However, each precondition may also specify a D-Bus error name that it throws. If the precondition fails then the simulator may return this error to the D-Bus client as the result of (for example) a method call. Method-triggered transitions are explained more fully on the transitions page.

Precondition with an Error

precondition throwing ErrorName { Variable == "value" }

Three important things to note about preconditions is that they're tested in program order; failure short-circuits testing of subsequent preconditions; and all preconditions in a transition have to evaluate to true for the transition to be eligible for execution.