Breakpoint monitors

Breakpoint monitors are used to stop simulations when certain conditions are fulfilled.

There are three breakpoint monitors:

  • Place contents monitors,
  • Transition enabled monitors, and
  • Generic breakpoint monitors.

Examples of breakpoint monitors can be found in the Queue system example.

Place contents monitors

A place contents monitor checks the number of tokens on a place to determine if a simulation should be stopped. The simulation can be stopped when the place is either

  • empty – that is, when there are no tokens on the place – or
  • not empty – that is, when there is at least one token on the place.

The option under the Type index entry for the monitor will determine when the simulation should stop.

Place content monitor

A place contents monitor will check the number of tokens on a place each time one of the surrounding transitions of the place occurs. A place contents monitor will not check the number of tokens on a place before the first step in a simulation.

To create a Place contents monitor, apply the Create place contents monitor tool to a place.

A place contents monitor will be deleted if the corresponding place is deleted.

Transition enabled monitors

A transition enabled monitor checks whether a transition is enabled to determine if a simulation should be stopped. The simulation can be stopped when the transition is either

  • enabled or
  • not enabled.

The option under the Type index entry for the monitor will determine when the simulation should be stopped.

Transition enabled monitor

A Transition enabled monitor will check whether the appropriate transition is enabled after every step in a simulation. If at least one place in the net has a timed color set, then the Transition enabled monitor will also check if the transition is enabled whenever the model time is increased. A Transition enabled monitor will not check if the transition is enabled before the first step in a simulation.

To create a Transition enabled monitor, apply the Create transition enabled monitor tool to a transition.

A transition enabled monitor will be deleted if the corresponding transition is deleted.

Generic breakpoint monitors

A Generic breakpoint monitor can be used to stop a simulation when an arbitrary condition is fulfilled. A generic breakpoint monitor can examine any subnet of a CPN, for example, a single node, a group of nodes, or no nodes.

To create a Generic breakpoint monitor, apply the Create breakpoint monitor tool to the appropriate subnet. The following example illustrates how to create a Generic breakpoint monitor that will monitor a single transition and a single place in the Simple protocol example net:

Create breakpoint monitor

After applying the Create breakpoint monitor tool, a new monitor will be added to the index, and Monitor template code is automatically generated for the predicate function for the monitor.

Breakpoint template code

The predicate function can be modified to obtain the desired behavior. The following predicate function will stop a simulation when the following two conditions are fulfilled:

  • A packet is lost when the Transmit_Packet transition occurs, and
  • There are at least two tokens on place B.

Breakpoint predicate function

For additional examples, see the help page for breakpoint monitoring functions.

A Generic breakpoint monitor will not be deleted if any of the associated nodes are deleted. However, if an associated node is deleted, it is likely that there will be errors in the monitor.

Related pages