Fault Diagnosis of Backward Conflict-Free Petri Nets by Generalized Markings

This paper addresses the fault diagnosis problem in discrete event systems using backward conflict-free Petri nets, where two different transitions have no common output places. The notion of generalized markings is employed, where the number of tokens in a place can be negative. Based on the special structures of backward conflict-free Petri nets and the generalized marking corresponding to an observed transition sequence, an integer linear programming (ILP) problem is constructed where the numbers of unknown integer variables and constraints are independent of the length of the observed transition sequence. A diagnosis algorithm is proposed by associating two different objective functions with the ILP problem and solving it. The computational efficiency of the proposed algorithm depends on the net structure only, regardless of the length of an observed transition sequence.


I. INTRODUCTION A. BACKGROUND
The rapid development of electronic information technology has spawned many complex man-made systems, such as intelligent transportation systems and automated manufacturing systems. These systems generally evolve as discrete state spaces and event-driven state transition mechanisms, which can be regarded as discrete event systems (DESs) at a certain level of abstraction [1], [2]. It is a particularly challenging task to ensure the reliable operation of these complex systems. As one of the tools to complete the task, fault diagnosis has received extensive attention in recent decades.
Petri nets are one of the typical mathematical models of DESs. The distributed nature and structural properties of Petri nets play an important role in solving various problems of DESs, including supervisory control [3]- [8], performance optimization [9]- [13], and big data [14]- [17]. In this paper, we address the fault diagnosis issue of a class of Petri nets.
In the context of DESs, Sampath et al. [18] originally define and solve the diagnosis problem based on finite state The associate editor coordinating the review of this manuscript and approving it for publication was Jenny Mahoney. automata, where the event set is partitioned into observable and unobservable ones and the faults are characterized by some of unobservable events (called faulty events). The defined diagnosis problem consists in inferring the occurrences of faulty events according to the observed event sequence. They first off-line construct a deterministic finite automaton, called a diagnoser, containing diagnosis information based on the given automaton model of a plant. Then, an online diagnosis algorithm as well as a necessary and sufficient condition for diagnosiability is reported by inspecting the diagnoser. Debouk et al. [19] extend the work in [18] to DESs with decentralized architecture and propose three protocols to realize the decentralized architecture. A reader is referred to [20]- [23] for a detailed discussion of automatonbased supervisory control and fault diagnosis.
By extending the automaton-based approach proposed in [18], the study in [24] deals with the fault diagnosis issue in the context of Petri nets, where a Petri net diagnoser is built by enumerating the reachability set of the net model. In [25], a monolithic interpreted Petri net (IPN) model including all possible faulty states is first constructed by combining the sub-models of system components. Then, a diagnosis algorithm based on the IPN model is exposed. 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/ By assuming that the unobservable subnet of a net model of a plant is acyclic, a variety of diagnosis approaches without analyzing the reachability graph are reported. In [26], the concept of basis markings is first introduced. For a bounded Petri net, its basis reachability graph (BRG) consisting of basis markings and observable transitions is constructed off-line and an efficient diagnosis algorithm is exposed by traversing the BRG according to the observed transition sequence. The application of this approach to manufacturing systems is investigated in [27].
In [28], an online diagnosis algorithm is reported by constructing and solving an integer linear programming (ILP) problem. The size of the ILP problem is linear with respect to the observed transition sequence and thus the size of such an ILP problem becomes too big to be solved in an acceptable time when the observed sequence is very long. The approach in [28] is extended to distributed systems using labeled Petri nets in [29].
Basile et al. [30] originally define the notion of generalized markings (g-markings) and address the diagnosis problem by building ILP problems according to the reached g-marking and solving them. In [31], the equivalence of partially observed Petri nets and labeled Petri nets in the sense of fault diagnosis is first proved and then a diagnosis algorithm for labeled Petri nets is proposed by exhaustively enumerating all possible markings reached when observing an event.
The problem of fault diagnosis is also addressed using high-level nets, such as time nets [32] and stochastic nets [33]. On the other hand, diagnosability analysis [34]- [37] and fault prognosis [38], [39] are two closely related problems to fault diagnosis that explore if the occurrence of a fault can be detected with a finite delay and predict a fault before its occurrence, respectively. However, we concentrate on dealing with the problem of fault diagnosis using Petri nets in this paper.

B. CONTRIBUTIONS
The computational efficiency of the existing approaches for fault diagnosis of Petri nets usually decreases with the increase of the length of the observed transition sequence. Specifically, the numbers of unknown integer variables and constraints of the ILP problems constructed in [28], [29] are linear with the length of the observed transition sequence. In [30], the number of times of solving ILP problems is linear with respect to the length of the observed transition sequence. Moreover, the algorithm in [31] exhaustively enumerates all possible markings that are reachable after firing an observed transition at each step. For a long transition sequence of largescale systems, it is difficult to perform fault diagnosis in an acceptable time by using these algorithms.
In this paper, we deal with the fault diagnosis problem of DESs that can be modeled as backward conflict-free Petri nets, where two different transitions cannot share the same output places, using generalized markings originally defined by Basile et al. in [30]. Based on the special structures of backward conflict-free nets and generalized markings, an efficient diagnosis approach is reported.
The numbers of unknown integer variables and constraints of an ILP problem constructed in this approach are independent of the length of the observed transition sequence. This means that the running time of the proposed algorithm does not increase even if the observed sequence is very long. We also extend the proposed approach to labeled Petri nets, where multiple transitions can have the same label.
The paper is organized as follows. Section II recalls the Petri net formalism and some preliminaries. In Section III, we formalize the diagnosis problem of Petri nets and propose a diagnosis algorithm based on generalized markings and integer linear programming. In Section IV, we extend the proposed algorithm to the case of labeled Petri nets. Finally, Section V draws the conclusions.

II. PRELIMINARIES
This section recalls the basic definitions of Petri nets and some preliminaries used in the paper. More details on Petri nets can be found in [2] and [40].

