If you find it challenging to apply Petri Nets in modeling an application then it may help to consider the following mapping between the types of words found in a text description of an application with the types of Petri Net elements found in a Petri Net diagram of the application:
- Nouns are candidates for places.
- Verbs are nominees for transitions (and/or inputs and outputs).
- Values, amounts or counts are contenders for tokens in places.
Example Application
[Consider Figure 1 for the following example]. For the “Exam Hall Problem”, think of (Infinity, 2017):
- A place as a holder or container for “things”.
a. There are two exam assistants in front of the hall and each assistant must be distinguished from the other. Thus there are two places: one place for each assistant in front of the hall (P4, P5).
b. The exam assistants can answer questions at the same time. Thus there are two additional places: one place for an exam assistant answering a question (P2, P3).
- A token in a place as the counter for the place, the number of “things”.
a. If an exam assistant is not in front of the hall then the place is empty. If an exam assistant is in front of the hall then the place is not empty, the place has a token.
b. If an exam assistant is answering a question then the place is not empty, the place has a token. If an exam assistant is not answering a question then the place is empty.
- A transition as a start or end of “activities”.
a. An exam assistant going to a student to answer a question is an activity (T1, T3).
b. An exam assistant who answered a question is another activity (T2, T4).
The given solution for the “Exam Hall Problem” appears to be a solution for the second scenario: the exam assistants take turns answering questions (Infinity, 2017). Figure 1 is a modified version of the given solution. It was modified to satisfy the requirements of the first scenario. It includes text labels, chosen from or derived from the words in the example description.
Figure 1 Petri Net Model for Exam Assistants Answering Questions in an Exam Hall
For the “dynamic and interactive version” of this document, the visibility of labels in Figure 1 can be toggled by clicking on the diagram (Chionglo, 2017).
Reference
Chionglo, J. F. (2017). A Reply to "How to Determine Places, Transitions and Tokens in a Scenario when Modeling with Petri Nets?" at Computer Science Stack Exchange. Available at https://www.academia.edu/31997446/A_Reply_to_How_to_with_Petri_Nets_At_Computer_Science_Stack_Exchange.
Infinity. (2017). "How to Determine Places, Transitions and Tokens in a Scenario when Modeling with Petri Nets?" at Computer Science Stack Exchange. Retrieved on Mar. 21, 2017 at How to Determine Places, Transitions and Tokens in a Scenario when Modeling with Petri Nets?.