# Model Predictive Control for Flexible Job Shop Scheduling in Industry 4.0 +
## 3 Model Generation
### Generation of the Discrete Time Petri Net Model
Without loss of generality, we consider all cases to lead towards the same state \(x^{O,C}\in\mathbb{X}_{O,C}\), for which condition (8) holds, except the fourth case where this exception it explicitly mentioned. 1. The operation \(O\) is _not executed at all_ and thus the first predicted input is \(u(0|k)\
otin\mathbb{U}_{O,S}\). As no other operation can be executed, the resulting cost over the prediction horizon \(N\) is Figure 3.0 (9)
2. The operation \(O\) is planned to _start immediately_, i.e., at \(\bar{k}=0\), on some machine \(M\in\mathcal{M}\) with \(\tau\in\mathcal{T}_{M}\) leading to the steady state \(x^{O,C}\). In this case, the first predicted input is \(u(0|k)\in\mathbb{U}_{O,S}\). As no other operation needs to be executed after finishing the execution of the operation \(O\), the resulting cost over the prediction horizon \(N\) is Figure 3.1 (10) where \(c_{\mathrm{P}}(M,O)\) is the production cost of the operation \(O\) on machine \(M\). 3. The operation \(O\) is planned to _start at a later point in time_, let us say at \(\bar{k}=\bar{k}\), on some machine \(M\in\mathcal{M}\) with \(\tau\in\mathcal{T}_{M}\), but it is still completely executed and the steady \(x^{O,C}\) is reached in the prediction. In this case, the input \(u(\bar{k}|k)\in\mathbb{U}_{O,S}\), but the first predicted input is \(u(0|k)\
otin\mathbb{U}_{O,S}\). The resulting cost over the prediction horizon \(N\) is Figure 3.2 (11) as no other operation can be started in \(x^{O,S}\) and thus the system stays in \(x^{O,S}\) for \(\bar{k}\) time steps. 4. The operation \(O\) is planned to _start at an even later point in time_ on some machine \(M^{\prime}\in\mathcal{M}\) with \(\tau\in\mathcal{T}_{M^{\prime}}\), such that it is not completely executed any more but only the first \(\bar{k}\) production steps, and no steady is reached at the end of the prediction. As no steady state is reached, the execution of \(O\) on \(M^{\prime}\) might or might not lead to \(x^{O,C}\) after the prediction horizon. In this case, the input \(u(N-\bar{k}|k)\in\mathbb{U}_{O,S}\), but the first predicted input is \(u(0|k)\
otin\mathbb{U}_{O,S}\). The resulting cost over the prediction horizon \(N\) is Figure 3.3 (12) where \(c_{\mathrm{P}}(M^{\prime},O)\) is the cost of the first part of the execution of \(O\) on \(M^{\prime}\). No other operation can be started in \(x^{O,S}\) and thus the system stays in \(x^{O,S}\) for \(N-\bar{k}\) time steps. As the MPC scheme (6) minimizes the cost over the prediction horizon \(N\), the optimal first input \(u^{*}(0,k)\) of the case with the lowest cost will be applied to the system. This means that the operation \(O\) will be executed in closed loop if \(c_{N,0}>c_{N,1},\ \ c_{N,2}>c_{N,1}\) and \(c_{N,3}>c_{N,1}\), which means that the immediate execution of the operation \(O\) yields most benefit over the prediction horizon \(N\). As the existence of a lower bound \(N_{O}\) for the prediction horizon needs to be proven, we can assume \(N\geq N_{O}>k_{\rm P}(M,\tau)\) for all \(M\) with \(\tau\in\mathcal{T}_{M}\). With this assumption, also the effect of the production cost \(c_{\rm P}(M,O)\) and the number of production steps \(k_{\rm P}(M,O)\) will be negligible, as the following considerations show. First note that due to condition (8) and as \(\tilde{k}>0\) it always holds that

\[ \begin{array}{rcl}c_{N,2}&>&c_{N,1}\\ c_{\rm P}(M,O)+\tilde{k}\,c(x^{O,S},0)&>&c_{\rm P}(M,O)\\ +\big{(}N-k_{\rm P}(M,\tau)-\tilde{k}\big{)}\,c(x^{O,C},0)&+\big{(}N-k_{\rm P}( M,\tau)\big{)}\,c(x^{O,C},0)\\ \tilde{k}\big{(}c(x^{O,S},0)-c(x^{O,C},0)\big{)}&>&0.\end{array}  \tag{13}\]

For \(c_{N,0}>c_{N,1}\) to hold, it follows with Equations (9) and (10)

\[ \begin{array}{rcl}N\,c(x^{O,S},0)&>&c_{\rm P}(M,O)+\big{(}N-k_{\rm P}(M, \tau)\big{)}\,c(x^{O,C},0)\\ N&>&\frac{c_{\rm P}(M,O)-k_{\rm P}(M,\tau)\,c(x^{O,C},0)}{c(x^{O,S},0)-c(x^{O,C },0)}.\end{array}  \tag{14}\]

For \(c_{N,3}>c_{N,1}\) to hold, it follows with Equations (10) and (12)

\[