# Communication Protocol Design for IoT-Enabled Energy Management in a Smart Microgrid
## 4 Error Probability Analysis
### \(k\) Odd, \(\ell\) Odd
: _The probability that the \(\bar{k}\)th HEMS incorrectly decodes the signal from the \((\bar{k}+2)\)th and the \((\bar{k}-2)\)th HEMSs is as follows:_  
\[Pr_{\bar{k},\bar{k}+2} =Pr_{\bar{k}}(1-Pr_{\bar{k}+1})+(1-Pr_{\bar{k}})Pr_{\bar{k}+1}\] \[Pr_{\bar{k},\bar{k}-2} =Pr_{\bar{k}}(1-Pr_{\bar{k}-1})+(1-Pr_{\bar{k}})Pr_{\bar{k}-1} \tag{11}\]  
_where \(Pr_{\bar{k}+1}\) and \(Pr_{\bar{k}-1}\) denote the probability of incorrectly decoding the signal at the \((\bar{k}+1)\)th and the \((\bar{k}-1)\)th HEMSs during time slot \(1\)._  
Proof. : There are two criteria which determine whether the signal of the \((\bar{k}+2)\)th HEMS can be obtained accurately. These include the following: (i) what \((\bar{k}+1)\)th HEMS decodes in the first time slot, and (ii) what \(k\)th HEMS decodes in the second time slot. Thus, the \(k\)th HEMS can erroneously detect the \((\bar{k}+2)\)th HEMS's signal in two possible ways as follows: (i) if \((\bar{k}+1)\)th HEMS decodes \(\tilde{u}_{k}+\hat{u}_{k+2}\) incorrectly and at the same time, \(\hat{V}_{k,k-2}\), forwarded from the \((\bar{k}-1)\)th HEMS, is correctly decoded at the \(k\)th HEMS, (ii) if the sum of the signals from the HEMSs indexed by the \(\bar{k}\) and \((\bar{k}+2)\) is correctly decoded by the \((\bar{k}+1)\)th HEMS and the signal relayed from the \((\bar{k}-1)\)th HEMS is incorrectly decoded at the \(\bar{k}\)th HEMS. Note that, if both the \((\bar{k}+1)\)th and the \(\bar{k}\)th HEMSs incorrectly decode the signals, then, for the BPSK signal, the error at the second stage will cancel the error from the first stage. After the second time slot, the HEMSs will receive the sum of the signals forwarded by the adjacent HEMSs. The signal transmission between HEMSs will repeat until the \(k\)th HEMS receives the signals from the \((k+1)\)th HEMS and the \(\ell\)th HEMS from the \((\ell-1)\)th HEMS. As a result, the chances of error at a certain HEMS can be computed based on the error rates at the HEMSs from whom the particular HEMS has received messages. The following lemma presents the associated mathematical formulation. **Lemma 3**. : _The probability of incorrectly decoding the \(\ell\)th HEMSs' message at the \(k\)th HEMS is approximated as follows:_  
\[Pr_{\bar{k},\ell,odd}\approx\sum_{a=1}^{|\ell-k|}Pr_{k+a-1,k+a}\prod_{b=1}^{ \ell-k,b\
eq a}(1-Pr_{k+b-1,k+b}) \tag{12}\]  
_where \(Pr_{k+a-1,k+a}\) denotes the probability that the \((k+a-1)\)th HEMS incorrectly decodes the signal from the \((k+a)\)th HEMS. On the other hand, the second term \((1-Pr_{k+b-1,k+b})\) indicates the probability that the \((k+b-1)\)th HEMS has correctly decoded the signal from the \((k+b)\)th HEMS._Proof. : The chances of error at the \(k\)th HEMS for incorrectly estimating the \(\ell\)th HEMS's message will be a function of the probabilities of error at the \(|\ell-k|\) HEMSs in between the two HEMSs. At a certain time, there can be \(J\) number of HEMSs, where \(J\in[1,|\ell-k|],J\in\mathbb{Z}\), from whom the \(k\)th HEMS received information. If \(J=1\), the error probability will be quite large given that it is highly probable for one of the HEMSs to decode incorrectly. On the other hand, for \(J>1\), the error probability would be smaller given that it is less likely for more than one HEMSs to incorrectly decode, particularly in high SNR. That is, as SNR increases, it can be considered that the probability of error at the \(k\)th HEMS will be dictated by the chances of error at the \(k\)th HEMS for decoding a single HEMS (indexed by \(a\)) between the \(k\)th and the \(\ell\)th HEMS, while the messages from the other HEMSs between \(k\) and \(\ell\) are correctly decoded. As a result, the error performance at \(k\)th HEMS for obtaining the information from the \(\ell\)th HEMS is presented in (12).