# Communication Protocol Design for IoT-Enabled Energy Management in a Smart Microgrid
## 5 Numerical Simulation Results  
In this section, a microgrid with six HEMSs is considered. These HEMSs are associated with houses connected to solar panels and the HEMSs can communicate about the surplus generation or energy deficit between each other as well as the central controller. The energy generation and consumption data are obtained from [54]. The data are collected for a particular day in July over 48 intervals, each of which is 30 min long. The nearby HEMSs have a channel gain of 100 between them, unless otherwise specified. The error probabilities are computed for 100 time frames, and then, the results are averaged.  
The system under simulation operates in the following manner. HEMSs 1, 3 and 5 transmit their messages, whereas HEMSs 2 and 4 receive the sum of signals and HEMS 6 receives the signal from HEMS 5. Then, HEMS 2, 4 and 6 transmit their signal, HEMSs 3 and 5 receive the sum of the signals and HEMS 1 receives the signal from HEMS 2. Then, HEMS 2 forwards the sum of signals from HEMSs 1 and 3 to them, and as a result, HEMSs 1 and 3 receive each other's messages. Similarly, HEMS 4 forwards the sum of signals and HEMSs 3 and 5 receive each other's signals. HEMS 5 also obtains the message from HEMS 6. After this, HEMSs 3 and 5 forward the sum of the signals received at the beginning, HEMS 2 obtains the signal from HEMS 3 and HEMS 4 obtains the signal from HEMS 5. HEMS 2 also receives the signal from HEMS 1. Then, HEMS 3 computes the sum of HEMS 1 and 5's signals, HEMS 5 computes the sum of HEMSs 3 and 6 and forwards that. Eventually, HEMS 2 receives the message from HEMS 5, HEMS 4 receives the signal from HEMS 1, HEMS 3 from HEMS 6 and HEMS 6 from HEMS 3. The process continues until all HEMSs obtain the signals from every other HEMS.  
Figure 2a-c show the actual and decoded energy mismatch information about HEMS 6 at all the other HEMSs for three different schemes. The first one is with the proposed scheme, the second one is with direct DF and the third one is with the central control centre. The energy mismatch value is first calculated at each HEMS by subtracting the generation value from the demand value. Thus, a positive energy mismatch value corresponds to excess demand, whereas the negative energy mismatch value corresponds to excess generation. The results show the energy mismatch information decoded for an SNR level of 5 dB. From the aforementioned figures, it can be seen that the proposed scheme performs at an equivalent level compared to the two other schemes, even at a low SNR. As identified in Remarks 1 and 2, the proposed scheme requires a smaller number of time slots to extract the messages compared to the two other schemes. For example, HEMS 6 can be decoded by all HEMSs by time slot 6 in the proposed scheme, whereas this is possible only after time slot 30 with direct DF and after time slot 12 with a central control centre. Thus, the proposed scheme can significantly reduce the latency while maintaining comparable reliability.  
In the following part of this section, we illustrate the error probability results rather than the decoded energy mismatch information for the sake of conciseness and clarity.  
Figure 2: Energy mismatch information at HEMS 6 decoded by all other HEMSs when the proposed scheme, direct decode\(-\)and\(-\)forward and transmission through central control centre are used.