Petri Net Model Based on Neural Network for Deadlock Control and Fault Detection and Treatment in Automated Manufacturing Systems

Previously, different deadlock control strategies for automated manufacturing systems (AMSs) based on Petri Nets with reliable resources have been proposed. However, in real-world applications, resources may be unreliable. Therefore, deadlock control strategies presented in previous research studies are not suitable for such applications. To address this issue, this paper proposes a novel three-step deadlock control strategy for fault detection and treatment of unreliable resource systems. In the first step, a controlled system (deadlock-free) is obtained using the “Maximum Number of Forbidding First met Bad Markings Problem 1” (MFFBMP1), which does not consider resource failures. Subsequently, all obtained monitors are merged into a single monitor based on a colored Petri net. The second step addresses deadlocks caused by resource failures in the Petri net model using a common recovery subnet based on colored Petri nets. The recovery subnet is applied to the system obtained in the first step to ensure that the system is reliable. The third step proposes a hybrid approach that combines neural networks with colored Petri nets obtained from the second step, for the detection and treatment of faults. The proposed approach possesses the advantages of modular integration of Petri nets and can also learn neurons and reduce knowledge, similar to neural networks. Therefore, this approach solves the deadlock problem in AMSs and also detects and treats failures. The proposed approach was tested using an example from literature.


