**3. Deadlock Prevention Policy for Reconfigurable S3PR Net Based on Siphons**

This section presents definitions on siphons in reconfigurable S3PR nets. Next, the siphon control method based on place invariants is introduced. Finally, a deadlock prevention algorithm is proposed to solve the deadlock problems in reconfigurable S3PR nets.

**Definition 29.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* <sup>=</sup> *(PC1, T1, F1, W1, M1o, K1). A place vector of N1 is expressed as a column vector I: PC1*<sup>→</sup> *<sup>Z</sup> indexed by PC1, and a transition vector of N1 is defined as a column vector J: T1* <sup>→</sup> *<sup>Z</sup> indexed by T1, where <sup>Z</sup>* <sup>=</sup> *{* ... *,* <sup>−</sup>*2,* <sup>−</sup>*1, 0, 1, 2,* ... *}.*

**Definition 30.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* <sup>=</sup> *(PC1, T1, F1, W1, M1o, K1). A place vector I of N1 is expressed as a place invariant (PI) if IT. [N1]* <sup>=</sup> *0<sup>T</sup> and I* - *0, and a transition vector of N1 is defined as a transition invariant (TI) if [N1]. J* = *0 and J* -*0.*

**Definition 31.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1). A place invariant I of N1 is expressed as a place semi-flow if each element of I is non-negative.* ||*I*|| = *{p* |*I(p)* - *0} is said to be the support of place invariant of I.* ||*I*||<sup>+</sup> = *{p*|*I(p)* > *0} is said to be the positive support of place invariant I.* ||*I*||− = *{p* |*I(p)* < *0} is said to be the negative support of place invariant I. I is a minimal place invariant if* ||*I*|| *is not a superset of the support of any other one and its components are mutually prime.*

**Definition 32.** *Let NR be a reconfigurable S3PR net with NR* = *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1). A transition invariant J of N1 is expressed as a transition semi-flow if each element of J is non-negative.* ||*J*|| = *{t* |*J(t)* - *0} is said to be the support of transition invariant of J.* ||*J*||<sup>+</sup> = *{t*|*J(t)* > *0} is said to be the positive support of transition invariant J.* ||*J*||− = *{t* |*J(t)* < *0} is said to be the negative support of transition invariant J. J is a minimal transition invariant, if* ||*J*|| *is not a superset of the support of any other one, and its components are mutually prime.*

**Definition 33.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1). li is said to be the coe*ffi*cients of place invariant I if for all pi* ∈ *PC1, li* = *I(pi).*

**Definition 34.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1). A non-empty set S* ⊆ *PC1 is called a siphon in N1 if* •*S* ⊆ *S*•*. S* ⊆ *PC1 is called a trap in N1 if S*•⊆ •*S. S*⊆ *PC1 is called a minimal siphon (trap) if a siphon (trap) contains no other siphons. A minimal siphon S is called a strict minimal siphon if S*• - •*S. Let* Π = *{S1, S2, S3,* ... *, Sk} be a set of strict minimal siphons of N1. We have S*= *SA* ∪ *SR, SR* = *S* ∩ *PR, and SA* = *S*\*SR, where SA and SR are sets of operations and resources places, respectively.*

**Definition 35.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* <sup>=</sup> *(PC1, T1, F1, W1, M1o, K1). A siphon S in N1 is called marked at marking M if <sup>p</sup>*∈*<sup>S</sup> M*(*p*) ≥ <sup>1</sup>*, and otherwise is called unmarked at marking M.*

**Definition 36.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1). A siphon S in N1 is called an emptiable siphon if there exists M* ∈ *R(N1, M1o) such that <sup>p</sup>*∈*<sup>S</sup> M*(*p*) = 0*, and otherwise is called non-emptiable siphon.*

**Theorem 4.** *Let NR be a reconfigurable S3PR net with NR* = *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1) and* Π *the set of N1 siphons. The net N1 is deadlock-free if for all S* ∈ Π*, for all M* ∈ *R(N1, M1o), <sup>p</sup>*∈*<sup>S</sup> M*(*p*) ≥ 1*.*

