# Communication Protocol Design for IoT-Enabled Energy Management in a Smart Microgrid
## 2 System Model
Whenever a HEMS receives information about two different HEMSs, it computes the sum of the signals and forwards this sum to the nearby HEMSs acting as relays. The process repeats itself as long as all HEMSs receive each other's information. Let us elaborate on the above communication scheme with an example system of five HEMSs. We denote the HEMSs as HEMS A, B, C, D and E. Let us consider that, initially, HEMSs A, C and E transmit the energy mismatch signals and HEMSs B and D listen. HEMS B receives the sum of signals from HEMSs A and C, whereas HEMS D receives signals from HEMSs C and E (time slot 1). Next, HEMSs B and D transmit and HEMSs A, C and E listen (time slot 2). HEMS A and E receive from HEMSs B and D, respectively, whereas HEMS C receives the sum of signals from HEMSs B and D. Then, HEMS B acts as a relay and forwards the sum of signals received in time slot 1 to A and C (time slot 3). Thus, HEMS A and HEMS C receive the messages from each other. Then, HEMS D forwards the sum  
Figure 1: A microgrid comprising households with renewable generation and IoT-enabled HEMSs that can exchange excess demand/generation information with each other for local energy trading applications. of signals to HEMSs C and E, enabling HEMSs C and E to retrieve each other's messages (time slot 4). Next, HEMS C forwards the sum of signals received in time slot 2 to HEMS B and HEMS D (time slot 5). As a result, HEMSs B and D receive messages from each other. Then, HEMS C forwards its message to HEMS B and HEMS D (time slot 6), which allows HEMSs B and D to decode the signals from HEMS A and HEMS E, respectively. Next HEMS B forwards the sum of HEMS C and D's signals, whereas HEMS D forwards the sum of HEMS B and HEMS C's signals (time slot 7). This enables HEMS A to decode HEMS D and HEMS E to decode HEMS B. Finally, HEMS C forwards the sum of signals from HEMS A and E, and HEMS B and D received this sum and decode HEMS E and HEMS A, respectively (time slot 8). Then, HEMS B (D) forwards the signal from HEMS E (A) to HEMS A (E). (time slot 9). Thus, nine time slots are needed in this scheme for the information exchange between five HEMSs. If the IoT-enabled HEMSs communicate with each other through the control centre, then, in the example system, HEMSs A, B, C, D and E will transmit their messages using five different time slots in the uplink. Then, the control centre will broadcast the message of each HEMS to all the HEMSs using five time slots in the downlink. Thus, in this scenario, a total of 10 time slots will be needed for centralised systems, similar to the ones with the NB-IoT protocol. As a result, the proposed scheme can significantly reduce the time delay and allow for better spectral efficiency compared to centralised systems. If the intermediate nodes decode the messages directly and forward them rather than their sum, then, in the aforementioned example, HEMS B will directly receive the message from HEMS A. Then, the process will continue from B to C, C to D and D to E. Thus, after four time slots, all HEMSs will have a copy of HEMS A's message. As a result, the information sharing among all HEMSs will be completed in \(5\times 4=20\) time slots. In effect, significant time savings can be achieved through the proposed method compared to systems that use one-hop direct communication (such as wireless mesh networks) where all HEMSs need to know each other's messages for decentralised energy management. Let us consider that the set of HEMSs are denoted by \(\mathcal{K}=\{1,2,...,K\}\) and individual HEMSs are indexed by \(k\). The renewable energy generation and electricity demand managed by the \(k\)th HEMS are represented by \(G_{k}\) and \(D_{k}\), respectively. Thus, the mismatch between generation and demand at a certain time point is computed as \(D_{k}-G_{k}\) at the \(k\)th HEMS. The information is then quantised, coded and modulated as \(u_{k}\). The channel coefficient between the two HEMSs indexed by \(k\) and \(\ell\) (where \(\ell\in\mathcal{K},\ell\
eq k\)) is denoted by \(\mathbf{h}_{k,\ell}\).