# Polar Codes and a M-ary Modulation-Based OFDM-PLC System
## 2 Polar Codes
### Decoding  
At the decoder, the SC decoding algorithm first partitions the decision units. If a decision bit is a frozen bit, its value is determined based on the known frozen bit value. Otherwise, its value is determined through the decision function \(h_{i}\), and the decision rule is:  
\[\hat{u}_{i}\triangleq \begin{cases}u_{i},\,i\in A^{c}\\ h_{i}\left(y_{1}^{N},\hat{u}_{1}^{i-1}\right),\;i\in A\end{cases}  \tag{3}\]  
The decision function \(h_{i}\) is defined as:  
\[h_{i}\left(y_{1}^{N},\hat{u}_{1}^{i-1}\right)\triangleq \begin{cases}0,\;L_{N} ^{i}\left(y_{1}^{N},\hat{u}_{1}^{i-1}\right)\geq 0\\ 1,\;\text{otherwise}\end{cases}  \tag{4}\]  
where \(L_{N}^{i}\left(y_{1}^{N},\hat{u}_{1}^{i-1}\right)\) is the log-likelihood ratio (LLR) for each channel, which is calculated by:  
\[L_{N}^{i}(y_{1}^{N},\hat{u}_{1}^{i-1})\triangleq\ln\frac{W_{N}^{i}\left(y_{1} ^{N},\hat{u}_{1}^{i-1}\Big{|}0\right)}{W_{N}^{i}\left(y_{1}^{N},\hat{u}_{1}^{ i-1}\Big{|}1\right)} \tag{5}\]  
where \(W_{N}^{i}\left(y_{1}^{N},\hat{u}_{1}^{i-1}\Big{|}u_{i}=0/1\right)\) represents the transition probability of the \(i\) separated sub-channel. The LLR \(L_{N}^{i}\left(y_{1}^{N},\hat{u}_{1}^{i-1}\right)\) is recursively calculated by:  
\[ \begin{cases}\;\;\;L_{N}^{2i-1}\left(y_{1}^{N},\hat{u}_{1}^{2i-2}\right)=f \left(L_{N/2}^{i}\left(y_{1}^{N/2},\hat{u}_{1,\rho}^{2i-3}\bigoplus\hat{u}_{1,\rho}^{2i-2}\right),L_{N/2}^{i}\left(y_{N/2+1}^{N},\hat{u}_{1,\rho}^{2i-2} \right)\right)\\ L_{N}^{2i}\left(y_{1}^{N},\hat{u}_{1}^{2i-1}\right)=g\left(L_{N/2}^{i}\left(y _{1}^{N/2},\hat{u}_{1,\rho}^{2i-2}\bigoplus\hat{u}_{1,\rho}^{2i-2}\right),L_{ N/2}^{i}\left(y_{N/2+1}^{N},\hat{u}_{1,\rho}^{2i-2}\right),\hat{u}_{2i-1} \right)\end{cases}  \tag{6}\]where \(\hat{a}_{1,\rho}^{2i-3}\) represents all odd numbers between 1 and \(2i-3\), \(\hat{a}_{1,e}^{2i-2}\) represents all even numbers between 1 and \(2i-2\), \(i\in[1,N]\), functions \(f\) and \(g\) are defined as follows:  
\[ \begin{cases}f(a,b)\triangleq\ln\left(\frac{e^{a+b}+1}{e^{a}+e^{b}}\right) \approx sgn(ab)\min(|a|,|b|)\\ \hskip 142.26378 ptg(a,b,c)\triangleq b+(-1)^{c}a\end{cases}  \tag{7}\]  
As the SC decoding algorithm uses LLR decision-making based on bit-by-bit, it can lead to error propagation due to incorrect decisions at certain nodes, which cannot guarantee maximum likelihood decoding of the entire codeword. To further improve decoding performance, the SCL algorithm [21] calculates path metrics (PM) values for \(2N\) paths (with a code length of \(N\)) when performing LLR decision-making on information bits. When the path width is \(L\) and \(L\geq 2\), path selection is performed based on the PM values, and the optimal path is selected as the decoding result. The PM is calculated as follows:  
\[PM_{l}^{i}=\left\{ \begin{aligned} PM_{l}^{i-1},\ if\ u_{i}\in A\ or\ u_{i}\in A^{c}\ and\ \hat{u}_{j}[l]=\delta\Big{(}L_{n}^{i}[l]\Big{)}\\ PM_{l}^{i-1}+\Big{|}L_{N}^{j}[l]\Big{|},\ if\ u_{i}\in A\ or\ u_{i}\in A ^{c}\ and\ \hat{u}_{j}[l]\
eq\delta\Big{(}L_{n}^{j}[l]\Big{)}\\ +\infty,\ if\ u_{i}\in A^{c}\ and\ incorrect\ value\end{aligned} \right. \tag{8}\]  
where \(i\in\{1,2,\ldots,N\}\) and \(l\) represent the corresponding paths, \(l\in\{1,2,\ldots,L\}\) and \(PM_{l}^{0}=0\); the LLR of \(L_{N}^{j}[l]\) is \(L_{N}^{j}[l]=\ln\frac{Wi_{N}^{i}(y_{1}^{N}\hat{a}_{1}^{i-1}[l])}{Wi_{N}^{i}(y _{1}^{N}\hat{a}_{1}^{i-1}[l])}\); \(\delta(x)=\frac{1}{2}(1-sgn(x))\) represents the decision bit \(\hat{u}_{i}\) as \(\hat{u}_{i}=\delta\Big{(}L_{N}^{i}\Big{(}y_{1}^{N},\hat{a}_{1}^{i-1}\Big{)} \Big{)}\). To improve the accuracy of path selection in the SCL algorithm, the CA-SCL algorithm introduces cyclic redundancy check (CRC) codes [22], forming a CRC-polar concatenated code. The decoding algorithm flowchart is shown in Figure 1 below:  
The original bit stream \((u_{1},\ldots,u_{k})\) and the CRC check bits with the length of \(r\) form sequence\((u_{1},\ldots,u_{k},u_{1},\ldots,u_{r})\), which is polar encoded to obtain the codeword sequence \((x_{1},\ldots,x_{N})\).