|
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.
- Browse through the help pages for CPN Tools, e.g.
- 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.
- 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.)
- 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.
- 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.
- 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.
- 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:
- Manual binding
- New hierarchy features
- Save of open tool palettes and tool options
- Set default tool
- Print of
- Groups
- Binding indexes
- Port/socket indexes
- Clone graphical attributes
- Blocks in history
- Automatic bring to front for occurring
transitions when using the Play tool
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
- Open the QueueSystemOneMonitor.cpn file (from queueSystemCPN05.zip).
- 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/
- 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.
- Disable/enable monitors, simulate, and examine the effects.
- Experiment with methods for creating and modifying
groups, for example:
- New group
- New global group
- Create group
- Add surrounding nodes
- Remove node
- Create a new Write-in-file monitor for a group of nodes
Performance analysis
- 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.)
- Examine the two monitors that are already defined in
the model.
- Run a simulation and examine the simulation output in
<queueSystem>/output/
- 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.
- 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.
- 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
- 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
- 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
- Open the QueueSystemManyMonitors.cpn file (from queueSystemCPN05.zip).
- 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
- 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
|