## 6 Application Description  
The overall application has the goal of monitoring the ST industrial site with particular attention to the power consumption within the whole industrial site. The following layers were set up according to the architecture just described. The technological layer is responsible for data acquisition from the electrical substations located inside the industrial site. This monitoring activity is achieved by a WSN. Inside the substations, the multifunction network analyzers (FRER Q96U4) provide the visualization of all the main characteristics of the electric network activities. Each electrical substation can have one or more BUS, each with a maximum of \(12\) multifunction network analyzers connected in parallel mode. One sensor node is physically connected to the BUS via a serial interface converter RS232-RS485. Each FRER of each BUS is identified by a progressive number \(Id\), with \(Id=1,2,\cdots,12\). It is possible to install one or more BUS for each substation: each BUS is uniquely identified by the Mac Address of the wireless interface of the connected node. Figure 3 shows how the devices are connected. Figure 3: Substation: devices connection schema. Figure 2: Details of the monitored area. The multifunction network analyzer detects \(45\) different types of measures. The sensor node, connected to the BUS, cyclically queries each FRER acquiring such \(45\) values. These values, one by one, are forwarded to the sink node that further elaborates and transfers them to the middleware layer. We can note that, depending on the application requirements, it could be necessary to decrease the maximum number of monitored devices on the BUS to have a shorter polling cycle on them. Let be \(\delta\) the mean time to read a value from a FRER, \(M\) the number of FRER connected on a BUS, and \(m\) the number of values to read from a FRER: the time interval incurring between two readings of the same measure is \(\Delta=\delta\cdot M\cdot m\). If \(\Delta\) is too long with respect to some specific application requirement, the two quantities \(M\) and \(m\) must be appropriately set to meet it. \(M\) depends on the nature of required measures and it can not be modified thus, in this scenario, the only possibility is to cut short the BUS. Since a sensor node serves as slave for each BUS, when the number of network analyzers in an electrical substation is high, the number of transmitting nodes increases, producing a high data loss rate due to packet collisions. For the monitoring activity of the whole site, we used six nodes and one sink connected through the topology depicted in Figure 4.  
We solved the problem of battery discharge [28; 29; 30] by installing solar panels in order to recharge the batteries (Figure 5 shows the final installation). The middleware layer implements the integration between the technological layer (sensors and FRERs) and the application layer. WhereX receives data from the sink node to which it is interconnected via the USB interface. A specific driver was implemented and installed to properly interface and interact  
Figure 4: WSN topology. Figure 5: Solar panel and battery charge circuit. with the sync node. The middleware provides data aggregation, one record of \(45\) measures for each FRER, and then stores them into the database (through a _db-event_). In general, to simplify the integration process it is necessary to improve the quality of the exchanged data. In fact, data are generally characterized by large volume, temporality, spatiality, inaccuracy, interferences, and limited active lifespan. Before a db-event is generated, the middleware executes a data filtering, which is necessary to remove the data affected by errors, and adapts them to the high-level application. All these operations are possible because WhereX gives the user the possibility to easily configure and personalize filters and rules to process the data. All these operations can be configured without restarting the middleware.