Modeling and Analysis of Connected Traffic Intersections Based on Modified Binary Petri Nets

We propose an approach for the modeling and analysis of two connected traffic intersections based on Petri nets (PNs).We first use a PN to model an isolated four-way signalized intersection; then we extend it to model two successive signalized intersections. We find that this model has unbounded places, which in turn results in some confliction problems. Hence, we introduce the concept of modified binary petri nets (MBPNs) to overcome the limitation and resolve the confliction problemwhen we design ourmodel and its controller.ThisMBPNmodel is a powerful tool and can be useful for themodeling and analysis ofmany other traffic applications.


Introduction
As a powerful tool that consists of a combined graphical and mathematical representation, Petri nets have been used for the modeling, control, and analysis in different applications including sensor networks [1], power systems [2,3], manufacturing systems [4][5][6][7], and many other practical systems.In traffic management problems, Petri nets have been used to model the traffic network in different ways for a variety of purposes.It can be concluded that when vehicle flow has been studied, hybrid Petri nets (HPNs) are a suitable modeling tool because they consist of both continuous and discrete nodes that work together to reflect the dynamics of the overall traffic system.Continuous nodes are suitable for modeling continuous events such as vehicle flow while discrete nodes are used to represent discrete events such as phase change in traffic signal and enabling/disabling vehicle movement because of occurrences of emergent events such as accidents and the blocking of the road.In [8], a general HPN model for transportation system was developed.Traffic flow was described by continuous nodes and the events that affect the traffic dynamics were modeled through discrete nodes.In [9], a simple HPN was used to model the intersection of two one-way streets, while in [10] a continuous Petri net was used to model a nonsignalized intersection, and then were added discrete nodes that are essential to represent a fourway intersection with two-phase traffic light through an HPN.In [11], the authors developed an HPN model to improve the performance of special and emergency vehicles.
In the aforementioned works on traffic network modeling and management, HPN models were adopted because they are more accurate to reflect the dynamics of the entire traffic network for certain applications.On the other hand, however, in some traffic network applications such as control and monitoring, only events are critical to be studied and analyzed.For these problems, discrete Petri nets as well as timed/colored Petri nets are the suitable modeling tools.In [12], the authors proposed a discrete Petri net model which describes the phase change of traffic light signal for an intersection.In [13], a discrete Petri net model for a small transportation system was developed to estimate the optimal travel route between the starting and destination points.In [14,15], timed colored Petri nets were used to represent urban traffic light control systems and then a real-world supervisor of the modeled urban traffic light system was implemented.Deterministic and stochastic Petri nets were used in [16] to model railroad level crossing traffic control systems to identify and avoid the critical scenarios.

International Journal of Vehicular Technology
Compared with HPN models, discrete Petri nets are much simpler in terms of modeling and analysis.Therefore, for applications that do not need to capture the detailed vehicle flow dynamics, discrete Petri nets are a good tool to use.In this paper, we introduce a discrete Petri net model for two connected traffic intersections.This model is based mainly on higher-level event occurrences without considering details of lower-level continuous dynamics.For instance, it can tell us that the event of vehicles crossing an intersection during a specific traffic light phase from a specific entrance to a known destination has occurred, but without considering information such as how many vehicles have crossed the intersection or how much time this process has taken.The advantage is that this model can give us an abstract view of the event correlations about the entire complex traffic network.Therefore, it can be used to analyze the effect of the occurrence of a specific event at a specific node on other parts of the network.In addition, we propose a modified binary Petri net (MBPN) model that is suitable for the analysis and control of these connected intersections.
The contributions of this paper are two-fold: (1) we develop a comprehensive discrete Petri net model for two connected intersections by considering both signal phase change and vehicle flow directions; and (2) we propose a modified binary Petri net model to resolve the potential confliction problem for the two-intersection PN.
This paper is organized as follows.In Section 2, the basics of discrete Petri nets are briefly reviewed.A discrete Petri net model for a single signalized intersection is described in detail in Section 3. In Section 4, two connected intersections are modeled by extending the single-intersection model and are analyzed in detail.In Section 5, we propose the modified binary Petri net for the purpose of monitoring and control.Conclusions and directions for future work are presented in Section 6.

