Top-down Development | CPN Tools help |
How-to |
When creating a hierarchical net "top-down", you start by creating the page that shows the overview of the subpages and how they are connected. See the Edit the net page on how to create the net structure.
The example below is based on the example net for the Hierarchical Protocol. In this example, the transitions Sender
and Network
on page Top
are very abstract representations of the Sender and Network parts of the protocol. Top-down development will be used to create a new page containing more detailed logic for the these parts.
A subpage tag is added to the transition, which is now a substitution transition. A new page is the created with a copy of the places surrounding the target transition. The page is named after the target transition.
Port-type tags are automatically set on the places on the new (sub)page, and the port-socket assignments are also handled automatically.
Now you can continue editing the superpage and the new subpage.
Using the Move to Subpage tool it is also possible to move a group to a subpage. The group must be closed, in the sense that no arcs may connect a place in the group to a transition that is not in the group. If a Move to Subpage is attempted on a group that is not closed, a red status bubble will appear to indicate that the operation did not succeed.
Once the tool has succesfully been applied, a new substitution transition is created at the center of the group, the name of the group is used as the name of the substitution transition, a new page (with the same name as the group) is created containing the elements of the group and the needed port places, and the subpage and port-socket relations are set up between the pages.
Port-sockets are computed in the same way as for moving a simple transition to a subpage: If an arc connects a transition in the group to a place that is not in the group, the place will become a socket and a port will be created to match it.