# Build-Launch-Consolidate Framework and Toolkit for Impact Analysis on Wireless Sensor Networks
## 3 Framework Overview
### Consolidator  
The consolidator consolidates all output files into one master workbook leveraging Power Query. The consolidator relies on the logs generated by the simulations to calculate different metrics. This implies that the source code for the network's nodes is programmed to output readings of desired metrics beforehand. Accordingly, log outputs include timestamps of these readings and events. Readings for each metric are collected by a specific query designed to parse for it. Readings for each metric are then stored separately for further analysis. The consolidator preprocesses all the log files resulting from simulations and records individual messages by simulation, timestamp, node ID, and output message. Each message is checked against a match of a predefined signature for each metric.  
Our existing implementation collects three popular metrics for measuring the performance of the network; namely, PDR, E2E delay, and power consumption. The consolidator can be expanded to accommodate additional metrics with proper configuration. PDR is a key indicator for the quality of message transmission and reception, and by extension, the availability of the service provided by the network. E2E delay, conversely, looks at the degradation of the service resulting from delayed packets. Both measures rely on the nodes logging timestamped messages of sending and delivering data packets, which are read by the consolidator for each metric. Increased power consumption is detrimental to the lifespan of the network because it quickly depletes the nodes' batteries. We estimated power consumption using PowerTrace [30] and the ENERGEST module. Both are used to track--at the node level during run time--how long each hardware component has been on (e.g., CPU and transmitter). If we know the rate of energy consumption for each individual component when it is used, then we can use both to calculate an estimated power consumed at a specific interval. These rates are often documented as part of the hardware specification for individual node types and can vary among different manufacturers and architectures. Table 3 illustrates the specification factors used for the Zolertia Z1 motes according to the datasheet [31]. Readings of power consumption rates are collected by reading logged messages by the nodes. The consolidator allows easy modification of these factors to scale to different hardware.  
At the core of the consolidator are master lists that include all simulations and their average readings for all nodes for each metric. In addition, the consolidator includes one worksheet that includes holistic average readings for all metrics for all simulations as a summary of experiment results, as illustrated in Figure 5. The consolidator also outputs separate sheets (one for each metric) that include node-level average readings for each experiment. These can be exported to CSV files for further analysis. Because the layouts of these networks were already built using the aforementioned builder, the same tool can be fed with resulting CSV results to help generate visual heatmaps. For example, if an experiment included 6 simulations (1 for each combination of scenario-placement-topology) to collect 3 metrics, we would have 18 heatmaps, each showing average readings of each node in each simulation. This proved to be a strong analysis tool and allowed us to visually trace the impact of each attack or treatment throughout the network structure.  
\begin{table}
\begin{tabular}{l l l} \hline \hline \# & **Parameter** & **Value** \\ \hline
1 & Number of motes & 34 + 1 Sink \\
2 & Malicious motes & 0 or 1 \\
3 & Mote type & Zolertia Z1 \\
4 & Mote distribution & Binary or Grid \\
5 & Tx and Rx success ratios & 1.0 \\
6 & Duration & 30 Min \\ \hline \hline \end{tabular}
\end{table}
Table 3: Simulation environment parameters.