Petri Nets Basics
In this section, the basic principles of (discrete) Petri net are briefly reviewed.The reader can find more details about Petri nets and their extensions in [17][18][19].
A Petri net is a bipartite directed graph comprising of two types of nodes, called places (drawn as circles) and transitions (drawn as bars), which are connected through arrows that are called arcs.A Petri net is called a marked Petri net if a nonnegative integer number of tokens (drawn as black dots) is assigned to each place.
Thus, a marked Petri net is defined as where  = { A transition is said to be enabled if each of its input places contains a number of tokens that is greater than or equal to the arc weight that connects that specific place to the transition.In other words, transition   is enabled at a specific marking   if and only if for all input places   to transition   .The inequality is taken elementwise.An enabled transition may fire.The firing of a transition is the mechanism of removing a specific number of tokens from each input place (which is equal to the weight of the arc directing from this specific input place to the transition) and depositing a specific number of tokens to each output place (which is equal to the weight of the arc directing the transition to this specific output place).
Let  be a transition firing sequence; then we define  as the firing vector of sequence  in such a way that each element   in  captures the number of times that transition   fires in .For instance, if  =  2  3  1  1 and the Petri net has four transitions, then  = [2 1 1 0]  .For a given Petri net marked with a specific marking   , we say that the firing sequence  is enabled if and only if a specific marking    exists in such a way that when the firing sequence  is applied to the given Petri net marked with   it will produce the marking    .Mathematically, transition firings can be captured by state equation given as follows: where  is the incident matrix of the Petri net and it is defined as  =  + −  − ( − is the input incident matrix and  + is the output incident matrix of the Petri net as defined earlier).
Example 1.Consider the Petri net shown in Figure 1.The net consists of four places:  1 ,  2 ,  3 , and  4 and four transitions:  1 ,  2 ,  3 , and  4 .Since  1 is the only place that has a token, the initial marking is written as  0 = [1 0 0 0]  .The input and output incident matrices ( − ,  + ) are given by So the incident matrix  can be calculated as According to (2)  is removed from place  1 and one token is added to  2 and  3 , respectively, to result in the new marking  = [0 1 1 0]  .Mathematically, the new marking can also be obtained by using (3), where   is the initial marking  0 ,    is the new marking, and the firing vector  is given by [1 0 0 0]  since we are looking for the result of firing  1 only once.Therefore, we have  1.However, note that the design concept can also be applied to other phase planes.In general, the number of phases for a four-bidirectionalsignalized intersection is no more than eight, as shown in [12].In particular, two-and six-phase plans [12,20] are also applicable for such an intersection.Our PN model here can also be modified to account for two-phase and sixphase signalized traffic intersection.A phase is defined as an event of giving particular permissions to vehicles coming from specific directions to cross the physical area of the intersection towards specific destinations.As shown in Table 1, during Phase 1, vehicles flowing from east to south and from west to north are permitted to cross the intersection; during Phase 2, vehicles flowing from east to west (and north) and from west to east (and south) are permitted to cross the intersection; during Phase 3, vehicles flowing from north to east and from south to west are permitted to cross the intersection; and during Phase 4, vehicles flowing from north to south (and west) and from south to north (and east) are permitted to cross the intersection.It is not difficult to check that these signal phases do not conflict with each other and they comprise of a complete signal cycle.

Petri Net Model of the Single Intersection.
The discrete Petri net model for the four-bidirectional road (shown in Figure 2) is depicted in Figure 3.The overall PN model is divided into 13 sub-PNs (modules), where each one is bounded by a dashed rectangular box.Eight of these modules represent the movement of vehicles while entering and crossing the intersection from left (N in l , S in l , E in l , and W in l ) or from forward/right (N in f , S in f , E in f , and W in f ).On the other hand, the four sub-PNs (N out , S out , E out , and W out ) represent movement of vehicles while leaving the intersection toward the four directions.Finally, the sub-PN () models the phase change of the traffic light signal.The sub-PN () consists mainly of four places ( 1 ,  2 ,  3 , and  4 ) and four transitions (  1 ,   2 ,   3 , and   4 ) that represent the four different phases mentioned in Table 1.The other nodes in module  exist only to make sure that the model offers a safe operation (no directional conflicts between vehicles while crossing the intersection).Having a token at the place   indicates that the th phase is taking place while losing this token means the ending of this phase.Furthermore, firing of transition    reflects the starting of the th phase.It is easy to note that the condition  1 + 2 + 3 +  4 = 1 has to be satisfied all the time.
Events related to vehicle movement through the intersection are described by other 12 sub-PNs; eight of them are used to model vehicles entering and crossing the intersection as  in  where  takes the notations (N, S, E, and W) and  takes either l (left) or f (forward and right).The subnet  in  consists of five places and four transitions; having a token in place  in  implies that vehicles are entering the intersection from the th incoming direction with the intention to take the direction of .Similarly, having a token in place    indicates the event that there is a queue of vehicles waiting in the incoming direction  with the intention to cross the intersection directed  (left or forward/right).Furthermore, a token at the places    means that the permission is given to those vehicles in the queue to cross the intersection while a token existing in    represents the event that those vehicles are crossing the intersection.
Finally, the other four sub-PNs (N out , S out , E out , and W out ) are quite simple.Each of them consists of a place  out  and a transition  out  .A token in the aforementioned places describes the event that vehicles are leaving the intersection at the outgoing direction .

Dynamics of the Petri Net Model.
The state evolution of the PN model shown in Figure 3 is performed based mainly on the state equation given in (3) and on the assumption that whenever a transition is enabled it fires immediately.The fact that permission is given to vehicles entering the intersection from a specific direction towards a specific destination during a specific phase results in the consideration that this permission has to be canceled at the end of this phase no matter some vehicles cross the intersection or not.Consequently, eight conflicts might appear in the model between each coupled transitions (   ,    ).The proposed algorithm specifies a priority execution for each conflict.If the initial marking of the Petri net model is the one given in Figure 3, the only enabled transition is   1 .Therefore, it fires immediately through removing a token from each input place to this transition ( 4 ,  2 4 ) and adding a token to each output place of this transition ( 1 ,  1 1 ,   wl , and   el ).It simply means that the first phase starts (indicated via the token in place  in 1 ) and permission is given to vehicles to cross the intersection.
To clarify the firing sequence, let us stick only to those vehicles that enter from west towards north.As shown in Figure 3, initially a token exists in place   wl , so vehicles are waiting in the west entrances to take left with the intersection.However, a conflict appears at this step between transitions (  wl ,   wl ) since both of them are enabled and only one token is marked in their common input place   wl .At this point, the algorithm will give the priority to transition   el , whose firing will result in removing tokens from the permission and queuing places (  wl ,   wl ) and adding a token to the place   wl , which indicates that the event of vehicles crossing the intersection from west to north is taking place simultaneously with the occurrence of the event that vehicles are crossing the intersection from east to south.
In the following step, three transitions are fired together, named (  wl ,   el , and   2 ).Firing the transitions   wl ,   el implies that vehicles are leaving the intersection towards south and north (through removing tokens from   wl ,   el ) and adding a token to each one of  out s ,  out n indicates the event that vehicles are leaving intersection towards south and north directions.Simultaneously, in the sub-PN, the transition   2 fires will indicate the starting of the second phase.
The necessity of having the sink transition   wl is to make sure that vehicles cross the intersection safely; if we assume that no vehicles are waiting in the queue to cross the intersection from west to north during the first phase, the permission will still be available through the existence of a token in   wl , which will lead to unsafe operation that vehicles coming from the west cross the intersection even after the ending of the first phase.Therefore, the role of the sink transition   wl is to take away the permission if it has not been used during the first phase.
We developed an algorithm to identify the enabled transitions at each time step and fire the enabled transitions immediately based on the state equation and the aforementioned priority rule.Given the initial marking, input and output incident matrices, the algorithm will firstly construct the column matrix  (which initially is equal to the initial marking); then it will calculate the subsequent markings by state equation given in (3) and compare them with the existing marking; if it is not equal to any of them, it will be saved as a new column in matrix  and will be used to find the subsequent markings.Otherwise, if the newly calculated marking is equal to any previous ones (any column in ), the algorithm will stop.Matrix  at this point consists of all possible markings in their order of occurrences.The block diagram of the algorithm (Algorithm 1) for capturing the state evolution of the PN is shown in Figure 4.
In Table 2, we capture the state (marking) evolution of the Petri net model shown in Figure 3 related to each step of transition firing.Note that this state evolution is partial since we only show the number of tokens in some important places.The first column in the table represents the initial marking of the Petri net.When a specific event occurs at a specific firing step, it will be represented through the value "1" in the table.Similarly, the change of value from "1" to "0" in a specific table cell implies the ending of that specific event.Since the model consists of 56 places, it is not possible to include all of them in the table.We focus only on the places  with essential meanings.It is to be noted that at each firing step, one and only one of the four phase places ( 1 ,  2 ,  3 , and  4 ) will take the value "1" (which is expected as previously mentioned).It is also not difficult to notice that during the 10th step, the current marking goes back to the second generated marking in Table 2, which indicates that the proposed PN model is live and reversible.
If we use a different initial marking, such as a marking that represents the case where no vehicles enter the intersection from north, south, and east, the value "1" will never exist at the place  out w during any firing step, which means that the event vehicles leave the intersection towards west will not take place.This is an expected logical result to avoid the conflicts of events.

Petri Net Model for Two Connected Intersections
In this section, we generalize the PN model obtained from the previous section to two connected intersections.The structure of two connected intersections is shown in Figure 5; if we call the intersection on the left side Intersection-1 and  3.
the intersection on the right side Intersection-2, then we can say that the east output of Intersection-1 is the west input to Intersection-2 while the west output of Intersection-2 is the east input to Intersection-1.
For this case, the Petri net model for traffic network shown in Figure 5 consists of two-single intersection PN models connected to each other.However, minor modifications are done for each model.For Intersection-1 model, the arcs connecting  in el to  in el and  in ef to  in ef have been removed; while for Intersection-2 model, arcs connecting  in wl to  in wl and  in wf to  in wf have been removed.To distinguish between the PN nodes belonging to each intersection, we added (2) as the subscript for each node symbol in Intersection-1, similarly adding (3) for Intersection-2.The two-single intersection models are connected to each other through their east and west inputs/outputs nodes, the PN model for the connection between two intersections is shown in Figure 6.
During the event that vehicles are leaving Intersection-1, a token existing at  out e(1) will result in the firing of transition  out e(1) , which removes the token from  out e(1) and adds a token to both places  in wf (2) and  in wl(2) that represents the occurrence of the event that vehicles are entering Intersection-2 from the west.However, this step does not perform very smoothly when we execute the two-intersection model using Algorithm 1.
The case is that, during one-phase cycle (the four phases took place once successively), transitions  out e(1) and  out w(2) fire three times because places  out e(1) and  out w(2) are charged three times per cycle since there are vehicles leaving Intersection-1 east directed and Intersection-2 west directed during three phases in a cycle.On the other hand, the four places,  in ef(1) ,  in el (1) ,  in wf (2) , and  in wl(2) , gain three tokens each per cycle and release only one of these tokens since the transitions downstream fire only once per cycle.It is obvious that this firing mechanism will lead the Petri net to be unbounded.Physically, the model will not be considered as a good representation for event occurrences because at some point if no vehicle enters the network through one of the three entrance of Intersection-1: west, north, and south, there will be still vehicles traveling from Intersection-1 to Intersection-2 which is not a real case.That is because places  in ef (1) ,  in el (1) will have tokens to feed the net of Intersection-2.The same case of unreal representation will exist for vehicles traveling from Intersection-2 towards Intersection-1.
To tackle this modeling issue, we have tried several approaches.Firstly, a Petri net controller was designed based on [21] to keep the number of tokens in each of the four places not exceeding one.This controller worked for these four places but it transferred the unbounded problem to the upstream places  out e(1) and  out w (2) .Adding another controller places to control these two nodes will not solve the problem because it causes conflicts which stop the execution of Algorithm 1 when it is used for the new model (with the controller).Designing a controller for the six places in one step will cause similar problem.Therefore, we propose the concept of the modified binary Petri net (MBPN), which will be presented in detail in the next section.

Introduction to Modified Binary Petri Nets.
As it can be seen from the previous discussions, we use PNs to determine whether an event has occurred or not based on the occurrence of other events.Modeling in such a way can be easily done through representing the occurrence of a specific event by associating a token in a specified place that describes this event.However, modeling in this traditional way will lead to problems in our models as discussed above.
Thus, we propose the concept of the modified binary Petri net (MBPN).The idea is to follow the traditional Petri net firing mechanisms, but with a restriction that no places can be marked with more than one token.Thus, the MBPN can be defined as follows.
(i) The weights of all arcs in the MBPN are ones, which indicates that the net is ordinary and all elements in the input and output incidents matrices can only be zeros or ones. out e(1) out e(1) in wf( 2) Intersection-1 Intersection-2 (ii) The initial marking of the MBPN can only be zero or one for each place.
(iii) State evolution from one marking to another is performed through the following two steps: (1) we calculate marking    according to traditional state equation of Petri nets: (2) we update the marking in places according to the number of tokens as follows: () = { 0 for places  such that    () = 0, 1 for places  such that    () ≥ 1.
Based on this definition, it is easy to see that for MBPN we have the following: (i) elements of incident matrices take only three values −1, 0, or 1; (ii) any modified binary Petri net is bounded since the number of states is less than or equal to 2  , where  is the number of places.
To illustrate the differences between the traditional PN and the MBPN, we can use the example provided in Figure 1 for illustration.If Algorithm 1 is applied for traditional PN, the marking evolution will be given by ] As it is shown above, the PN is unbounded due to place  4 , in which the number of tokens will keep increasing after the marking [1 1 1 2]  .Now we consider the MBPN.It is not difficult to see that the marking evolution is given by Thus, MBPN has bounded markings and avoids the potential problems in creating extra tokens for our connected traffic intersection model.In general, for traffic applications that can be represented through binary-state nodes (0 or 1), MBPN is a suitable modeling tool and can guarantee the smooth representation for event occurrences in these applications.

Using MBPN Firing Mechanism for Studying the Two
Connected Intersections.Now we investigate the PN model shown in Figure 6.We use Algorithm 1 with a small modification that takes into account (8) mentioned above by MBPN.The algorithm performed 15 steps before it stopped due to the condition of having repeated markings.Because of the size of the PN model ( = 112,  = 88), we do not show markings for all places in the net.Instead, in Table 3, we show the markings of the places which represent the connections between two intersections.It is easy to note that the MBPN framework resolves the issue of unbounded states and is a more realistic tool for the modeling and analysis of certain traffic applications other than traditional PNs.

Discussions on Potential Extensions to Traffic Networks.
Starting from two connected intersections model, we can expand the approach proposed in this paper to study traffic network with much more complex dynamics.To see this implication, assuming that we have a complex traffic network consisting of  intersections, we can derive its input incident matrix  − composed from input incident block matrices as: where  − 1 ,  − 2 , . . .,  −  are the input incident matrices for intersections  1 ,  2 , . . .,   , respectively.The sizes of these block matrices may be different because they depend on the intersection specifications such as the number of incoming and outgoing roads connected to them and the number of phases applied to them.Note that the off-diagonal entries are zeros because intersections are connected through transitions to places.
For the output incident matrix, the diagonal block matrices will be the output incident matrices  + 1 , From the discussions above, we observe that we can easily expand the two-intersection model proposed in this paper to a large traffic network with much more intersections.
In addition, the MBPN model proposed can guarantee the boundedness of places in the net; thus, it is suitable for capturing the event occurrences of the overall traffic network.

Conclusions and Discussions
In this paper, we developed a discrete Petri net model for a single traffic intersection and then extended it to represent a traffic network consisting of two connected intersections.This model was based on traditional Petri nets in order to analyze the effect of occurrence/nonoccurrence of specific events on other network nodes without considering the detailed dynamics.An algorithm was designed to capture transition firings based on the state equation and the priority assignment.We noticed that the traditional Petri net model for two connected intersections will lead to unbounded places in the model, which are not realistic for the monitoring and control.Thus, we introduced a modification to the traditional Petri nets to resolve this issue.We called this new type of Petri nets the modified binary Petri nets, which have a good representation for traffic network in terms of events occurrences and traffic dynamic correlations.One direction for our future work is to enhance the model with timing information by using timed transitions.By incorporating with time information, the new model will be suitable for event simulations in large traffic networks.Another interesting research direction is to identify a wider range of applications (e.g., routing, scheduling, etc.) of modified binary Petri nets in traffic systems and networks.

Figure 1 :
Figure 1: A simple Petri net model.

Figure 2 :
Figure 2: The structure of a single intersection.

Figure 3 :
Figure 3: Petri net model for the single signalized intersection shown in Figure 2.

Figure 4 :
Figure 4: Block diagram of Algorithm 1 for capturing the state evolution of the Petri net shown in Figure 3.

Figure 5 :
Figure 5: The structure of two connected intersections.

Figure 6 :
Figure 6: Petri net model for the connections between two intersections.
+ (  ,   ) is the weight of the arc directed from the transition   to place   .If there is no such arc, then the element of  + (  ,   ) is set to be zero;  0 is the initial marking (denotes the number of tokens in each place initially) of the Petri net.It is not difficult to see that the sizes of the input and output incident matrices are  × .
1 ,  2 , . . .,   } is a finite set of places consisting of  elements;  = { 1 ,  2 , . . .,   } is a finite set of transitions consisting of  elements;  − is the input incident matrix, which captures the arc weights directed from places to transitions.For instance,  − (  ,   ) is the weight of the arc directed from the place   to transition   .If there is no such arc, then the element of  − (  ,   ) is set to be zero;  + is the output incident matrix, which captures the arc weights directed from transitions to places.For instance, , it is not difficult to see that the only enabled transition is  1 at the initial marking.When  1 fires, one token } represents the outgoing roads.The Petri net model, which will be introduced in the following subsection, is designed based on the assumption that this intersection's traffic light signals have four phases as a case of study as shown in Table 3.1.Structure of a Single Intersection.In Figure2, a fourbidirectional-road signalized intersection is shown with its accessible roads.Direction symbols {n, s, e, w} are used to define the four bidirectional roads.They represent the four directions north, south, east, and west, respectively.The

Table 1 :
Four phases of the signalized intersection considered in this paper.

Table 2 :
Partial state evolution of the single-intersection Petri net model shown in Figure

Table 3 :
A partial set of marking evolution of MBPN model for two connected intersections.
+ 2 , . ..,  +  for the intersections  1 ,  2 , . ..,   .Off-diagonal block matrices represent the connection between two intersections.For instance,  + 1−2 represents the connections from intersection  1 to intersection  2 ,  + 2−1 represents the connection from  2to  1 , and so forth.The general form of the output incident matrix for the overall traffic network can be written as