Places, transitions, and pages in CP-nets have names. These names are (possibly empty) strings of characters. Names are simply labels that are used to identify objects. Names do not influence the semantics of CP-nets, and, in general, names of these kinds of objects do not have to be unique. However when using the state space tool, there are a number of syntax restrictions for names.
Monitors:start also have names. These names are non-empty strings of characters. The names of monitors are used to identify the monitors, they are used when generating code for the monitors, and they may be used for other purposes, such as for file names. There are a number of syntax restrictions for monitor names.
In the following, we will differentiate between name inscriptions and ML names.
A name inscription is a user-defined text string, and it can contain any sequence of characters, including letters, numbers, punctuation, and white space. Name inscriptions are shown in the GUI, and they are saved when you save a model. There are four kinds of name inscriptions: place name inscriptions, transition name inscriptions, page name inscriptions, and monitor name inscriptions. In the example below, there are 5 name inscriptions.
An ML name is a text string that is obtained from a name inscription according to a method described below. During syntax checking the GUI converts name inscriptions to ML names which are used in the simulator and state space tool. The ML names of the objects in the figure above are:
trans. An ML name is either an empty string or a CPN ML identifier. ML names must be CPN ML identifiers because they are used as function and structure names when code is generated when you enter the state space tool.
Converting name inscriptions to ML Names
A name inscription is converted to an ML name using the following method:
- Take the longest (possibly empty) prefix of the name inscription that contains only letters, digits, white spaces, apostrophes (‘), and underscores (_).
- Remove all white space at the beginning and end of the string obtained in step 1.
- If the string obtained in step 2. is empty or starts with something other than a letter, then the ML name is the empty string, otherwise continue with step 4.
- Replace all sequences of white spaces with a single underscore. The resulting string is the ML name.
Syntax restrictions on ML names
State Space Tool
The following criteria must be met in order to enter the state space tool:
- All pages must have unique ML names
- All places on a page must have unique ML names. (Places on different pages may have the same ML name.)
- All transitions on a page must have unique, non-empty ML names. (Transitions on different pages may have the same ML name.)
Note that a place and a transition on the same page may have the same ML name.
The following criteria must be met when monitoring a CP-net:
- All monitors must have unique, non-empty ML names
- All pages associated with a monitor must have unique, non-empty ML names
- All places on a given page that are associated with a monitor must have unique, non-empty ML names
- All transitions on a given page that are associated with a monitor must have unique, non-empty ML names
If two places or transitions have the same ML name, then there will be a dark red halo on one of the nodes indicating a naming conflict.
In this example, the ML name of the two places is
Send. If the hyphen is removed from each of the name inscriptions, then the ML names of the places will be