txlev=txlev/(double)AMP;// output of signal_energy is fixed point representation
txlev_float=(double)txlev/(double)AMP;// output of signal_energy is fixed point representation
printf("\n");
printf("\n");
...
@@ -501,7 +504,7 @@ int main(int argc, char **argv) {
...
@@ -501,7 +504,7 @@ int main(int argc, char **argv) {
n_false_positive=0;
n_false_positive=0;
//AWGN
//AWGN
sigma_dB=10*log10((double)txlev)-SNR;
sigma_dB=10*log10(txlev_float)-SNR;
sigma=pow(10,sigma_dB/10);
sigma=pow(10,sigma_dB/10);
for(trial=0;trial<n_trials;trial++){
for(trial=0;trial<n_trials;trial++){
...
@@ -511,10 +514,9 @@ int main(int argc, char **argv) {
...
@@ -511,10 +514,9 @@ int main(int argc, char **argv) {
for(i=0;i<frame_length_complex_samples;i++){
for(i=0;i<frame_length_complex_samples;i++){
for(ap=0;ap<frame_parms->nb_antennas_rx;ap++){
for(ap=0;ap<frame_parms->nb_antennas_rx;ap++){
// [hna] doesn't work with noise in case of mod_order = 6
// [hna] doesn't work with noise in case of mod_order = 6
((short*)gNB->common_vars.rxdata[ap])[2*i]=(((int16_t*)UE->common_vars.txdata[ap])[(i<<1)]);// + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP)); // convert to fixed point
((short*)gNB->common_vars.rxdata[ap])[2*i]=(((int16_t*)UE->common_vars.txdata[ap])[(i<<1)])+(int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP);// convert to fixed point