1e3/RU2UE[ru_id][UE_id][CC_id]->sampling_rate,// sampling time (ns)
1e3/sim->RU2UE[ru_id][UE_id][CC_id]->sampling_rate,// sampling time (ns)
(double)PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB-66.227);// rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
1e3/UE2RU[0][ru_id][CC_id]->sampling_rate,// sampling time (ns)
1e3/sim->UE2RU[0][ru_id][CC_id]->sampling_rate,// sampling time (ns)
(double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx-66.227);// rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
LOG_D(SIM,"UE %d: DL simulation 1: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
while(current_UE_rx_timestamp[UE_id][CC_id]<
(last_UE_rx_timestamp[UE_id][CC_id]+read_size)){
LOG_D(SIM,"UE %d: DL simulation 2: UE_trx_read : current TS %"PRIi64", last TS %"PRIi64", sleeping\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
LOG_D(SIM,"UE %d: DL simulation 1: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
LOG_D(SIM,"UE %d: DL simulation 2: UE_trx_read : current TS %"PRIi64", last TS %"PRIi64", sleeping\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
usleep(500);
}
LOG_D(SIM,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
LOG_D(SIM,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
LOG_D(PHY,"Setting amp for RU %d to %f (%d)\n",ru_id,ru_amp[ru_id],dB_fixed((double)signal_energy((int32_t*)buff[0],frame_parms->ofdm_symbol_size)));
LOG_D(PHY,"Setting amp for RU %d to %f (%d)\n",ru_id,sim.ru_amp[ru_id],dB_fixed((double)signal_energy((int32_t*)buff[0],frame_parms->ofdm_symbol_size)));
// tell top-level we are done
pthread_mutex_lock(&subframe_mutex);
subframe_ru_mask|=(1<<ru_id);
pthread_mutex_lock(&sim.subframe_mutex);
sim.subframe_ru_mask|=(1<<ru_id);
LOG_D(SIM,"Setting RU %d to busy\n",ru_id);
pthread_mutex_unlock(&subframe_mutex);
pthread_mutex_unlock(&sim.subframe_mutex);
return(nsamps);
}
...
...
@@ -385,30 +347,25 @@ void init_ru_devices(){
ru->rfdevice.trx_stop_func=ru_trx_stop;
ru->rfdevice.trx_set_freq_func=ru_trx_set_freq;
ru->rfdevice.trx_set_gains_func=ru_trx_set_gains;
last_ru_rx_timestamp[ru_id][0]=0;
sim.last_ru_rx_timestamp[ru_id][0]=0;
}
}
voidinit_ue_devices(){
AssertFatal(PHY_vars_UE_g!=NULL,"Top-level structure for UE is null\n");
for(intUE_id=0;UE_id<NB_UE_INST;UE_id++){
AssertFatal(PHY_vars_UE_g[UE_id]!=NULL,"UE %d context is not allocated\n",UE_id);
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
//UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id];
AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
AssertFatal(UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
AssertFatal(sim.RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
AssertFatal(sim.UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE