Converting from Design/CPN
How-to


All models that are created in Design/CPN can be transferred to CPN Tools by following these steps:

  1. Save a Design/CPN model in XML format.
  2. Convert the XML file generated by Design/CPN to the XML format for CPN Tools.
  3. 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 XML format 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:

After selecting the desired group of pages, the "Save XML..." entry can be selected.

Save XML format in Design/CPN

Use the Converter

After saving a model in XML format from Design/CPN, the model must be converted to another XML 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.

Dialog Box for Converter

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 model 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 CPN ML for CPN Tools. In many cases, a similar function with a different name will be available in CPN Tools. Colour-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.

Discovering an unknown function

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 colour sets, CPN Tools should also recognize color and automatically convert it to colset.
declare   Keyword used to declare additional functions and constants for colour sets. Obsolete in CPN Tools, as all relevant colour set functions are automatically defined for all colour 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 multi-sets
+ +++ Timed multi-set addition, see timed multi-sets
- -- Multi-set subtraction, see multi-sets
* ** Scalar multiplication, see multi-sets
ran'cs() cs.ran() See colour set functions
lt'cs(v1,v2) cs.lt(v1,v2) See colour set functions
mkst_col'cs(v) cs.mkstr(v) See colour set functions
mkstr_ms'cs(ms) cs.mkstr_ms(ms) See colour set functions
cs cs.all() See colour set functions
size'cs cs.size() See colour set functions
ord'cs(v) cs.ord(v) See colour set functions
col'cs(i) cs.col(i) See colour set functions
mult'cs(ms1,...,msn) cs.mult(ms1,...,msn) See colour set functions
in'cs(v) cs.legal(v) See colour set functions
of_idi'cs(v) cs.of_idi(v) See colour 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 colour sets and colour set functions.