Application of an Interference Cancellation Detector in a Two-Way Relaying System with Physical Network Coding

: In this paper, we investigate the performance of a detector recently proposed by us that is applied in the relay station receiving signals from two terminals concurrently exchanging data in the two-way relaying system. This is one of the potential conﬁgurations to save resources in ﬁfth-generation systems, similar to non-orthogonal multiple access, which is also considered for such systems. Two-way relaying can be implemented using physical network coding. This technique originates from the network coding idea, in which network nodes can perform some mathematical operations. The idea of the investigated detector lies in the application of tentative decisions about weaker signals in the detection of stronger ones and then, after improved detection of stronger user signals, achieving more reliable decisions about the weaker ones. We compare the performance of the proposed detector with the performance of a detector in which the relay makes decisions on the data symbols received from the stations participating in two-way relaying on a symbol-by-symbol basis. Simulation results performed for two-way relaying with physical network coding reported in this paper conﬁrm the superiority of the proposed detector when compared with the standard physical network coding solution applied in the relay node.


Introduction
Fifth-generation systems (5G) are in the phase of intensive development although some crucial decisions on their structure, architecture, and form of physical, medium access control, and network layers have already been made and have received the form of standards [1,2]. However, several topics remain open. Among them, non-orthogonal multiple access [3] aiming at increasing the efficiency of radio resource utilization is one of the more interesting ones.
Another idea which can be potentially useful in increasing network throughput is network coding (NC). The idea of network coding was introduced by Ahlswede, N. Cai, S.-Y. R. Li, R. W. Yeung in their seminal paper [4], released in 2000. Since that time, hundreds of papers have been published in this area. Papers [5][6][7] are representative examples of fundamental extensions of [4]. In network coding, network nodes not only route information blocks but can also perform some arithmetic operations on the incoming blocks in order to route the outgoing blocks in a modified form. Such operations have been proven to enable the improvement of network throughput. Wireless networks are particularly well-suited to network coding, as they have a natural capability to send signals to several nodes or terminals concurrently. Numerous researchers have studied the performance of network coding in wireless networks, taking into account the properties of omnidirectional transmission and several other transmission arrangements. The representative papers related to these topics are [8][9][10].
A new idea, particularly suited for wireless network coding, is the application of signal operations in the physical layer of a communication system instead of operations on bit streams, performed in regular network coding. This way, inherent features of propagation in wireless media can be efficiently utilized. The first paper devoted to physical layer network coding (PNC) was presented by Zhang, Liu, and Lam in 2006 [14]. They considered an idealized communication system in which two terminals transmit data to the third one, the latter playing the role of an access point or a relay. The phase of concurrent transmission to the relay is called the multiple access phase. The authors made some simplifying assumptions, such as that the power and phase of the signals received by the relay from both terminals are equal, which is hard to achieve [15]. The relay interprets the superposition of the received signals as a joint signal constellation and, using appropriate mapping, generates a new signal that results from a modulo-2 sum of the bit blocks sent from both terminals by the component signals. This signal, broadcast by the relay, is received by both terminals (broadcast phase), which allows them to decode the other terminal signal, based on the received one and the knowledge of their own.
In 2018, the book [16], specifically devoted to physical layer network coding, was published, establishing a solid source of knowledge on this topic.
In wireless links, the application of channel coding is necessary. If regular or physical layer network coding is applied, channel coding has to be used in terminals and often in relays. Two basic approaches can be applied in a relay: the generation of the relay packet in standard or physical layer network coding is performed either on the bit-by-bit or symbol-by-symbol basis, or after channel code decoding (Decode-and-Forward (DF) rule). Each approach has advantages and drawbacks. In the first approach, network coding does not introduce a substantial delay and the relay is more energy efficient. On the other hand, performing network coding operations before channel decoding is more error-prone and can result in lower link performance. The second approach results in a higher performance, but it requires more computations and introduces longer delay.
We claim that the contributions of this paper are the following: 1.
We confirm that the detection algorithm performed by the relay, proposed by us in [17], results in better overall performance of a two-way relaying system as compared with a typical successive interference cancellation (SIC) receiver applied in the relay.

2.
We also show that the proposed detection algorithm performed in the relay jointly with channel code decoding of both end terminal signals performs better than the algorithm realizing joint detection of component signals performed based on the composite signal constellation that is achieved by summing the signals received from both end terminals in the multiple access phase.
The performance of the proposed detection algorithm applied in the relay node of a two-way relaying system is measured by the estimation of the bit error rate (BER) in both terminals participating in the information exchange in two-way relaying. The aim of this paper is not to calculate outage probability for two-way relaying systems nor to calculate the capacity of two-way relaying channels. We focus on the detection algorithm performed by the relay in the multiple access phase of data exchange as it has a crucial meaning for the overall system performance.
The rest of the paper is organized as follows. In Section 2, a two-way relaying system is recalled and the related works for such a system with channel coding are reviewed. Section 3 presents the physical layer network coding system models and explains two basic algorithms of signal detection in the relay. The first algorithm is based on symbol-bysymbol detection and creation of a broadcast relay signal, derived from composite received signals in the multiple access phase. The second algorithm is the one proposed by the authors of this paper, originally presented in [17] for the design of non-orthogonal multiple access (NOMA) receivers. We show that this algorithm can be also successfully applied in the relay of a two-way relaying system. Section 4 presents the simulation model used in the experiments and shows the simulation results. In Section 5, higher layer issues are briefly discussed. Finally, in Section ??, conclusions are formulated.

