# Model Predictive Control for Flexible Job Shop Scheduling in Industry 4.0 +
## 3 Model Generation
### Generation of the Discrete Time Petri Net Model
In this respect, the MPC problem is analyzed in the following sections and guarantees are provided that the desired properties, i.e., always having a feasible solution and leading to a state in which the production problem is completed, are fulfilled if some specific conditions are satisfied. We first show that there always exists a solution to the optimization problem (6) in the following section, before we provide conditions on the cost function \(c(x,u)\) and the prediction horizon \(N\) which guarantee that applying the MPC to the manufacturing system will lead to the completion of every task in every job and therefore to the completion of the scheduling problem. ### Feasibility of the Mpc Problem

As a first important property of the MPC problem formulated in Section 4.1, it needs to be guaranteed that the optimization problem (6) always has a feasible solution when it is applied in closed loop (7), which is called _recursive feasibility_ in the context of MPC [14]. Proving recursive feasibility of an MPC problem requires prior assumptions. In our case, the standing assumption is that the PN was generated with the Algorithms 1 and 2 for a manufacturing system as described in Section 2. We first show that under this assumption the MPC optimization problem (6) is feasible for every possible state of the PN, before specifically analyzing the closed loop system (7). **Lemma 2** (Feasibility). : _For every Petri Net \(PN=(\mathbb{P},\mathbb{T},\mathbb{E},w,x^{0})\) generated with the Algorithms 1 and 2 represented in its state space form (3), (4), the MPC optimization problem (6) is feasible for all \(x(k)\in\mathbb{N}^{n}\)._Proof of Lemma 2.: The input trajectory \(u(\cdot|k)=(0,\ldots,0)\) satisfies (6d), and for all \(x(k)\in\mathbb{N}^{n}\) it satisfies constraint (6c) due to Property (P7). Constraint (6b) is satisfied with \(x(k+1|k)\) according to the open loop system dynamics (4). Therefore \(u(\cdot|k)=(0,\ldots,0)\) is a feasible candidate solution of the MPC Problem (6) for every \(x(k)\in\mathbb{N}^{n}\). For the PN generated with the Algorithms 1 and 2 it particularly holds that \(x^{0}\in\mathbb{N}^{n}\) due to Property (P3). **Lemma 3** (Recursive feasibility). : _For every Petri Net \(PN=(\mathbb{P},\mathbb{T},\mathbb{E},w,x^{0})\) generated with the Algorithms 1 and 2 represented in its state space form (3), (4), the MPC optimization problem (6) is feasible with \(x(k)=x^{0}\), the nominal closed loop system (7) with \(u^{*}(0|k)\) from problem (6) satisfies the condition (3), and Problem (6) is feasible for all \(k\in\mathbb{N}\)._

Proof of Lemma 3.: From Lemma 2 and as \(x^{0}\in\mathbb{N}^{n}\) due to Property (P3) follows that the input trajectory \(u(\cdot|k)=(0,\ldots,0)\) is a feasible candidate solution at \(x(k)=x^{0}\). That the nominal closed loop system (7) with \(u^{*}(0|k)\) from problem (6) satisfies the condition (3) follows directly from the fact that \(x(k)=x(0|k)\) holds in the nominal case and since \(u^{*}(0|k)\) satisfies (6c). For every feasible input trajectory \(u(\cdot|k)\) at time instant \(k\), the input trajectory \(u(\cdot|k+1)=(u(1|k),\ldots,u(N-1|k),\)\(0)\) is a feasible input trajectory to Problem (6) at time \(k+1\) with the initial state \(x(0|k+1)=x(k+1)=x(1|k)\) from the nominal closed loop system (7). The feasibility of the inputs \(u(0|k+1)=u(1|k),\ldots,u(N-2|k+1)=u(N-1|k)\) follows directly from the feasibility of \(u(\cdot|k)\) at time instant \(k\). The final predicted input \(u(N-1|k+1)=0\) is also feasible due to the following reasons. First, it naturally satisfies constraint (6d). The predicted state \(x(N-1|k+1)\) is a natural number, i.e., \(x(N-1|k+1)\in\mathbb{N}^{n}\), due to the feasibility of \(u(N-2|k+1)=u(N-1|k)\) and satisfies the constraint (6b) according to the open loop system dynamics (4). For \(x(N-1|k+1)\in\mathbb{N}^{n}\), constraint (6c) is satisfied with \(u(N-1|k+1)=0\) due to Property (P7). The input trajectory \(u(\cdot|k)=(0,\ldots,0)\) used in the proof of Lemma 2 simply does not start any task in the scheduling problem.