# Investigation of Energy Cost of Data Compression Algorithms in WSN for IoT Applications
## 4 Hybrid Model for Run Length Encoding with Adaptive Huffman Encoding
### Hybrid Algorithm
Hence based on the above equations we have analysed the compression ratio of different algorithms with varying data size from 0 to 1500 bits as shown in Figure 4. It can be clearly seen that the compression ratio of RLE is better than Hybrid-RLEAHE, AHE and Hybrid-AHERLE. For instance, the compression ratio for 1500 bits for RLE is 21.42, H-AHERLE is 18.29, AHE is 4.54 and H-AHERLE is 1.1. Hence from the analysis and compression ratio results we have considered only RLE, AHE and H-RLEAHE in our further studies. ## 6 Network Setup and Scenario Analysis

Assumptions
* Consider all sensor nodes to be stationary. * The study assumes that the data gathered from source IoT nodes is destined for a single BS. * SNs that have similar processing and communication capabilities are considered homogeneous. It also takes into account the fact that all SNs have the same initial energy. * The x and y coordinates of SNs released randomly are always in the topological region. * Applying Euclidean distance, the separation between two near-neighboring SNs is calculated. ### Results and Discussion

As indicated in Table 4. the research is further examined in multiple scenarios with varied network area, number of grids/clusters, and total number of nodes. The number of grids varies between 8 and 100, while the total number of nodes spans from 100 to

Figure 4: Compression ratio with data varying size in bits. \begin{table}
\begin{tabular}{l l} \hline \hline  & \(2\times 4,100\) nodes (Centre, left edge, top edge and corner) \\  & \(4\times 4,100\) nodes \\ Base station location & \(4\times 4,200\) nodes (Centre, left edge, top edge and corner) \\  & \(10\times 10,625\) nodes \\  & \(10\times 10,1250\) nodes \\ \hline Number of Rounds & 1500 rounds \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Network parameter setup. 1250 dependent on the network area. Table 4 provides further information on each of these potential outcomes. The hybrid routing protocol, it is parameter settings and network structure form the basis for different scenarios as reported in [47]. The entire setup is in an area with the base station located at various locations as shown in Table 3. The conventional data compression algorithm RLE and AHE is compared with H-RLEAHE and without compression with the parametric settings given in Table 3 and the grid formation is shown in Table 4. Total packets sent to base station (BS), nodes alive, residual energy in network, packet delivery ratio (PDR), and throughput are used to evaluate performance. In the next sections, we will see how various grid and network settings affect performance. ### Case Study 1-1: 2 \(\times\) 4, 100 Nodes, BS at Center

Figure 5 shows the results of Case Study 1-1: 2 \(\times\) 4 grids, 100 Nodes, where the base station is placed at the center. Figure 5 depicts the network architecture, which consists of 16 grids with the numbered cluster heads connected by a black line. Figure 5 compares the findings of many different performance metrics and shows that a network with 100 nodes may survive for 118 (AHE), 484 (without compression), 740 (H-RLEAHE), and 982 (RLE) cycles. Compared to RLE, the network lifetime reduces by 87.98%, 50.71% and 24.64%, respectively, for AHE, WC and H-RLEAHE. The increase in the number of rounds for which the network remains alive can be safely attributed to the lesser data to be communicated to the BS as the compression techniques reduce the data significantly. The visualization of average energy in the nodes can be seen from Figure 5, validating the higher energy in the nodes in the RLE method vis-a-vis other strategies. Further, packet delivery ratio also demonstrates an improvement as shown in Figure 5. Similarly, Figure 5 demonstrates an improvement in throughput by sending packets up to 982 rounds. The average packets sent to BS/round is also increased significantly as shown in Figure 5.