Introduction to hierarchical nets | CPN Tools help |
Brief motivation and introduction to some concepts | How-to |
Creating large, intricate nets can be a cumbersome task. But similar to modular programming, the construction of CP-nets can be broken into smaller pieces by utilizing the facilities within CPN Tools for creating substitution transitions. Conceptually, nets with substitution transitions are nets with multiple layers of detail - you can have a somewhat simplified net that gives a broad overview of the system you are modelling, and by substituting transitions of this top-level net with more detailed pages, you can bring more and more detail into the model.
Substitution transitions add nothing fundamentally new. Everything that can be done with them can also be done by using fusion places. But like fusion places, substitution transitions add so much convenience that they can make the difference between modelling feasibility and total impossibility.
Let us consider a substitution transition named Reverse
which stands for a net that is used to reverse a list of integers. A small blue tag, called a subpage tag, is associated with the substitution transition Reverse
.
Arcs surrounding substitution transitions may or may not have inscriptions. However, these inscriptions have no semantic meaning.
Top
in the figure above is a superpage.
When a CP-net uses a substitution transition the logic that the transition represents must be kept somewhere. It is kept on a page called a subpage, and the logic on the subpage is called a subnet or a submodel.
The page named Reverse
is the subpage associated with the substitution transition Reverse
Each substitution transition is said to be a supernode of the corresponding subpage.
The hierarchical structure of a net, i.e. the relationships between subpages and superpages, is shown in the index entry for the overview of the net. The name of a subpage is always shown below the name of its superpage, and the name of the subpage is always indented with respect to the name of the superpage.
If a subpage name is not visible in the index, click on the blue arrow next to the superpage to unfold its list of subpages.
Places Begin
and End
on page Top
are sockets.
Begin
and End
on page Reverse
are ports.
There are three kinds of port-type tags: In-tags, Out-tags, and I/O-tags.
Note that the arcs surrounding a port do not have to correspond to the port-type tag. For example, there may be arcs from a transition to a port that has an In-tag, i.e. the port may be an output node for a transition on the subpage even though it has an In-tag.
To learn about how port/socket assignments are indicated, read about the graphical feedback for port-type tags.
For example, the initial marking of the place Begin
on (super)page Top
is the same as the initial marking of the place Begin
on the (sub)page Reverse
.
If a subpage is the value of more than one substitution transitions, there are said to be multiple instances of the subpage. Analogously, there are also multiple instances of the places and transitions on the subpage. The marking of each instance of a subpage can be completely independent from the markings of other instances of the same subpage.
Here is a net with two instances of subpage Reverse
, as indicated by the (1)
and (2)
following the page name. Note that the markings of the two instances of the place Begin
on the page Reverse
are different: they are the same as the initial markings of the corresponding sockets.
To learn about how to find out which subpage instance is associated with a substitution transition, read about the graphical feedback for subpage tags.