## 3 Considered Two-Way Relaying PNC Systems
### Reference PNC Algorithm  
Without loss of generality, let us assume that \(H_{1,k}>H_{2,k}\) in (1). If we divide both sides of (1) by \(H_{1,k}\), we get:  
\[V_{k}=\frac{Y_{k}}{H_{1,k}}=X_{1}+h_{k}X_{2}+\frac{N_{k}}{H_{1,k}},\quad h_{k }=\frac{H_{2,k}}{H_{1,k}} \tag{2}\]  
The sample \(V_{k}\) contains a new composite modulation of the signal received on the \(k\)-th subcarrier in the relay, and a noise sample. Figure 3: General scheme of a two-way relaying PNC system in the multiple access phase. Let us consider an instructive example where both terminals use QPSK modulation schemes. Figure 4 shows both QPSK constellations with bit block mappings, and the composite signal constellation contained in \(V_{k}\). If QPSK with a typical binary block is applied in constellation points mapping, then the resulting composite constellation is 16-point; however, knowing the applied mappings and relative channel coefficient \(h_{k}\), we can determine the mapping of the composite constellation. Assume that the number of constellation points of \(X_{1,k}\) is \(2^{p}\), whereas for \(X_{2,k}\) it is \(2^{q}\). Let the PNC algorithm find the composite constellation point using the maximum likelihood (ML) rule. Then, the closest constellation point in the Euclidean distance sense is determined for each received sample \(V_{k}\) (\(k=0,1,\ldots,N-1\)). Let us denote the constellation points of the composite constellation as \(D_{k}\)., namely:  
\[D_{k}=X_{1,k}+h_{k}X_{2,k} \tag{3}\]  
Then, according to the ML criterion, we find \(D_{k}\) from the set \(\{D_{k}\}\) of possible constellation points which fulfills the following rule:  
\[\hat{D}_{k}=\operatorname*{argmin}_{\{D_{k}\}}\left|V_{k}-D_{k}\right|^{2} \tag{4}\]  
Now, a unique mapping of constellation points, \(D_{k}\), and bit blocks has to be set. Out of many possible mappings, we can select the one for which the first \(p\) bits are the same as in the constellation of \(X_{1,k}\), participating in the creation of a particular \(D_{k}\), and the remaining \(q\) bits are the same as in the mapping for \(X_{2,k}\) participating in that \(D_{k}\) as well. In our example, let the decided constellation point \(\hat{D}_{k}\) be the one that is assigned to the binary block \(b_{1}b_{2}b_{3}b_{4}\). One can easily find that the bits \(b_{1}\) and \(b_{2}\) originate from constellation point \(X_{1,k}\), whereas the bits \(b_{3}\) and \(b_{4}\) are associated with constellation point \(X_{2,k}\). Thus,  
Figure 4: Constellations of QPSK symbol \(X_{1,k}\) (**a**), QPSK symbol \(X_{2,k}\) scaled by \(h_{k}\) (**b**), and composite signal constellation (**c**) with exemplary mapping of binary blocks onto constellation points. after detecting the composite constellation point, the PNC algorithm can perform the following symbol-by-symbol operations:  
\[a_{1}=\hat{b}_{1}\oplus\hat{b}_{3},\quad a_{2}=\hat{b}_{2}\oplus\hat{b}_{4}, \quad\oplus\text{ - mod-2 addition} \tag{5}\]  
Based on the bits \(a_{1}\) and \(a_{2}\), generated according to (5), a new QPSK signal is synthesized, which is subsequently transmitted by the relay in the broadcast phase to terminals A and B. Let us note that if the channel code applied in terminals A and B is linear, then the modulo-2 addition of codeword bits creates another codeword of the same code. If some bit decisions made by the relay are incorrect, then they are equivalent to errors in the codeword which can potentially be corrected by the terminals. Both terminals perform QPSK detection and determine the binary block \(\hat{a}_{1}\hat{a}_{2}\). On this basis, and knowing the stored own transmitted block \(b_{1}b_{2}\) for terminal A and \(b_{3}b_{4}\), for terminal B, the far end block can be determined by the modulo-2 addition of these respective blocks with the detected binary block \(\hat{a}_{1}\hat{a}_{2}\).