# Model Predictive Control for Flexible Job Shop Scheduling in Industry 4.0 +
## 3 Model Generation
### Generation of the Discrete Time Petri Net Model  
Form the description of the JMPMSF in Section 2, we will automatically generate a Petri Net model with the algorithms presented in our previous work [17]. The generated PN model will provide all possible manufacturing decisions in the form of controlled transitions in the set \(\mathbb{T}_{C}\). Their implications are captured in the matrix \(B\) of the algebraic description (4) and the decisions are taken by means of the firing count vector \(u\). The automatic production process is represented through the independent transitions in the set \(\mathbb{T}_{I}\) and handled in the matrix \(A\) of the algebraic representation (4), as presented in Section 3.2. The state of the Petri Net \(x\) represents the current status of the manufacturing system. In order to preserve the production related meaning of the elements of the PN components, we introduce distinct identifiers as labels for the places and transitions. By introducing corresponding vectors \(x^{\text{ID}}\) and \(u^{\text{ID}}\), the state \(x\) and the input vector \(u\) are intuitively understandable and can be related to the elements in the production system. The identifiers hold information on the machine, the task and the job to which the places and transitions refer. Additionally, we introduce a classifying character \(\sigma\in\Sigma=\{S,F,P,B,I,N,C\}\) to indicate the meaning of the places and transitions in the production process. The classifier \(S\) relates to \"start\", \(F\) relates to \"finish\", \(B\) to \"buffer\", \(I\) to \"idle\", \(N\) to \"necessary\", and \(C\) to \"completed\". This set of classifiers was specifically selected for the given production problem together with the desired model of it and the algorithms that translate between them, which will be presented in the sequel. This set of classifiers is certainly not the only possible one to implement a similar model generation. If further characteristics of the production problem are investigated or other restrictions are present, the set of classifiers can be changed and further Petri Net structures can be introduced. The identifier of a place \(P\) has the form \((M,\tau,I,\sigma)\), as a place can relate to one machine \(M\in\mathcal{M}\), one task \(\tau\in\mathcal{T}\), one job \(J\in\mathcal{J}\) and has the production related meaning that corresponds to its classifier \(\sigma\in\Sigma\). With this notation it becomes obvious to which machine, which task and which job a place \(P_{(M,\tau,I,\sigma)}\) relates and how its marking can be interpreted. If a place has no specific machine, task or job it relates to, its identifier has a zero at the respective position. For example the marking of the place \(P_{(M,0,0,I)}\) indicates whether the machine \(M\) is idle, which is independent of any specific task or job. A transition connects at least two places and its production related role can be related to the places connected to it. Its identifier has the form \((M,M^{\prime},\tau,\tau^{\prime},J,\sigma)\), which indicates that the transition \(T_{(M,M^{\prime},\tau,\tau^{\prime},J,\sigma)}\) connects places of the form \(P_{(M,\tau,I,\sigma)}\), and \(P_{(M^{\prime},\tau^{\prime},J,\sigma)}\). The identifiers of transitions only refer to one job \(J\), since we assume dependencies between different jobs to arise only through the fact that they are produced in the same manufacturing system, as discussed in Section 2 and formulated in Restriction (R2). As a consequence, all places connected to the same transition either relate to the same job or they do not relate to any job at all. Analogous to the algorithms presented in our previous work [17], the PN model of the manufacturing system is created with the Algorithms 1 and 2. The generated model is a discrete time description of the manufacturing system and the production processesare represented by chains of places \(P_{(M,\tau,J,P_{1})}\), \(P_{(M,\tau,J,P_{2})}\), \(\cdots\), \(P_{(M,\tau,J,P_{\mathrm{kp}}(M,\tau))}\).