This repository contains the implementation of the Amplify-and-Forward (AF) Relaying scheme simulation, which models a cooperative communication system. The simulation incorporates Rayleigh fading, path loss, shadowing, relay selection, maximal ratio combining (MRC), and computes key performance metrics such as Bit Error Rate (BER), Signal-to-Noise Ratio (SNR), and Spectral Efficiency.
The Amplify-and-Forward (AF) Relaying scheme enhances communication reliability and coverage in wireless networks. A source node transmits data to a destination node, with the help of one or more relays. These relays amplify the signal received from the source before forwarding it to the destination.
This simulation models the transmission over a fading channel, calculates the SNR at the destination, and computes the BER using different relaying strategies. The mathematical formulation below details each step of the simulation process.
Transmission power in dB is converted to linear scale using the following equation:
Where:
-
$$P_{\text{trans}}$$ : Transmission power in Watts (linear scale). -
$$P_{\text{dB}}$$ : Transmission power in decibels (dB).
The channel coefficients are modeled as complex Gaussian random variables, representing Rayleigh fading:
-
$$h_{sr} $$ : Channel coefficient from Source to Relay. -
$$h_{rd} $$ : Channel coefficient from Relay to Destination.
Path loss quantifies the reduction in signal power as it propagates through space:
Where:
-
$$\alpha $$ : Path loss exponent. -
$$r $$ : Distance between transmitter and receiver.
Shadowing adds an extra random variation to the received signal power, modeled as a Gaussian random variable:
Where:
-
$$\sigma_{\text{shadow}} $$ : Standard deviation of the shadowing effect (dB).
Modulated symbols are mapped to a complex constellation, e.g., for QPSK modulation:
-
$$s_k $$ : Modulated symbol. -
$$M $$ : Modulation order (e.g., 4 for QPSK).
The signal from the source to the relay is attenuated by path loss and shadowing:
The best relay is selected based on channel gain:
The relay amplifies the received signal:
The relay transmits the amplified signal to the destination, affected again by path loss and shadowing:
The signals received directly from the source and via the relay are combined to maximize signal quality:
The SNR at the destination for the combined signal is calculated:
$$ \text{SNR}{\text{combined}} = \frac{|y{\text{combined}}|^2}{1 + \text{Var}(y_{\text{combined}})} $$
The received signal is demodulated, and the Bit Error Rate (BER) is computed:
Spectral efficiency is measured in bits per second per Hertz (bps/Hz):
To run the simulation, simply execute the Python script. The simulation parameters (e.g., transmission power, modulation order, number of relays) can be modified within the code to experiment with different configurations. The results will include the average Bit Error Rate (BER) after the transmission of a specified number of symbols.
The plot shows three graphs:
○ The BER initially increases and reaches a peak at around 2.5 dB, then starts to decrease with increasing transmission power. It generally follows a downward trend after 5 dB, indicating that higher transmission power reduces the BER, which is expected. ○ The fluctuations in the middle (around 12.5 dB) may suggest some variations in noise or relay performance that could be worth investigating further.
○ The spectral efficiency remains constant at around 2 bits/s/Hz, which is consistent with the modulation scheme (QPSK) used in the simulation. Since the modulation order is fixed, it is expected that spectral efficiency remains unchanged despite varying transmission power.
○ The SNR fluctuates significantly with transmission power. Instead of following a monotonic increase, the SNR peaks at around 2.5 dB and 10 dB, with dips in between. This suggests that either the channel model or the relay amplification process is causing irregularities in signal quality.
Summary:
• The BER generally decreases with increasing transmission power, which aligns with expected behavior in communication systems, though the fluctuations indicate some irregularities in the relay or noise handling.
• Spectral efficiency is constant, as expected for a fixed modulation scheme. SNR does not increase smoothly, showing peaks and valleys across the transmission power range, which suggests there may be some optimization or modeling issues affecting the overall signal quality at various power levels.
Support for different modulation schemes (e.g., 16-QAM, 64-QAM). Evaluation of multiple relaying strategies (Decode-and-Forward, Selection Combining). Simulation of multi-user or multi-hop scenarios.