Counting Arcs to Places and Transitions in CPN-Tools
Question
Background: CPN-Tools is a model checker using colored Petri nets, and it uses CPN ML as its query language. CPN ML is an extension of Standard ML, a type-inference functional language.
Issue: CPN-Tools is popularly used to model domains that require state space analysis. I am using it to model a domain where I need to know the number of incoming and outgoing arcs from a place. The difference is that I am looking at the Petri net model representation, not the state space. So when I say counting arcs from a place, I do mean a place, not a state space node. In my research so far, I have come across the CPN'PlaceTable
and CPN'TransitionTable
structures that contain properties of places and transitions, and look promising to my quest. However, I haven't found any CPN ML examples to help me figure out a way to count incoming/outgoing arcs using these structures.
Question: So my question, or actually questions are:
- how do I use
CPN'PlaceTable
or any other method to count incoming arcs to a given place? - how do I use
CPN'TransitionTable
or any appropriate method to count outgoing arcs from a given transition?
Case example: I'm using this simple Petri net to give an idea about what I am expecting. Please view this link for the illustration.
In the image, we see 3 places and 2 transitions. What I want ideally is to be able to have CPN ML functions, incoming(place_name)
and outgoing(transition_name)
that work this way
incoming(Place1) = 0
incoming(Place2) = 2
incoming(Place3) = 1
outgoing(Transition1) = 2
outgoing(Transition2) = 1
Other info: I want to emphasize again that I'm not referring to state space nodes. There's lots of documentation in CPN-Tools about arc properties in state spaces, but I haven't found much information about my said question on the CPN-Tools support forums. And to make matters worse, CPN'
structures in general are highly un-documented in CPN-Tools.
No correct solution