Execution Order
This Chapter address how an instance decides what Block to execute next. There are three cases to consider:
- An instance is in transition between States
- An instance is in NULL State
- An instance is in a non-NULL State
Between States
The most common case is when an instance is in transition between States, i.e. the current Block is anything but ExitState Block. In this case the Block to be executed next is selected among children of the current Block. The children Blocks are checked from left to right. The first one found ready to be executed is executed.
From NULL State
NULL State is a special state of a Flowchart. Blocks directly descending from NULL State Block are executed according to special rules.
At the start of the Flowchart execution, Blocks directly descending from NULL State Block and ready for execution are all executed, in left-to-right order.
During Flowchart execution the NULL State Block children Blocks operate is as follows:
- Receive Block executed every time it receives a message. On every execution a new instance is started.
- Trigger Block executed one or more times, depending on the configuration parameters of the Block. On every execution a new instance is started.
- Timeout Block – a global Timeout Block is executed on expiration of the associated timer. On every execution a new instance is started.
From non-NULL State
Among the paths available to continue execution, an instance takes the one becoming available first. For example, a Flowchart may have multiple Receive Blocks and Timeout Blocks directly descending from a State Block. The descending siblings are checked left to right, and the first one ready to be executed, will be. The first incoming PDU waited for by one of the Receive Blocks determines the path the instance will follow. If no expected message arrived before the timeout fires, the instance takes the timeout path.
Use no more than a single non-waiting (immediately executable) Block among the siblings directly descending from a non-NULL State.
In the Flowchart above, the leftmost Operations Block will be executed every time the control flow pass through a non-NULL State ABCD, because this Block is always ready for execution. The siblings Blocks on the right–Send Block, Receive Block, and another Operations Block will never be executed.
Multiple ExitState Blocks
A Flowchart might have multiple ExitState Blocks for a State. The below steps describe how the selection of the exit path happens.
Case 1
Applicable when the Flowchart has two or more ExitState Blocks for the same State, located on different worksheets. The worksheets are checked from the leftmost (S1) to the rightmost. The first ready to be executed Block gets executed.
Case 2
Applicable when a Flowchart has two or more ExitState Blocks for the same State on the same worksheet. The Blocks are checked from the left to right. The Blocks with the same X coordinate are checked top to bottom. The first ready to be executed Blocks gets executed.