**Proof.** Let *S* be a siphon in *N1* and *p* ∈ *S*. *p* is marked at marking *M* and satisfies *<sup>p</sup>*∈*<sup>S</sup> M*(*p*) ≥ 1. The net *N1* has at least one transition *t* enabled at any marking reachable from *M* and *S* is never be an unmarked, and it is therefore deadlock-free. -

**Theorem 5.** *Let NR be a reconfigurable S3PR net with NR* = *((N, Mo),* R*). Let N1 be a state of NR with N1* = *(PC1, T1, F1, W1, M1o, K1) and* Π *the set of N1 siphons. The net (N1, M1o) is in a deadlock state, i.e., M is a dead marking of N1. Then, {p* ∈ *PC1*|*M(p)* = *0} is a siphon S.*

**Proof.** Since *M* is a dead marking, each *t* has an empty input place *p* at *M*, ∀*p* ∈ •*t*, *M*(*p*) < *W*(*p, t*), and thus *S*• includes each transition of *N1*. In fact, we have •*S* ⊆ *S*•. Therefore, *S* is a siphon. Since the net has at least one transition *t* ∈ *T1*, *S* is not an empty set. -

**Corollary 3.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* <sup>=</sup> *(PC1, T1, F1, W1, M1o, K1), a deadlocked N1 net includes at least one unmarked siphon S.*

**Corollary 4.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let N1 be a state of NR with N1* <sup>=</sup> *(PC1, T1, F1, W1, M1o, K1), N1 is a deadlocked net at marking M. Then, N1 has at least one unmarked siphon S such that for all p* ∈ *S, there exists t* ∈ *p*• *such that W1(p, t)* > *M(p).*

To develop a deadlock prevention policy for reconfigurable S3PR net, we reviewed the approach of designing a control place (monitor) for a place invariant developed by Yamalidou et al. [40]. Then we develop a deadlock prevention policy for reconfigurable S3PR net to achieve an optimal place invariant. Yamalidou et al. propose a computationally efficient method based on place invariants that enforces algebraic constraints on the elements of a marking of a net system by constructing control places. The control purpose is to ensure a siphon to be a marked siphon, i.e., ensure a siphon be non-emptiable at all elements of a marking.

Assume that a reconfigurable S3PR net with *NR* = ((*N*, *Mo*), <sup>R</sup>) and *Nk* (state of *NR*) with *Nk* = (*PCk*, *Tk*, *Fk*, *Wk*, *Mko*, *Kk*), *k* = 1, 2, ... , |R| is a net to be controlled, which includes *n* places and *m* transitions. Let [*Nk*] be the incidence matrix of a plant reconfigurable S3PR net. The control places can be represented by [*Nc*] a matrix that shows the connection relationship between control places to transitions of the net *Nk*. The controlled net with incidence matrix [*N*] comprises both the original reconfigurable S3PR net and the monitors, i.e.,

$$\begin{bmatrix} \mathbf{N} \end{bmatrix} = \begin{bmatrix} \mathbf{N}\_k \\ \mathbf{N}\_c \end{bmatrix} \tag{4}$$

The control purpose is to impose a set of linear constraints to prevent unwanted markings being reached. The constraints are formulated in a matrix form:

$$
\mathcal{L}.M \ge \mathcal{B} \tag{5}
$$

where *M* denotes the marking vector of net *Nk*, L is an integer *nc* x *n* matrix (*nc* - the number of constraints), and B is an integer column vector. After the introduction of a non-negative slack variable that corresponds to the initial marking *Mko* of *Nk*, constraint (5) can be reformulated as:

$$M\_{\subset^0} = \mathcal{B} - \mathcal{L}\mathcal{M}\_{k\nu}.\tag{6}$$

where *Mco* represents the initial marking of monitor *c*.

If [*Nk*] is the incidence matrix, we have: *Mk* = *Mko* + [*Nk*]. → δ . Therefore, *Mc* = B−L.(*Mko* + [*Nk*]. → δ ), which also can be reformulated as:

