Commit 49a14c4f authored by Raymond Knopp's avatar Raymond Knopp

fixes for TDL channel models in nr_ulsim

parent ae4f3320
This diff is collapsed.
......@@ -180,7 +180,7 @@ void do_DL_sig(sim_t *sim,
//RU2UE[eNB_id][UE_id]->path_loss_dB = 0;
multipath_channel(sim->RU2UE[ru_id][UE_id][CC_id],s_re,s_im,r_re0,r_im0,
length,hold_channel);
length,hold_channel,0);
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp2(sim->RU2UE[ru_id][UE_id][CC_id]->ch[0],
sim->RU2UE[ru_id][UE_id][CC_id]->channel_length)*sim->RU2UE[ru_id][UE_id][CC_id]->channel_length;
......@@ -394,7 +394,7 @@ void do_UL_sig(sim_t *sim,
multipath_channel(sim->UE2RU[UE_id][ru_id][CC_id],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti,hold_channel);
frame_parms->samples_per_tti,hold_channel,0);
rx_pwr = signal_energy_fp2(sim->UE2RU[UE_id][ru_id][CC_id]->ch[0],
......
......@@ -44,7 +44,8 @@ void multipath_channel(channel_desc_t *desc,
double rx_sig_re[2][30720*2],
double rx_sig_im[2][30720*2],
uint32_t length,
uint8_t keep_channel)
uint8_t keep_channel,
int log_channel)
{
int i,ii,j,l;
......@@ -150,7 +151,8 @@ void multipath_channel(channel_desc_t *desc,
double *rx_sig_re[2],
double *rx_sig_im[2],
uint32_t length,
uint8_t keep_channel)
uint8_t keep_channel,
int log_channel)
{
int i,ii,j,l;
......@@ -196,6 +198,11 @@ void multipath_channel(channel_desc_t *desc,
rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y);
rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y);
if (i==0 && log_channel == 1) {
printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)),
desc->ch[ii+(j*desc->nb_rx)][l].x,
desc->ch[ii+(j*desc->nb_rx)][l].y);
}
} //l
} // j
......
......@@ -695,9 +695,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps += chan_desc->amps[i];
}
for (i = 0; i<chan_desc->nb_taps; i++)
for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] /= sum_amps;
tdl_delays[i] *= DS_TDL;
}
chan_desc->delays = tdl_delays;
chan_desc->ricean_factor = tdl_ricean_factor;
chan_desc->aoa = 0;
......@@ -1733,15 +1734,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
desc->ch[aarx+(aatx*desc->nb_rx)][k].x += s*desc->a[l][aarx+(aatx*desc->nb_rx)].x;
desc->ch[aarx+(aatx*desc->nb_rx)][k].y += s*desc->a[l][aarx+(aatx*desc->nb_rx)].y;
// printf("l %d : desc->ch.x %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x);
// printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]);
} //nb_taps
#ifdef DEBUG_CH
k=0;
printf("(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y);
printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y);
#endif
}
} //channel_length
} //channel_length
}
} //aatx
} //aarx
......
......@@ -277,7 +277,8 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
double rx_sig_re[2],
double rx_sig_im[2],
uint32_t length,
uint8_t keep_channel)
uint8_t keep_channel,
int log_channel)
\brief This function generates and applys a random frequency selective random channel model.
@param desc Pointer to channel descriptor
......@@ -287,6 +288,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
@param rx_sig_im output signal (imaginary component)
@param length Length of input signal
@param keep_channel Set to 1 to keep channel constant for null-B/F
@param log_channel=1 make channel coefficients come out for first sample of input
*/
void multipath_channel(channel_desc_t *desc,
......@@ -295,7 +297,8 @@ void multipath_channel(channel_desc_t *desc,
double *rx_sig_re[2],
double *rx_sig_im[2],
uint32_t length,
uint8_t keep_channel);
uint8_t keep_channel,
int log_channel);
/*
\fn double compute_pbch_sinr(channel_desc_t *desc,
channel_desc_t *desc_i1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment