## 4 Implementation of the Experiment Results in OMNeT++ Discrete Event Simulator
### Implementation of the Received Signal Strength Indication in OMNeT++ Discrete Event Simulator  
The RSSI is the power level of the signal received at a device's antenna. The RSSI is determined by the transmission power, the distance between the transmitter and the receiver, and the radio environmental field, which can disturb RF wave signals beneath the receiver's antenna, such as reflection that bounces the waves in various directions. The refraction of waves involves a change in the direction of the waves as they pass from one medium to another; diffraction, which scatters the wave and spreads it around the line of sight; or conditions such as weather changes.  
RSSI-based location techniques demonstrate the relationship between the RSSI and the distance in wireless sensor networks, and this relation is computed according to the following equation:  
\[RSSI|_{dBnt}=RSSI_{0}|_{dBm}-10|_{dB}n\times log\bigg{(}\frac{d}{d_{0}}\bigg{)} +\left.X_{\sigma}\right|_{dB} \tag{7}\]  
where \(RSSI_{0}\) indicates the RSSI when the reference distance is \(d_{0}m\) indicates the path loss index in a specific environment; \(X_{\sigma}\) is in dB, being a distribution with \(\sigma\)-level standard deviation. The more noisy the environment, the greater the deviation in the signal, which becomes more complex to predict.  
The RSSI module was implemented under the physical layer into the compound module of the narrow-band receiver, as shown in Figure 21. Additionally, it was computed with each received packet, encapsulated as a signal tag to have the possibility of sending it to different modules, recording it, and showing the output results in a graph, as in the PER module.  
The RSSI module used the RSSI-based location technique in Equation (7). The distance was obtained from different positions of the nodes in the simulator. The RSSI reference as the distance reference, the attenuation coefficient \(n\), and the distribution level \(X_{\sigma}\) were entered by the user as parameters before the simulation to obtain the system response in different environments. The diagram block Figure 22 shows the module location and its initiation parameters. The RSSbase module was created to collect information from different modules, such as different node positions.  
A simulation process was built in the OMNeT++ discrete event simulator, where the distance between the WuRx nodes is increasing. The receiver node record the RSSI values with each received packet. Four scenarios were included to study different cases of noise figures, where the standard deviation varied from 0.5 dB, as shown in Figure 23a, to 1.5 dB, as shown in Figure 23b. As it was mentioned before, different environments are characterized by various noises: the more persistent the noise, the higher value of the deviation. As shown in  
Figure 21: RSSI network description (NED) module.  
Figure 23c,d, another log-normal distribution was built in the simulator with different widths, 0.5 dB and 1 dB, to better show how RSSI changes in fading channels.  
Figure 23: Results of the simulation of the RSSI with different standard deviation values: (**a**) with low noise level (**b**) with high noise figure level; (**c**) using the log-normal distribution with low deviation; (**d**) using the log-normal distribution with higher deviation.  
Figure 22: RSSI module in OMNeT++ discrete event simulator.