module YPetri
YPetri
is a domain-specific language (DSL
) for modelling dynamical systems. It caters solely to the two main concerns of modelling: model specification and simulation.
Model specification in YPetri
is based on a Petri net. Classical Petri net (PN), originally described by Carl Adam Petri in 1962, is a bipartite graph with two kinds of nodes: places (circles) and transitions (rectangles), connected by arcs (lines). Places act as variables – each place holds exactly one value (“marking”), a discrete number imagined as consisting of individual units (“tokens”). The action of transitions (“firing”) is also discrete. Each time a transition fires, a fixed number of tokens is added/subtracted to the connected places. It turns out that classical PNs are very useful in describing things like industrial systems, production lines, and also basic chemical systems with a number of molecules is connected by stoichiometric reactions.
YPetri
allows specification of not just classical PNs, but also of many extended Petri net (XPN) types, which have been described since Petri's work. This is achieved by making YPetri
transitions functional (mathematical functions in lambda notation can be attached to them), and allowing the possibility of transitions being defined as either timed and timeless, and as eithier nonstoichiometric and explicitly stoichiometric. Together, this makes 4 types of functional transitions available in YPetri
, which can be used to capture almost any type of XPN. In this way, YPetri
can serve as a common platform for data exchange and cooperation between different XPN formalisms, without sacrificing the special qualities of XPNs described thus far.
The basic simulation method is simple PN execution. In its course, transitions fire, and thereby change the places' marking by adding/removing tokens as dictated by their operating prescription. Other simulation methods become available for more specific net types, such as timed nets.
Public command interface of YPetri
.
Constants
- Agent
- Core
- DEBUG
- GuardError
- Net
- Place
- Simulation
- Transition
- VERSION
- World
Public Class Methods
# File lib/y_petri.rb, line 67 def included( receiver ) receiver.extend YPetri::DSL receiver.delegate :y_petri_agent, to: "self.class" end