I. INTRODUCTION
An automated manufacturing system is a typical example of discrete event systems. It allows different product types to enter at discrete points in time with asynchronous or concurrent operations by sharing resources such as robots, automatic guided vehicles, machines, buffers, and automated tools. In an AMS, each component can be processed according to a given process sequence using a set of system resources.
The associate editor coordinating the review of this manuscript and approving it for publication was Shouguang Wang . However, this sharing of resources can lead to deadlocks; hence, a few operations may remain incomplete. Therefore, deadlock control is essential for AMSs. In addition, resource faults may occur in a real-world system; this can cause new deadlocks in controlled AMSs. In general, a fault is defined as an interruption of an item's ability to perform a particular function [1], and it is synonymous with errors, mistakes, disturbances, or failures leading to unwanted or unbearable equipment behavior [2]. Resource faults cannot be neglected in a real production system. However, a majority of previous studies have only considered the process definition and VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ optimization of the process under ideal conditions. The early detection and treatment of faults is of paramount importance and great practical significance to ensure safe, efficient, and reliable operation of AMSs, and also for avoiding performance degradation, product deterioration, and damage to human health. Therefore, it is essential to develop a robust deadlock prevention policy that can perform fault detection and treatment of unreliable resource systems and also ensure deadlock-freedom in AMSs. Petri nets are a commonly used graphical and mathematical modeling tool suitable for scheduling, deadlock analysis, and control in AMSs [3], [4]. They are convenient for describing characteristics and behaviors such as synchronization, causal dependence, conflict, concurrency, and sequencing in AMSs. Petri nets can also be used to provide behavioral features, such as boundedness and liveness [5], [6]. From a technical perspective, several policies based on Petri nets have been proposed; these policies are based on three strategies: (i) deadlock detection and recovery, (ii) deadlock avoidance, and (iii) deadlock prevention [5], [7]. Most of these policies have proposed deadlock control in Petri nets through structural analysis [3], [8] and reachability graph analysis [9]- [11]. Moreover, three criteria were suggested for assessing and constructing an AMS control supervisor, namely behavioral permissiveness, computational complexity, and structural complexity [5], [12].
In the literature, there have been studies dealing with the development of deadlock control strategies. Some of these studies have assumed that resources in AMSs are reliable [8], [13]- [19], while some others have assumed that they are unreliable [20]- [30]. As an exploratory study on deadlock control for reliable and unreliable resources in AMSs, Wang et al. [22] suggested two strategies for one-unit resource allocation systems with unreliable resources. In the first policy, one unreliable resource was considered, and in the second, several unreliable resources were considered. Chew et al. [23] guaranteed robust system operations by developing two-controller supervisors, where the types of parts could use a central buffer to deal with different unreliable resources. Liu et al. [24] developed recovery subnets to model the failure, and recovery nets of multiple types of unreliable resources for systems of simple sequential processes with resources (S 3 PRs). Deadlocks were prohibited by designing control places based on a divide-and-conquer control policy, which was accomplished by inserting normal/inhibitor arcs between recovery subnets and control places. In some cases, however, a waiting time was required for a failed resource to be repaired, which resulted in a significant reduction in the resource utilization. Liu et al. [29] developed two robust deadlock controls for GS 3 PRs (generalized S 3 PRs) with unreliable resources, based on a reachability graph partition technique, whereby markings were divided into forbidden and legal markings. Thereafter, controlling the deadlocks in a robust way was accomplished by preventing the prohibited markings. Li et al. [31] developed a two-step deadlock control policy and a robust legal marking. In the first step, control places were designed, based on an elementary siphon policy developed in [32], which ensured that the system model was deadlock-free if there was no failure in the resource. The second step addressed failure-induced deadlock control problems. The resource failures were modeled by recovery subnets and recoveries were added into the system derived from the first step. This resulted in an unreliable controlled system. Yue et al. [25] proposed an AMS class deadlock controller policy with multiple unreliable resources using the algorithm modified by Banker, and a set of resource capacity constraints. Liu et al. [33] proposed a deadlock control strategy for GS 3 PRs with unreliable resources, based on elementary siphons theory [34], [35] and the max'-controlled siphon control approach presented in [36]. Al-Ahmari et al. [6] proposed a robust deadlock state feedback control strategy, which consisted of a two-step system with unreliable and shared resources for S 3 PRs. In the first step, a controlled system (deadlock-free) was obtained using a strict minimal siphon, which did not consider resource failures. The second step was designed to deal with the deadlock caused by all the resource failures. A common recovery subnet based on colored Petri nets was proposed. This recovery subnet was applied to the obtained system from the first step to ensure that the system was reliable.
Owing to the broad scope of the problem of detection and treatment of faults and the challenges in achieving real-time solutions to this problem, several approaches for the detection and treatment of AMS faults have been proposed over the past several years. Maki and Loparo [37] proposed a multi-layered feedforward neural network method to detect and diagnose defects in industrial processes; their method required simultaneous monitoring of multiple data. Their results showed that the method based on the neural network was successful in diagnosing and detecting defects associated with prior interim periods. In addition, this method could also be appropriately generalized for industrial processes. Liu et al. [38] applied a multi-layer perceptron neural network approach to develop a continuous-time method to detect and diagnose a continuous motor, using continuous magnets. Their study confirmed the feasibility of the combined use of parameter estimation and classification of a neural network for fault detection and isolation in a motor, through experiments on a real motor. Based on the governing principles of the motor, the model parameters could be easily converted into electromechanical motion parameters, and defects could be detected. In addition, the neural network had the ability to classify patterns. Riascos and Miyagi [39] utilized the distributed Petri nets method to develop a supervisor framework to detect and address failures in the operations in manufacturing systems. The proposed method was efficient, and it effectively created several graphs that represented operational units as manufacturing systems. It could exploit networks that had already been analyzed for model systems without considering anomalous situations. It also had the ability to analyze models for each diagnosis of the failure with a more rational approach.
Riascos et al. [40] proposed a methodology for detecting and treating malfunctions in automated machines. The methodology was based on the integration of Petri diagnostic networks and Bayesian networks. Miyagi and Riascos [41] proposed a methodology for modeling and analyzing manufacturing systems that were fault-tolerant. This methodology helped improve normal production processes and also in the discovery and handling of errors. This approach was based on the hierarchical integration of networks and standard Petri nets. Rajakarunakaran et al. [42] utilized the artificial neural network approach to diagnose and detect defects in technical systems, in order to realize safer factory operations, especially in rotor systems. The proposed neural network model yielded results in almost 100% of the cases, as compared to other methods. Honggui et al. [43] employed a fuzzy neural network approach to design a fault detection system using online sensors and sludge volume index and employed fault diagnosis methods for the waste water treatment process. Their proposed method was subsequently applied to a real wastewater treatment process and compared with other methods. The results demonstrated that the approach was considerably promising for several types of chemical or biological sensors in the wastewater treatment process.
Neural networks have generated significant interest as problem-solving techniques in detection and treatment of faults. The advantage of neural networks is their ability to be generalized to deal with noisy or partial inputs. Neural networks can tackle continuous input data as well. However, the learning needs to be facilitated to solve the problem of detection and diagnosis of faults. Therefore, the major objective of this work is to propose a novel three-step deadlock control strategy for fault detection and treatment of unreliable resource systems. In the first step, a controlled system (deadlock-free) is obtained using ''Maximum Number of Forbidding First-Bad Markings Problem 1'' [44], which does not consider resource failure. The second step addresses issues of deadlock control caused by resource failures. For all the resource failures in the Petri net model, a common recovery subnet based on colored Petri nets is proposed [6]. This recovery subnet is applied to the obtained system from the first step to ensure that the system is reliable. The third step comprises a hybrid approach that combines a neural network with colored Petri nets, obtained from the second step to perform detection and treatment of faults. The proposed approach possesses the advantages of modular integration of Petri nets, and has the ability to learn neurons and reduce the knowledge, as in neural networks. Thus, this approach provides a combination of three features: (i) deadlock-free system without considering resource failure, (ii) detection of faults, and (iii) treatment of faults.
This paper is organized as follows. Section II describes basic concepts of Petri nets and the deadlock prevention policy based on the concept of strict minimal siphon. The robust control of unreliable resources based on colored Petri nets and computational complexity of the proposed policies are presented in Section III. The ''General Petri Net Simulator'' (GPenSIM) code and validation of the developed method is presented in Section V. A real-world AMS case study is presented in Section VI, followed by conclusions and future research presented in Section VII.

