# Experimental Study of 6 LoPLC for Home Energy Management Systems
## 4 Simulation Setup
### System Parametrisation and Packet Analysis  
The idea of this section is to extract system parameters from the test bench and apply them to simulate HEMS applications in diverse scenarios. One Hanadu gateway (designated as the HEMS controller) and two nodes are available for this evaluation. We begin the evaluation by setting up a power line network between the controller and one of the nodes designated as the LED-lamp. In contrast with filament-based lights, the LED-lamp fixture used in this work is a full-fledged network node with a valid network properties, such as the IPv6 address; the same applies to the sensor. For experimental purposes, the lamp is deployed as the light source whose intensity is controlled over the power line network. To view the bi-directional communication, we installed Wireshark (an open source packet sniffer) on a Linux laptop and connected it to the Ethernet port of the HEMS controller to monitor the end-to-end communication. A sample of the packet analysis is presented in Figure 5.  
Figure 5: Traffic capture in Wireshark showing the packet analysis.  
Figure 5 was obtained by sending a command from the controller to change the intensity of the light using the IPv6 address of the HEMS controller and the lamp as the message source and destination, respectively. The packet analysis in Figure 5 reveals some important characteristics of the control messages and acknowledgement exchanged between the controller and the lamp. For example, based on this traffic analysis in Figure 5, the size of control messages, the transport layer protocol, the network layer protocol, the application layer protocol and the UDP port number used during the communication were obtained. The complete parameters outlined in Table 1 are combined with the power line channel specification to simulate the performance of HEMS application in NS-3.  
It should be noted that the application data sizes in Table 1 are payloads only. In addition to background coloured noise, impulsive noise imposes performance constraints on PLC systems. Generally, impulsive noise is generated by the operation of power electronic devices and transient switching events. For example, SCR, switching mode power supplies (in light dimmers) and DC-DC converters are known sources of impulse noise. Since diverse types of appliances are typically found in homes, the effect of impulsive noise on HEMS system is also of interest in this work.  
To capture these realities, two random number generators (rngs) in NS-3 are employed to generate a random value within 1-10. Thus, in each instantiation, the first rng creates a value within 1-10 s for the impulsive noise interval, and the second rng generates values within 1-10 ms for pulse duration. Impulsive noise power of 9.91 dBm is employed as this was the peak value observed in the laboratory. Using these values, an instance of impulsive noise characterised by inter-arrival time and durations of 1-10 s and 1-10 ms, respectively, is then created to interfere with the data signal. To ensure that the results of the same scenario are consistent and reproducible, a fixed seed is used in the rng in each simulation. This is done by calling ns3::RngeSeedManager::SetSeed(). The results of the simulations are presented and discussed in the next section.