190 likes | 436 Views
DEMO CPN-tools. Ronny Mans Eindhoven University of Technology, Faculty of Technology Management, Department of Information Systems, P.O.Box 513, NL-5600 MB, Eindhoven, The Netherlands. Outline. Introduction to CPN Tools Building a net Time, Hierarchy and Color Analysis Simulation
E N D
DEMOCPN-tools Ronny Mans Eindhoven University of Technology, Faculty of Technology Management, Department of Information Systems, P.O.Box 513, NL-5600 MB, Eindhoven, The Netherlands.
Outline • Introduction to CPN Tools • Building a net • Time, Hierarchy and Color • Analysis • Simulation • Single run, replications • Monitors • Net for DCT case
Classical Petri net • Simple process model • Just three elements: places, transitions and arcs. • Graphical and mathematical description. • Formal semantics allows for analysis.
Limitations of classical Petri nets • Inability to test for zero tokens in a place. • Models tend to become large. • Models cannot reflect temporal aspects • No support for structuring large models, cf. top-down and bottom-up design • High level Petri nets in CPN • Color • Time • Hierarchy
CPN (Colored Petri nets) • CPN is the language developed by Kurt Jensen. • CPN supports the extensions with time, color and hierarchy. • CPN is based on standard ML. • CPN is supported by Design/CPN and CPN Tools. • For more information: http://www.daimi.au.dk/CPnets/
Simulations • Simulations of CP-nets are run for many reasons: • Debugging • Analysis of system behavior (performance or functional) • Presentation of a model to project team • Communication with external programs • The usefulness of the simulations is heavily dependent on the flexibility and functionality of the simulator. • Access to simulation information • Stopping simulations
Accessing simulation information • It is often useful to be able to exchange information between the CPN simulator and external processes or files. • Code segments can be added to transitions for: • Reading and writing in files • Calculating some performance measures • Sending and receiving information from external processes
Controlling a simulation • Simulation stop criteria • Number of steps executed • Dependent on model time • Dependent on markings or transitions
Common functionality • These controlling and accessing activities share a common pattern: If certain conditions are fulfilled, then do something. • If transition T occurs, then save information in a file. • If there are no tokens on place P, then stop the simulation. • If model time is greater than C, then calculate the average number of tokens on place P.
Problems when simulating • Problems controlling and accessing simulation information: • Cannot access marking information. • Net structure may have to be changed to obtain desired functionality. • If multiple transitions need to be inspected, then code segments must be duplicated. • Code segments cannot be disabled. • Only low-level support, which is difficult to use.
Monitors in CPN Tools monitor (verb) to watch, keep track of, or check, usually for a special purpose Merriam-Webster’s Collegiate Dictionary • A monitor is a mechanism that is used to observe, inspect, control or modify a simulation of a CP-net. • Important characteristics of monitors: • They can inspect the statesand eventsof a simulation, and take appropriate actions based on the observations. • There is an explicit separation between monitoring the behavior of a net, and modeling the behavior of the system.
Levels of monitors • Standard monitors • Very easy to define • Do not require users to write any code • Parameterized monitors • Similar to standard monitors, but slightly more flexible, and require some programming • User-defined monitors • Very flexible, but require more programming
Monitoring subnets • A monitor can inspect markings and occurring transitions, with variable bindings, during a simulation • Zero or more places • Zero or more transitions • Monitors are activated after simulation steps • After every simulation step, if no transitions are monitored • After every relevant transition has occurred
Data Collector monitors • Mark Size (used on places) • List Length Data Collector (used on places) • Count Transition (used on transitions) • Generic Data Collector (used on subnets)
Breakpoint monitors • Place Content (used on places) • Transition Enabled (used on transitions) • Generic Breakpoint (used on subnets)
Other monitors • Write in file (used on subnets) • User defined (used on subnets)
Monitoring functions • Initialization function • Called once before a simulation • Predicate function • Called after simulation steps • Observation function • Called when predicate function returns true • Extracts relevant data from the model • Action function • Does something appropriate with the observed value • Stop function • Called once after a simulation