II. PRELIMINARIES
This section presents the basics of Petri nets, concept of strict minimal siphon, deadlock prevention policy based on AMSs, and GPenSIM tool.

A. BASICS OF PETRI NETS
be a simple sequential process with resources (S 3 PR) Petri net, where p 0 is a process idle place; P A is a set of operation places, and P R is a set of resources places. P A ∩ P R = ∅. T is a non-empty set of transitions.
be an S 3 PR Petri net, where x and y are nodes in N ), i.e., x, y ∈ P C ∪ T . Then, · x = {y ∈ P C ∪T |(y, x) ∈ F} is called the preset (input) of node x, and x · = {y ∈ P C ∪ T |(x, y) ∈ F} is called the postset (output) of node x. ' where ||I || is not a superset of the support of any other one and its components are mutually prime. Definition 20: where p 0 , P A , P R , T, F, and W are defined as mentioned above. SC is a set of colors that comprises colors c i and the operations on c i . C f is the color function that traces p into colors c i , p ∈ P C , and c i ∈ SC. N f is the node function that traces F into (P C × T ) ∪ (T × P C ). A f is the arc function that traces each flow (arc) f ∈ F into the term e. G f is the guard function that traces each transition t ∈ T to a guard expression g that has a Boolean value. I f is the initialization function that traces each place p ∈ P C into an initialization expression.

B. DEADLOCK PREVENTION POLICY BASED ON AN ITERATIVE METHOD AND COLORED PETRI NETS
In this section, an MFFBMP1 that was developed in [44] is presented to construct a place invariant (PI), which can forbid as many first met bad markings (FBMs) as feasible. Subsequently, the approach of vector covering method is used to determine the minimal covering sets of legal markings and FBMs [5]. The solution of the integer linear programming problem (ILPP) can then derive invariant place coefficients and monitors. The design process of the iterative monitor is performed as follows. At each iteration, the PI is intended to forbid as many FBMs as feasible. All the FBMs forbidden by the PI are removed from the minimal covered set of FBMs. This process is stopped when all the minimal covered set of FBMs are prohibited.
The following mathematical model shows the model developed by [44]. MFFBMP1: The objective function f is used to maximize the number of FBMs that are prohibited by place invariant PI. Denote its optimal value by f * . M * FBM and M * L are defined in Definitions 25 and 26, respectively. N * FBM is used to represent that is to say no FBMs in M * FBM can be prohibited by the place invariant. In (2), let I be a place invariant, where l i s({i|p i ∈ P A }) are the coefficients of I , β is a positive integer variable, and M l (p i ) is the number of tokens in minimal covering set of legal markings, ∀M l ∈ M * L . All legal markings should be kept after the addition of a monitor, meaning that any marking M l ∈ M * L cannot be prevented from being reached; li's coefficients should satisfy (2), which is called the condition of reachability. In (3), Q is a constant positive integer that must be sufficiently large; M k (p i ) denotes the number of tokens in minimal covering set of FBMs; ∀M k ∈ M * FBM and fk a set of M * FBM variables, where f k ∈ {0, 1}, k = 1, 2, . . .). In addition, in (3), f k = 1 indicates that M k is forbidden by I , f k = 0 indicates that this constraint is redundant, and M k cannot be forbidden by I .
is called a synchronous Petri net resulting from the integration of (N x , M x ) and (N y , M y ), expressed as (N x , M x ) (N y , M y ), and satisfying:  Definition 29 [3]: denotes a proposed deadlock controller for N by [44], expressed as (DC, can be simplified and replaced by a colored common deadlock control subnet, which is a Petri net is an initial token with the color markings of the combined monitor, expressed Definition 30 [3]: Theorem 1: The controlled colored S 3 PR Petri net (N CN , M CNo ) is live.
Proof: We must prove that all transitions T , T CCi , T CCo in (N CN , M CNo ) are live. There is no M * FBM , since all t x ∈ T are live. For all t y ∈ T CCi , if ∀p i ∈ · t y , M CN (p i ) > 0, then t y can fire in any case because it is uncontrollable. Thus, Based on the concept of MFFBMP1 [44] and colored Petri net [3], the deadlock-prevention algorithm is developed.

C. ROBUST CONTROL FOR UNRELIABLE RESOURCES BASED ON COLORED PETRI NETS
In Algorithm 1, the resources of the system are usually assumed to be reliable. After applying Algorithm 1 to such a system, one common monitor is inserted. In practice, the resources of the system may fail. Therefore, a common recovery subnet is designed and inserted to model all the resource failures in the system. This section concentrates on the relation between the controlled system in Algorithm 1 and resource failures.
Definition 31 [6]: Let (N CN , M CNo ) be a controlled colored S 3 PR Petri net and r u ∈ P R be an unreliable resource in N CN . A colored common recovery subnet of r u is a Petri net N ccr = ({p i , p combined2 }, {t fi , t ri },F ccr , C F ), where p combined2 is called the recovery place of all p i , t fi is a failure transition, and t ri is the recovery transition. Step 5: Output a controlled colored S 3 PR Petri net (N CN , M CNo ) Step 6: End (p combined2 , t ri ), (t ri , p i )}, and an unreliable resource may fail when it is busy (its holders) or in an idle state r u . Thus, we describe P H = {r u }∪H (r u ) as a set of places, where H (r u ) is a set of holders of r u , expressed by H (r u ) = {p\p ∈ P A , p ∈ · ·r u ∩ P A = ∅}; p i ∈ P H . C F is a set of colors that maps Definition 32 [6]: Let (N CN , M CNo ) be a controlled colored , and let P UR be an unreliable resources set. For all r u ∈ P UR , insert one common recovery subnet for all p i ∈ P H resulting in a colored controlled unreliable S 3 PR Petri net expressed as (N CU , M CUo ) = (N CN , M CNo ) (N ccr , M ccro ), which is the integration of (N CN , M CNo ) and (N ccr , M ccro ).
Definition 33 [6]: Proof: We must prove that all transitions T, T CCi , T CCo , T F , and T R in (N CU , M CUo ) are live. If there is no failure in r u ∈ P UR and for all t x ∈ T , if ∀p i ∈ · t x , M CU (p i ) > 0, then t x can fire. For all t y ∈ T CCi , if ∀p i ∈ · t y , M CU (p i ) > 0, then t y can fire. For all t z ∈ T CCo , if M CU (p combined1 ) > 0, then t z can fire. For all t e ∈ T F , if for all p i ∈ · t e , M CU (p combined2 ) > 0, then t e can fire, leading to M CU (p combined2 ) > 0. For all t s ∈ T R , if M CU (p combined2 ) > 0, then t s can fire. Therefore, we can say that the net (N CN , M CNo ) is live.
Based on above Definitions 31-33 and Theorem 2, the developed unreliable resources based on colored Petri net algorithm is stated as follows. Step 1: for each r u ∈ P UR do 1. Add a failure transition t fi . / * By using Definition 31. * / 2. Assign color C ccri for failure transition t fi . / * By using Definition 31. * / 3. Add a recovery transition t ri . / * By using Definition 31. * / 4. Add an arc from p i to t fi . / * By using Definition 31. * / 5. Add an arc from t fi to p combined2 . / * By using Definition 31. * / 6. Add an arc from p combined2 to t ri . / * By using Definition 31. * / 7. Add an arc from t ri to p i . /By using Definition 31. * / end for Step 2: Output a net (N CU , M CUo ).