$$M\_{\mathbb{C}} = M\_{\text{co}} + (-\mathcal{L}.[N\_k].\stackrel{\rightarrow}{\delta})\tag{7}$$

The place invariant computed by (5) must meet the place invariant equation *I* T[*N*] = **0**T. Therefore, the monitor [*Nc*] can be formulated as:

$$\mathbb{E}\left[\mathcal{N}\_{\mathbb{C}}\right] = -\mathcal{L}.\left[\mathcal{N}\_{k}\right] \tag{8}$$

Consequently, *Mc* may be considered as a marking of some additional monitors, where the supervised reconfigurable S3PR net has an incidence matrix [*N*] = *Nk Nc* , and a marking vector *M* = *Mk Mc* .

**Theorem 6.** *Let NR be a reconfigurable S3PR net with NR* = *((N, Mo),* R*). Let Nk be a state of NR with Nk* = *(PCk, Tk, Fk, Wk, Mko, Kk), incidence matrix* [*Nk*] *and initial marking Mko be given. A set of nc linear constraints* L.*Mk* ≥ B *are to be imposed. If* B−L.*Mk* ≥ 0 *then a Petri net controller with incidence matrix* [*Nc*] = −*L*.[*Nk*] *and initial marking Mco* = B−L.*Mko enforces the constraint* L.*Mk* ≥ B *when included in the closed loop system* [*N*] = *Nk Nc . In addition, the controller is maximally permissive.*

#### **Proof.** See [40,41]. -

Now, we consider the place invariant approach to control the siphon. Let *S* be an unmarked siphon. The control purpose is to ensure that *S* is never unmarked through the system evolution (*N*, *Mo*) and eliminate markings that break the linear constraint (5) from the reachable markings.

Let *VS*\*S* ∈ Π be the monitor resulting from controlling the siphon *S*. There are siphons *S* such that if *<sup>p</sup>*∈*<sup>S</sup> Mo*(*p*) ≥ 1 for the initial marking *Mo*, then *<sup>p</sup>*∈*<sup>S</sup> M*(*p*) ≥ 1 for all reachable markings *M*. Therefore, a siphon *S* does not require control. In order to reduce the supervisor's complexity, these siphons are identified and no monitors are added. Thus, we have two sets of constraints: L.*M* ≥ B and L*o*.*M* ≥ B*<sup>o</sup>* rather than a single set of constraints L.*M* ≥ B. The deadlock prevention supervision of the original net needs enforcing L.*M* ≥ B and selecting an initial marking *Mo* such that L*o*.*Mo* ≥ B*<sup>o</sup>* and L.*Mo* ≥ B. The constraints L*o*.*M* ≥ B*<sup>o</sup>* are the constraints that all reachable markings satisfy when the initial markings satisfy them. Therefore, there are two cases to control a siphon:

If *VS* • ⊆ •*S*, then *S* does not require monitor and *VS* is not assigned to a net *N*. Furthermore, *VS* • ⊆ •*S* if and only if *S* is a trap. Thus, when *S* is also a siphon, it is (trap) controlled for all initial markings *Mo* that satisfy *<sup>p</sup>*∈*<sup>S</sup> Mo*(*p*) ≥ 1. Therefore, a siphon *S* is assigned to (L*o*; B*o*).

A. If *VS* • - •*S*, then *S* needs a monitor and *VS* is assigned to *N*. Therefore, the *S* is assigned to (L; B).

**Definition 37.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let Nk be a state in NR with Nk* = *(PCk, Tk, Fk, Wk, Mko, Kk). A siphon S in Nk is called controlled if for all M* ∈*R(Nk, Mko), <sup>p</sup>*∈*<sup>S</sup> M*(*p*) ≥ 1 *and satisfy* L.*M* ≥ B *and* L*o*.*M* ≥ B*o.*