Two-Way Relaying System Model and Related Works
Let us recall a two-way relaying communication system in which standard or physical layer network coding is used. In such a communication system, packets from terminal A are transmitted to terminal B, and vice versa, via a relay which is located in the range of both terminals. However, none of the terminals can reach the other one directly with appropriate transmission quality. In order for terminals A and B to exchange packets in the standard two-way relaying, three steps are necessary (see Figure 1). In the first step, terminal A sends a packet to the relay. In the second step, terminal B sends its packet to the relay. In the third step, the relay performs the modulo-2 addition of both packets, creating a packet which is broadcast to both terminals. Based on the knowledge of own packet transmitted to the relay, and the packet received from it, the terminal recovers the packet transmitted by the remote terminal as the modulo-2 sum of both packets.
Electronics 2021, 10, x FOR PEER REVIEW 3 of 17 applied in the relay of a two-way relaying system. Section IV presents the simulation model used in the experiments and shows the simulation results. In Section V, higher layer issues are briefly discussed. Finally, in Section VI, conclusions are formulated.

Two-Way Relaying System Model and Related Works
Let us recall a two-way relaying communication system in which standard or physical layer network coding is used. In such a communication system, packets from terminal A are transmitted to terminal B, and vice versa, via a relay which is located in the range of both terminals. However, none of the terminals can reach the other one directly with appropriate transmission quality. In order for terminals A and B to exchange packets in the standard two-way relaying, three steps are necessary (see Figure 1). In the first step, terminal A sends a packet to the relay. In the second step, terminal B sends its packet to the relay. In the third step, the relay performs the modulo-2 addition of both packets, creating a packet which is broadcast to both terminals. Based on the knowledge of own packet transmitted to the relay, and the packet received from it, the terminal recovers the packet transmitted by the remote terminal as the modulo-2 sum of both packets. Physical layer network coding makes the system more efficient. In PNC, both terminals transmit their packets in the first phase simultaneously. The relay interprets the composite received signal constellations carrying packet data and generates a modulo-2 sum of the packets, which subsequently determines the packet broadcast by the relay to both terminals in the second phase. Thus, only two phases (multiple access and broadcasting) are needed, in contrast to the standard NC requiring three phases. The crucial factor in PNC is the way that the relay produces the packet to be broadcast to the terminals participating in the packet exchange. The generic scheme of this system is shown in Figure 2. As already mentioned, there is a problem of how channel coding and other algorithms are managed in the relay of a two-way relaying system. This problem has attracted the attention of many researchers.
Paper [18] is devoted to the implementation of physical layer network coding in twoway relay networks. The authors compare the existing network coding schemes, such as traditional network coding, physical network coding, and so-called soft network coding (SNC). The latter was introduced in [19]; however, it is related to traditional NC with channel coding. In this paper, channel decoding at the relay is performed after hard or soft combining of the samples subsequently received from terminals A and B. Then, taking advantage of the linearity of channel coding and network coding, single codeword decoding is performed. The authors of [18] further enhance the idea presented in [19] by combining the samples of the signals subsequently received from both terminals in front of Physical layer network coding makes the system more efficient. In PNC, both terminals transmit their packets in the first phase simultaneously. The relay interprets the composite received signal constellations carrying packet data and generates a modulo-2 sum of the packets, which subsequently determines the packet broadcast by the relay to both terminals in the second phase. Thus, only two phases (multiple access and broadcasting) are needed, in contrast to the standard NC requiring three phases. The crucial factor in PNC is the way that the relay produces the packet to be broadcast to the terminals participating in the packet exchange. The generic scheme of this system is shown in Figure 2.
Electronics 2021, 10, x FOR PEER REVIEW 3 of 17 applied in the relay of a two-way relaying system. Section IV presents the simulation model used in the experiments and shows the simulation results. In Section V, higher layer issues are briefly discussed. Finally, in Section VI, conclusions are formulated.

