Advanced Issues

The basic concept of block contracts is described here. Make sure you have read about the semantics of activities first.

Implicit Termination

You may find a transition labelled with / that points to a final state. This is called implicit termination.

As an example, see the following figure.

This is the contract of block Timer Periodic. The rightmost hand-side is an example of implicit termination. It allows the surrounding (enclosing) block to terminate while the Timer Periodic block is in state active, without invoking any parameter or pin of Timer Periodic.

Implicit termination is typically used for blocks that do not need to release resources and in shallow blocks.

Multiple Pin Labels

From the basic concept of block contracts, you have learned that transition labels can have two pins. In fact, they can include any number of pins.

The contract of Timer Periodic block, for instance, has a transition with three pins.

Transition /tick; stop; stopped involves three pins, i.e., output pin tick, input pin stop and output pin stopped. Note that the sequence of those pins is important. For this example, the block will emit event tick and subsequently (but without delay) receive input event stop and then emit an output via pin stopped.

The semicolons (;) are used to help reading the label easier. It separates different groups of pins. A group either consists only of input or output pins. Therefore, for the transition above we have three groups, i.e., output-pin group, input-pin group and another output-pin group. Each group consists of a single pin, “tick”, “stop”, and “stopped” respectively.

A group can contain more than one pin. Plus sign (+) is used to separate pins within a group.

As mentioned previously, the transition “/tick; stop; stopped” allows block Timer Periodic to be stopped right after a “tick”. This means that the use of the block depicted in the following figure is allowed by the contract.

Let us remove the transition mentioned above, as also illustrated by the contract of block “Timer Periodic Stop Delayed” in the following figure.

For the new block, the direct flow from pin tick to pin stop is not allowed. The contract diagram of block Timer Periodic Stop Delayed shows that stopping the block from pin “tick” needs another transition invoking pin “stop” (and “stopped”) which cannot be combined with the transition involving pin “tick”. Therefore, two separate activity steps are needed. (See also this example)

To cut the single activity step from pin “tick” to pin “stop”, a timer can be used. If no delay is necessary, then you can set the duration of the timer to 0 ms as depicted in the bottom half of the following figure.

Note that you cannot use an operation, set and get actions, decision and merge nodes instead of the timer. These nodes are not stable positions.