**Definition 38.** *Let NR be a reconfigurable S3PR net with NR* <sup>=</sup> *((N, Mo),* R*). Let Nk be a state in NR with Nk* = *(PCk, Tk, Fk, Wk, Mko, Kk). The deadlock controller for (Nk, Mok) is expressed as (V, MVo)* = *(PV, TV, FV, MVo), where (1) PV* = *{VS*\*S* ∈ Π*} is set of monitors. (2) TV* = *{t*\*t* ∈ •*VS* ∪*VS* •*}. (3) FV* ⊆ *(PV* × *TV)* ∪ *(TV* × *PV) is called a flow relation of V. (4) for all VS* ∈ *PV, MVo*(*Vs*) = B−L.*Mko*(*Vs*)*, where MVo(VS) is called an initial marking of a monitor. (NRC, MRCo) is said to be a controlled reconfigurable S3PR net resulting from the integration of (Nk, Mko) and (V, MVo), expressed as (Nk, Mko) (V, MVo), where NRC* = *(PRC, TRC, FRC, WRC, MRCo, KRC), PRC* <sup>=</sup> *PCk* <sup>∪</sup> *PV, TRC* <sup>=</sup> *Tk* <sup>∪</sup> *TV, FRC: (PRC* <sup>×</sup> *TRC)* <sup>∪</sup> *(TRC* <sup>×</sup> *PRC)* <sup>→</sup> *IN is called flow relations, WRC: (PRC* <sup>×</sup> *TRC)* <sup>∪</sup> *(TRC* <sup>×</sup> *PRC)* <sup>→</sup> *IN is a mapping that assigns a weight to an arc, MRCo: PRC* <sup>→</sup> *IN is the initial marking, and KRC: PRC* <sup>→</sup> *IN is the function of capacity that assigns to each place p the maximal number of tokens KRC(p).*

Based on the concept of place invariant and siphon control, the deadlock prevention algorithm for reconfigurable S3PR net is developed as follows:

**Algorithm 2:** *Deadlock prevention algorithm for reconfigurable S3PR net based on siphon control*

*Input: An S3PR net (No, Mo) Output: A controlled reconfigurable S3PR net (NRC, MRCo). Initialization: Generate dynamic configurations* <sup>R</sup> <sup>=</sup> *{rr1, rr2, rr3,* ... *, rrm} k*=*0, PV* <sup>=</sup> <sup>∅</sup>, *TV* <sup>=</sup> <sup>∅</sup>, *FV* <sup>=</sup> <sup>∅</sup>, *(NRC, MRCo)* = ∅. *Step 1: while* <sup>R</sup> - <sup>∅</sup> *do k*=*k*+*1* 1.1. *Build (Nk, Mko) by using Algorithm 1.* 1.2. *Compute minimal siphons* Π *for (Nk, Mko).* 1.3. *for each S* <sup>∈</sup> <sup>Π</sup> *do if VS* • - •*S, then* a. Add *S* to (L; B). b. *NVS* = −L.[*Nk*] c. *MVo*(*Vs*) = B−L.*Mko*. d. *PV :*= *PV* ∪ {*Vs*} e. *TV* := *TV* ∪ {*t*\*t* ∈ •*VS* ∪ *VS* •}. f. *FV* := *FV* ∪ ((*PV* × *TV*) ∪ (*TV* × *PV*)) *elseIf VS* • ⊆ •*S and <sup>p</sup>*∈*<sup>S</sup> Mo*(*p*) <sup>≥</sup> 1, *then* Add *S* to (L*o*; B*o*). *end if end for* 1.4. *(NRC, MRCo) :*= *(Nk, Mko) (Vk, MVko)* 1.5. R = R\*CR.* /*\* CR is covered rrk*\*/ *end while Step 2: Output a controlled reconfigurable S3PR net (NRC, MRCo). Step 3: End*

To illustrate the proposed Algorithm 2, reconsider the initial S3PR net (*No*, *Mo*) illustrated in Figure 2. The initial net has four minimal siphons *S1* = {*p1, p2, p3, p4*}*, S2* = {*p3, p5*}, *S3* = {*p2, p4, p6*}, and *S4* = *{p4, p5, p6*}. The *No* incidence matrix is

