# A Theoretical Foundation for Context-Aware Cyber-Physical Production Systems
## 4 CPPS Models
**Definition 6** ([13]). : _Given two discrete timed PNs, \(G_{1}\) = ( \(P_{1}\), \(T_{1}\), \(F_{1}\), \(m_{10}\), \(\mu_{1}\)) and \(G_{2}\) = ( \(P_{2}\), \(T_{2}\), \(F_{2}\), \(m_{20}\), \(\mu_{2}\)), the operator \"\(\|\)\" to combine \(G_{1}\) and \(G_{2}\) is defined as follows: \(G_{1}\|G_{2}\) = ( \(P\), \(T\), \(F\), \(W\), \(m_{0}\), \(\mu\)), where \(P=P_{1}\cup P_{2}\), \(T=T_{1}\cup T_{2}\), \(F(p,t)\) = \(\left\{ \begin{array}{l}F_{1}(p,t)\;if\;p\in P_{1}\;and\;t\in T_{1}\\ F_{2}(p,t)\;if\;p\in P_{2}\;and\;t\in T_{2}\end{array} \right.\), \(F(t,p)\;=\left\{ \begin{array}{l}F_{1}(t,p)\;if\;p\in P_{1}\;and\;t\in T_{1} \\ F_{2}(t,p)\;if\;p\in P_{2}\;and\;t\in T_{2}\end{array} \right.\), \(m_{0}(p)=\left\{ \begin{array}{l}m_{10}(p)\;if\;p\in P_{1}\\ m_{20}(p)\;if\;p\in P_{2}\end{array} \right.\) and \(\mu(t)=\left\{ \begin{array}{l}\max(\mu_{1}(t),\mu_{2}(t))\;if\;t\in T_{1} \cap\;T_{2}\\ \mu_{1}(t),\;if\;t\in T_{1}\backslash T_{2}\\ \mu_{2}(t),\;if\;t\in T_{2}\backslash T_{1}\end{array} \right..\)  
Although the composition operation is the same as the one in [13], the properties and structure of the resulting models obtained by the composition operation are different from the ones obtained in [13]. The DTPN models considered in this paper allow more complex interactions patterns between resources and tasks. Hence, the liveness property of the composed DTPN models may not be preserved (This point is discussed in Section 4 of this paper). This is the reason why a control policy is needed to maintain the liveness property of the composed DTPN models. **Definition 7**. : _A nominal model is described by a discrete timed Petri net \(G=(P,T,F,m_{0},\mu)=GJ\|GR\), where \(GJ=\underset{j\in I}{\parallel}GJ_{j}\) and \(GR=\underset{r\in R}{\parallel}GR_{r}=\)( \(P_{R}\), \(T_{R}\), \(F_{R}\), \(m_{R0}\), \(\mu_{R}\)), where \(m_{0}:P\to Z^{|P|}\). The state of \(G\) is called a marking and it is represented by a vector \(m\in Z^{|P|}\)._  
The overall model obtained by combining Figure 1a,b with Figure 2a,b is shown in Figure 3a. To make it clear for readers to understand the differences between the models used in this paper and the one proposed in [13], we illustrate their differences by an example. Figure 3b is a model that is similar to the one proposed in [13]. Note that the model in Figure 3b only allows at most one resource involved for each transition. By contrast, there are two types of resources involved in transitions \(t_{2}\), \(t_{3}\), \(t_{6}\) and \(t_{7}\) in the model of Figure 3a. This is due to the synchronization of operations with the two resources in CPPS. Obviously, this means that the model proposed in this paper allows more complex interactions patterns between resources and tasks. That is, the model proposed in this paper extends the one proposed in [13]. However, this powerful modeling capability should be used in conjunction with a proper control method. Note that the overall model in Figure 3b will not evolve to any undesirable state no matter what sequence of transitions is fired. However, the overall model in Figure 3a may evolve to the circular waiting state in Figure 4. In Figure 4, all resources are held by tasks in the production processes and wait for the resources to be released. Therefore, the development of a method to supervise and control the usage of resources is an important issue. Figure 3: (**a**) Overall model obtained by merging Figure 1 with Figure 2; (**b**) A model which allows at most one resource involved for each transition. Before defining the control policy, we first define the initial marking and the final marking of the CPPS model. The initial marking is set according to the order requirements. The requirements of an order can be described by product demands, \(D_{j}\), where \(D_{j}>0\forall j\in\mathbf{J}\) and deadline \(\Phi\). The initial marking (state) and final marking (state) is defined as follows. **Definition 8**. : _Suppose the order requirements for type-j tasks is \(D_{j}\).