## 4 Performance Evaluation  
A BSN with mobile sensor nodes inside the human body is simulated to evaluate the performance of the proposed protocol using MATLAB. The energy consumption of the proposed MAC protocol is compared with IEEE 802.15.6. It stated in Section 2, multi-hop communication could save more energy than single-hop communication. However, there exists control message overhead in the proposed MAC protocol. The energy consumption of the control overhead cannot be negligible. This section will analyze whether the proposed protocol could save energy or not even if there exists control message overhead. The random mobility patterns are generated based on the assumptions given in Table 3. The GI tract is normally more than 6 meters in length and the nodal speed in the gastrointestinal tract is 0.2 mm/s [36]. Here the mobility pattern is modeled as multi-segment line around 6.3 meters inside a cube of \(25\times 15\times 25\) cm. The assumptions are within the range of normal adult human. Each segment follows normal distribution with the mean length of 7.4 cm and the standard deviation of 3.1 cm. The angle of each segment line to the coordinate follows a uniform distribution with the minimum value of 0\({}^{\circ}\) and maximum value of 360\({}^{\circ}\). The mobility pattern starts at (7, 11.3, 25) and ends at (0, 0.2, 4). This mobility pattern is much more realistic and very close to the real GI tract of the human body. The parameters used in the simulations are listed in Table 4. The mobility pattern is generated using the above-mentioned model in a \(25\times 25\times 15\) cm\({}^{3}\)cube. Different network sizes from two sensors to six sensors are simulated. In the simulation, the channel path-loss model and energy model are the same as that in Section 2. The parameters are justified in Section 2. The circuitry power adopts 100 \(\mu\)W, 1 mW and 5 mW in this simulation. 405 MHz is adopted as the RF frequency. We define the frame format length as 1 s. The mini-control slot duration defined as 1 ms and the data slot duration is defined as 20 ms. The payload size for information exchange and scheduling assignment is estimated as 10 bytes and the payload size for broadcasting and information uploading is estimated as \(10\times N\), where, \(N\) is the number of the sensors. The sensing data packet size is defined from 512 bytes to 3 kbytes. The packet interval is from 0.2 s to 1 s. These parameters are selected as close as the real WCE. The total simulation lasts 20,000 s. For energy calculation, the total energy consumption is calculated as the summation of the energy consumption of the status tx, rx, and idle for all the sensor devices as shown in Equation (13). The energy consumptions for both control data and sensing data are calculated into the total energy consumption:  
\[E_{total}=\sum_{sensors}(E_{tx}+E_{rx}+E_{idle}) \tag{13}\] \begin{table}
\begin{tabular}{c c c c} \hline
**Parameters** & **Value** & **Parameters** & **Value** \\ \hline Maximum angle & 360 & Mean of distance & 7.361 cm \\ Minimum angle & 0 & Standard deviation & 3.1229 cm \\ Length of small & \(\sim\)630 cm & Border & \(25\times 15\times 25\) cm \\
\begin{tabular}{c} Starting point \\ \end{tabular} & (7,11.3,25) & Destination point & (0, 0.231, 4) \\ \hline \end{tabular}
\end{table} 
Table 3: Assumptions for random mobility pattern generation. The IEEE 802.15.6 MAC protocol is used as reference for comparison with the proposed MAC protocol. In the simulation it adopts guaranteed time slots (GTS) in the managed access period. The sensor devices and coordinator node communicate in a point-to-point mode. In the simulation no acknowledgement is adopted, which gives a fair comparison with the proposed protocol. The data slots are equally assigned to sensor devices in advance. To make the comparison fair, we try to obtain the minimum transmission power for 802.15.6. Figure 7 shows the packet delivery ratio (PDR) _vs._ transmit power. 2 dBm is the minimum transmit power to ensure PDR of 1.