A. BASICS OF PETRI NETS
A Petri net is a four-tuple G = (P, T , Pre, Post), where P = {p 1 , . . . , p m } is the set of places with cardinality m, T = {t 1 , . . . , t n } is the set of transitions with cardinality n, Pre : P × T → N 1 and Post : P × T → N are the pre-and post-incidence matrices, respectively, which specify the arcs of the net. Pictorially, places and transitions are represented by circles and bars, respectively. The incidence matrix of a net is denoted by C = Post − Pre.
For a transition t ∈ T , its preset (the set of input places) is defined as • t = {p ∈ P | Pre(p, t) > 0}, and its postset (the set of output places) is defined as t • = {p ∈ P | Post(p, t) > 0}. Analogously, we define the preset and postset of a place p ∈ P as • p = {t ∈ T | Post(p, t) > 0} and p • = {t ∈ T | Pre(p, t) > 0}, respectively.
A directed cycle of net G is represented as τ 1 . . . τ r , where . . r, and τ 1 = τ r . Clearly, a self-loop is the simplest form of a directed cycle. A Petri net is said to be acyclic if it has no directed cycle.
A marking of a Petri net is a mapping M : P → N that assigns to each place a non-negative integer representing the number of tokens in the place. Graphically, a token is usually denoted by a black dot. We use x 1 p 1 + · · · + x m p m to denote the marking [x 1 , . . . , x m ] T for convenience. By associating an initial marking M 0 with a net G, we obtain a Petri net system, denoted as G, M 0 .
A transition t ∈ T is said to be enabled at marking M if there are sufficient tokens in its input places, i.e., ∀p ∈  A transition sequence The final marking M h is said to be reachable from M by firing σ , denoted as M [σ M h . We write t ∈ σ to represent that t is a transition contained in transition sequence σ . The reachability set of Petri net system G, M 0 , denoted by R(G, M 0 ), is the set of all markings reachable from M 0 . The language of Petri net G is the set of transition sequences that are enabled from M 0 , formally defined by Given a transition sequence σ ∈ T * , we define a function π : T * → N n to compute the number of occurrences of transition t ∈ T in σ such that y = π (σ ) and y(t) = h if t is contained h times in σ . A marking M that is reachable from M 0 by firing a sequence σ ∈ T * , i.e., M 0 [σ M , can be computed by the following state equation: which provides a linear algebraic characterization of the state space of a net system. Theorem 1 [40]: Given an acyclic Petri net with initial marking M 0 , a marking M ≥ 0 is reachable from M 0 if and only if there exists a non-negative integer vector x such that Definition 1: A net is said to be backward conflict-free if for any two transitions t a , t b ∈ T with t a = t b , it holds t a In a Petri net for fault diagnosis, a fault is often characterized by an unobservable transition, called faulty transition (an observable fault can be readily detected). Meanwhile, there also exist some regular unobservable transitions. As a result, the unobservable transition set T u is further divided into the set T f of faulty transitions with n f = |T f | 2 and the set T reg of regular unobservable transitions with n reg = |T reg |, i.e., T u = T f ∪ T reg . Obviously, it holds n = n o + n u = n o + n f + n reg . ♦

C. LABELED PETRI NET
In a real-world system, because of financial or technical reasons, a sensor is usually used to monitor two or more system events whose occurrences have the same output. To model such a situation, we assign to each transition a label by defining a labeling function : T → E ∪ {ε}, where E is the given event set and ε stands for an empty string. An unobservable transition t ∈ T u is associated with a label ε and thus we have T u = {t ∈ T | (t) = ε}. At the same time, we assign an observable transition t ∈ T o a label from set E and have Note that two or more observable transitions may have the same label. The set of transitions that are assigned a label e ∈ E is denoted by T e = {t ∈ T | (t) = e}.
A labeled Petri net system G, M 0 , E, is a Petri net system G, M 0 that is associated with a labeling function We point out that the class of Petri nets can be viewed as a special subclass of labeled Petri nets by assuming E = T o and assigning each observable transition Analogous to the function π , two functions π o : T * o → N n o and π u : T * u → N n u are defined to map an observable transition sequence σ o and an unobservable transition sequence σ u to an n o -dimensional vector and an n u -dimensional vector, respectively. The labeling function can be extended to a sequence σ ∈ T * such that . . t h with h being a positive integer. Clearly, for a transition sequence σ ∈ T * , the sequence ω = (σ ) consists of the labels of all observable transitions in σ and is called an observation. 3 Given a labeled net system G, M 0 , E, , we use to denote the set of its observations. Given an observation ω ∈ L E (G, M 0 ), we use to represent the set of consistent transition sequences with ω.
In plain terms, the set (ω) contains all transition sequences δ's in L(G, M 0 ) such that ω = (δ) and the last transition of δ is observable.

III. FAULT DIAGNOSIS OF PETRI NETS A. PROBLEM FORMULATION
Fault diagnosis aims to detect and isolate the occurrences of faults according to the observation of a system. In the context of Petri nets, the observation of a system is often described in terms of observable transition sequences (label sequences for labeled Petri nets). On the other hand, given an observation ω ∈ E * , the diagnosis result can be characterized by a mathematical function : (ω, t f ) = N if t f does not occur according to ω, U if the occurrence of t f is uncertain, and F if t f has occurred with certainty. Since the class of Petri nets is a special subclass of labeled Petri nets, the diagnosis functions for Petri nets and labeled Petri nets are uniformly defined as follows.
Definition 3: The diagnosis function : i.e., one of the consistent sequences contains t f and the other does not.
♦ In this paper, we make two assumptions on the structure of the considered Petri net: Assumption (A1) restricts Petri net G to have a special structure, i.e., any two transitions have no common output places, which is the basis of the generalized-marking-based solution (see Subsection III-B). Like some studies for fault diagnosis [26], [28], [30], we hold Assumption (A2) to utilize the necessary and sufficient condition of Eq. (1).
Note that, in this section, we only solve fault diagnosis problem of Petri nets. An extended version of the solution is provided in Section IV for the diagnosis of labeled Petri nets. Up to this point, the problem to solve in this section can be stated as follows.
Problem 1: Given a Petri net system G, M 0 satisfying Assumptions (A1) and (A2) and an observation Traditionally, a marking of a net, as defined in Section II, is a non-negative integer vector. However, Basile et al. [30] define a new kind of marking that can contain negative entries, called a generalized marking (abbreviated as g-marking). In this paper, we propose an efficient diagnosis approach based on g-markings, which is applicable to backward conflict-free Petri nets. Formally, a generalized marking can be defined as follows.
♦ In a Petri net system G, M 0 , if a transition t is not enabled, then it cannot be fired according to the firing rule defined in Section II such that each reached marking does not contain negative elements. However, if we force a transition t that is not enabled at marking M to ''fire'', a new marking with negative elements, i.e., a generalized marking M, would be obtained, which is computed by the state equation Eq. (1), i.e., M = M + C · π (t). The negative elements of a generalized marking usually imply a lack of resources or that some necessary actions (or events) should be performed before the observed ones in some real-world systems.  implies that the unobservable transitions t 3 and t 6 should be fired to enable t 4 and t 7 , respectively. Thus, it is possible to develop a fault diagnosis algorithm by means of the negative elements in a generalized marking. The remainder of this paper is devoted to achieving such a goal. ♦ Example 2: In this example, we give some intuition to further explain Assumption (A1), i.e., the considered Petri net is backward conflict-free. Consider the net shown in Fig. 2, If the observation is σ o = t 3 t 2 , the corresponding generalized marking is M = [1, 0, 0, 1] T by Definition 5. It is clear that there is no negative element in M and thus the diagnosis algorithm based on negative elements of a generalized marking may become invalid. For example, if the observation is σ o = t 3 t 2 , it is certain that faulty transition t 1 has occurred. However, this fact cannot be reflected by inspecting the negative elements of M. To avoid such a situation, we assume that the considered Petri net is backward conflict-free, i.e., any two transitions cannot have common output places.
♦ In this subsection, we provide a solution for Problem 1 based on g-markings and integer linear programming. Moreover, the number of unknown integer variables of the build ILP problem is only related to the cardinality of T u . First, let us consider a theorem that is the theoretical foundation of the proposed diagnosis algorithm.
Theorem 2: Given a Petri net system G, M 0 and an if and only if there exists a vector y satisfying the following equation where h ∈ N and n u is the cardinality of set T u .
According to Theorem 2, for an observation σ o ∈ T * o , if we find a solution to Eq. (2), say y, then there exists one or more transition sequence σ ∈ L(G, M 0 ) corresponding to y such that σ ∈ (σ o ). On the other hand, for a sequence σ ∈ (σ o ), we can always find a vector y that satisfies Eq. (2). Thus, we can specify an objective function to Eq. (2) to detect the occurrence of faults in a system.
Corollary 1: Given a Petri net system G, M 0 with T u = T reg ∪ T f and an observation Proof: If β 1 = min y(t f ) > 0, then there must exist a vector y i with i ∈ {1, . . . , h} in Eq. (3) such that y i (t f ) > 0. We prove this by contradiction. If there is no vector y i with y i > 0 in Eq. (3), then it holds y i (t f ) = 0 for i = 1, . . . , h. Thus, we can find a new solution y A = y 1 + . . . + y h to Eq. (2) with min y A (t f ) = 0. This contradicts the assumption. Without loss of generality, we assume y 1 (t f ) > 0. Then, we conclude that the unobservable transition sequence σ u 1 with y 1 = π (σ u 1 ) contains faulty transition t f , i.e., for each σ = σ u 1 t α 1 . . . σ u h t α h ∈ (σ o ), it holds t f ∈ σ . According to Definition 3, we have (σ o , t f ) = F. Corollary 2: Given a Petri net system G, M 0 with T u = T reg ∪ T f and an observation Proof: If a solution to Eq. (2) satisfies β 2 = 0, for each vector y i with i = 1, . . . , h in Eq. (3), it holds y i (t f ) = 0. Thus, each unobservable transition sequence σ u i with i = 1, . . . , h does not contain t f , i.e., each sequence σ = σ u 1 t α 1 . . . σ u h t α h ∈ (σ o ) corresponding to the solution does not contain t f . According to Definition 3, we prove (σ o , t f ) = N . Based on Corollaries 1 and 2, we next present Algorithm 1 that reports the diagnosis decision for each fault t f ∈ T f VOLUME 8, 2020 corresponding to an observation σ o of a net system. Algorithm 1 is simply explained as follows. We first in Line 1 initialize an empty vector D that collects the diagnosis of each fault t f ∈ T f in sequence. Then, on the basis of the inputs, i.e., the net system G, M 0 and the observation σ o , two integer linear programming models, i.e., Eqs. (4) and (5) in Corollaries 1 and 2, are built in Lines 3 and 4, respectively. We perform fault diagnosis of t f ∈ T f in Lines 5-13 and record the diagnosis result in D in Line 16. The correctness of the algorithm is ensured by Corollaries 1 and 2.

C. AN ILLUSTRATIVE EXAMPLE
In this subsection, we present an illustrative example to show the possible industrial applications of backward conflict-free nets. Consider the workshop shown in Fig. 3 that contains three production lines. The first one starts by firing t 1 that takes a raw part from place p 1 . Then, two parallel operations modeled by t 4 t 8 and t 5 t 9 , respectively, are performed. Finally, the operation t 12 takes two intermediate parts from p 11 and p 12 and forms a finished product that is transported (modeled by t 15 ) by an automatic guided vehicle. The operation sequences of the second and third production lines are described as t 2 t 6 t 10 t 13 and t 3 t 7 t 11 t 14 , respectively.
Places p 1 , p 2 and p 3 are called resource places and the other ones are buffer places. Transition t 2 takes two different raw parts from p 2 and p 3 respectively. There are two possible faults in this workshop modeled by t 16 (loss of intermediate parts) and t 18 (behavioral abnormality of t 6 ) respectively. The unobservable transition set is T u = {t 1 , t 2 , t 4 , t 9 , t 11 , t 16 , t 18 } with T f = {t 16 , t 18 }. The initial marking is M 0 = 30p 1 + 30p 2 + 20p 3 .
Assume that the observed transition sequence is σ = σ t 12 where σ = t 5 t 3 t 7 t 5 t 8 t 12 t 15 t 6 t 10 t 13 t 5 t 8 ∈ T * is a prefix of σ and t 12 ∈ T o is the last observed transition. The generalized marking corresponding to σ is computed by For σ = σ t 12 and t 16 ∈ T f , Eq. (4) is built as According to Algorithm 1, one can verify that (σ, t 16 ) = U and (σ, t 18 ) = F.

D. COMPUTATIONAL COMPLEXITY
The main computational load of Algorithm 1 stems from solving two ILP problems, i.e., ILPP 1 and ILPP 2. In what follows, we analyze the size of the programming problem shown in Eq. (2). It is easy to verify that the number of integer variables is I = n u and the number of constraints is i.e., for an observation σ o = t α 1 . . . t α h , the size of the programming problem is independent of the length of σ o . This is particularly significant when the observation is very long.
The generalized-marking-based and ILP-based diagnosis approaches for Petri nets (a superclass of backward conflictfree nets) are originally proposed in [30] and [28], respectively. Analogous to this paper, they assume that the unobservable subnet is acyclic and compute the minimal or maximal objective value of an integer linear programming to perform diagnosis. Since backward conflict-free nets are a subclass of Petri nets, the results of these two approaches can be applied to solve Problem 1 defined in this paper.
To apply the results reported in [28], one need to replace Eq. (2) occurring in Eqs. (4) and (5)  On the other hand, by viewing σ o = t α 1 . . . t σ h as the concatenation of each observed transition and recording the diagnosis decisions after t σ h only, the online fault detection algorithm proposed in [30] can be used to solve Problem 1. However, the online fault detection algorithm has to solve an integer programming problem with n u variables and m constraints 2·h times. Fortunately, the size of our ILP problem (i.e., Eq. (2)) as well as the number of times to solve it is independent of σ o . This means that the running time of our algorithm does not increase as the length of the observed transition sequence increases.
Let us consider the net shown in Fig. 3 where T f = {t 16 , t 18 } and assume that the following five transition sequences are given: We use the symbol • to denote the concentration of two transition sequences such that a new sequence σ = σ 1 • σ 2 is the concentration of σ 1 and σ 2 . Moreover, we extend the symbol • to the concentration of multiple transition sequences such that the resulting sequence is σ = σ 1 • σ 2 • · · · • σ i with i ∈ {2, 3, 4, 5}. For convenience, we denote the concentration of transition sequences by σ 1-j with j ∈ {1, 2, 3, 4, 5} satisfying σ 1-j = σ 1 • · · · • σ j . For five observations represented as σ 1-k with k = 1 . . . 5, we build the ILP problems by Eq. (2) and Eq. ξ (ω, M 0 , Post, Pre) in [28], respectively, and the running times to perform diagnosis are shown in Table 1.
In Table 1, the length of an observation σ 1-k ∈ L E (G, M 0 ) with k ∈ {1, 2, 3, 4, 5} is 4 · k. The columns ''time 1 (s)'' and ''time 2 (s)'' list the running times (in seconds) to perform diagnosis by solving the ILP problems constructed according to Eq. (2) and Eq. ξ (ω, M 0 , Post, Pre) in [28], respectively, which is tested using GUROBI solver on a computer with a 2.5GHz processor. The column ''diagnosis'' records the diagnosis decisions of faulty transitions t 16 and t 18 , represented as a row vector. We observe that the size of Eq. (2) is independent of the length of an observation and the time of solving Eq. (2) does not increase. However, the size of Eq. ξ (ω, M 0 , Post, Pre) as well as the time to solve it increases as the length of the observation increases.

IV. DIAGNOSIS OF LABELED PETRI NETS
We in this section extend Algorithm 1 to the case of labeled Petri nets. The main idea is to enumerate all possible observable transition sequences corresponding to an observation and to combine the diagnosis results for these sequences. To conveniently present the algorithm, we first define some notations.
Definition 6: Given a net G = (P, T , Pre, ♦ In other words, given a sequence σ ∈ T * , the sequence σ o = Q o (σ ) is the projection of σ on T o and consists of all observable transitions in σ . Given an observation ω ∈ L E (G, M 0 ) of a labeled Petri net system G, M 0 , E, , we define as the set of observable transition sequences corresponding to ω.
The diagnosis algorithm for labeled Petri nets is presented in Algorithm 2. Note that the algorithm takes a labeled Petri net system G, M 0 , E, and an observation ω ∈ E * as the input. The symbol B in Line 3 stands for a set that collects the diagnosis decision of t f ∈ T f for each observable transition sequence σ o ∈ o (ω) corresponding to ω. By Definition 3, it is easy to verify that (ω, t f ) = N if all components in B are N , (ω, t f ) = F if all components are F, (ω, t f ) = U otherwise (see Lines 17,20,and 22). Example 4: Let us consider the Petri net shown in Fig. 1, where T u = {t 1 , t 3 , t 6 } and T f = {t 1 , t 6 }. The labeling function associated with this net is defined by (t 2 ) = (t 5 ) = a and (t 4 ) = (t 7 ) = b. Assuming that the observation is ω = aab, we have o (ω) = {t 2 t 2 t 4 , t 2 t 5 t 4 , t 2 t 5 t 7 , t 5 t 2 t 4 , t 5 t 2 t 7 }. For all σ o ∈ o (ω) and all t f ∈ T f , the diagnosis result (σ o , t f ) shown in Table 2  Proof: For a faulty transition t f ∈ T f and an observation ω ∈ L E (G, M 0 ) in a labeled Petri net, it is necessary to inspect if all transition sequences σ ∈ (ω) contain t f in order to determine the value of (ω, t f ) according to Definition 3. The necessary and sufficient condition of Theorem 2 shows that, for an observation σ o ∈ T * o , all transition sequences σ ∈ (σ o ) can be inspected by solving two ILP problems Eqs. The variable B in Algorithm 2 collects the diagnosis decision of t f for each σ o ∈ o (ω). If all entries in B are N , then each transition sequence σ ∈ (σ o ) does not contain t f , i.e., for all σ ∈ (ω), it holds t f / ∈ σ . Thus, we have (ω, t f ) = N by Definition 3 (see Line 17). Analogously, we have (ω, t f ) = F if all entries in B are F. Otherwise, we can find two entries N and F in B, which means that there are two sequences σ o 1 , σ o 2 ∈ o (ω) such that (σ o 1 , t f ) = N and (σ o 2 , t f ) = F. This implies that two sequences σ 1 ∈ (σ o 1 ) ⊆ (ω) and σ 2 ∈ (σ o 2 ) ⊆ (ω) satisfying t f / ∈ σ 1 and t f ∈ σ 2 can be found. Thus, we conclude (ω, t f ) = U (see Line 22) according to Definition 3.

V. CONCLUSION
In this paper, we propose a fault diagnosis algorithm of Petri nets under the assumption that the considered Petri net is backward conflict-free. The main advantage of the algorithm is its high computational efficiency, where the size of the ILP problem to be solved is independent of the length of an observation. In future works, we plan to extend it to distributed diagnosis for large systems.