'Uppaal - How to force a transition when a condition becomes true?
I would like to be able to force a transition as soon as a condition becomes true.
For example in this Example, I would like to force the transition from the system next from the state S0 to S1 as soon as the global variable a becomes 5. The guard is not enough because a can still be incremented once it reach 5 before the transition is fired. I really need the transition to be triggered and then continue to increment a.
Is there a simple way to do it? I tried by adding invariant in the state but it is creating deadlocks.
Solution 1:[1]
Use channel synchronization. Several approaches:
declare
chan message;and addmessage!synchronization on theincrementprocess, addmessage?on thenextprocess transition, and use another transition with the guard to check the value ofaand move to another location accordingly.declare
urgent broadcast chan ASAP;and useASAP!on thenextedge, this will make this transition urgent as soon it becomes enabled (i.e. the guard is satisfied). Only the integer guards are supported on urgent transitions.
Solution 2:[2]
You can simply add invariant a<=5 in the S0 state.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mariusm |
| Solution 2 |
