OAI Bug – Wrong noise power scaling of SNR in the rf simulator
Goal: Apply correct SNR setting in RF Simulation mode
Oberservation: in radio/rfsimulator/apply_channelmod.c
- Orig Code:
// Energy in one sample to calibrate input noise
// the normalized OAI value seems to be 256 as average amplitude (numerical amplification = 1)
const double noise_per_sample = pow(10,channelDesc->noise_power_dB/10.0) * 256;
- NEW/suggested Code:
// Because we scale the sample amplitude with the noise power (dB). If the average value of I and Q is 256,
// the average rms value of the complex signal samples is sqrt(2)*256, so for noise per sample db = 0,
// and with the corrected scaling, noise_per_sample = 10^(noise_power_db/20)*256. The rms noise magnitude
// of the complex AWGN would be also sqrt(2)*256, i.e. leading to an SNR of 0 dB.
// we need to convert the noise power to an rms amplitude by the following formular: channelDesc->noise_power_dB/20.0
const double noise_per_sample = pow(10,channelDesc->noise_power_dB/20.0) * 256;