$$[N\_o] = \begin{bmatrix} -1 & 0 & 0 & 1 \\ 1 & -1 & 0 & 0 \\ 0 & 1 & -1 & 0 \\ 0 & 0 & 1 & -1 \\ 0 & -1 & 1 & 0 \\ -1 & 1 & -1 & 1 \end{bmatrix} \tag{9}$$

while its initial marking is:

$$M\_{\theta} = \begin{bmatrix} & 5 & 0 & 0 & 0 & 1 & 1 \end{bmatrix}^{\mathrm{T}} \tag{10}$$

*S4* creates monitor *VS1*, therefore one monitor *VS1* is added, which enforces:

$$M(p\_4) + M(p\_5) + M(p\_6) \ge 1\tag{11}$$

The following place invariant is generated:

$$M(V\_{S1}) = M(p\_4) + M(p\_5) + M(p\_6) - 1\tag{12}$$

The current matrices L and B represent the Equation (12).

$$
\mathcal{L} = \left[ \begin{array}{cccc} 0 & 0 & 0 & 1 & 1 & 1 \end{array} \right] \mathcal{B} = \left[ 1 \right] \tag{13}
$$

while the others minimal siphons create constraints in (L*o*; B*o*).

$$\mathcal{L}\_o = \begin{bmatrix} 1 & 1 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 \end{bmatrix} \\ \mathcal{B}\_o = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \tag{14}$$

The controller net incidence matrix is calculated by Equation (8):

$$
\begin{bmatrix} N\nu\_{\mathcal{S}} \end{bmatrix} = -\mathcal{L}\begin{bmatrix} N\nu\_{\mathcal{o}} \end{bmatrix} = \begin{bmatrix} -1 & 0 & 1 & 0 \end{bmatrix} \tag{15}
$$

The controller's initial place marking is calculated as:

$$M\_o(V\_{S1}) = M\_o(p\_4) + M\_o(p\_5) + M\_o(p\_6) - 1 = 1$$

The controlled net of (*No*, *Mo*) is illustrated in Figure 7. The place and arcs of the controller are shown with blue lines.

Now, reconsider the reconfigured S3PR net by addition of new machine (*N1*, *M1o*) illustrated in Figure 3c. The reconfigured net has seven minimal siphons *S1* = {*p3, p5*}*, S2* = {*p7, p9*}, *S3* = {*p2, p4, p6, p8*}, *S4* = *{p4, p5, p6, p8*}, *S5* = *{p2, p6, p8, p9*}, *S6* = *{p5, p6, p8, p9*}, and *S7* = *{p1, p2, p3, p4, p7, p8*}.

**Figure 7.** Controlled S3PR net by Algorithm 2.

The *N1* incidence matrix is:

$$[N\_1] = \begin{bmatrix} -1 & 0 & 0 & 0 & 0 & 1 \\ 1 & -1 & 0 & 0 & 0 & 0 \\ 0 & 1 & -1 & 0 & 0 & 0 \\ 0 & 0 & 1 & -1 & 0 & 0 \\ 0 & -1 & 1 & 0 & 0 & 0 \\ -1 & 1 & -1 & 1 & -1 & 1 \\ 0 & 0 & 0 & 1 & -1 & 0 \\ 0 & 0 & 0 & 0 & 1 & -1 \\ 0 & 0 & 0 & -1 & 1 & 0 \end{bmatrix} \tag{16}$$

while its initial marking is:

$$M\_{10} = \begin{bmatrix} \ \ \ \ \ \ \ \ 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 \end{bmatrix}^{\text{T}} \tag{17}$$

*S4*, *S5*, and *S6* create monitor *VS1*, *VS2*, and *VS3*, respectively. Thus, three monitors are added, *VS1*, *VS2*, and *VS3*, which enforce:

$$M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) \ge 1\tag{18}$$

$$M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) \ge 1\tag{19}$$

$$M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) \ge 1\tag{20}$$

The following place invariants are accordingly generated:

$$M(V\_{S1}) = M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) - 1\tag{21}$$

$$M(V\_{S2}) = M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) - 1\tag{22}$$

$$M(V\_{S3}) = M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) - 1\tag{23}$$

