# Bounded-Error-Pruned Sensor Data Compression for Energy-Efficient IoT of Environmental Intelligence
## 4 Experimental Results and Performance Evaluations
### Calculations of Compression and Energy Consumption Ratios for BESDC  
The compression performance of BESDC is simply calculated by comparing the compressed sensor data size with the original sensor data size from the above-mentioned four different environmental datasets. The calculation is listed in Equation (11). \[\mathrm{compression\ ratio}=\frac{\mathrm{BESDC\ compressed\ data\ size}}{ \mathrm{Original\ data\ size}} \tag{11}\]  
To evaluate the energy consumption, the parameters shown in Table 2 are adopted from [45]. According to these parameters from CC2420 transceiver and ARM7 TDMI data-sheets, energy consumed in data compression is calculated according to the number of different machine instructions executed in the proposed BESDC algorithms on ED and SN via the assembly code output from Visual Studio 2010, including different instructions of ADD (addition), MUL (multiply), CMP (comparison) and SHF (shift). As well, energy consumed in data transmission (transmit and receive) is calculated according to \begin{table}
\begin{tabular}{c c c c c c} \hline  & **Type** & **Correlation (Temporal, Spatial)** & **Samples** & **Frequency** & **Date Collected** \\ \hline
1 & Temperature & High, High & 8760 & 1 sample/h. & 2018 \\
2 & PM 2.5 & High, Low & 8760 & 1 sample/h. & 2018 \\
3 & CO & High, Low & 8760 & 1 sample/h. & 2018 \\
4 & Seismic Wave & Low, Low & 10,000 & 10 samples/s. & 21 September 1999 \\ \hline \end{tabular}
\end{table} 
Table 1: Four environmental datasets for testing BESDC. the number of bits compressed by BESDC in data, temporal and spatial correlations. In our experiments for BESDC performance, the energy consumption ratio is calculated as defined in Equation (12). \[\text{energy consumption ratio}=\frac{\text{Energy consumption with compression}}{\text{Energy consumption without compression}} \tag{12}\]  
The energy consumption function \(eg_{TX}(n)\) in joule units (i.e., J) for ED or SN to transmit \(n\) bits can be calculated as defined in Equation (13). For example, to calculate the energy consumption to transmit 1 bit using the applied parameters in Table 2, we can have the energy consumption value of \(eg_{TX}(1)=I_{TX}\times V_{TX}\times T_{TX}\times 1=17.4\) mA \(\times\) 3.3 V \(\times\) 32 \(\upmu\)s/bit \(\times\) 1 bit = 1.83744 \(\upmu\)j (i.e., \(T_{TX}\) indicates the time for ED or SN to send out 1 bit to network). The energy consumption \(eg_{RV}(m)\) for ED or SN to receive \(m\) bits can be calculated as defined in Equation (14). Thus, we can have \(eg_{RV}(1)=I_{RV}\times V_{RV}\times T_{RV}\times 1=2.08032\)\(\upmu\)J. Then, the energy consumption function \(eg_{COM}(n,P_{sensor})\) for \(n\)-bit compression via the output of assembly code from data compression program \(P_{sensor}\) running on sensors, such as ED or SN in proposed BESDC, can be calculated as defined in Equation (15). In Equation (15), \(i_{add}^{P_{sensor}},i_{mul}^{P_{sensor}},i_{cmp}^{P_{sensor}}\) and \(i_{shf}^{P_{sensor}}\) are indicated as the respective numbers for different assembly instructions of ADD, MUL, CMP and SHF counted in running program \(P_{sensor}\). Then, \(\varepsilon_{add}\), \(\varepsilon_{mul}\), \(\varepsilon_{cmp}\) and were the measured energy consumption values, respectively, in experience from [45] for each instruction of ADD, MUL, CMP and SHF in a program of encoding 1 bit. Therefore, for the sensor node of ED running EB-RLE with EB-HC in program \(P_{ED}\), we can have the ED total energy consumption function \(eg^{ED}(n)\) as shown in Equation (16), for compressing \(n\)-bit data and transmitting compressed \(\widetilde{n}\)-bit data to SN. In Equation (17), we can have the total energy consumption function \(eg^{SN}(m)\) for SN running spatial correlation compression with EB-HC in program \(P_{SN}\), to receive \(m\)-bit data from ED and compress them to \(\widetilde{m}\)-bit data, finally sending the compressed \(\widetilde{m}\)-bit data to fog-computing machines.