CPN'05

Tutorials on CPN Tools and Hands-On Session

October 25, 2005


Getting Started with CPN Tools

Hands-On Session

The following exercises are for people who are not familiar with CPN Tools.
  1. Browse through the help pages for CPN Tools, e.g.

  2. Load and examine one or more of the Example Nets. The example nets are found in the <cpntools>/Samples/ directory, where <cpntools> is the directory in which CPN Tools is installed.

  3. Make the following modifications and extensions to the hierarchical CPN model of a simple protocol. (The model is similar to the example net of the hierarchical protocol.)
    1. Communication Network
      The CPN model of the simple protocol uses a boolean variable ok to model the loss of packets and acknowledgements. Slides 21-22 (from a slide set of an introduction to CP-nets) show a different way of modelling the loss of packets and acknowledgements. Modify the CPN model such that the network is modelled in the same way as in the slide set.
    2. Reception of Acknowledgements
      When an acknowledgement is received by the sender it updates the counter on NextSend according to the number contained in the acknowledgement. This implies that the counter on NextSend can be decreased when an "old" acknowledgement is received. Modify to CPN model such that the counter on NextSend will never be decreased.
    3. Bounded Retransmission
      The CPN model of the simple protocol specifies no bound on the number of times that a packet can be transmitted. Modify the CPN model such there is a bound on the number of times that a packet can be retransmitted.

  4. Perform state space analysis for a variant of the example net of the simple protocol. To download the model and for suggested exercises see the description of Project 2 for the CPN course from Spring 2005.

New Features in CPN Tools

The following new features were presented in a tutorial:

Performance Analysis and Monitoring Facilities

Slides from tutorial: PDF, PowerPoint

Hands-On Session

Download the queueSystemCPN05.zip file. Extract the files from the zip file. The file contains, among other things, three CP-nets and several gnuplot scripts.

Introduction to monitors

  1. Open the QueueSystemOneMonitor.cpn file (from queueSystemCPN05.zip).

  2. Examine the Write-in-file monitor in the model
    • Run a simulation, and examine the file that is generated.
    • The file should be in the directory <queueSystem>/output/

  3. Experiment with breakpoint monitors, for example:
    • Create a new Place contents monitor for a place.
    • Create a generic breakpoint monitor for a group of nodes.

    Note: Currently, breakpoint monitors work most reliably when running simulations with the Fast Forward tool. Errors may occur when used with Single Step or Play tool. The Transition Enabled breakpoint monitor does not currently work.

  4. Disable/enable monitors, simulate, and examine the effects.

  5. Experiment with methods for creating and modifying groups, for example:
    • New group
    • New global group
    • Create group
    • Add surrounding nodes
    • Remove node

  6. Create a new Write-in-file monitor for a group of nodes

Performance analysis

  1. Open the QueueSystemTwoDC.cpn file (from queueSystemCPN05.zip).

    Note: The Rewind tool should be applied before running the first simulation of the model to ensure that the initialization functions are called properly. (This is a bug that will be fixed.)

  2. Examine the two monitors that are already defined in the model.
    • Run a simulation and examine the simulation output in <queueSystem>/output/

  3. Define some data collectors for the queue system, for example:
    • Define two different data collectors for measuring the length of the queue of jobs, i.e. the length of the list on the place Queue. For example by using
      • List length data collector
      • Generic data collector
    • Define a data collector for counting the number of jobs with jobType B that are removed from the queue.
    • Data collector for calculating queue delay of A jobs.

  4. Define a net-specific breakpoint for the queue system, e.g.
    • Stop when 100 jobs have left the queue
    • Stop when 500 jobs have been processed by the server
    • Stop when model time is greater than 10000. Hint: use time() or intTime() functions to access current model time.

  5. Use the Fast Forward tool to run a simulation.
    • Did the simulation stop when you expected it to? If not, why not?
    • Examine the simulation output
      • Performance report
      • Log files

  6. Run a number (at least 3) of simulation replications of the model
    • Use the Evaluate ML tool to evaluate CPN'Replications.nreplications n, where n is the number of desired replications

  7. Use gnuplot to plot the simulation log files
    • Start gnuplot
    • In gnuplot, move to the output directory, e.g.
      > cd "C:\Documents and Settings\Administrator\Desktop\queueSystem\output"
    • Load the gnuplot script for plotting the log files from the replications that have been run. You will need to change to the newly created directory for the replication output, e.g.
      > cd "reps_1"
      > load "plotsimlogfiles.gpl"
    • Load the gnuplot script that shows how the generated gnuplot scripts can be changed and improved. That script is found in the <queueSystem>/ directory
      > load "../../plotsimlogfilesMod.gpl"

More on monitors

  1. Open the QueueSystemManyMonitors.cpn file (from queueSystemCPN05.zip).

  2. Examine the monitors in the net, and run simulations.
    • User-defined monitor which updates a log file
    • Different data collectors that calculate performance measures in slightly different ways:
      • Three data collectors for measuring Queue Delay
      • Four data collectors for measuring Queue Length
      • Two data collectors for measuring Server Utilization
    • Breakpoint monitors
    • Write-in-file monitor

  3. Open one of the Example Nets, or your own favorite net, and experiment with monitors.

Building and Deploying Visualizations of Coloured Petri Net Models Using BRITNeY Animation and CPN Tools


Last modified: Sun Oct 23 15:43:46 2005 -- CP-nets Webmaster
http://www.daimi.au.dk/CPnets/workshop05/cpn/index.html