# Relay-Enabled Task Offloading Management for Wireless Body Area Networks
## 3 System Model
### Computation Model  
The relay is of significant importance when considering the execution of task \(C_{i}\) from the implanted devices and the on-body physiological task \(D_{i}\). As analyzed earlier, task \(U_{i}\) of relay \(i\) to be performed can be defined as:  
\[U_{i}=(F_{i},C_{i},D_{i},T^{r}_{i}),i\in\mathcal{N}, \tag{3}\]  
where \(F_{i}\) and \(T^{r}_{i}\) represent the required computation resource (i.e., CPU resource) and the maximum time allowance to complete all tasks, respectively. One should note that \(D_{i}\) cannot be offloaded to others and should always be executed by relay \(i\) itself. In the proposed system, we assume that the MEC server performs as a coordinator and assists relays to execute the task \(C_{i}\) by providing computation resources, since each relay has \(D_{i}\) to be executed locally and only \(C_{i}\) can be offloaded. We define the indication parameters, i.e., \(a_{ij},i\in\mathcal{N},j\in\mathcal{N}\) to denote whether task \(C_{i}\) from relay \(i\) is offloaded to relay \(j\). Thus, one has:  
\[a_{ij}=\left\{ \begin{array}{c}0,\text{no offloading},\\ 1,\text{relay $i$ offloads the task $C_{i}$ to the relay $j$,}\end{array} \right. \tag{4}\]  
where \(i\in\mathcal{N},j\in\mathcal{N}\). Once relay \(i\) decides to execute \(C_{i}\) itself, the local power consumption for this task can be given as:  
\[p_{i}^{c}=C_{i}\alpha(f_{i}^{c})^{\beta},i\in\mathcal{N}, \tag{5}\]  
where \(f_{i}^{c}\) means the computation capability (i.e., CPU cycles per second) of relay \(i\) as analyzed in Reference [29]. The positive constant parameters \(\alpha\) and \(\beta\) are pre-configured and depend on the chip architecture. Realistic measurements of those parameters are \(\alpha=10^{-11}\) and \(2\leq\beta\leq 3\)[30]. Then, one has the time of local execution:  
\[T_{i}^{C}=\frac{F_{i}}{f_{i}^{c}},i\in\mathcal{N}, \tag{6}\]  
where \(T_{i}^{C}\leq T_{i}^{r}\). However, when \(T_{i}^{C}>T_{i}^{r}\), it means that relay \(i\) cannot accomplish the task under QoS requirements, and thus the task offloading process is needed. According to Equations (4) and (5), the energy consumption of relay \(i\) to execute task \(C_{i}\) can be expressed as:  
\[E_{i}^{C_{i}}=p_{i}^{c}T_{i}^{C}=F_{i}C_{i}\alpha(f_{i}^{c})^{\beta-1},i\in \mathcal{N} \tag{7}\]  
When consider the locally executed task \(D_{i}\), the energy consumption for sensing this can be expressed as: \(E_{i}^{sen}=D_{i}E_{i}^{c}\), where \(E_{i}^{c}\) is the energy consumption required for sensing one bit. Similar to Equation (7), the energy consumption of executing task \(D_{i}\) can be written as:  
Figure 1: The architecture of the proposed system: (**a**) communication flow; (**b**) information broadcasting; (**c**) task offloading schemes. \[E_{i}^{D_{i}}=F_{i}D_{i}\alpha(f_{i}^{c})^{\beta-1},i\in\mathcal{N} \tag{8}\]  
Thus, the minimal energy consumption for relay \(i\) is \(E_{i}^{min}=E_{i}^{D_{i}}+E_{i}^{sen}\). Recalling Equation (4), \(a_{ij}=1\) indicates that relay \(i\) decides to offload task \(C_{i}\) to relay \(j\) via an on-body to on-body communication link. The distance between the two relays can be expressed as:  
\[d_{ij}=\sqrt{\left|\left|\mathbf{w}_{i}-\mathbf{w}_{j}\right|\right|^{2}},i\in \mathcal{N},j\in\mathcal{N},i\
eq j, \tag{9}\]  
where \(\mathbf{w}_{j}\) is the coordinate of relay \(j\). The time of the task offloading can be expressed as:  
\[T_{ij}^{off}\left(a_{ij}\right)=\sum_{j\in\mathcal{N}}a_{ij}\left(\frac{\sqrt{ \left|\left|\mathbf{w}_{i}-\mathbf{w}_{j}\right|\right|^{2}}}{c}\right),i\in\mathcal{ N},j\in\mathcal{N},i\
eq j, \tag{10}\]  
where \(c\) is the speed of light. Relay \(j\) can then execute task \(C_{i}\) in the same manner as relay \(i\). However, once relay \(j\) cannot execute the task due to a lack of computation resources or the execution time \(T_{i}^{C}\geq T_{i}^{r}\), the task will be offloaded to the C-MEC.