The current matrices L and B represent the Equations (18)–(20).

$$
\mathcal{L} = \begin{bmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \end{bmatrix}, \mathcal{B} = \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} \tag{24}
$$

while the other minimal siphons create constraints in (L*o*; B*o*).

$$
\mathcal{L}\_0 = \begin{bmatrix} 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 \\ 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 0 \end{bmatrix}, \\ \mathcal{B}\_0 = \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} \tag{25}
$$

The controller's net incidence matrix is calculated by Equation (12);

$$
\begin{bmatrix} N\_{V\_S} \end{bmatrix} = -\mathcal{L} \begin{bmatrix} N\_1 \end{bmatrix} = \begin{bmatrix} -1 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & -1 & 0 & 1 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 \end{bmatrix} \tag{26}
$$

The initial marking controllers are calculated as:

$$M\_o(V\_{S1}) = M\_o(p\_4) + M\_o(p\_5) + M\_o(p\_6) + M\_o(p\_S) - 1 = 1$$

$$M\_o(V\_{S2}) = M\_o(p\_2) + M\_o(p\_6) + M\_o(p\_S) + M\_o(p\_9) - 1 = 1$$

$$M\_o(V\_{S3}) = M\_o(p\_5) + M\_o(p\_6) + M\_o(p\_S) + M\_o(p\_9) - 1 = 2$$

The controlled reconfigurable net of (*N1*, *M1o*) is illustrated in Figure 8. The place and arcs of the controllers are shown with blue lines.

**Figure 8.** Controlled reconfigurable S3PR net by addition of new machine.

Then, reconsider the reconfigured S3PR net by addition of new product (*N2*, *M2o*) illustrated in Figure 4c. The reconfigured net has 11 minimal siphons *S1* = {*p7, p9*}*, S2* = {*p3, p5, p11*}, *S3* = {*p10, p11, p12, p13*}, *S4* = *{p4, p5, p6, p8, p12*}, *S5* = *{p5, p6, p8, p9, p12*}, *S6* = *{p1, p2, p3, p4, p7, p8*}, *S7* = *{p2, p4, p6, p8, p10, p12*}, *S8* = *{p2, p6, p8, p9, p10, p12*}, *S9* = *{p4, p5, p6, p8, p12*}, *S10* = *{p5, p6, p8, p9, p12*}, and *S11* = *{p2, p6, p8, p9, p10, p12*}. The *N2* incidence matrix is

$$
\begin{aligned}
\begin{bmatrix}
1 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & -1 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & -1 & 0 & 0 & 0 & 0 & 0 \\
0 & -1 & 1 & 0 & 0 & 0 & 0 & -1 & 1 & 0 \\
0 & 0 & 0 & 1 & -1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 & -1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & -1 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 \\
0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 1
\end{bmatrix}
\end{aligned}
\tag{27}$$

while its initial marking is:

$$M\_{2O} = \begin{bmatrix} & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 5 \end{bmatrix}^T \tag{28}$$

*S4*, *S5*, and *S8* create monitors *VS1*, *VS2*, and *VS3*, respectively. Thus, three monitors are added, *VS1*, *VS2*, and *VS3*, which enforce:

$$M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) + M(p\_{12}) \ge 1\tag{29}$$

$$M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{12}) \ge 1\tag{30}$$

$$M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{10}) + M(p\_{12}) \ge 1\tag{31}$$

The following place invariants are accordingly generated:

$$M(V\_{S1}) = M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) + M(p\_{12}) - 1\tag{32}$$

$$M(V\_{S2}) = M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{12}) - 1\tag{33}$$

$$M(V\_{S\bar{3}}) = M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{10}) + M(p\_{12}) - 1\tag{34}$$

The current matrices L and B represent the Equations (29)–(31).

$$
\mathcal{L} = \begin{bmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 0 \end{bmatrix}, \mathcal{B} = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \tag{35}
$$

while the other minimal siphons create constraints in (L*o*; B*o*).

$$
\mathcal{L}\_{o} = \begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 0 \end{bmatrix}, \mathcal{B}\_{o} = \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} \tag{36}
$$

