Arcs have only one inscription — the arc inscription. An arc inscription is a CPN ML expression that evaluates to a multiset or a single element.

Before an arc inscription has been added, the default text for an arc inscription is expr.

Default arc inscription

Default arc inscription

The color set of the arc expression must match the color set of the place attached to the arc; otherwise, an error message will appear near the arc during syntax checking.

Examples of arc inscriptions

Examples of arc inscriptions

Free variables

A free variable is an output arc variable that has not been bound to an input arc or to the guard. When executing a CPN, CPN Tools assigns a random value to this variable. The type of a free variable must be a small color set.

In the example below, variable b is a free variable.

 

Free variable in arc inscription

Free variable in arc inscription

If a free variable from a large color set is bound to an output arc, an error message will indicate the problem.

Free variable from large color set

Free variable from large color set

Arc delay

Output arc inscriptions may have an arc delay expression if the color set of the attached place is a timed color set. An output arc delay must be an expression of type integer, and it must be appended to an output arc inscription, using @+ as a separator. The syntax is:

exp @+ arc-delay

An omitted output arc delay is equivalent to a delay of zero.

Arc delays can, in exactly the same way as transition delays, use values, CPN variables, functions, and time(). They may also be dependent on token values.

Arc inscription time delay

Arc inscription time delay

Examples of output arc delay expressions can be found in the following example net: timed resource allocation example.

Preempting time stamps

Input arc inscriptions may have a time value expression if the color set of the corresponding input place is one of the timed color sets.

A time expression on an input must be an integer, and it must be appended to an input arc inscription, using @+ as a separator. The syntax is:

exp @+ int

When an input arc inscription is of the form exp@+int, then the transition can consume a token a specified amount of time before the time specified by its time stamp.

As an example, the input arc expression exp@+5 will allow the transition to consume token(s) from a place up to 5 time units before the time stamp carried by the token(s). In the example below, transition t2 is enabled at time 3 (even though all tokens on the input place have time stamps equal to 8) due to the time expression on its input arc. In contrast, transition t1 will not be enabled until time 8.

Preempting time stamps

Preempting time stamps

Note that the time expression on an input arc must be an integer; otherwise, an error may occur during simulation.

Conditional arc inscriptions

Conditional arc inscriptions may be used on input arcs if all variables are bound in the guard or in another input arc.

Conditional arc inscriptions on output arcs may bind output variables mentioned in the output clause of the code segment.

Examples of conditional arc inscriptions can be found in the following example nets: resource allocation and ring protocol.

Function application

Functions used in arc inscriptions must not have side effects.

Functions may be used on input arcs only if the function parameters are bound elsewhere at that transition.

Functions on output arc inscriptions may bind output variables.

Examples of functions on input arcs can be found in the following example net: distributed database.

Side effects

Arc inscriptions on input arcs to transitions are not allowed to have side effects and cannot:

  • contain input, output, or use commands;
  • update or use reference variables (see more about variables);
  • Use the time function
  • use the random function.

Arc inscriptions on output arcs from transitions are not allowed to have side effects and cannot:

  • contain input, output, or use commands and
  • update reference variables (see more about variables).

These restrictions are currently not checked by CPN Tools, and the system may malfunction if the restrictions are violated.

Related pages

Inscriptions and expressions

Code segments

You must be logged in to post a comment.