PETRI NET

  • A collection of directed arcs connecting places and transitions is defined as petri net.
  • Places may hold tokens.
  • Marking of a net is its assignment of tokens to places.
  • Petri net consists of
    • places
    • transitions
    • arcs

Arcs:

  • Arcs run from a place to a transition or vice versa.
  • Not between places or between transitions

Places:

  • Places in a Petri net may contain a discrete number of marks called tokens.

Purpose of the Petri Nets:

  • It is to provide a variety of online services for the international Petri Nets community.
  • mailing lists
  • bibliographies
  • tool databases
  • newsletters
  • Addresses

Behavioral properties:

  • Reachability
  • Boundedness
  • Liveness
  • Reversibility and home state
  • Coverability
  • Persistence
  • Synchronic distance
  • Fairness

Techniques used in Structural analysis:

Structural analysis makes it possible to prove some properties without constructing the reachability graph.

  • Place invariants
  • Traps

Application areas:

 

  • Business Process Modeling
  • Concurrent programming
  • Data analysis
  • Diagnosis (Artificial intelligence)
  • Discrete process control
  • Kahn process networks
  • Process Modeling
  • Reliability engineering
  • Simulation
  • Software design
  • Workflow management systems

Code:

class PetriNet(PetriNetBase):

def RunSimulation(this, iterations, initialLabelling):

this.PrintHeader()  # prints e.g. “H, O, H2O”

this.labelling = initialLabelling

this.PrintLabelling() # prints e.g. “3, 5, 2”

for i in range(iterations):

if this.IsHalted():

print “halted”

return

else:

this.FireOneRule()

this.PrintLabelling();

print “iterations completed”

def EnabledTransitions(this):

return filter(lambda transition: transition.IsEnabled(this.labelling), this.transitions)

def IsHalted(this):

return len(this.EnabledTransitions()) == 0

def FireOneRule(this):

this.SelectRandom(this.EnabledTransitions()).Fire (this.labelling)

def SelectRandom(this, items):

randomIndex = randrange(len(items))

return items[randomIndex]