The controller's net incidence matrix is calculated by Equation (12);

$$
\mathbb{E}\left[\mathbf{N}\_{V\_S}\right] = -\mathbb{E}\left[\mathbf{N}\_{2o}\right] = \begin{bmatrix} -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 & -1 & 0 & 1 & 0 \\ 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \tag{37}
$$

The initial marking controllers are calculated as:

$$M\_0(V\_{S1}) = M\_0(p\_4) + M\_0(p\_5) + M\_0(p\_6) + M\_0(p\_8) + M\_0(p\_{12}) - 1 = 1$$

$$M\_0(V\_{S2}) = M\_0(p\_5) + M\_0(p\_6) + M\_0(p\_8) + M\_0(p\_9) + M\_0(p\_{12}) - 1 = 2$$

$$M\_0(V\_{S3}) = M\_0(p\_2) + M\_0(p\_6) + M\_0(p\_8) + M\_0(p\_9) + M\_0(p\_{10}) + M\_0(p\_{12}) - 1 = 1$$

The controlled reconfigurable net of (*N2*, *M2o*) is illustrated in Figure 9. The place and arcs of the controllers are shown with blue lines.

Then, reconsider the reconfigured S3PR net by rework (*N3*, *M3o*) illustrated in Figure 5c. The reconfigured net has 13 minimal siphons *S1* = {*p4, p5, p6, p8, p12, p16*}*, S2* = {*p5, p6, p8, p9, p12, p16*}, *S3* = {*p4, p5, p6, p8, p16, p17*}, *S4* = *{p5, p6, p8, p9, p16, p17*}, *S5* = *{p2, p6, p8, p9, p10, p12, p15, p16*}, *S6* = *{p2, p4, p6, p8 p10, p15, p16, p17*}, *S7* = *{p2, p6, p8, p9, p10, p15, p16, p17*}, *S8* = *{p2, p4, p6, p8, p10, p12, p15, p16*}, *S9* = *{p7, p9*}, *S10* = *{p1, p2, p3, p4, p7, p8*}, *S11* = *{p3, p5, p11*}, *S12* = *{p14, p17*}, and *S13* = *{p10, p11, p12, p13, p14, p15, p16*}. Siphons *S1*–*S7*, create monitors *VS1*- *VS7*, respectively. Thus, seven monitors are added, *VS1*- *VS7*, which enforce:

$$M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) + M(p\_{12}) + M(p\_{16}) \ge 1\tag{38}$$

$$M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{12}) + M(p\_{16}) \ge 1\tag{39}$$

$$M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) + M(p\_{16}) + M(p\_{17}) \ge 1\tag{40}$$

$$M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{16}) + M(p\_{17}) \ge 1\tag{41}$$

$$M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{10}) + M(p\_{12}) + M(p\_{15}) + M(p\_{16}) \geq 1\tag{42}$$

$$M(p\_2) + M(p\_4) + M(p\_6) + M(p\_8) + M(p\_{10}) + M(p\_{15}) + M(p\_{16}) + M(p\_{17}) \geq 1\tag{43}$$

$$M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{10}) + M(p\_{15}) + M(p\_{16}) + M(p\_{17}) \geq 1\tag{44}$$

**Figure 9.** Controlled reconfigurable S3PR net by addition of new product.

The following place invariants are accordingly generated:

$$M(V\_{S1}) = M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) + M(p\_{12}) + M(p\_{16}) - 1 \tag{45}$$

$$M(V\_{S2}) = M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{12}) + M(p\_{16}) - 1 \tag{46}$$

$$M(V\_{S3}) = M(p\_4) + M(p\_5) + M(p\_6) + M(p\_8) + M(p\_{16}) + M(p\_{17}) - 1 \tag{47}$$

$$M(V\_{S4}) = M(p\_5) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{16}) + M(p\_{17}) - 1 \tag{48}$$

$$M(V\_{SS}) = M(p\_2) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{10}) + M(p\_{12}) + M(p\_{15}) + M(p\_{16}) - 1 \tag{49}$$