D. NEURAL NETWORK PETRI NET MODEL STRUCTURE FOR FAULT DETECTION AND TREATMENT
Neural networks have attracted considerable interest as problem-solving techniques in the detection and treatment of faults. The main element here is a neuron with multiple inputs and a single output. Each input is multiplied by a weight, the inputs are summed, and this quantity is operated by the neuron's transfer function to create an output [46]. Occasionally, the output is referred to as the level of activity. A multi-layer feedforward neural network is utilized in this study, which has one hidden layer. To adjust the weighted sum input of each neuron, the bias unit, whose activity level is corrected at one, is linked to all the neurons in the hidden and output layers. Each application determines the number of neurons in the input and output layers, and the number of neurons in the hidden layer will be adapted throughout the learning phase to enable successful learning of the network.
The learning algorithm for neural network simulates the system of neuronal biology, which relies on a dynamic structure that depends on simulation, inhibition and cooperation, and competition for information processing, to guide the network's learning and working. However, unlike many other neural networks, it does not take network errors or energy function as the algorithm's rules. A neural network can build several types of nets that can organize themselves. Neural networks have many forms and algorithms. However, only the basic structure is mostly used. ; p i , p j ∈ P N , p j is promptly reachable from p i , if p i ∈ · t dm and p j ∈ t dm · , and expressed by p j ∈ PRM (p i ).
Definition 38: Let (N N , M No ) be a neural Petri net model with N N = (P N , T N , F N , X k , Y k , W N , M No ); p i , p j , p k ∈ P N , p k is reachable from p i , if p j ∈ PRM (p i ) and p k ∈ PRM (p j ), and expressed by p k ∈ RM (p i ).
where W N is said to be a place to transition the connectivity matrix, and its element can be expressed as a synaptic weight w ij : ∀i, p j ∈ · t dm i = 1, 2, . . . ,n j = 1, 2, . . . ,m Definition 42: Let (N N , M No ) be a neural Petri net model with N N = (P N , T N , F N , X k , Y k , W N , M No ); the j th neuron whose corresponding input O j ∈ Y N is maximum (i.e., the winner). Therefore, its output value y j is taken as 1; otherwise, the others' output values are taken as 0 and expressed as Definition 43 [46]: is the winner neuron's synaptic weight of the winner j th neuron, whose corresponding input v j ∈ V N and can be updated as where, γ → [0, 1] is a learning rate, which usually takes values [0.01, 0.03]. δ is the number of elements that are equal to 1 in the learning pattern vector X k = ∪ i∈n {x k i }.  Proof: We must prove that all transitions T, T CCi , T CCo , T F , T R , and T N in (N NN , M NNo ) are live. If there is no failure in r u ∈ P UR and for all t x ∈ T , if ∀p i ∈ · t x , M NN (p i ) > 0, then t x can fire. For all t y ∈ T CCi , if ∀p i ∈ · t y , M NN (p i ) > 0, then t y VOLUME 8, 2020 can fire. For all t z ∈ T CCo , if M NN (p combined1 ) > 0, then t z can fire. For all t e ∈ T F , if for all p i ∈ · t e , M NN (p combined2 ) > 0, then t e can fire, leading to M NN (p combined2 ) > 0. For all t s ∈ T R , if M NN (p combined2 ) > 0, then t s can fire. For all t h ∈ T N , if for all p i ∈ P N , p i ∈ · t h , M NN (p i ) > 0, then t h can fire. Therefore, we can say that the net (N NN , M NNo ) is live.
Based on Definitions 34-44 and an algorithm proposed by [46], the developed learning process and solution neural network Petri net model of the fault detection and treatment algorithm is stated as follows:   (N , M o ). Then, all monitors V p will be merged into common monitor p combined1 . Therefore, in the worst case, the computational complexity of algorithm 1 is O(n). Algorithm 2 is used to design a common recovery subnet p combined2 for all unreliable resources in controlled S 3 . Each unreliable resource r u ∈ P UR may fail when it is idle r u or in a busy state H (r u ). Thus, P H as a set of places and defined in Definition 31. Let the number of set of places that require recovery subnets P UR be x, i.e., |P UR | = x. In addition, each recovery subnet requires only one common recovery place for all places in P UR and failure transition and recovery transition for each p i ∈ P UR . Thus, the computational complexity of Algorithm 2 is O(2x). The ''FOR loop'' is executed 2x times to design the common recovery subnet for all unreliable resource in colored controlled S 3 PR (N CN , M CNo ). Thus, the computational complexity is O(2x), which is O(x).

