# A Theoretical Foundation for Context-Aware Cyber-Physical Production Systems
## 4 CPPS Models
: _A resource subnet \(GR_{r}\) for a type-\(r\) resource is a discrete timed Petri net \(GR_{r}=(\ P_{r},\ T_{r},\ F_{r},\ m_{r0},\ \mu_{r}\ )\) that consists of a number of activities of type-\(r\) resources, where \(r\in\textbf{R}\) and the function \(\mu_{r}\) is used to specify the firing time of each transition in \(T_{r}\). Each activity is represented by a circuit [36] in which a number of transitions and places forms a closed loop. A resource subnet \(GR_{r}\) has an idle state place denoted by \(p_{r}\). The set of all idle state places of resources is denoted by \(P_{o}=\{p_{r},r\in R=\{1,2,...,R\}\}\). Without loss of generality, we will also refer to the type-\(r\) resource by \(r\in\textbf{R}\) whenever it is clear from the context._  
Figure 1a,b show two resource subnets, \(GR_{r_{1}}\) and \(GR_{r_{2}}\). There are four circuits, \(r_{1}t_{1}p_{2}t_{2}\), \(r_{1}t_{3}p_{4}\), \(r_{1}t_{5}p_{7}t_{6}\) and \(r_{1}t_{7}p_{8}\) in \(GR_{r_{1}}\). There are two circuits, \(r_{2}t_{2}p_{3}t_{3}\) and \(r_{2}t_{6}p_{8}t_{7}\) in \(GR_{r_{2}}\). **Definition 4**. : _The capacity of type-\(r\) resources in period \(\tau\) is denoted as \(C_{rr}\), where \(C_{rr}=m_{r0}(p_{r})\) for all \(\tau\in\{1,2,...,\Pi\}\), where \(\Pi\) is the time horizon._  
A CPPS may process different types of tasks. Let \(\textbf{J}\) denote the set of task types. Each task consists of a number of operations. Each operation can be specified by transitions. A type of task is described by a task subnet. Therefore, the task subnet considered in this study consists of a sequence of transitions. Let \(T_{j}\) denote the set of transitions in a task subnet. A transition may involve multiple resources. **Definition 5**. : _A type \(j\) task subnet \(GJ_{j}=(P_{j},T_{j},F_{j},\mu_{j0},\mu_{j})\), \(j\in\textbf{J}\), is a discrete timed Petri net which consists of a sequence \(t_{j0},t_{j1},t_{j2},...,t_{jN_{i}},t_{jN+1}\) of \(N_{j}+2\) transitions in the set \(T_{j}\) and a sequence \(p_{j0},p_{j1},\ p_{j2},\ p_{j3}\,...,\ p_{jN_{j}}\) of \(N_{j}+1\) places in \(P_{j}\), where \(\mu_{j}:T_{j}\to Z\) is a function that specifies the lower bound of the firing time of each transition \(t\in T_{j}\). The first transition \(t_{j0}\) is a fictitious transition that represents the release of a task. The transition \(t_{jN_{j}}\) represents completion of the final operation of the task. The last transition \(t_{|N_{j}+1}\) is a fictitious transition that represents the removal of a completed task._  
Note that the set of transitions in \(T_{j}\backslash\left\{t_{|0},t_{|N_{j}}t_{|N_{j}+1}\right\}\) requires allocation of resources, i.e., \(|^{\bullet}t\cap P_{o}|\geq 1\,\forall t\in T_{j}\backslash\left\{t_{|0},t_{|N_{j} }t_{|N_{j}+1}\right\}\) and \(|^{\bullet}t\cap P_{o}|=0\,\forall t\in\left\{t_{|0},t_{|N_{j}},t_{|N_{j}+1}\right\}\). A transition \(t\in T_{j}\) involving multiple resources is characterized by \(|^{\bullet}t\cap P_{r}|\geq 2\). The number of resources required to fire transition \(t\), where \(t\in T_{j}\), is denoted by \(R_{ji}(r)\forall r\in R\). Figure 2a,b show two task subnets, \(GJ_{1}\) and \(GJ_{2}\). To convey the idea to construct the model, we introduce a composition operator \" \(\|\)\" to merge two or more DTPN models through common transitions, places and arcs. There are many composition or synthesis methods in the literature (e.g., [13, 52, 53, 54, 55]). These include composition by merging transitions or places. Several operations that preserve the liveness property of the composed nets have been proposed in [52, 53]. These operations include the fusion of a series of places or transitions and parallel places or transitions, and the elimination of self-loop places or transitions. Some of these studies focus on the synthesis of Petri nets for manufacturing systems (e.g., [13, 55]). For this paper, the composition operation is used to capture the synchronization of resources and workflows. Therefore, the composition operation used in this paper is the same as the one used in [13]. It is defined as follows.