$$M(V\_{\mathcal{S}\delta}) = M(p\_{\mathcal{D}}) + M(p\_4) + M(p\_6) + M(p\_8) + M(p\_{10}) + M(p\_{15}) + M(p\_{16}) + M(p\_{17}) - 1 \tag{50}$$

$$M(V\_{\mathbb{S}7}) = M(p\_{\mathbb{Z}}) + M(p\_6) + M(p\_8) + M(p\_9) + M(p\_{10}) + M(p\_{15}) + M(p\_{16}) + M(p\_{17}) - 1 \tag{51}$$

The current matrices L and B represent the Equations (38)–(44).

$$
\mathcal{L} = \begin{bmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 \\ \end{bmatrix}, \mathcal{B} = \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} \tag{52}
$$

The controller's net incidence matrix is calculated by Equation (12);

$$
\begin{bmatrix} N\_{V\_S} \end{bmatrix} = \begin{bmatrix} -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & -1 & 0 & 0 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 & -1 & 0 & 1 & 0 & -1 & 0 & 0 & 0 \\ -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 1 & 0 & 0 \end{bmatrix} \tag{53}
$$

The initial marking controllers are calculated as:

*Mo*(*VS1*) = 1, *Mo*(*VS2*) = 2, *Mo*(*VS3*) = 2, *Mo*(*VS4*) = 3, *Mo*(*VS5*) = 1, *Mo*(*VS6*) = 1, and *Mo*(*VS7*) = 2. The controlled reconfigurable net of (*N3*, *M3o*) is illustrated in Figure 10. The place and arcs of the controller are shown with blue lines.

**Figure 10.** Controlled reconfigurable S3PR net by rework.

Finally, reconsider the reconfigured S3PR net by addition of a new robot (*N4*, *M4o*) illustrated in Figure 6c. The reconfigured net has 17 minimal siphons, ten of which *S1*–*S10* that create monitors *VS1*- *VS10*, respectively, which are siphons *S1* = {*p2, p6, p6-1, p8, p9*}*, S2* = {*p4, p5, p6-1, p8, p11*}, *S3* = {*p5, p6-1, p8, p9, p11*}, *S4* = *{p4, p5, p6-1, p6-2, p8, p12, p16*}, *S5* = *{p4, p5, p6-1, p6-2, p8, p16, p17*}, *S6* = *{p5, p6-1, p6-2, p8 p9, p12, p16*}, *S7* = *{p5, p6-1, p6-2, p8, p9, p16, p17*}, *S8* = *{p3, p5, p6-2, p12, p16*}, *S9* = *{p3, p5*, *p6-2, p16, p17,*}, and *S10* = *{p6-2, p10, p15, p16, p17*}. The current matrices L and B are expressed as:

L = ⎡ ⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣ 010001001100000000 000111001001000000 000011001101000000 000111101000100010 000111101000000011 000011101100100010 000011101100000011 001010100000100010 001010100000000011 000000100010000111 ⎤ ⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦ , B = ⎡ ⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎣ 1 1 1 1 1 1 1 1 1 1 ⎤ ⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎦ (54)

The controller's net incidence matrix is calculated by Equation (12);

$$
\begin{bmatrix} N\_{V\_5} \end{bmatrix} = \begin{bmatrix} 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ -1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 0 \\ -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 & -1 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 0 \\ -1 & 0 & 0 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 1 & 1 & 0 & 0 \end{bmatrix} \tag{55}
$$

The initial marking controllers are calculated as *Mo*(*VS1*) = 1, *Mo*(*VS2*) = 1, *Mo*(*VS3*) = 2, *Mo*(*VS4*) = 2, *Mo*(*VS5*) = 3, *Mo*(*VS6*) = 3, *Mo*(*VS7*) = 4, *Mo*(*VS8*) = 1, *Mo*(*VS9*) = 2, and *Mo*(*VS10*) = 1.

The controlled reconfigurable net of (*N4*, *M4o*) is illustrated in Figure 11. The place and arcs of the controller are shown with blue lines.

**Figure 11.** Controlled reconfigurable S3PR net by rework.