III. NUMERICAL EXAMPLE
To illustrate the proposed methodology, consider the AMS example shown in Fig. 1(a). The S 3 PR Petri net model was given in Chen et al. [44] and Kaid et al. [3]. The system consists of two machines M1 and M2. Each machine processes one part at a time and one robot R1 holds one part at a time. There are two buffers for loading/unloading. In addition, in the system, two types of part A and B are considered to be processed. The operation sequences for the two-part types are illustrated in Fig. 1(b). The Petri net model of this AMS example is shown in Fig. 2. It comprises 11 places and eight transitions. The places can be defined as the following set partitions: P A = {p 2 , p 3 , . . ., p 7 }, P R = {p 9 , p 10 , p 11 }, and P 0 = {p 1 , p 8 }. The Petri net model contains 20 reachable markings. We have M * FBM = {p 3 + p 5 , p 2 + p 5 , p 2 + p 6 } and M * L = {p 5 + p 6 + p 7 , p 2 + p 3 + p 4 }. By considering the application of steps 1 and 2 in Algorithm 1, at the first iteration, assume that I 1 is the place invariant to be computed, and that it satisfies equation (2) for the two legal markings in M * L , i.e., l 5 .1 + l 6 .1 + l 7 .1 ≤ β and l 2 .1 +l 3 .1 +l 4 .1 ≤ β. Thus, we have two constraints: l 5 + l 6 + l 7 ≤ β and We have three variables f 1 , f 2 , and f 3 to reflect whether I 1 prohibits FBM1s FBM 1 = p 3 + p 5 , FBM 2 = p 2 + p 5 , and FBM 3 = p 2 + p 6 , respectively. Thus, we have three constraints: Subsequently, MFFP1 is described as MFFBMP1: We solve the MFFBMP1 and obtain the optimal solution as l 2 = 2, l 5 = 1, l 6 = 1, β = 2, f 2 = 1, f 3 = 1, and all the other variables are zero. Then, a control place V S1 is developed for I 1 : 2µ 2 + µ 5 + µ 6 + µ Vs1 = 2. As a result, I 1 prohibits FBM2 and FBM3, and we have · V S1 = {2t 2 , t 7 }, V S1 · = {2t 1 , t 5 }, and M CNo (V S1 ) = β = 2. Thus, we have At the second iteration, let I 2 place invariant be computed and satisfy equation (2) for the two legal markings in M * L , i.e., l 5 .1 +l 6 .1 +l 7 .1 ≤ β and l 2 .1 +l 3 .1 +l 4 .1 ≤ β. Thus, we have two constraints: l 5 + l 6 + l 7 ≤ β and We have one variable f 1 to reflect whether I 2 prohibits FBM1 FBM 1 = p 3 + p 5 . Thus, we have one constraint: Subsequently, a new MFFBMP1 is described as below. MFFBMP1: max f = f 1 subject to Next, consider the application of step 3 in Algorithm 1. The two obtained control places are merged into p combined1 . The output arcs T CCo of p combined1 are expressed as T CCo = {2t 1 , t 2 , 2t 5 }. The input arcs T CCi of p combined1 are expressed as Thus, we have two color types: C R = {C vs1 , C vs2 }. Therefore, the total number of colored tokens is three, two tokens of C vs1 color and one token of C vs2 color. Fig. 3 displays the proposed single controller for the controlled colored S 3 PR Petri net model shown in Fig. 2, obtained by using Algorithm 1. Fig. 3 shows that if transition t 1 fires, it chooses two tokens with color C vs1 from the common place p combined1 , one token from p 9 , one token from the input place p 1 , and deposits them into p 2 . If transition t 2 fires, it chooses one token with color C vs2 from the common place p combined1 , one token from p 2 , one token from p 10 , and deposits them into p 3 . In addition, if transition t 5 fires, it chooses one token with color C vs1 from the common place p combined1 , one token with color C vs2 from the common place p combined1 , one token from p 11 , one token from input place p 8 , and deposits them into p 5 . If transition t 2 fires, it generates two colors C vs1 on the tokens from p 2 and p 10 , and deposits them into common place p combined1 . Moreover, if transition t 3 fires, it generates one color C vs2 on the tokens from p 3 and p 11 , and deposits them into the common place p combined1 . If transition t 6 fires, it generates one color C vs2 on the tokens from p 5 and p 10 , and deposits them into the common place p combined1 . Finally, if transition t 7 fires, it generates one color C vs2 on the tokens from p 6 and p 9 , and deposits them into the common place p combined1 . To validate Algorithm 1 developed earlier, we have coded Algorithm 1 using the GPenSIM tool [3], [47], and the results from the code are compared with Ezpeleta et al. [48], Chen et al. [44], and Kaid et al. [3]. Table 1 and Fig. 4 show the results for the number monitors and arcs, initial marking, reachable markings, and liveness. We observe that the obtained controlled colored S 3 PR Petri net model by Algorithm 1 has minimal structural complexity compared to the methods used by Ezpeleta et al. [48],  Chen et al. [44], and Kaid et al. [3]. For a comparison of the performance time criteria, the simulation was performed for 480 min in MATLAB. The results of the simulation are illustrated in Table 2, which shows the results in context of the performance time criteria. Overall, the proposed model based on Algorithm 1 is better in terms of resource utilization than the other techniques from the literature while also achieving greater overall throughput but less throughput time per part.
If machine 1 breaks down in busy state p 2 or p 7 , i.e., t f 2 or t f 7 fires, it generates a token of color C ccr2 from p 2 or a token of color C ccr7 from p 7 , and deposits the same into p combined2 . If machine 1 breaks down in idle state p 9 , i.e., t f 9 fires, it generates a token of color C ccr9 from p 9 , and deposits it into p combined2 .Then, machine p 9 is repaired, and the token with color in p combined2 moves into p 2 , p 7 , or p 9 by firing t r2 , t r7 , or t r9 .If the transition t r2 , t r7 , or t r9 fires, it chooses the token with color C ccr2 , C ccr7 , or C ccr9 from p combined2 and deposits it into p 2 , p 7 , or p 9, implying that the recovery of machine 1 p 9 is completed. If robot 1 breaks down in busy state p 3 or p 6 , i.e., t f 3 or t f 6 fires, it generates a token of color C ccr3 from p 3 or a token of color C ccr6 from p 6 , and deposits the same into the p combined2 . If robot 1 breaks down in idle state p 10 , i.e., t f 10 fires, it generates a token of color C ccr10 from p 10 , and deposits it into p combined2 . Then, robot 1 p 10 is repaired, and the token with color in p combined2 moves into p 3 , p 6 , or p 10 by firing t r3 , t r6 , or t r10 . If the transition t r3 , t r6 , or t r10 fires, it chooses the token with color C ccr3 , C ccr6 , or C ccr10 from p combined2 and deposits the same into p 3 , p 6 , or p 10 , implying that the recovery of robot 1 p 10 is completed. Finally, if machine 2 breaks down in busy state p 4 or p 5 , i.e., t f 4 or t f 5 fires, it generates a token of color C ccr4 or a token of color C ccr5 , from p 4 or p 5 , respectively, and deposits the  same into the p combined2 . If machine 2 breaks down in idle state p 11 , i.e., t f 11 fires, it generates a token of color C ccr11 from p 11 , and deposits it into p combined2 . Then, machine 2 is repaired, and the token with color in p combined2 moves into p 4 , p 5 , or p 11 by firing t r4 , t r5 , or t r11 . If the transition t r4 , t r5 , or t r11 fires, it chooses the token with color C ccr4 , C ccr5 , or C ccr11 from p combined2 and deposits it into p 4 , p 5 , or p 11, implying that the recovery of machine 2 p 11 is completed.
To validate the developed Algorithm 2, we have coded the algorithm using the GPenSIM tool [3], [47], and the results from the code are compared with those of Al-Ahmari et al. [6]. Table 3 and Fig. 6 show the results in the context of the performance time criteria. Overall, the proposed model based on Algorithm 2 is better in terms of resource utilization than that of Al-Ahmari et al. [6]. In addition, the proposed model can obtain greater overall throughput, but less throughput time per part than the latter.
Finally, to illustrate the performance of the proposed Algorithm 3, consider an unreliable S 3 PR net model displayed in Fig. 5. The proposed Algorithm 3 is used to detect the type of failure of the parameters given, which results in various faults. For this purpose, the neural network approach has two phases, training and testing. The neural network is trained during the training phase to detect the underlying significant relation between the selected inputs and outputs.
The networks were tested after training with a test data set that was not used for training. When the networks have been trained and tested, they are ready to detect the faults under various operating conditions. The following concerns are to be tackled while developing the model for system failure detection: (a) input and output variable selection, (b) data generation, (c) data normalization, and (d) network structure selection and network training. TABLE 4. Names of the input variables in the system displayed in Fig. 7.

