## 3 Methods and Tools
### Propagation Model  
To be able to evaluate the behavior of the communication network presented above, we derived and implemented an accurate propagation model that was finally programmed in the TOSSIM simulator. This task was decomposed into two steps: first, we acquired real propagation data in an SG substation of Iberdrola (a Spanish energy provider; see Figure 2b) by means of a high-end Vector Network Analyzer (the E5071B - VNA, Agilent Technologies(r), Santa Clara, CA, USA). Finally, a mathematical model that approximates the propagation behavior of the SG was chosen  
Figure 2: (a) Simulated base network (b) SG substation where the data was acquired. (see Equations (1) and (2)) and fitted to the acquired data. This two-fold approach guarantees that if the fitting process is thorough, the propagation model will replicate the original data, and thus, an SG environment. Arguably, the most important propagation phenomenon when simulating narrow-band communications (such as the 802.15.4 standard) is the relation between the received power and distance to the transmitter. Thus, we have focused on accurately replicating this relation. To do so, we distinguish three visibility conditions between device pairs: LOS, OLOS and NLOS. Differentiating these scenarios is of paramount importance as propagation losses have been proven to be strongly influenced by the visibility conditions of communication links [17; 31; 34]. In order to model this phenomenon, we have first obtained a series of measures (via the VNA) under the aforementioned visibility conditions: the VNA generates a known signal that travels the wireless medium before reaching the receiver. Then, the differences between the transmitted and the received signal are analyzed and lastly fitted to a propagation model. This procedure is repeated for the following distances: 1, 2, 5, 10, 15, 20, 25, and 30 m. In order to gain statistical confidence, for each distance, we have acquired up to 30 individual measurements over an area of \(\lambda/2\) (i.e. half of the wavelength, which translates to 32.8 cm and 12.5 cm for the 915 MHz and 2400 MHz respectively). This is a fairly common method in characterizing propagation environments [31; 35] and is carried out with the intention of make the derived propagation model as much general as possible. This procedure is rerun for both bands: the 915 MHz and the 2400 MHz ones. Figure 3 above shows the received power vs distance for the different visibility conditions and frequency bands (along with the 95% confidence intervals). Figure 3: Received power vs. distance for (**a**) LOS, (**b**) OLOS, and (**c**) NLOS visibility conditions in an SG environment. 95% confidence intervals are also included. As explained before, the main purpose of the propagation model is to replicate the behavior of the acquired data (presented in Figure 3) under the three different visibility conditions. The first significant phenomenon in Figure 3a-c to reproduce is the progressive deterioration of communication as the receiver moves away from the transmitter (i.e., less power is received when the distance increases \(\overline{D}_{in}\) grows). This and other important phenomena, such as the presence of greater losses in NLOS than OLOS/LOS or larger losses in higher frequencies, can be adequately characterized by a very well-known propagation model: the log-normal shadowing path-loss model (LNSPL) [36]. The LNSPL (Equation (1)) models the dependency of received power on distance by considering the distance \(d\) at which we evaluate the path losses. It permits modulating the effect of this phenomenon (the rate at which the received power decays with distance) by adjusting the path loss exponent \(n\) for different scenarios, frequencies and visibility conditions. Furthermore, the variance over the mean received power is adjusted for each situation by a zero mean Gaussian random variable (X\({}_{\sigma}\)) - which represents the variability of the received power over the expected value.