# Communication Protocol Design for IoT-Enabled Energy Management in a Smart Microgrid
## 4 Error Probability Analysis
### \(k\) Odd, \(\ell\) Odd  
In this case, during the first time slot, the probability of error at the \(\ell\)th HEMS is given by the following lemma. **Lemma 1**. : _The error probability at the \(\bar{\ell}\)th HEMS (where \(\bar{\ell}\) is even) during the first time slot is as follows:_  
\[\begin{array}{llll}\mbox{Pr}_{\bar{\ell}}=& \begin{array}{ll}Q(\sqrt{\frac{ 2|h_{\bar{\ell}-1}|^{2}}{N_{0}}})&\mbox{if}&\bar{\ell}=L\\ Q(\sqrt{\frac{2|h_{\bar{\ell}-1}|^{2}}{N_{0}}})(1-Q(\sqrt{\frac{2|h_{\bar{\ell} -1}|^{2}}{N_{0}}}))+Q(\sqrt{\frac{2|h_{\bar{\ell}-1}|^{2}}{N_{0}}})(1-Q(\sqrt{ \frac{2|h_{\bar{\ell}-1}|^{2}}{N_{0}}}))&\mbox{if}&\bar{\ell}\
eq L\end{array}  \tag{9}\]  
**Proof. ** Note that at the first time slot, the \(\bar{\ell}\)th HEMS decodes the message from the \((\bar{\ell}-1)\)th HEMS if \(\bar{\ell}=L\) or the sum of signals from the HEMSs \(\bar{\ell}+1\) and \(\bar{\ell}-1\) if \(\bar{\ell}\
eq L\). The SNR of the signal received from the \((\ell-1)\)th HEMS at the \(\bar{\ell}\)th HEMS is given by \(\frac{|h_{\bar{\ell}-1}|^{2}}{N_{0}}\). If BPSK modulation is considered, the probability of incorrectly decoding the message from the \((\bar{\ell}-1)\)th HEMS at the \(\bar{\ell}\)th HEMS is written as in the first expression in (9). When \(\bar{\ell}\
eq L\), the \(\bar{\ell}\)th HEMS can incorrectly decode either of the signals from the \((\bar{\ell}-1)\)th HEMS or the \((\bar{\ell}+1)\)th HEMS to incorrectly decode the sum of signals from the \((\bar{\ell}+1)\)th and \((\bar{\ell}-1)\)th HEMSs. In case the \(\bar{\ell}\)th HEMS incorrectly decodes both the other HEMSs' signals, then it can still decode the signal correctly due to the signal patterns in the BPSK modulation. As a result, the probability of incorrectly decoding the sum of the signals from the \((\bar{\ell}-1)\)th and the \((\bar{\ell}+1)\)th HEMSs at the \(\bar{\ell}\)th HEMS is given as in the second expression in (9), where the first (second) term indicates the probability of incorrectly decoding the signal from the \((\bar{\ell}-1)\)th (\((\bar{\ell}+1)\)th) HEMS, while correctly decoding the signal from the \((\bar{\ell}+1)\)th (\((\bar{\ell}-1)\)th) HEMSs. In the next time slot, if \(\bar{k}=1\), then the sum of the signals from the \(k\)th and the \((\bar{k}+2)\)th HEMSs is decoded by the \(\bar{k}\)th HEMS. In the case of \(\bar{k}\
eq 1\), the \(\bar{k}\)th HEMS decodes the sum of signals from the HEMSs indexed by \(\bar{k}\) and the \((\bar{k}-2)\) in addition. Thus, the error probability at the \(\bar{k}\)th HEMS for decoding the sum of signals from the HEMSs indexed by\(\bar{k}\) and \(\bar{k}+2\), as well as the sum of the signals from the \(k\)th and the \((\bar{k}-2)\)th HEMS in the second time slot, is given as follows:  
\[\Pr_{\bar{k}}= Q(\sqrt{\frac{2|h_{\bar{k}+1|\bar{k}|^{2}}}{N_{0}}})\quad\quad\text{ if}\quad\bar{k}=1 \tag{10}\] \[Q(\sqrt{\frac{2|h_{\bar{k}-1|\bar{k}|^{2}}}{N_{0}}})\quad\quad \text{if}\quad\bar{k}\
eq 1\]  
Note that the expressions in (10) indicate the probability of incorrectly estimating \(\hat{V}_{\bar{k},\bar{k}+2}\) and \(\hat{V}_{\bar{k},\bar{k}-2}\). The expression for this probability has been derived in [52, 53] and can be readily applied to the HEMSs receiving the sum of the signals. Now, after the second time slot, the \(k\)th HEMS can extract the signal from the \((\bar{k}+2)\)th and the \((\bar{k}-2)\)th HEMS by cancelling self information. Thus, the probability of incorrectly decoding the new information after time slot 2 is given as in the following lemma. **Lemma 2**.