# Wireless Sensor Network Energy Model and Its Use in the Optimization of Routing Protocols
## 2 Description of the Energy Model
\begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline
**Scenario** & \(E_{\text{MC}}\) **(0)** & \(E_{\text{ON}}\) **(0)** & \(E_{\text{OFF}}\) **(0)** & \(E_{CSMA}\) **(0)** & \(E_{\text{Switching}}\) **(0)** & \(E_{TX}\) **(0)** & \(E_{RX}\) **(0)** \\ \hline Simulator for CC2530 & 9.6398 & 2.9342 & 14.1883 & 78.4582 & 7.4382 & 59.9173 & 264.1783 \\ Real network for CC2530 & 9.2578 & 2.5573 & 14.0123 & 78.9362 & 7.8625 & 59.1173 & 264.8746 \\ Simulator for CC2650 & 8.4677 & 2.3891 & 12.1903 & 77.3274 & 6.1248 & 56.4702 & 260.9471 \\ Real network for CC2650 & 8.4677 & 2.6891 & 12.1903 & 77.3274 & 6.1248 & 56.4702 & 260.9471 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Energy model tested on two scenarios. where \(P_{Length}\) is the length of the packet (bytes), \(T_{TX}\) is the time (seconds) that it takes a node to send a byte and is given by \(V_{TX}\) (Volts) and \(I_{TX}\) (Amperes). As with the transmission mode, a node expends receiving energy when it receives packets. This energy is determined using (7):  
\[E_{RX}=P_{Length}\times T_{RX}\times I_{RX}\times V_{RX}. \tag{7}\]  
where \(P_{Length}\) is the length of the packet (bytes), \(T_{RX}\) is the time (seconds) that it takes a node to receive a byte and is given by \(V_{RX}\) (Volts) and \(I_{RX}\) (Amperes). The values of (1)-(7) are presented in Table 1.  
Therefore, the total energy can be calculated with (8):  
\[E_{Total}= E_{MC}+E_{ON}+E_{OFF}+E_{CSMA}+E_{Switching}+E_{TX}+E_{RX}. \tag{8}\]  
The simple energy model shown by the aforementioned equations estimates the energy expended by the main tasks of a node within a WSN for any system, where those functions related to wireless communications are the most important from an energy standpoint. This model can assess global and local energies. A generic case is presented to interpret the analysis of the model. The energy of the node \(i\) is represented as \(EnergyNode_{i}\), which is obtained by adding up the energy consumed by a node \(i\) to perform each task along the active network. When a node connects to the network, it has consumed zero energy initially, so that \(EnergyNode_{i}=0\). For this energy model, we segregate energies that depend directly on the number of packets transmitted or not. The energies related to the packets are: \(E_{TX}\), \(E_{RX}\), \(E_{Switching}\) and \(E_{CSMA}\). The energies that depend exclusively on node operation are: \(E_{ON}\), \(E_{OFF}\), and \(E_{MC}\). Therefore,  
\[ \begin{array}{ll}EnergyNode_{i}=&\overbrace{E_{TX_{i}}+E_{RX_{i}}+E_{Switching_{i}}+E_{CSMA_{i}}}^{Dependent\ on\ packets}+\\ &\\ &\overbrace{E_{MC_{i}}+E_{ON_{i}}+E_{OFF_{i}}}^{Independent\ on\ packets}.\end{array}  \tag{9}\]  
Now, to calculate the energy consumed by each node starting with packet-dependent energies, \(E_{TX_{i}}\) will be the energy transmitted in the node \(i\), so,  
\[E_{TX_{i}}=(P_{Length}\times T_{TX}\times I_{TX}\times V_{TX})\times(P_{TX_{ i}}+P_{RTX_{i}}), \tag{10}\]  
where \(P_{TX_{i}}\) is the total number of messages transmitted by node \(i\). \(P_{RTX_{i}}\) is the total number of packets retransmitted by node \(i\), because a packet receipts acknowledgment, ACK, was not received. In addition, \(E_{RX_{i}}\) will be the energy transmitted in the node i, so,  
\[E_{RX_{i}}=(P_{Length}\times T_{RX}\times I_{RX}\times V_{RX})\times P_{RX_{ i}}, \tag{11}\]  
where \(P_{RX_{i}}\) is the total number of packets received by node \(i\). In the same way, \(E_{Switching_{i}}\) is the switching energy consumed when a node changes from transmission to reception or vice versa. The \(E_{Switching_{i}}\) energy for node i is given by (12):  
\[ \begin{array}{ll}E_{Switching_{i}}=&(T_{Switching}\times I_{Switching} \times V_{Switching})\times\\ &(P_{TX_{i}}+P_{RTX_{i}}+P_{RX_{i}}),\end{array}  \tag{12}\]  
The term \((P_{TX_{i}}+P_{RTX_{i}}+P_{RX_{i}})\) represents the number of times there is switching or changing in state activity from the time the packet is sent to the time the packet is received or vice versa.