Single Controller-Based Colored Petri Nets for Deadlock Control in Automated Manufacturing Systems

: Deadlock control approaches based on Petri nets are usually implemented by adding control places and related arcs to the Petri net model of a system. The main disadvantage of the existing policies is that many control places and associated arcs are added to the initially constructed Petri net model, which significantly increases the complexity of the supervisor of the Petri net model. The objective of this study is to develop a two-step robust deadlock control approach. In the first step, we use a method of deadlock prevention based on strict minimal siphons (SMSs) to create a controlled Petri net model. In the second step, all control places obtained in the first step are merged into a single control place based on the colored Petri net to mark all SMSs. Finally, we compare the proposed method with the existing methods from the literature.


Introduction
An automated manufacturing system (AMS) is a conglomeration of robots, machine tools, fixtures, and buffers. Several types of products enter the manufacturing system at separate points in time; the system can process these parts based on a specified sequence of operations and resource sharing. The sharing of resources leads to the occurrence of deadlock states, in which the local or global system is incapacitated [1][2][3][4]. Thus, an efficient deadlock-control algorithm is needed to prevent the deadlocks in an AMS. Petri nets are an excellent mathematical and graphical tool suitable for modeling, analyzing, and controlling deadlocks in AMSs [5,6]. The behavior and characteristics of an AMS (such as synchronization, conflict, and sequences) can be described by using Petri nets. Moreover, Petri nets may be used to provide the liveness and boundedness of a system [7]. To address the deadlock problem in AMSs, several approaches with Petri nets exist. These approaches are categorized into three strategies: (1) deadlock detection and recovery, (2) deadlock prevent ion, and (3) deadlock avoidance [7,8].
Traditionally, deadlock control approaches for AMS control are evaluated by using three criteria: structural complexity, computational complexity, and behavioral permissiveness [ 7]. Structural complexity means that a controller can be implemented with fewer monitors and arcs. When the computational complexity of a deadlock control approach is low, it can be applied to a large-scale system [7]. Behavioral permissiveness achieves high resource utilization in a controlled Petri net. Deadlock control may be implemented in AMS with reliable resources (resources without failures or breakdowns) or unreliable resources (resources with failures or breakdowns). For reliable resources, there are two main techniques to prevent deadlocks in AMSs using a Petri net: reachability graph analysis [9][10][11] and structural analysis [12,13]. The reachability graph analysis needs listing all or a part of the reachable markings of the Petri net model. There are two parts of the reachability graph: the deadlock zone (DZ) and the live zone (LZ). First-met bad markings (FBMs) are defined in and extracted from the DZ. In this case, the deadlock is eliminated by designing and adding a monitor to prohibit the first-met bad markings from being reached. In this process, all first-met bad markings can be prevented by using iterations [14]. Several policies have been developed to prevent deadlock states, including iterative methods, the theory of region, and siphon control [10,[13][14][15][16][17][18][19]. The weakness of the reachability graph analysis is that the size of a reachability graph of a Petri net grows quickly and, in the worst case, grows exponentially with respect to the net size and its initial marking, and the net can easily reach an unmanageable level. Structural analysis is often applied to a typical structure of Petri nets, such as siphons. The control steps in this technique are simple: each minimal siphon is prohibited from being non-empty, and each unmarked minimal siphon needs an added monitor to ensure a system to be live. However, the weakness of this technique is that the number of control places will be increased when the size of a Petri net model is increased; hence, this results in high structural complexity [20].
In the literature, deadlock control approaches based on the structural analysis technique (siphons) for AMSs with the Petri nets framework can be implemented by inserting the control places and the associated arcs to the original net, so that its siphons are permanently non -empty. The main disadvantage of the current policies is that many control places and associated arcs are inserted into the original Petri net model, which leads to the increased complexity of the supervisor of the Petri net model, compared with the initial model for the Petri net supervisor. Hence, an efficient approach is needed to minimize the Petri net supervisors' structural complexity for AMS. The objective of this study is to develop a two-step robust deadlock control policy. A technique based on SMSs developed in [21] is used in the first phase to develop a controlled Petri net model. In the second step, all control places obtained in the first step are merged into one control place based on colored Petri nets to make all SMSs marked.
The rest of the paper is organized as follows. Basic concepts of Petri nets are introduced in Section 2. Section 3 describes a deadlock prevention approach based on the SMS and the proposed robust control based on colored Petri nets. Section 4 shows an example from the literature. Finally, Section 5 presents conclusions and future research.

Preliminaries
This section introduces the basics of Petri nets and a general Petri net simulator (GPenSIM) tool.

Basics of Petri Nets
Let N = (P, T, F, W) be a Petri net, where P and T are finite non-empty sets of places and transitions, respectively. Elements in P ∪ T are named nodes. Here, P ∪ T ≠ ∅ and P ∩ T = ∅; P and T are depicted by circles and bars, respectively. Next, F ⊆ (P × T) ∪ (T × P) is the set of directed arcs that join the transitions with places (and vice versa), W: (P × T) ∪ (T × P) → IN is a mapping that assigns an arc's weight, where IN = {0, 1, 2, ...}.
N is known as an ordinary net if ∀ (p, t) ∈ F, W (p, t) = 1, where N = (P, T, F). N is named a weighted net if there is an arc between x and y such that W (x, y) > 1. Let N = (P, T, F, W) and node a ∈ P ∪ T. Then, · a = {b ∈ P ∪ T | (b, a) ∈ F} is named the preset of node a, and a· = {b ∈ P ∪ T | (a, b) ∈ F} is named the postset of node a.
A  GPenSIM poses restrictions in modeling compared to CPN. However, this is the price paid for achieving simplicity in GPenSIM (easiness in learning, using, and extending). 3. The arc weights can dynamically alter in CPN tools because of the logic conditions connected to it. GPenSIM does not allow dynamic nets (e.g., dynamic arcs, run-time removal of places and transitions). Once a Petri net is defined in the Petri net definition file (PDF), it cannot be changed. To model, simulate, analyze, and control the Petri net models in GPenSIM, three files should be coded: Petri net definition file (PDF), main simulation file (MSF), and pre-and postprocessor files.
1. PDF defines the static elements of a Petri net (places, transitions, and arcs). 2. Before the simulation starts, MSF loads a PDF into memory and the workbench, and then the simulation begins. During the simulation runs, MSF will be blocked; the control will be handed back to MSF together with the simulation results when the simulation is finished. Consequently, MSF has no control over what happens during the simulation. 3. Pre-and postprocessors will be called during the simulation before and after firing of the transition. The preprocessor will inspect if the conditions of firing for a certain transition are met, and the postprocessor will execute post-firing activities if needed after a certain transition has been fired. These can be used to control the runtime of the system, as they are called during the simulation.
All tokens are homogeneous inside a place. It does not matter which token is first or last to arrive at the place. Similarly, it does not matter by which transition a token is deposited at the place. However, GPenSIM introduces the token colors. Each token can become identifiable and unique with a unique token identification number (tokID). Moreover, we can add some tags ("colors") to each token. The following problems are crucial when using colors in GPenSIM: 1. Only transitions can manipulate colors: the colors of the output tokens can be added, deleted, or changed in the preprocessor. 2. By default, colors are inherited: the system gathers all colored tokens from the input places when a transition fires and then transfers the colored tokens to the output places. However, color inheritance can be avoided by overriding. 3. An enabled transition may choose certain color-based input tokens.
4. An enabled transition may choose certain time-based input tokens (e.g., when the creation time of the tokens is known). 5. A token has the following structure: tokID, time of creation, and color setting.
A. tokID: a single token identifier (integer value). B. creation_time: the transition time (real value) when the token was produced. Importantly, this time may differ when the transition actually deposited the token in an output place. C. t_color (text string set) is a color setting.
There are several GPenSIM functions used for color manipulation. One of the functions used in this study is tokenEXColor, which can be expressed as follows: [set_of_tokID,nr_token_av] = tokenEXColor (place, nr_tokens_wanted, t_color), where the function requires three input arguments and returns two output values.

Input arguments:
(place, nr_tokens_wanted, t_color):  Place: from which place the tokens are to be selected.  nr_tokens_wanted: the number of required tokens with the specified color.  t_color: a set of colors.

Output values:
[set_of_tokID,nr_token_av]  set_of_tokID: a set of tokIDs that meet the color specifications. The set length of tokIDs is equal to the input argument of nr_tokens_wanted.  nr_token_av: the number of valid tokIDs available in set_of_tokID; the set may have trailing zeros to match the length of nr_tokens_wanted.

Deadlock Prevention Policy Based on SMSs and Colored Petri Nets
In this section, we use a deadlock-prevention approach based on strict SMSs to design a controlled Petri net model. This approach is adopted from Ezpeleta et al. [1]. (2)

Definition 3 [23]. Let N = ({p 0 } ∪ PA ∪ PR, T, F) be an S 2 PR, and Mo be an initial marking of N. An S 2 PR with such a marking is said to be acceptably marked if (1) Mo
Definition 4 [23]. A system of S 2 PR, named S 3 PR for abbreviation, is defined recursively as follows: 1. An S 2 PR is as well an S 3 PR 2. Let N1 and N2 be two S 3  The composition of n S 2 PR N1-Nn via PC, is denoted by ⨂ =1 . ̅ is used to denote the S 2 P from which the S 2 PR Ni is formed.

Definition 5 [23]. Let N = ({p 0 } ∪ PA ∪ PR, T, F) be an S 3 PR. Mo is an initial marking of N. (N, Mo) is said to be an acceptably marked S 3 PR if (1) (N, Mo) is an acceptably marked S 2 PR, (2) N= N1 ∘ N2, where (Ni, Moi) is said to be an acceptably marked S 3 PR and
Definition 6 [23]. Let N be an S 3 PR, A non-empty set S ⊆ P is said to be a siphon in N if · ⊆ · . When a siphon does not include other siphons, it is said to be a minimal siphon.
Definition 7 [24]. Let S be a minimal siphon in an S 3   We call (NV, MVo) a controlled Petri net model resulting from the integration of (V, MVo) and (N, Mo), denoted as (V, MVo) ∥ (N, Mo). A control place or monitor is inserted to each SMS to ensure the liveness of a Petri net, and all SMSs can never be unmarked. The proposed policy is simple and guarantees success. However, it leads to a more complex Petri-net-controlled system than the original Petri net model, because the number of added monitors is equal to that of the SMSs in the target Petri net model, and the number of associated arcs is larger than that of the added monitors. According to the strict minimal siphon concept, the developed deadlock prevention approach proposed by [1] is described by Algorithm 1. Step 1: Compute the set of SMS Π for N. Step 3: Output a controlled net (NV, MVo).

Algorithm 2: Integrated Strict Minimal Siphon And Colored Petri Nets-Based Algorithm
Input: Petri net models (N, Mo) and (V, MVo).
Step 4: End Figure 7 shows the proposed single controller for the controlled Petri net model from Figure 2 by using Algorithm 2. In the net shown in Figure 7, when transition t1 fires, the system selects only one token from input place p1, one token from resource place p9, one token of color Cvs1 from pcombined, and one token of color Cvs3 from pcombined, and it transfers them into p2. Moreover, when transition t2 fires, the system selects only one token from operation place p2, one token from resource place p10, and one token of color Cvs2 from pcombined and transfers them into p3. When transition t5 fires, the system selects only one token from input place p8, one token from resource place p11, one token of color Cvs2 from pcombined, one token of color Cvs2 from pcombined, and one token of color Cvs3 from pcombined and transfers them into p5. When transition t2 fires, it creates a color Cvs3 on the tokens from p2 and p10 and transfers them into common place pcombined. In addition, when the transition t3 fires, it creates two colors Cvs1 and Cvs2 on the tokens from p3 and p11 and transfers them into place pcombined. Moreover, when transition t6 fires, the system creates a color Cvs2 on the tokens from p5 and p10 and transfers them into place pcombined. Finally, when transition t7 fires, the system creates two colors Cvs1 and Cvs3 on the tokens from p6 and p9 and transfers them into pcombined.
By default, colors are inherited: when a transition TDCo fires, the system gathers all colored tokens from the input place pcombined and then transfers these colored tokens to the output place pi. However, color inheritance can be prohibited by overriding. After implementing a Petri net model shown in Figure 7 by using the GPenSIM code, we usually obtain three files: the Petri net definition file (PDF), common processor file (COMMON_PRE file), and main simulation file (MSF). Figure 8 shows the resulting PDF file and defines the static Petri net model by declaring the sets of places, transitions, and arcs. Figure 9 shows the MSF file used to compute the simulation results. Figure 10 displays the resulting MSF COMMON_PRE file and defines the conditions for the enabled failure and recovery transitions to st art firing based on the colored tokens, mean time to failure, and mean time to repair.   To make the work more solid and well-positioned, we have developed a Trust-based colored controlled Petri net (TCCPN) [26][27][28][29] and comparing the proposed work with relevant TCCPNs.

Definition 13. Let (N TM, M TMo) be a Trust-based colored controlled Petri net (TCCPN) S 3 PR with NTM = (PA ∪ {p 0 } ∪ PR ∪ {pcombined}, T ∪ TDCi ∪ TDCo, F ∪ FDC, CR, η, τ, ψ, MTMo), and R (N TM, MTMo) be its reachable graph, where 1. η is the arcs weight, which denotes the importance or probability of input arcs into a transition. If there is an arc (p, t), η (p, t) = c indicates there is a probability of η (p, t) encouraging the token entering t from p.
If the token has a capacity h, the new capacity will be h * c.

τ is a time guard for transition t ∈ (T ∪ TDCi ∪ TDCo), τ: t → [e, f], τ (t) indicates transition t can only
fire during e and f. Particularly, if e = f, that indicates the transition can only occur through e. To model a TCCPN, there are many types of factors that can have an influence on trust in colored controlled net S 3 PR, and a non-negative real number can represent the value of each factor type. An assessment process will consume factors for aggregating a new trust value. We use E in to characterize the input factors consumed and use E out to characterize the aggregation trust value. For an assessment process APk, E in (APk) is related to the input place and E ou (APk) is related to the output place. There are rules for firing transitions in a TCCPN and are stated as below:

Definition 14.
A transition Tk under the marking M can be fired when the foll owing conditions are satisfied: where τ(t) is the valid firing time in TCCPN, and E in (APk) is the current value of the token in the input place. E out (APk) is the current value of the token in the output place, and Ψ (pi) is the threshold for entering pi. Note that an assessment process APk may have more than one input place and output place.
Finally, comparing the proposed work with a relevant developed TCCPN is shown in Section 4.

Case Study
In this section, we show the results of the experiments with the proposed approach. Specifically, we use an AMS example available in the literature: the AMS Petri net model given in Piroddi et al. [30], Chen et al. [8], Chen and Li [31], Chen et al. [32], and TCCPN [26][27][28][29]. The Petri net model is displayed in Figure 11; it includes 14 transitions and 19 places. The places can be described as the following set partition: P 0 = {p1, p19}, PR = {p13, …, p18}, and PA = {p2, …, p14}. The properties of the developed Petri net models are obtained using the free GPenSIM tool [22]. We find that it has 282 reachable markings, and the system is not live (it has a deadlock).
In the net displayed in Figure 11, when transition t1 fires, the system selects only one token from input place p1, one token from resource place p17. Additionally, the system selects tokens from pcombined: one token of color Cvs1, one token of color Cvs2, one token of color Cvs3, and one token of color Cvs4. If transition t2 is fired, the system selects only one token from place p2, one token from resource place p16, and one token of color Cvs5 from pcombined. Moreover, when transition t3 fires, the system selects only one token from input place p2, one token from resource place p13, and one token of color Cvs3 from pcombined.
If transition t9 fires, the system selects only one token from input place p19, one token from resource place p18, one token of color Cvs1 from pcombined, one token of color Cvs3 from pcombined, and one token of color Cvs4 from pcombined. In addition, when transition t11 fires, the system selects only one token from input place p9, one token from resource place p15, one token from resource place p17, one token of color Cvs2 from pcombined, and one token of color Cvs5 from pcombined.
When transition t4 fires, the system creates two colored tokens-one of color Cvs2 and one of color Cvs5-and transfers them into the common place pcombined. Moreover, when transition t5 fires, the system adds color Cvs2 to the tokens and transfers them into the common place pcombined. If transition t7 fires, the system creates three colored tokens-one of color Cvs1, one of color Cvs3, and one of color Cvs4-and transfers them into the common place pcombined. Finally, when transition t13 fires, the system creates four colored tokens-one of color Cvs1, one of color Cvs2, one of color Cvs3, and one of color Cvs5-and transfers them into the common place pcombined.
To test and validate the developed GPenSIM code, we compared it with the methods in Piroddi et al. [30], Chen et al. [8], Chen and Li [31], Chen et al. [32], and TCCPN [26][27][28][29]. The simulation was undertaken for 480 min. After running and simulating the Petri net model in MATLAB, we obtained the results summarized in Tables 2 and 3. Table 1 shows the results in terms of the number of monitors, number of arcs, liveness, and reachable marking. We observe that the proposed approach provides a supervisor with only a single control place and 9 arcs, both of which are minimal compared with other techniques in Piroddi et al. [30], Chen et al. [8], Chen and Li [31], and Chen et al. [32]. Table 2 displays the results in terms of utilization of the robots and machines, throughput of Part A and Part B, work-in-process (WIP), and total time in system (throughput time). In terms of the resource utilization, all methods obtain approximately the same values, as shown in Figure 12. Moreover, from the viewpoint throughput, the proposed method can provide greater throughput than other techniques as shown in Figure 13. In term of WIP, the proposed method leads to better WIP than the other techniques as shown in Figure 14. With respect to throughput time of Part A and Part B, overall, the proposed method can obtain less throughput time than other techniques as shown in Figures 15 and 16. Therefore, the proposed method is valid, it can give sufficiently accurate results, and it can potentially be applied to other cases.   Chen et al. [8] Piroddi et al. [24] Chen and Li [25] Chen et al. [26] TCCPN [26][27][28][29] Proposed method Chen et al. [8] Piroddi et al. [24] Chen and Li [25] Chen et al. [26] TCCPN [26][27][28][29] Proposed method Part Throughput Part A Part B Figure 14. Comparison of work-in-process for the Petri net model from Figure 11.

Conclusions
In this paper, we introduce a two-step controlled deadlock policy. In the first step, we create a Petri net controlled model using the deadlock prevention method based on SMSs proposed by [1]. In the second step, all control places obtained after the first step are merged into a single control place based on the colored Petri nets to mark all SMSs. We compare the proposed method with the methods of Piroddi et al. [30], Chen et al. [8], Chen and Li [31], and Chen et al. [32], and TCCPN [26][27][28][29]. According to our results, the proposed controller is more powerful, has a simpler structure, and does not need to calculate reachability graphs; therefore, it has low-overhead computation. The most challenging research topic in the future is that the controlled system that developed by previous deadlock control approaches may undergo changes of control requirements and specifications such as: