# Symmetric-Key-Based Security for Multicast Communication in Wireless Sensor Networks +
## 6 Efficiency
### Energy Consumption  
The number of packets sent by the key distribution protocol mainly determines its energy consumption. In this section, we are going to calculate the number of packets sent on the application layer, when there are \(n\) members in the group.  
In the unicast approach, each mote needs to send one packet to the NMM to register to the group, resulting in \(n\) packets. The NMM sends the information of each mote to the publisher in a single packet. Next, the publisher sends a packet to each other mote in the group, resulting in \(n-1\) packets. Finally, each mote transmits an acknowledgement to the publisher, who sends the final acknowledgement to the NMM. The average number of packets sent by the motes in the group equals \((3n-1)/n\). Please note that we are not counting the packet sent by the NMM, since the NMM is in the cloud and thus not part of the WSN.  
In the multicast approach, the registration phase and acknowledgement are the same as for the unicast approach, resulting in \(2\cdot n\) packets. However, the distribution phase only results in one multicast packet being sent. Hence, the average number of packets sent by the motes in the group  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{2}{c}{**NMM to Publisher**} & \multicolumn{2}{c}{**Publisher to Members**} \\ \cline{2-5}
**Members** & \
\begin{tabular}{c} **Packet Size** \\ **(bytes)** \\ \end{tabular} & **Fragments** &
\begin{tabular}{c} **Packet Size** \\ **(bytes)** \\ \end{tabular} & **Fragments** \\ \hline
**2** & 64 & 1 & 68 & 2 \\
**3** & 96 & 2 & 84 & 2 \\
**4** & 128 & 2 & 100 & 2 \\
**5** & 160 & 3 & 116 & 2 \\
**6** & 192 & 3 & 132 & 2 \\
**7** & 224 & 4 & 148 & 3 \\
**8** & 256 & 4 & 164 & 3 \\
**9** & 288 & 5 & 180 & 3 \\
**10 equals \((2n+1)/n\). Again, the packet from the NMM is not included. Our simulation results, shown in Figure 6, confirm these formulas for both the unicast and the multicast approach.  
Of course, the number of frames sent by the LL is more important to estimate the energy consumption. It is possible for a single packet sent on the application layer to result in multiple frames being sent on the LL in the entire network, because of fragmentation and the need to forward packets multiple hops and to multiple children. In Figure 7 we observe that the number of hops between the members and the publisher has a bigger influence on the number of sent frames then the number of members in the group. There are less LL frames being sent for the multicast approach since multicast packets do not need to be duplicated until the last hop. The difference is mostly noticeable with increasing number of hops between P and the other members and with an increasing number of members in the multicast group. This difference is smaller than expected when compared with the number of sent packets on the application layer, because the larger multicast packet (containing the LI information) results in more fragmentation, as explained previously in Section 6.2. The simulations show that in our topology, after 4 hops with 5 members, this still results in an 8% advantage in terms of sent LL frames when using the multicast approach.  
Figure 6: Average number of application packets sent since the start of the registration phase of the protocol. The number of members in the group is denoted as \(n\) and the number of hops between the publisher and the members is denoted as \(h\).  
Figure 7: Average number of LL frames sent since the start of the registration phase of the protocol. The number of members in the group is denoted as \(n\) and the number of hops between the publisher and the members is denoted as \(h\).