Monitoring a CP-net | CPN Tools help |
How to observe, inspect, and control simulations | How-to |
A monitor is a mechanism in CPN Tools that is used to observe, inspect, control, or modify a simulation of a CP-net. Monitors can inspect both the markings of places and the occurring binding elements during a simulation, and they can take appropriate actions based on the observations. Many different monitors can be defined for a given net.
Example nets with monitors
Files may be created for disabled write-in-file monitors and disabled data collector monitors.
Errors may occur if you use state space tool for a net with monitors. This may also be true even if the monitors are disabled.
The code generated for list length and marking size data collector monitors depends on whether the net is timed or untimed, i.e. whether there is at least one place in the net with a timed colour set. If the net changes from being untimed to timed, or vice versa, after one of these data collector monitors has been created, then these monitors are not automatically updated. You can force the monitor to be updated by editing the monitor, e.g. by modifying the name of the monitor. You can then use the Undo tool to undo the change to the name of the monitor. Saving, closing, and reopening the net will also ensure that these monitors will be (re)created properly.
Sometimes the tool will stall during syntax checking of nets with monitors. This can happen if may monitors are defined, or if the monitoring functions are very long. When the syntax check stalls, the yellow auras on monitor names and transitions do not disappear, but the declarations and places in the net are successfully checked. The net shown below contains 37 monitors, and it stalls during the syntax check.
Sometimes (but not always) it is possible to force the syntax check to continue by editing a monitor, e.g. by adding a space to a monitoring function. If the syntax check stalls for you, please submit a Bug report and remember to include the net which causes the problem.