# Integrated Evaluation of Reliability and Power Consumption of Wireless Sensor Networks
## 6 Experimental Evaluation
### Suggestions  
In order to show the power consumption reduction resulting from the suggestions proposed by the _Editor_ (see Table 1), we carried out six experiments:  
* Experiment 01 (_E01_): it evaluates the impact of the statement _for_ (Suggestion _S01_) in the power consumption. This statement has three expressions: (1) the first one is associated with the \begin{table}
\begin{tabular}{c l} \hline \hline
**Suggestion** & **Description** \\ \hline _S01_ & Avoid to use the _for_ statement to initialise an array. \\ _S02_ & Use the increment instead of decrement in the _for_ statement. \\ _S03_ & Avoid the use of parenthesis in mathematical expressions. \\ _S04_ & Place most accessed branches of decision commands as first options. \\ _S05_ & Use ++ instead of +1. \\ _S06_ & If the value of the variable does not change, make it a constant. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Implementation suggestions of _Suggestion Component_. initialization, (2) the second one is the controlling statement, which is assessed before the iteration, and (3) the last expression commonly defines the step size;
* Experiment 02 (_E02_): it evaluates statement _for_ using increment (e.g., _for(i = 0 ; i < 10; i++)_) or decrement (e.g.,_for(i = 10 ; i >= 0; i-_)_) in the step size (Suggestion _S02_);
* Experiment 03 (_E03_): it evaluates the power consumption of the use or not of parenthesis (Suggestion _S03_);
* Experiment 04 (_E04_): it assesses the branch order of statement _if-then-else_ (Suggestion _S04_), comparing the results obtained when the most accessible branch is the last or the first one;
* Experiment 05 (_E05_): it evaluates the three ways (var++, var++=1, var = var + 1) of incrementing a value in neSC (Suggestion _S05_); and
* Experiment 06 (_E06_): it checks if there is some difference in the application's power consumption when it uses a variable, constant or fixed value (Suggestion _S06_). These experiments were carried out by implementing six different neSC applications. The neSC applications were deployed in an IRIS mote, connected to a MTS400 basic environment sensor board. An oscilloscope was used to measure the power consumption of the mote where the applications execute. A computer attached to the oscilloscope obtains the code snippet execution start and end times through monitoring one of the LEDs of the mote, which is turned on/off to indicate the execution starting/ending. The PC runs a tool named AMALGHMA [20] that is responsible for calculating the power consumption. Each experiment was performed 100 times, and the confidence level is equal to 95%. Two applications were used in Experiment _E01_. These applications initialize an array of size 20 and assign the value zero to all positions. First application uses the statement _for_ to perform this task, while second code uses 20 individual assignments to carry out the same task. The power consumption of both applications is shown in Figure 14. In this case, the first application (with statement _for_) consumes 71.85% more energy than the second one. We applied the hypothesis testing to the results, and it generated a \(p\)-value equal to \(1.85816\times 10^{-65}\), which shows that statement _for_ has a great impact on the power consumption of the application. This fact occurs because it has three expressions that consume a lot of energy: initialization of the value assignment, evaluation of a condition, and increase/decrease expression. In Experiment _E02_, we implemented two applications: the first application uses an increasing step (from zero to twenty), and the second code uses a decreasing step (from twenty to zero). These applications initialize an array with size predefined equal to 20 and assign zero to all positions of the array. Figure 14: Power Consumption of E01. In this case, the application that uses the decreasing step consumes 54.78% more energy than the one with increasing step. The hypothesis testing yielded a \(p\)-value equal to \(7.7639\times 10^{-49}\). Hence, it shows that is better to use an increasing step solution.