petri net formalism: add inhibitor arc
This commit is contained in:
parent
da4f1718ce
commit
6571d8556c
6 changed files with 33 additions and 13 deletions
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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 ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue