# Lightweight CoAP-Based Bootstrapping Service for the Internet of Things
## 4 Experimental Results
### Performance Evaluation
#### 4.2.5 Energy Consumption  
To obtain the energy consumption, we used the Powertrace [105] tool that comes with Cooja simulator. We used it to estimate the median energy consumed by each bootstrapping (mJ/bootstrapping) in CoAP-EAP and PANATIKI. The different measurements show the CPU consumption when the Smart Object is fully operative; the consumption when transmitting (TX) and receiving (RX) consumption and, finally the total energy consumption of each solution. Figures 12a-c, 13a-c, 14a-c and 15a-c show the energy consumption expressed in millijoules per bootstrapping (mJ/bootstrapping) in the same cases as Section 4.2.2.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Empty Main** & **Network Support (e.g., IP/UDP)** & **EAP** & **Lower Layer** & **Total Size** \\ \hline PANATIKI & 62.7 kB & 24.9 kB & 9.4 kB & 5.9 kB & 102.9 kB * \\ CoAP-EAP & 62.7 kB & 24.9 kB & 9.4 kB & 3.8 kB (+4.6 kB cantcoap) & 105.4 kB \\ \hline \hline \end{tabular}
* This size does not include any CoAP implementation.  
\end{table}
Table 3: Implementations memory size.  
Figure 12: CPU energy consumption. (**a**) CPU energy consumption with 0.0 loss ratio; (**b**) CPU energy consumption with 0.1 loss ratio; (**c**) CPU energy consumption with 0.2 loss ratio.  
Figure 13: TX energy consumption. (**a**) TX energy consumption with 0.0 loss ratio; (**b**) TX energy consumption with 0.1 loss ratio; (**c**) TX energy consumption with 0.2 loss ratio.  
Figure 14: RX energy consumption. (**a**) RX energy consumption with 0.0 loss ratio; (**b**) RX energy consumption with 0.1 loss ratio; (**c**) RX energy consumption with 0.2 loss ratio.  
Figure 15: Total energy consumption. (**a**) Total energy consumption with 0.0 loss ratio; (**b**) Total energy consumption with 0.1 loss ratio; (**c**) Total energy consumption with 0.2 loss ratio.  
As observed in all the measurements, as the packet loss ratio increases, more retransmissions (and, therefore, more message processing) are required (processing retransmitted messages, sending the retransmitted messages, _etc._). Thus the energy spent because the CPU is working also increases. Additionally, we can see that the CPU consumption remains very similar in both alternatives when packet loss ratio is around 0. The reason is that the number of retransmissions is low and basically this CPU energy is spent on processing the messages shown in Figure 11. Since these values are very similar it is reasonable to observe similar CPU energy consumption. However, when the network conditions worsen, the CPU needs to work more in the case of PANATIKI than CoAP-EAP, which is an evidence that more retransmissions are required in PANATIKI due to more fragmentation as a consequence of the message length, and due to the more aggressive retransmission policy.  
The energy spent transmitting (TX) (Figure 13a-c), as well as as receiving (RX) messages (Figure 14a-c) over the radio interface, are the most energy consuming tasks. In fact, both are more important than the energy consumed by the CPU.  
If the circumstances are not adverse, the best case scenario with 1 hop and a packet loss ratio of 0, the CoAP-EAP behavior (\(\approx\)5.2 mJ/bootstrapping) is slightly better than PANATIKI (\(\approx\)6.3 mJ/bootstrapping). However, CoAP-EAP clearly reduces the energy consumption in contrast with PANATIKI when the network conditions are worse. For example, with 3 hops and 0.2 packet loss ratio PANATIKI spends around \(\approx\)60 mJ/bootstrapping in RX while CoAP-EAP spends \(\approx\)32 mJ/bootstrapping. This energy consumption is also evidence that PANATIKI involves more retransmissions and needs to send and, therefore, receive more messages.  
In the majority of scenarios with a loss ratio greater than 0, CoAP-EAP proves to be significantly better in terms of energy consumption in each of the modes.  
Finally, Figure 15a-c show the total energy consumption per bootstrapping including all these factors, where we can observe that CoAP-EAP proves to be a more energy-saving solution than PANATIKI.