CPN Tools cannot open models that were created by Design/CPN, but all models that are created in Design/CPN can be transferred to CPN Tools by following these steps:
- Save a Design/CPN model in XML format.
- Convert the XML file generated by Design/CPN to the XML format for CPN Tools.
- Load the file generated by the converter in to CPN Tools.
Each of these steps are described in more detail below.
Save XML in Design/CPN
The first step to transferring a model from Design/CPN to CPN Tools, is to save the model in XMLformat in Design/CPN. This is done by using the Save XML…
entry in the File
menu. Note that the Save
and Save as…
entries will not save a model in XML format.
Important: Only the pages that are currently selected in Design/CPN will be saved when the Save XML…
entry is selected. The Hierarchy
page can be used to select a group of pages. For example, all pages can be selected by:
- Activating the window containing the
Hierarchy
page. (The page name of the active window is shown in white on a black background.) - Selecting the
Select all Nodes
entry in theGroup
menu
After selecting the desired group of pages, the Save XML
entry can be selected.
Use the converter
After saving a model in XML format from Design/CPN, the model must be converted to anotherXML format which is used in CPN Tools. A converter is available for just this purpose. Currently, the converter can only be run under Windows, i.e. a Linux version of the converter is not available.
The converter is distributed together with CPN Tools for Windows.
The converter can be started from the Windows Start
menu, e.g. Start Menu
⇒ Programs
⇒ CPN Tools
⇒ Utils
⇒ converter
. After the converter has been started, a dialog box will appear, allowing you to select the file that is to be converted. Pressing the Open
button will convert the selected file.
The converter generates files with the extension .cpn
. For example, if the file HierarchicalProtocol.xml
is converted, then the file containing the converted model will have the name HierarchicalProtocol.cpn
. If the output file has the same name as an existing file, then a new dialog box will appear allowing you either to overwrite the existing file or to rename the output file.
Load model in CPN Tools
You can Load a net from a file that was generated by the converter.
During the syntax check of a converted model, inconsistencies between Design/CPN and CPN Tools will be discovered. For example, some functions that are available in Design/CPN are not available (under the same name) in for CPN Tools. In many cases, a similar function with a different name will be available in CPN Tools. Color-coded auras and highlights will reveal where the problems can be found.
Here, for example, the syntax check reveals that the function imin
is not available in CPN Tools. It can, however, be replaced with the function Int.min
.
Here is an overview of some of the keywords and functions that are different in Design/CPN and CPN Tools.
Design/CPN | CPNTools | Comment |
---|---|---|
color | colset | Keyword used when declaring Color sets, CPN Tools should also recognize color and automatically convert it to colset. |
declare | Keyword used to declare additional functions and constants for color sets. Obsolete in CPN Tools, as all relevant Color set functions are automatically defined for all Color sets. | |
pageref | Keyword for declaring a page reference variable. Not supported in CPN Tools. | |
instref | Keyword for declaring an instance reference variable. Not supported in CPN Tools. | |
+ | ++ | Multi-set addition, see Multisets |
+ | +++ | Timed multi-set addition, see Timed multisets |
- | – | Multi-set subtraction, see Multisets |
* | ** | Scalar multiplication, see Multisets |
ran'cs() | cs.ran() | See Color set functions |
lt'cs(v1,v2) | cs.lt(v1,v2) | See Color set functions |
mkst_col'cs(v) | cs.mkstr(v) | See Color set functions |
mkstr_ms'cs(ms) | cs.mkstr_ms(ms) | See Color set functions |
cs | cs.all() | See Color set functions |
size'cs | cs.size() | See Color set functions |
ord'cs(v) | cs.ord(v) | See Color set functions |
col'cs(i) | cs.col(i) | See Color set functions |
mult'cs(ms1,…,msn) | cs.mult(ms1,…,msn) | See Color set functions |
in'cs(v) | cs.legal(v) | See Color set functions |
of_idi'cs(v) | cs.of_idi(v) | See Color set functions |
first'cs | Not supported in CPN Tools | |
last'cs | Not supported in CPN Tools | |
dist'cs | Not supported in CPN Tools | |
rot'cs | Not supported in CPN Tools | |
index'cs | Not supported in CPN Tools | |
clr'cs | Not supported in CPN Tools |
For more information about some of the functions that are available in CPN Tools, see the help pages for the individual Color sets and Color set functions.
You must be logged in to post a comment.