Two-Way Relaying System Model and Related Works
Let us recall a two-way relaying communication system in which standard or physical layer network coding is used. In such a communication system, packets from terminal A are transmitted to terminal B, and vice versa, via a relay which is located in the range of both terminals. However, none of the terminals can reach the other one directly with appropriate transmission quality. In order for terminals A and B to exchange packets in the standard two-way relaying, three steps are necessary (see Figure 1). In the first step, terminal A sends a packet to the relay. In the second step, terminal B sends its packet to the relay. In the third step, the relay performs the modulo-2 addition of both packets, creating a packet which is broadcast to both terminals. Based on the knowledge of own packet transmitted to the relay, and the packet received from it, the terminal recovers the packet transmitted by the remote terminal as the modulo-2 sum of both packets. Physical layer network coding makes the system more efficient. In PNC, both terminals transmit their packets in the first phase simultaneously. The relay interprets the composite received signal constellations carrying packet data and generates a modulo-2 sum of the packets, which subsequently determines the packet broadcast by the relay to both terminals in the second phase. Thus, only two phases (multiple access and broadcasting) are needed, in contrast to the standard NC requiring three phases. The crucial factor in PNC is the way that the relay produces the packet to be broadcast to the terminals participating in the packet exchange. The generic scheme of this system is shown in Figure 2. As already mentioned, there is a problem of how channel coding and other algorithms are managed in the relay of a two-way relaying system. This problem has attracted the attention of many researchers.
Paper [18] is devoted to the implementation of physical layer network coding in twoway relay networks. The authors compare the existing network coding schemes, such as traditional network coding, physical network coding, and so-called soft network coding (SNC). The latter was introduced in [19]; however, it is related to traditional NC with channel coding. In this paper, channel decoding at the relay is performed after hard or soft combining of the samples subsequently received from terminals A and B. Then, taking advantage of the linearity of channel coding and network coding, single codeword decoding is performed. The authors of [18] further enhance the idea presented in [19] by combining the samples of the signals subsequently received from both terminals in front of As already mentioned, there is a problem of how channel coding and other algorithms are managed in the relay of a two-way relaying system. This problem has attracted the attention of many researchers.
Paper [18] is devoted to the implementation of physical layer network coding in two-way relay networks. The authors compare the existing network coding schemes, such as traditional network coding, physical network coding, and so-called soft network coding (SNC). The latter was introduced in [19]; however, it is related to traditional NC with channel coding. In this paper, channel decoding at the relay is performed after hard or soft combining of the samples subsequently received from terminals A and B. Then, taking advantage of the linearity of channel coding and network coding, single codeword decoding is performed. The authors of [18] further enhance the idea presented in [19] by combining the samples of the signals subsequently received from both terminals in front of their demodulators. They show in a theoretical analysis that the proposed scheme, similar to that presented in [19], saves about 50 percent of the cost of demodulation and decoding processes as compared with traditional NC with coding. The drawback of the schemes proposed both in [18] and [19] is the requirement of three transmission steps, as in regular NC, as compared with two steps in PNC.
In [15], the achievable rates of several physical layer network coding schemes are analyzed for two-way relaying channels. The authors propose a new method of PNC inspired by Tomlinson-Harashima precoding [20] in which a modulo operation is used to control the power at the relay. They motivate their proposal by the fact that, in the original PNC, the relay broadcasts a signal that contains a component that is already known to the destination terminals. In this sense, from the perspective of a given receiver, a portion of the transmit power budget of the relay is wasted on transmitting already known information. The paper contains a simplified throughput analysis of all considered physical layer network coding schemes; however, no coding is considered.
In [21], Zhang and Liew, the inventors of PNC, further develop their PNC idea. The authors integrate network coding and channel coding through the appropriate application of a channel code, called the Repeat Accumulate (RA) code [22], at the two end nodes. Thanks to this solution, based on the samples received by the relay, the modulo-2 addition of both received source packets can be calculated efficiently. The authors assume that the relay does not need to detect individual packets from both end nodes, but it is only interested in decoding its modulo-2 sum. The authors redesign the belief propagation decoding algorithm of the RA code to suit the needs of the PNC multiple access channel. However, one can notice that the simulation system model used in experimental investigations is oversimplified, and confirmation of usability of the proposed solutions would require a much more sophisticated model.
In [23], convolutional codes in two-way relay networks with rate diverse network coding are considered. In this arrangement, for a given memory length constraint, two source nodes can adopt convolutional codes of different lengths and use a reduced-state trellis to reduce decoding complexity. The authors claim that the proposed approach can improve system throughput significantly. It offers increased reliability and reduces the complexity of decoding of the applied convolutional code. However, one can notice that the application of the reduced-state trellis in the decoding algorithm results in performance deterioration.
Codes other than convolutional ones have also been studied for application in PNC. In [24], the authors compare the performance of a two-way relaying network employing PNC with three types of error-correcting codes used at the source and destination nodes. These are iteratively decodable low-density parity check codes (LDPC), turbo codes, and bit-interleaved coded modulation with iterative decoding (BICM-ID). The research reported in [24] indicates that, when applied in PNC, the performance of LDPC codes is degraded more than in the case of other codes due to the sum-product decoding algorithm which is less robust to unreliable symbols broadcast from the relay. However, it is worth stressing that other factors can also influence channel code selection, such as introduced decoding delay, simplicity of decoder implementation, etc. The authors assumed a very idealized transmission model analogous to that used in [14]. The signals received by the relay are an ideal sum of constellation symbols and additive AWGN noise. Moreover, the relay performs hard-decision decoding, determining the signal constellation of modulo-2 sum bits carried by both signals reaching the relay. We must admit that the reference system model reported in our paper in Section 3.1 is much more realistic, taking into account possible different attenuations and phase shifts of the signals arriving to the relay.
Another proposal associated with iteratively decodable codes is shown in [25]. In this paper, a novel joint channel and physical layer network decoding scheme for a two-way relaying communication system is presented. The proposed decoding scheme can be viewed as a serial concatenated decoding scheme with the source codes, not necessarily the same, treated as the outer codes, and the physical network coding as the inner code. The drawback of the authors' approach is similar to that in [24]. Namely, they assume an ideal PNC scheme, in which the signal received by the relay is a sum of equally attenuated and co-phased BPSK signals transmitted by both end nodes. This assumption is not realistic. Again, our model shown in Section 3.1 seems to be much better.
Bandwidth-efficient coded modulation schemes for PNC with high-order modulations are also a topic of interest. In [26], several soft-decision iterative decoding schemes for PNC operated with coded modulations and bit-interleaved coded modulations are presented. The authors consider network coding-based channel decoding and multi-user complete decoding for PNC. They analyze the performance of the considered systems through EXIT charts and verify it by BER estimation. Again, the authors apply a very idealized, unrealistic model with ideal symbol synchronization and AWGN as the only distortion. However, for multi-level modulations, allowing different attenuations and phase shifts of the signals received from both end nodes would result in much more complex schemes on the receiver side, so it can be the reason for justification of the applied idealized transmission model.
In [27], Chu, Yoo, and Jung consider a PNC coding technique for a two-way relaying network that exploits the spatial modulation (SM) with convolutional codes at both source nodes and the relay node. It is assumed that all the nodes are equipped with multiple antennas. The relay node detects the signal by utilizing a maximum-likelihood detection technique based on a direct decoding or separate decoding algorithm. The authors claim that the SM-based PNC outperforms the conventional PNC technique. Simulation results achieved by the authors of [27] indicate that the direct decoding yields lower complexity than the separate decoding while achieving almost the same performance as the latter. It is worth noting that, in this case, the authors apply a more realistic model in which each constituent channel between any terminal antenna and any relay antenna is characterized by a complex channel coefficient. This leads to the channel representation in the form of complex channel matrices. To a certain extent, it is a necessity because using a fully ideal channel model in the MIMO configuration (with all channel coefficients equal to one) would not enable operation of the relay receiver.
Application of a multi-antenna system in PNC two-way relaying is a subject of the paper [28]. The extension of the transmission range in an LTE-like system is considered using a relay station playing the role of a relay between two end nodes, namely, a base station (BS) and a mobile station (MS). It is shown that using more antennas in the relay enables detection of both MS and BS signals separately and, after turbo decoding of both streams, modulo-2 addition of the MS and BS packets can be performed, which results in a packet subsequently transmitted in the broadcast phase. BER estimation is selected as a performance measure. This topic is further investigated in [29]. The authors assume operation in the multiple access phase similar to that in [28], and compare possible arrangements of transmission in the broadcast phase. The first arrangement is a typical PNC system similar to that considered in [28], whereas, in the second one, precoding with the multi-user MIMO technique is applied. The authors prove that the multi-user MIMO method can obtain better performance than the network coding technique at the cost of higher computational requirements.
Finally, a multiple antenna relay in two-way relaying transmission is also considered in [30]. The authors assume that both end nodes are equipped with single antennas. The subject of analysis is a posteriori probability (APP) relay detector. General formulas for loglikelihood ratios for received codeword bits, as well as mutual information characterizing each type of the considered APP detector, are given. The authors analyze the so-called separate decoding detector, in which the relay detects the codewords received from each node separately. They also consider two versions of a joint channel decoding and network coding detector (regular and generalized one), which determines the codewords being the sum of the codewords transmitted by both end nodes. The drawback of the two last detectors is the necessity of application of the same codes by both end nodes when transmitting the packets to the relay. Other questions are the computational complexity of the APP detectors despite their statistical optimality, and the sensitivity of the considered detectors to inaccuracies in the channel characteristics.
Channel estimation errors in PNC transmission over fading channels are the subject of the research reported in [31]. The authors model channel estimation errors as Gaussian distributed ones and formulate the network coding error as the distance between real and estimated points in the channel coefficients plane. Utilizing this model, the authors present a statistical lower bound on the variance of estimation error that can be tolerated by the relay terminal without imposing a network coding error on the system. In our own research, we also take into account non-ideal channel knowledge and estimate its influence on the system performance expressed by BER.
Two-way relaying systems continue to be the subject of intensive investigation. In recent years, many new papers have been published in this area. Below, we consider only a few positions. In [32], a new approach for two-way relaying networks is proposed. The authors consider improving performance with a combination of successive cancellation, digital network coding, and opportunistic relay selection in a two-way cooperative scheme, in which two source nodes send their packets to each other via multiple relaying nodes. In [33], the authors extend the idea presented in [32] to the cognitive networks, where primary and secondary users operate concurrently. It is worth noting that the successive interference cancellation relay receiver considered in [32] and [33] uses a standard solution in which the weak signal is treated as noise in the detection of the stronger one. Then, after the stronger signal is detected and re-modulated, it is used in the detection of the weak one. Our experience, evidenced in [17], indicates that this approach has some serious limitations due to the necessity of careful selection of participating terminals. The reason for this is sensitivity to power differences in the contributing signals approaching the relay. This was the reason that we concentrated on improving the detection algorithm to make the selection of the terminals less sensitive to power differences between signals reaching the relay.
Two-way relaying schemes are also considered in the application in a full-duplex cellular system [34]. The authors focus on the full-duplex wireless communication network, in which a full-duplex base station and half-duplex mobile station exchange their information in two phases via a half-duplex relay station. The amplify-and-forward and decode-and-forward relaying schemes are considered in this configuration. The relay station chooses the best scheme depending on the channel state information to achieve the maximum capacity.
As the main contribution of our research is the investigation of the decision-making based on two received packets in the physical layer at the relay node, in our research we limit ourselves to relatively simple convolutional codes applied for orthogonal frequency division multiplexing (OFDM) transmission, which are typical for the WiFi IEEE 802.11 family of standards, including 802.11a/g/n/ac and ax. As we will see in the next sections of this paper, the investigated PNC algorithms operate on each subcarrier in parallel; therefore, in our opinion, the subcarrier spacing, OFDM symbol duration, and other parameters of WiFi transmission do not have influence on the operation of the improved SIC detector reported and analyzed in this paper, unless system configuration with more advanced than convolutional codes is applied. Therefore, we are convinced that our results achieved in the physical layer are valid both for traditional IEEE 802.11g and new IEEE 802.11ax standards. The differences in performance of both detectors could be changed if-more powerful than convolutional codes-LDPC codes standardized in IEEE 802.11ax were applied. These codes can diminish the difference in performance of both investigated PNC detectors applied in the relay. We will also report how channel estimation errors affect the performance of the whole two-way relaying system. Despite the above discussion, we believe that the conclusions drawn from our results can be extended to more advanced coding systems.