TABLE 5.
Names of the outputs in the system displayed in Fig. 7.
Using an unreliable S 3 PR net model displayed in Fig. 5, the required data were obtained. The data consisted of four input variables (continuous variables) [49]- [51], which are listed in Table 4 and one output that is labeled as a fault (exactly one fault), is listed in Table 5 In this study, the dataset selected for evaluating the proposed model is segmented into three subsets, which include training, validation, and test sets. In the learning phase, Algorithm 3 uses the training dataset to determine the feature vector; the test phase uses the dataset to calculate the accuracy of fault detection; and the validation phase uses the dataset to decide to stop the iterations to achieve the maximum generalization capacity. The complete dataset comprised 2250 patterns belonging to all of the five faults types. Furthermore, the dataset contained 75% training, 5% validation, and 20% testing patterns. The generated data were utilized as 1687 patterns for training, 113 patterns for validation and 450 patterns for testing. The training data were completely different from the testing data. Fig. 7 shows the neural colored controlled unreliable S 3 PR Petri net model for fault detection in the unreliable model displayed in Fig. 7. Note that only one unreliable resource can fail at a time.
In the input layer displayed in Fig. 7, the data extraction system was made up of an accelerometer x 1 , electrical current sensor x 2 , strain gage x 3 , coolant sensor x 4 , sensor in the robot's grip x 5 , and acoustic emission sensor x 6 . An acquisition signal system collects the signals of these sensors that identify the machine tool states (normal or abnormal). The signal peaks produced by the machine tool may be ''random'' or ''uniform''. Signals with uniform peaks imply erroneous programming of the machining parameters or slight tool-wear. On the other hand, signals with random peaks imply very high tool-wear or tool-break. The load or unload process can be monitored by sensors in the robot's grip or wrist. The crashing or collision effects can be detected from the differences between the sensor signals and the kinematics/dynamics effects [52].
In the output layer displayed in Fig. 7, the effects of failures are related to tool wear, tool break, coolant lack, programming mistakes, and the robot's grip or wrist. Failures resulting from programming errors, such as an erroneous machine parameter or non-appropriate tools produce uniform peaks. Failures caused by tool-break produce random peaks. Failures from tool-wear are recognized by uniform peaks and motor oscillations. Failures owing to the robot's grip or wrist are recognized by the differences between sensor signals and kinematics/dynamics effects. Finally, failures resulting from a lack of coolant produce coolant failures. The suggested treatments used to recover a failed machine or robot are shown in Table 6. The treatments include parameter change t t1 , tool change t t2 , intervention of human operator t t3 , or coolant change t t4 . If the neural subnet model output is tool wear failure [1 0 0 0 0], the suggested treatment will require a parameter change. If the neural subnet model output is tool break failure [0 1 0 0 0], the suggested treatment is a tool change. When the neural subnet model output is coolant failure [0 0 1 0 0], the suggested treatment is a coolant change. In addition, if the neural subnet model output is a programming error or machining parameter failure [0 0 0 1 0], the suggested treatment is a parameter change. Finally, when the neural subnet model output is a robot's grip or wrist failure [0 0 0 0 1], the suggested treatment will involve intervention by human operator. Many training experiments were conducted to determine the optimal network structure and the best training parameters of the neural networks, which can yield minimal errors during the training phase. Similarly, several training experiments with various numbers of the hidden neurons with 1, 4, 7, 9, and 12 neurons were trained to analyze the effect of the number of neurons in the hidden  layer on the performance of fault detection. We used a neural network with 12 hidden layers for this purpose. Fig. 8 shows the results from the proposed model. The proposed algorithm can detect faults as a function of time. The optimal value of mean square error (MSE) corresponding to 26 iterations is 0.14567 with a learning rate of 0.0001, and the accuracy of the model is 96%, as summarized in Table 7. To illustrate how the value of learning rate γ influences the convergence of the proposed algorithm, Fig. 9 shows how much we change the weights of W at each step. If γ is too small, then the algorithm converges slowly towards the optimal solution. On the other hand, if γ is too large, the algorithm deviates and produces a significant loss of performance. Fig. 10 demonstrates that we achieve the best solution corresponding to a correlation coefficient (R = 0.92074),   which indicates the effectiveness of Algorithm 3. In addition, it is observed that the correlation coefficient value properly represents the quality of fault detection. It follows from these results that the proposed algorithm, integrated with regression is better suited and more practical when dealing with problems of detection and treatment of faults.
Finally, Algorithm 3 was compared with that of Al-Ahmari et al. [6] and Algorithm 2. Table 8 and Fig. 11 show the results with respect to the performance time criteria.
Overall, the proposed model based on Algorithm 3 is better in terms of resource utilization than that of Al-Ahmari et al. [6] and Algorithm 2. In addition, the proposed model can obtain greater throughput than the latter two, and also achieve less throughput time per part than the latter two.

