petri net formalism: add inhibitor arc

This commit is contained in:
Joeri Exelmans 2024-12-03 23:25:10 +01:00
parent da4f1718ce
commit 6571d8556c
6 changed files with 33 additions and 13 deletions

View file

@ -7,5 +7,8 @@ arc:Association (PNConnectable -> PNConnectable)
PNPlace:Class
PNTransition:Class
# inhibitor arc
inh_arc:Association (PNPlace -> PNTransition)
:Inheritance (PNPlace -> PNConnectable)
:Inheritance (PNTransition -> PNConnectable)

View file

@ -0,0 +1,13 @@
# A place with tokens:
p:RAM_PNPlace
ps:RAM_PNPlaceState {
RAM_numTokens = `get_value(this) > 0`;
}
:RAM_pn_of (ps -> p)
# An incoming inhibitor arc from that place to our transition:
t:RAM_PNTransition
:RAM_inh_arc (p -> t)

View file

@ -42,5 +42,5 @@ def render_petri_net(od: ODAPI):
src_name = od.get_name(od.get_source(arc))
tgt_name = od.get_name(od.get_target(arc))
dot += f"{src_name} -> {tgt_name};"
show_graphviz(dot, engine="dot")
show_graphviz(dot, engine="neato")
return ""