Considered Two-Way Relaying PNC Systems
As OFDM transmission is applied in several radio communication systems, we consider a simple model of PNC with OFDM transmitters and a receiver, shown in the multiple access phase in Figure 3. Binary information data packets a 1 and a 2 to be transmitted by terminal A and B, respectively, are encoded using a channel forward error correcting (FEC) code, resulting in blocks x 1 and x 2 . These blocks are delivered to OFDM transmitters in both terminals and are subsequently transmitted over multipath channels featuring impulse responses h 1 and h 2 , respectively. sider a simple model of PNC with OFDM transmitters and a receiver, shown in the tiple access phase in Figure 3. Binary information data packets 1 a and 2 a to be tran ted by terminal A and B, respectively, are encoded using a channel forward error co ing (FEC) code, resulting in blocks 1 x and . x These blocks are delivered to O transmitters in both terminals and are subsequently transmitted over multipath cha featuring impulse responses 1 h and 2 h , respectively. For the sake of simplicity, we assume that the channel impulse responses have energy, and we model the unequal power of the signals reaching the relay usin weighting coefficients 1 g and . The received signal is disturbed by the additive white Gau noise ν(t). In this paper, we assume that signals from both transmitters arrive at th ceiver with such a propagation delay difference that the receiver can select a com orthogonality period in which OFDM signals from both transmitters are analyzed. cally, e.g., in device-to-device (D2D) or WiFi communications, distances between t mitters and receivers are not large (e.g., up to a few hundred meters), so a coarse syn nization of both transmitters justifies such an assumption. The relay receives the version of the summed signals and derives the sample block Y which constitutes the carrier outputs of the OFDM correlator. Next, the PNC processing algorithm derive data block which will be transmitted by the relay OFDM transmitter in the broa phase to both terminals A and B.
If the OFDM systems between the relay and both terminals are sufficiently syn nized, as assumed above, we can consider transmission on each subcarrier as transmi over a flat fading channel. Consider transmission on the k-th subcarrier. Assume th channels from terminal A and terminal B to the relay on the k-th subcarrier are char ized by the complex channel coefficients N is the sample of the additive noise on the output of the correlator for th subcarrier, and k X , 1 and k X , 2 are quadrature phase shift keying (QPSK) or quadr amplitude modulation (QAM) data symbols transmitted in the multiple access pha that subcarrier by terminal A and B, respectively. Based on the samples k Y (k = 0, 1, − 1), the relay calculates the signal to be emitted in the broadcast phase.
Several arrangements of the PNC processing algorithm are possible. We conside of them. The first one [16] is treated as a reference to show the performance of the posed second one. For the sake of simplicity, we assume that the channel impulse responses have unit energy, and we model the unequal power of the signals reaching the relay using the weighting coefficients g 1 and g 2 . To model the propagation loss, we assign the power P i (i = 1, 2) of signals incoming to the receiver from each user by setting the values of the coefficients g i = √ P i . The received signal is disturbed by the additive white Gaussian noise ν(t). In this paper, we assume that signals from both transmitters arrive at the receiver with such a propagation delay difference that the receiver can select a common orthogonality period in which OFDM signals from both transmitters are analyzed. Typically, e.g., in device-to-device (D2D) or WiFi communications, distances between transmitters and receivers are not large (e.g., up to a few hundred meters), so a coarse synchronization of both transmitters justifies such an assumption. The relay receives the noisy version of the summed signals and derives the sample block Y which constitutes the subcarrier outputs of the OFDM correlator. Next, the PNC processing algorithm derives the data block which will be transmitted by the relay OFDM transmitter in the broadcast phase to both terminals A and B.
If the OFDM systems between the relay and both terminals are sufficiently synchronized, as assumed above, we can consider transmission on each subcarrier as transmission over a flat fading channel. Consider transmission on the k-th subcarrier. Assume that the channels from terminal A and terminal B to the relay on the k-th subcarrier are characterized by the complex channel coefficients H 1,k and H 2,k , respectively. On the output of the fast Fourier transform (FFT) correlator placed in the relay, the signal sample Y k can be described by the equation (we omit the time index for simplicity): where N k is the sample of the additive noise on the output of the correlator for the k-th subcarrier, and X 1,k and X 2,k are quadrature phase shift keying (QPSK) or quadrature amplitude modulation (QAM) data symbols transmitted in the multiple access phase on that subcarrier by terminal A and B, respectively. Based on the samples Y k (k = 0, 1, . . . , N − 1), the relay calculates the signal to be emitted in the broadcast phase. Several arrangements of the PNC processing algorithm are possible. We consider two of them. The first one [16] is treated as a reference to show the performance of the proposed second one.

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: 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. 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 . the resulting composite constellation is 16-point; however, knowing the applied mappings and relative channel coefficient k h , we can determine the mapping of the composite constellation. Assume that the number of constellation points of 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 k V (k = 0, 1, …, N − 1). Let us denote the constellation points of the composite constellation as . k D , namely:  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, . . . , N − 1). Let us denote the constellation points of the composite constellation as D k ., namely: Then, according to the ML criterion, we findD k from the set {D k } of possible constellation points which fulfills the following rule: 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 pointD 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, after detecting the composite constellation point, the PNC algorithm can perform the following symbol-by-symbol operations: a 1 =b 1 ⊕b 3 , a 2 =b 2 ⊕b 4 , ⊕ -mod-2 addition (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â 1â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â 1â2 . Namely, terminal A finds the bits transmitted by terminal B from the equation: whereas terminal B determines the bits transmitted by terminal A from the expression: The presented procedure is very simple; however, it does not take into account the fact that channel coding is applied in both terminals; thus, making symbol-by-symbol decisions followed by appropriate mapping for the broadcast symbols is evidently not optimal.

Proposed PNC Detection Algorithm
Instead of symbol-by-symbol operations in the relay aiming at the generation of the signal broadcast by the relay, more sophisticated processing can be applied, which should result in better performance as compared with the previous scheme. Using the successive interference cancellation (SIC) algorithm recently proposed by the authors of this paper in [17], we can find the estimates X 1,k and X 2,k of both composite signals X 1,k and X 2,k and, moreover, find the log-likelihood ratios (LLRs) of each bit assigned to a particular constellation point of both symbols. The algorithm presented and analyzed in [17] is visualized in Figure 5, for readers' convenience.
The scheme starts with the joint ML tentative detection block (A1). This block searches for the pair of symbols X 1,k and X 2,k using the following rule: Again, we assume that the signal arriving through channel H 1,k has higher power than the signal arriving through channel H 2,k . Out of two symbol estimates, we select the tentative estimate of the weaker signal, X 2,k , to generate the final estimate of the stronger one, X 1,k (see (A3) in Figure 5). The latter is subsequently used to generate the approximate values of LLR used at the input of the channel code decoder. The result of soft input decoding is the information block estimateâ 1 of terminal A. This block is re-encoded using the same channel code. Then, the modulated symbolsX 1,k are produced and subsequently used in interference cancelling, and the detection of weaker user symbol estimates X 2,k , for which LLR inputs to the channel code decoder of the code used by terminal B are derived. The channel code decoder generates the information block estimateâ 2 of terminal B. Then, the relay calculates a new information block which is the modulo-2 sum of both decoded blocks, i.e., b =â 1 ⊕â 2 (9) and generates QPSK/QAM symbols to be broadcast to both terminals. In both terminals A and B, regular detection and decoding algorithms are applied, resulting in the information block estimateb. Finally, the binary blocks transmitted by the remote end terminals are determined using Formulas (6) and (7).   As we can see, the proposed PNC algorithm to be applied in the relay is more complicated when compared with the reference one, because both composite signals and binary sequences carried by them are extracted in the relay. In addition to two channel code encoders and decoders used in both end terminals, two channel code decoding processes take place in the relay. Therefore, we categorize our relay as the decode-and-forward one. We expect that the increase in computational effort will result in better performance as compared with the simple reference PNC algorithm. This will be proved by simulation.

Simulation Results
We have estimated the performance of the two-way relaying PNC system applying the SIC detection algorithm proposed by us, using the example of an OFDM system model based on the WiFi model analyzed in [35]. In our experiments, we modeled a system consisting of two terminals (A and B) cooperating with a relay, as considered previously.
The main system parameters are summarized in Table 1. As we have already mentioned, we assume that OFDM symbols that are transmitted from both end terminals are quasi-synchronous, i.e., the OFDM receiver in the relay is able to find the orthogonality period needed for OFDM symbol detection, which is located within OFDM symbols generated by each terminal. The convolutional code is used as the channel code with a coding rate R = 1/2. The standard [133,171] code is applied. QPSK modulation is used by both terminals and the relay. Other modulation selection and coding rates, i.e., modulation and coding schemes (MCS), are also possible, depending on individual channel conditions. The applied channel models simulate multipath Rayleigh fading channels denoted in the text by vectors h 1 and h 2 . They feature an exponential decay power profile with selected RMS delay spread.

System Performance with Ideal Channel Coefficients
To verify the detection quality of the proposed PNC algorithm applied in the relay in comparison to the reference one, first, ideal knowledge of channel coefficients is assumed. This enables evaluation of improvements in the detection of the algorithm itself.
In the simulation experiments, the number of packets that were transmitted from each terminal was K = 100, 1000, 5000, or 10,000, depending on the required accuracy and level of BER estimation. Every packet contained L = 100 payload OFDM symbols.
The main aim of the simulation was to determine the estimated BER vs. signal-tonoise ratio (SNR) measurements for both users. In all our simulation runs we assumed the following definition of SNR: where P Tx is the reference power transmitted by both terminals, N is the noise power, and the channel coefficients g 1 and g 2 model, as mentioned before, both propagation losses and the change of the power level with respect to the reference one. In all simulation results shown below, we set g 1 = 1 without the loss of generality. A multipath channel model typical for WiFi was applied [35]. As already mentioned, the power delay profile was exponentially decaying, depending on the root mean square delay T rms = 50 ns. We assumed the so-called block fading channel model, i.e., the time invariance of the channel impulse response within the transmission of a single packet. For each OFDM packet, new channel coefficients were randomly selected.
We are aware of limitations in propagation conditions on channels in 5 GHz band; therefore, we assumed that the distance between end nodes and the relay was such that it ensures transmission with sufficient SNR level on the receiver side. For the performed link-level simulations reported in this paper, the assumed model is sufficient for estimation of BER against SNR. No shadowing or time evolution of channel parameters other than block fading was taken into account. The readers interested in more elaborate channel models and physical phenomena accompanying new propagation scenarios are directed to the papers [36][37][38].
Simulations were performed for several levels of a power imbalance between the signals reaching the relay from terminals A and B to show how robust both PNC algorithms are. As g 1 = 1, we controlled the values of the coefficient g 2 . For g 2 = 1, both signals from end terminals arrive at the relay with the same power, whereas in the case when g 2 = 0.2, the difference in the power of strong and weak signals is 14 dB. We estimated the performance on the output of both terminal receivers (A and B) for g 2 in the range between 0.2 and 0.9 (for the latter value, the difference in power is about 0.9 dB).
As we can see in Figure 6, for relatively small power differences between the stronger and weaker signals, our proposed PNC algorithm applied in the relay results roughly a 4 dB improvement at BER equal to 10 −3 or lower. We can also notice that for a smaller power difference between the arriving signals (equivalent to a higher value of g 2 ), the performance in the form of BER deteriorates by about 1 dB as compared with two cases when g 2 values are equal to 0.9 and 0.6. This results from the fact that when both signals reach the relay receiver at similar powers, the composite constellation can contain some constellation points which are very close to each other. A wrong decision is very probable for them.  Similar conclusions can be drawn based on Figure 7, in which the plots for the values of g 2 between 0.5 and 0.2 are drawn. The worst performance for both types of PNC algorithm occurs for g 2 = 0.2, however, the proposed PNC algorithm is about 2 dB better than the reference one. One can also notice that for g 2 = 0.5, the difference in performance is much more significant and is equal to about 5.5 dB.
The general conclusion is that if any of the analyzed PNC receivers is applied, aiming to receive the same receive power of the signals received from both terminals is not the best strategy. The best performance is achieved when, for g 1 = 1, g 2 = 0.5, which is equivalent to a 6 dB difference in power.  The general conclusion is that if any of the analyzed PNC receivers is applied, aiming to receive the same receive power of the signals received from both terminals is not the best strategy. The best performance is achieved when, for , which is equivalent to a 6 dB difference in power.

Two-Way Relaying PNC System Performance with Estimated Channel Coefficients
So far, we have reported the results achieved for ideal knowledge of channel coefficients for each applied subcarrier. However, in reality, they must be estimated and the resulting estimates have to be used in the detection process in both the reference and proposed PNC algorithms in the relay. As WiFi transmission, which we had taken as the object of our simulation experiments, is not fitted to two-way relaying in the PNC scheme,

Two-Way Relaying PNC System Performance with Estimated Channel Coefficients
So far, we have reported the results achieved for ideal knowledge of channel coefficients for each applied subcarrier. However, in reality, they must be estimated and the resulting estimates have to be used in the detection process in both the reference and proposed PNC algorithms in the relay. As WiFi transmission, which we had taken as the object of our simulation experiments, is not fitted to two-way relaying in the PNC scheme, we adopted the strategy previously presented by us in [17]. Namely, we used a simple method of channel estimation for both channels in the form of a short packet exchange at the start of the two-way relaying PNC operation. Such a procedure can be repeated after appropriate time intervals, if necessary, to follow the changes in channel characteristics. For convenience, we shortly summarize this strategy below. It is shown in graphical form in Figure 9 of [17].
First, terminal A transmits a short packet consisting of a preamble only. If necessary, it can contain some additional OFDM symbols consisting of known data (pilots). As we have noticed in our simulation experiments reported below, and in [17], where it was reported for another application, the additional pilot symbols have a significant influence on the system performance. Then, terminal B, after a passive reception (detection without making valuable decisions) of the preamble from terminal A, transmits its own preamble as well. After that, the relay transmits the START signal and regular PNC operation begins when both terminals transmit their packets concurrently in the multiple access phase of two-way relaying. Let us recall that a standard preamble of an IEEE 802.11a data packet contains, among others, two long training OFDM symbols mostly aimed at channel estimation. Recall that such a preamble is a legacy part of the preambles of newer IEEE 802.11 standards, including IEEE 802.11ax. As the samples of both long training symbols are known, the received FFT outputs, being the response of the channel to both training symbols, are averaged and subsequently divided by the ideal tones of both training symbols [35].
It turns out that direct use only of the preamble symbols causes serious deterioration in the performance, as compared with the case when the channel characteristics are perfectly known. Thus, the improvement in channel estimates can be achieved if we perform averaging over a larger number of OFDM pilot symbols. Figure 8 shows the BER performance for both proposed and reference PNC algorithms applied in the relay of the two-way relaying system when g 2 = 0.5, when the channel estimation is based on selected numbers N p of pilot symbols.
in the performance, as compared with the case when the channel characteristics are perfectly known. Thus, the improvement in channel estimates can be achieved if we perform averaging over a larger number of OFDM pilot symbols. Figure 8 shows the BER performance for both proposed and reference PNC algorithms applied in the relay of the two-way relaying system when 5 . 0 2  g , when the channel estimation is based on selected numbers p N of pilot symbols. As we can see in Figure 8, the difference in the required SNR for BER = 10 −3 between the standard procedure (N p = 2) and the application of N p = 20 (9 additional pairs of pilot OFDM symbols) is very high and reaches about 6 dB for the proposed PNC algorithm, and is even higher for the reference one. As such, a large additional pilot load seems to be too high. In the following experiments we selected a compromise value of N p = 6. Figures 9 and 10 show the estimated BER for the case when, in both considered PNC algorithms, estimates of the channel coefficients based on N p = 6 pilot symbols are applied. In both figures, the plots for the two-way relaying system working with the estimated coefficients are merely shifted by 2 dB towards higher SNR values. This is the price of using estimates of channel coefficients instead of ideal ones. Nevertheless, the difference in the performance of both PNC algorithms remains valid and the proposed solution, although more computationally demanding, results in a 2 to 5 dB improvement as compared with the reference one. pilot OFDM symbols) is very high and reaches about 6 dB for the proposed PNC algorithm, and is even higher for the reference one. As such, a large additional pilot load seems to be too high. In the following experiments we selected a compromise value of . 6  p N Figures 9 and 10 show the estimated BER for the case when, in both considered PNC algorithms, estimates of the channel coefficients based on 6  p N pilot symbols are applied. In both figures, the plots for the two-way relaying system working with the estimated coefficients are merely shifted by 2 dB towards higher SNR values. This is the price of using estimates of channel coefficients instead of ideal ones. Nevertheless, the difference in the performance of both PNC algorithms remains valid and the proposed solution, although more computationally demanding, results in a 2 to 5 dB improvement as compared with the reference one.

Conclusions
Intensive simulations performed for the reference and proposed physical layer network coding detection algorithms applied in the multiple access phase at the relay of two-way relaying systems have proven that the proposed improved PNC detection algorithm can be a valuable alternative to the typical, regular one at the price of higher computational requirements in the relay, mostly in the form of separate channel decoding of both data streams generated by the end terminals. Previous experiences of the authors indicate that the proposed detection algorithm outperforms the standard successive interference cancellation detector, in which, in detection of a stronger signal, a weaker signal is treated as noise. Such configuration is often assumed by other researchers when SIC receivers are considered in detection of both received signals. The performance of the proposed and reference algorithms has been demonstrated on the example of a typical OFDM transmission system. It is worth mentioning that, in contrary to many previous papers in which ideal AWGN channel model with perfect signal synchronization and power control is applied, our research is supported by simulations in which multipath channels typical for WiFi transmissions are modeled. This results in much more realistic PNC configuration on each OFDM subcarrier.