IV. CONCLUSIONS
This paper presents a three-step robust deadlock control strategy for fault detection and treatment of unreliable resource systems in an AMS. In the first step, a controlled system was obtained using MFFBMP1, which did not consider resource failure. The second step addressed the problems of deadlock control caused by resource failures. For all the resource failures in the Petri net model, a common recovery subnet based on colored Petri nets was proposed. The recovery subnet was added to the obtained system at the first step to ensure that the system was reliable. The third step proposed a novel hybrid approach that combined neural networks with colored Petri nets, which were obtained at the second step to detect and treat faults. The proposed strategy was validated using the GPenSIM tool and compared with existing methods in the literature.
The major advantages of the developed strategy are as follows: (i) It has a simpler structure and low-overhead computation, and is more powerful compared with Ezpeleta et al. [48], Chen et al. [44], Kaid et al. [3], and Al-Ahmari et al. [6]. (ii) It takes the descriptive advantages of modular integration of Petri nets and has the ability to learn neurons and reduce the knowledge, as in neural networks. (iii) It can be applicable to other types of complex AMSs (e.g., liquid-crystal display manufacturing and semiconductor fabrication) by considering suitable variables and faults. It can include automated guided vehicles, automated storage and retrieval systems, and machines. (iv) It can consider systems that require sequential and complex resources. (v) It provides a combination of three types of procedures: deadlock-free system without considering resource failure, detection of faults, and treatment of faults. (vi) It considers not only solving deadlock problem in AMSs but also detection and treatment of failures.
The main drawback of the proposed approach is that it may undergo changes in control specifications and requirements, such as changing the system's processing routes or adding new machines, and new products. In the event of the system facing these issues, the system needs to be reconfigured.
Then, new deadlock problems can occur in the proposed model. Therefore, our future research will further investigate the proposed methodology to improve its efficiency for valid and rapid reconfiguration of manufacturing systems.
EMAD ABOUEL NASR received the Ph.D. degree in industrial engineering from the University of Houston, TX, USA, in 2005. He is currently a Professor with the Industrial Engineering Department, College of Engineering, King Saud University, Saudi Arabia, and an Associate Professor with the Mechanical Engineering Department, Faculty of Engineering, Helwan University, Egypt. His current research interests include CAD, CAM, rapid prototyping, advanced manufacturing systems, supply chain management, and collaborative engineering.
ADEL AL-SHAYEA was a consultant with the King Saud University Rector's Office and worked for SABIC Marketing Ltd., Riyadh, and the Institute of Public Administration (IPA). In addition, he is a consultant with the King Abdullah Institute of Research and Consulting Studies. He is a Consultant Industrial Engineer (CE-SCE). He is a member of the Saudi Council of Engineers (SCE), Saudi Arabia, as well as a member of several committees, such as the national committee for the codification and standardization of operation and maintenance works. He is currently the Assistant Vice President for academic and educational affairs with King Saud University. He participated and conducted several consultative works for governmental and private organizations. He also refereed several engineering works in Saudi Arabia. He worked as an Engineering Consultant for several industrial organizations in Egypt. His current research interests include optimization modeling, theory, and algorithm design with applications in waste management and energy management, financial engineering, and big data. VOLUME 8, 2020