Commit 90ffa51f authored by lfarizav's avatar lfarizav

Some initialization modifications

parent 03fbb652
...@@ -33,7 +33,12 @@ phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id) ...@@ -33,7 +33,12 @@ phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
ue->measurements.rssi, ue->measurements.rssi,
ue->measurements.rx_power_avg_dB[eNB_id] ue->measurements.rx_power_avg_dB[eNB_id]
); );
printf("[UE %d] Gain control: rssi %d (%d,%d)\n",
ue->Mod_id,
rx_power_fil_dB,
ue->measurements.rssi,
ue->measurements.rx_power_avg_dB[eNB_id]
);
// Gain control with hysterisis // Gain control with hysterisis
// Adjust gain in ue->rx_vars[0].rx_total_gain_dB // Adjust gain in ue->rx_vars[0].rx_total_gain_dB
...@@ -63,7 +68,7 @@ phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id) ...@@ -63,7 +68,7 @@ phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
} }
LOG_D(PHY,"[UE %d] Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",ue->Mod_id,ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB); LOG_D(PHY,"[UE %d] Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",ue->Mod_id,ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
printf("[UE %d] Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",ue->Mod_id,ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
/* if ((ue->frame%100==0) || (ue->frame < 10)) /* if ((ue->frame%100==0) || (ue->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n", msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
......
...@@ -88,7 +88,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) ...@@ -88,7 +88,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id) uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id)
{ {
printf("get_n_adj_cells: if ue%d = %d. n_adj_cells %d\n",PHY_vars_UE_g[Mod_id][CC_id]->Mod_id,PHY_vars_UE_g[Mod_id][CC_id],(PHY_vars_UE_g[Mod_id][CC_id])?PHY_vars_UE_g[Mod_id][CC_id]->measurements.n_adj_cells:0);
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
if (ue) if (ue)
...@@ -200,7 +200,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, ...@@ -200,7 +200,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
//printf("previous_thread_id %d\n",previous_thread_id); //printf("previous_thread_id %d\n",previous_thread_id);
//printf("[UE %d] ue->current_thread_id[%d] %d, subframe %d\n",ue->Mod_id,subframe,ue->current_thread_id[subframe], subframe); //printf("[UE %d] ue->current_thread_id[%d] %d, subframe %d\n",ue->Mod_id,subframe,ue->current_thread_id[subframe], subframe);
for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) { for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) {
printf("ue_rrc_measurements: UE%d, eNB_offset %d,n_adj_cells %d\n",ue->Mod_id,eNB_offset,ue->measurements.n_adj_cells);
if (eNB_offset==0) { if (eNB_offset==0) {
ue->measurements.rssi = 0; ue->measurements.rssi = 0;
//ue->measurements.n0_power_tot = 0; //ue->measurements.n0_power_tot = 0;
...@@ -353,7 +353,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, ...@@ -353,7 +353,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d, nu %d, subframe %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d, nu %d, subframe %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l,nu,subframe); eNB_offset,k,l,nu,subframe);
#endif #endif
printf("[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d, nu %d, subframe %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l,nu,subframe);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
rxF = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(l*ue->frame_parms.ofdm_symbol_size)]; rxF = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(l*ue->frame_parms.ofdm_symbol_size)];
off = (ue->frame_parms.first_carrier_offset+k)<<1; off = (ue->frame_parms.first_carrier_offset+k)<<1;
...@@ -421,7 +422,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, ...@@ -421,7 +422,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
//printf("after ue->measurements.rssi %d\n",ue->measurements.rssi); //printf("after ue->measurements.rssi %d\n",ue->measurements.rssi);
//((200*ue->measurements.rsrq[eNB_offset]) + ((1024-200)*100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi))>>10; //((200*ue->measurements.rsrq[eNB_offset]) + ((1024-200)*100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi))>>10;
} else { // Do abstraction of RSRP and RSRQ } else { // Do abstraction of RSRP and RSRQ
ue->measurements.rssi = ue->measurements.rx_power_avg[0]; ue->measurements.rssi = ue->measurements.rx_power_avg[ue->common_vars.eNb_id];
// dummay value for the moment // dummay value for the moment
ue->measurements.rsrp[eNB_offset] = -93 ; ue->measurements.rsrp[eNB_offset] = -93 ;
ue->measurements.rsrq[eNB_offset] = 3; ue->measurements.rsrq[eNB_offset] = 3;
...@@ -488,8 +489,17 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue, ...@@ -488,8 +489,17 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue,
//printf("before ue->measurements.rssi %d\n",ue->measurements.rssi); //printf("before ue->measurements.rssi %d\n",ue->measurements.rssi);
//printf("[UE %d] ue->current_thread_id[%d] %d, subframe %d\n",ue->Mod_id,subframe,ue->current_thread_id[subframe], subframe); //printf("[UE %d] ue->current_thread_id[%d] %d, subframe %d\n",ue->Mod_id,subframe,ue->current_thread_id[subframe], subframe);
//printf("previous_thread_id %d\n",previous_thread_id); //printf("previous_thread_id %d\n",previous_thread_id);
for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) { /*if (ue->Mod_id==0 && ue->common_vars.eNb_id==0)
write_output("rxsigF00.m","rxF00", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],10*ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti,1,16);
else if (ue->Mod_id==0 && ue->common_vars.eNb_id==1)
write_output("rxsigF10.m","rxF10", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],10*ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti,1,16);
else if (ue->Mod_id==1 && ue->common_vars.eNb_id==1)
write_output("rxsigF11.m","rxF11", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],10*ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti,1,16);
else if (ue->Mod_id==1 && ue->common_vars.eNb_id==0)
write_output("rxsigF01.m","rxF01", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],10*ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti,1,16);*/
for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) {
printf("ue_rrc_measurements_freq: UE%d, eNB_offset %d,n_adj_cells %d, ofdm_symbol_size %d, symbols_per_tti %d\n",ue->Mod_id,eNB_offset,ue->measurements.n_adj_cells,ue->frame_parms.ofdm_symbol_size,ue->frame_parms.symbols_per_tti);
if (eNB_offset==0) { if (eNB_offset==0) {
ue->measurements.rssi = 0; ue->measurements.rssi = 0;
//ue->measurements.n0_power_tot = 0; //ue->measurements.n0_power_tot = 0;
...@@ -505,11 +515,13 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue, ...@@ -505,11 +515,13 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue,
if(ue->frame_parms.frame_type == FDD) if(ue->frame_parms.frame_type == FDD)
{ {
printf("ue_rrc_measurements_freq: FDD\n");
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)]; rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)]; rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)];
} }
else else
{ {
printf("ue_rrc_measurements_freq: TDD\n");
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].rxdataF[aarx][(13*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)]; rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].rxdataF[aarx][(13*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(2*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)]; rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(2*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)];
} }
...@@ -551,12 +563,14 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue, ...@@ -551,12 +563,14 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue,
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]); // printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12); ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx]; ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
printf("UE%d,eNB%d.subframe 0 or 5 FDD: n0_power_dB %d, n0_power_tot %d\n",ue->Mod_id,ue->common_vars.eNb_id,ue->measurements.n0_power_dB[aarx],ue->measurements.n0_power_tot);
} }
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot); //LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx)); ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
printf("UE%d,eNB%d.outside subframe 0 or 5 FDD: n0_power_tot_dB %d, n0_power_tot_dBm %d\n",ue->Mod_id,ue->common_vars.eNb_id,ue->measurements.n0_power_tot_dB,ue->measurements.n0_power_tot_dBm);
} else { } else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n"); LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
} }
...@@ -642,7 +656,8 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue, ...@@ -642,7 +656,8 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue,
LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d, nu %d, subframe %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d, nu %d, subframe %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l,nu,subframe); eNB_offset,k,l,nu,subframe);
#endif #endif
printf("[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d, nu %d, subframe %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l,nu,subframe);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
rxF = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(l*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)]; rxF = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(l*ue->frame_parms.ofdm_symbol_size)+subframe*(ue->frame_parms.ofdm_symbol_size*ue->frame_parms.symbols_per_tti)];
off = (ue->frame_parms.first_carrier_offset+k)<<1; off = (ue->frame_parms.first_carrier_offset+k)<<1;
...@@ -695,23 +710,29 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue, ...@@ -695,23 +710,29 @@ void ue_rrc_measurements_freq(PHY_VARS_UE *ue,
// 2 RE per PRB // 2 RE per PRB
// ue->measurements.rsrp[eNB_offset]/=(24*ue->frame_parms.N_RB_DL); // ue->measurements.rsrp[eNB_offset]/=(24*ue->frame_parms.N_RB_DL);
ue->measurements.rsrp[eNB_offset]/=(2*ue->frame_parms.N_RB_DL*ue->frame_parms.ofdm_symbol_size); ue->measurements.rsrp[eNB_offset]/=(2*ue->frame_parms.N_RB_DL*ue->frame_parms.ofdm_symbol_size);
printf("UE%d. rsrp %d\n",ue->Mod_id,ue->measurements.rsrp[0]);
// LOG_I(PHY,"eNB: %d, RSRP: %d \n",eNB_offset,ue->measurements.rsrp[eNB_offset]); // LOG_I(PHY,"eNB: %d, RSRP: %d \n",eNB_offset,ue->measurements.rsrp[eNB_offset]);
if (eNB_offset == 0) { if (eNB_offset == 0) {
// ue->measurements.rssi/=(24*ue->frame_parms.N_RB_DL); // ue->measurements.rssi/=(24*ue->frame_parms.N_RB_DL);
// ue->measurements.rssi*=rx_power_correction; // ue->measurements.rssi*=rx_power_correction;
// ue->measurements.rssi=ue->measurements.rsrp[0]*24/2; // ue->measurements.rssi=ue->measurements.rsrp[0]*24/2;
ue->measurements.rssi=ue->measurements.rsrp[0]*(12*ue->frame_parms.N_RB_DL); ue->measurements.rssi=ue->measurements.rsrp[0]*(12*ue->frame_parms.N_RB_DL);
printf("UE%d:rssi %d. rsrp %d\n",ue->Mod_id,ue->measurements.rssi,ue->measurements.rsrp[0]);
//printf("ue->measurements.rsrp[0] %d\n",ue->measurements.rsrp[0]); //printf("ue->measurements.rsrp[0] %d\n",ue->measurements.rsrp[0]);
} }
if (ue->measurements.rssi>0) if (ue->measurements.rssi>0){
ue->measurements.rsrq[eNB_offset] = 100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi; ue->measurements.rsrq[eNB_offset] = 100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi;
else printf("rssi>0: UE%d:rssi %d. rsrp %d\n",ue->Mod_id,ue->measurements.rssi,ue->measurements.rsrp[0]);
}
else{
ue->measurements.rsrq[eNB_offset] = -12000; ue->measurements.rsrq[eNB_offset] = -12000;
printf("else rssi: UE%d:rssi %d. rsrp %d\n",ue->Mod_id,ue->measurements.rssi,ue->measurements.rsrp[0]);
}
//printf("after ue->measurements.rssi %d\n",ue->measurements.rssi); //printf("after ue->measurements.rssi %d\n",ue->measurements.rssi);
//((200*ue->measurements.rsrq[eNB_offset]) + ((1024-200)*100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi))>>10; //((200*ue->measurements.rsrq[eNB_offset]) + ((1024-200)*100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi))>>10;
} else { // Do abstraction of RSRP and RSRQ } else { // Do abstraction of RSRP and RSRQ
ue->measurements.rssi = ue->measurements.rx_power_avg[0]; ue->measurements.rssi = ue->measurements.rx_power_avg[ue->common_vars.eNb_id];
// dummay value for the moment // dummay value for the moment
ue->measurements.rsrp[eNB_offset] = -93 ; ue->measurements.rsrp[eNB_offset] = -93 ;
ue->measurements.rsrq[eNB_offset] = 3; ue->measurements.rsrq[eNB_offset] = 3;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "SCHED/extern.h" #include "SCHED/extern.h"
#include "defs.h" #include "defs.h"
#include "extern.h" #include "extern.h"
#include "LAYER2/MAC/extern.h"
#include "common_lib.h" #include "common_lib.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
...@@ -493,6 +493,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) ...@@ -493,6 +493,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0; // uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int ret=-1; int ret=-1;
int i;
int aarx,rx_power=0; int aarx,rx_power=0;
/*#ifdef OAI_USRP /*#ifdef OAI_USRP
__m128i *rxdata128; __m128i *rxdata128;
...@@ -543,7 +544,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) ...@@ -543,7 +544,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue->rx_offset += (FRAME_LENGTH_COMPLEX_SAMPLES>>1); ue->rx_offset += (FRAME_LENGTH_COMPLEX_SAMPLES>>1);
init_frame_parms(&ue->frame_parms,1); init_frame_parms(&ue->frame_parms,1);
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); for (i=0; i<NB_eNB_INST; i++)
lte_gold(frame_parms,ue->lte_gold_table[i],i);
//lte_gold(frame_parms,ue->lte_gold_table[ue->common_vars.eNb_id],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode); ret = pbch_detection(ue,mode);
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); // write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
...@@ -590,7 +593,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) ...@@ -590,7 +593,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue->rx_offset += (FRAME_LENGTH_COMPLEX_SAMPLES>>1); ue->rx_offset += (FRAME_LENGTH_COMPLEX_SAMPLES>>1);
init_frame_parms(&ue->frame_parms,1); init_frame_parms(&ue->frame_parms,1);
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); for (i=0; i<NB_eNB_INST; i++)
lte_gold(frame_parms,ue->lte_gold_table[i],i);
//lte_gold(frame_parms,ue->lte_gold_table[ue->common_vars.eNb_id],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode); ret = pbch_detection(ue,mode);
// write_output("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); // write_output("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
...@@ -633,7 +638,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) ...@@ -633,7 +638,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
frame_parms->nushift = frame_parms->Nid_cell%6; frame_parms->nushift = frame_parms->Nid_cell%6;
init_frame_parms(&ue->frame_parms,1); init_frame_parms(&ue->frame_parms,1);
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); for (i=0; i<NB_eNB_INST; i++)
lte_gold(frame_parms,ue->lte_gold_table[i],i);
//lte_gold(frame_parms,ue->lte_gold_table[ue->common_vars.eNb_id],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode); ret = pbch_detection(ue,mode);
// write_output("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); // write_output("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
...@@ -669,7 +676,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) ...@@ -669,7 +676,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue->rx_offset += (FRAME_LENGTH_COMPLEX_SAMPLES>>1); ue->rx_offset += (FRAME_LENGTH_COMPLEX_SAMPLES>>1);
init_frame_parms(&ue->frame_parms,1); init_frame_parms(&ue->frame_parms,1);
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); for (i=0; i<NB_eNB_INST; i++)
lte_gold(frame_parms,ue->lte_gold_table[i],i);
//lte_gold(frame_parms,ue->lte_gold_table[ue->common_vars.eNb_id],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode); ret = pbch_detection(ue,mode);
// write_output("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); // write_output("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
...@@ -887,8 +896,9 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode) ...@@ -887,8 +896,9 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0; // uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int ret=-1; int ret=-1;
int i;
int aarx,rx_power=0; int aarx,rx_power=0;
printf("initial_synch_freq: UE %d, eNB %d\n",ue->Mod_id,ue->common_vars.eNb_id); printf("initial_synch_freq: UE %d, eNB %d, NB_eNB_INST %d, eNB->Nid_cell %d\n",ue->Mod_id,ue->common_vars.eNb_id, NB_eNB_INST,PHY_vars_eNB_g[ue->common_vars.eNb_id][0]->frame_parms.Nid_cell);
/*#ifdef OAI_USRP /*#ifdef OAI_USRP
__m128i *rxdata128; __m128i *rxdata128;
#endif*/ #endif*/
...@@ -908,10 +918,12 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode) ...@@ -908,10 +918,12 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
//rx_sss(ue,&metric_fdd_ncp,&flip_fdd_ncp,&phase_fdd_ncp); //rx_sss(ue,&metric_fdd_ncp,&flip_fdd_ncp,&phase_fdd_ncp);
frame_parms->nushift = frame_parms->Nid_cell%6; frame_parms->nushift = frame_parms->Nid_cell%6;
// lte-gold // lte-gold
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); for (i=0; i<NB_eNB_INST; i++)
printf("binitial_synch [UE%d]->[eNB%d]: pbch_detection_freq returns %d\n",ue->Mod_id,ue->common_vars.eNb_id,ret); lte_gold(frame_parms,ue->lte_gold_table[i],i);
printf("binitial_synch [UE%d]->[eNB%d]: pbch_detection_freq returns %d, Nid_cell %d\n",ue->Mod_id,ue->common_vars.eNb_id,ret,frame_parms->Nid_cell);
ret=pbch_detection_freq(ue,mode); ret=pbch_detection_freq(ue,mode);
printf("ainitial_synch [UE%d]->[eNB%d]: pbch_detection_freq returns %d\n",ue->Mod_id,ue->common_vars.eNb_id,ret); printf("ainitial_synch [UE%d]->[eNB%d]: pbch_detection_freq returns %d, Nid_cell %d\n",ue->Mod_id,ue->common_vars.eNb_id,ret,frame_parms->Nid_cell);
//init_frame_parms(frame_parms,1); //init_frame_parms(frame_parms,1);
//printf("dumping enb frame params\n"); //printf("dumping enb frame params\n");
//dump_frame_parms(&PHY_vars_eNB_g[0][0]->frame_parms); //dump_frame_parms(&PHY_vars_eNB_g[0][0]->frame_parms);
...@@ -924,10 +936,13 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode) ...@@ -924,10 +936,13 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms(frame_parms,1); init_frame_parms(frame_parms,1);
frame_parms->Nid_cell=PHY_vars_eNB_g[ue->common_vars.eNb_id][0]->frame_parms.Nid_cell; frame_parms->Nid_cell=PHY_vars_eNB_g[ue->common_vars.eNb_id][0]->frame_parms.Nid_cell;
frame_parms->nushift = frame_parms->Nid_cell%6; frame_parms->nushift = frame_parms->Nid_cell%6;
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
printf("binitial_synch, second chance[UE%d]->[eNB%d]: pbch_detection_freq returns %d\n",ue->Mod_id,ue->common_vars.eNb_id,ret); for (i=0; i<NB_eNB_INST; i++)
lte_gold(frame_parms,ue->lte_gold_table[i],i);
printf("binitial_synch, second chance[UE%d]->[eNB%d]: pbch_detection_freq returns %d, Nid_cell %d\n\n",ue->Mod_id,ue->common_vars.eNb_id,ret,frame_parms->Nid_cell);
ret = pbch_detection_freq(ue,mode); ret = pbch_detection_freq(ue,mode);
printf("ainitial_synch, second chance[UE%d]->[eNB%d]: pbch_detection_freq returns %d\n",ue->Mod_id,ue->common_vars.eNb_id,ret); printf("ainitial_synch, second chance[UE%d]->[eNB%d]: pbch_detection_freq returns %d, Nid_cell %d\n\n",ue->Mod_id,ue->common_vars.eNb_id,ret,frame_parms->Nid_cell);
} }
if (ret==0) { // fake first PBCH found so indicate sync to higher layers and configure frame parameters if (ret==0) { // fake first PBCH found so indicate sync to higher layers and configure frame parameters
...@@ -1038,7 +1053,7 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode) ...@@ -1038,7 +1053,7 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power+= signal_energy((int*)&ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[aarx][6*frame_parms->ofdm_symbol_size], rx_power+= signal_energy((int*)&ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[aarx][6*frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
printf("rx_power %d\n",rx_power); printf("UE%d: rx_power %d\n",ue->Mod_id,rx_power);
/*common_vars.common_vars_rx_data_per_thread[0].rxdataF /*common_vars.common_vars_rx_data_per_thread[0].rxdataF
// do a measurement on the full frame // do a measurement on the full frame
......
...@@ -194,7 +194,7 @@ int write_output_chFf(const char *fname,const char *vname,float data1[1200],floa ...@@ -194,7 +194,7 @@ int write_output_chFf(const char *fname,const char *vname,float data1[1200],floa
{ {
FILE *fp=NULL; FILE *fp=NULL;
fp = fopen(fname,"a+"); fp = fopen(fname,"w+");
int i; int i;
......
...@@ -198,9 +198,9 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, ...@@ -198,9 +198,9 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero
bit = malloc(coded_bits_per_codeword*sizeof(float)); bit = malloc(coded_bits_per_codeword*sizeof(float));
if (phy_vars_ue->do_ofdm_mod) if (phy_vars_ue->do_ofdm_mod)
rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdataF[eNB_id]; rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdataF[0];
else else
rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id]; rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[0];
//chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; //chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id];
chest_t = (int16_t**) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates[eNB_id]; chest_t = (int16_t**) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates[eNB_id];
chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id];
......
...@@ -2701,7 +2701,7 @@ void ue_measurement_procedures( ...@@ -2701,7 +2701,7 @@ void ue_measurement_procedures(
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT);
if (abstraction_flag==1) if (abstraction_flag==1)
ue->sinr_eff = sinr_eff_cqi_calc(ue, 0, subframe_rx); ue->sinr_eff = sinr_eff_cqi_calc(ue, ue->common_vars.eNb_id, subframe_rx);
} }
...@@ -2715,7 +2715,7 @@ void ue_measurement_procedures( ...@@ -2715,7 +2715,7 @@ void ue_measurement_procedures(
#ifndef OAI_USRP #ifndef OAI_USRP
#ifndef OAI_BLADERF #ifndef OAI_BLADERF
#ifndef OAI_LMSSDR #ifndef OAI_LMSSDR
phy_adjust_gain (ue,dB_fixed(ue->measurements.rssi),0); phy_adjust_gain (ue,dB_fixed(ue->measurements.rssi),ue->common_vars.eNb_id);
//printf("phy_adjust_gain phy_proc_ue\n"); //printf("phy_adjust_gain phy_proc_ue\n");
#endif #endif
#endif #endif
...@@ -2723,7 +2723,7 @@ void ue_measurement_procedures( ...@@ -2723,7 +2723,7 @@ void ue_measurement_procedures(
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT);
eNB_id = 0; eNB_id = ue->common_vars.eNb_id;
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
if (ue->no_timing_correction==0) if (ue->no_timing_correction==0)
...@@ -2909,6 +2909,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin ...@@ -2909,6 +2909,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int subframe_rx = proc->subframe_rx; int subframe_rx = proc->subframe_rx;
//printf("pbch0_before. ue->proc->frame_rx %d, ue->subframe_rx %d, enb->proc->frame_tx %d, enb->subframe_tx %d\n",ue->proc.proc_rxtx[0].frame_rx,ue->proc.proc_rxtx[0].subframe_rx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[0].frame_tx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[0].subframe_tx); //printf("pbch0_before. ue->proc->frame_rx %d, ue->subframe_rx %d, enb->proc->frame_tx %d, enb->subframe_tx %d\n",ue->proc.proc_rxtx[0].frame_rx,ue->proc.proc_rxtx[0].subframe_rx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[0].frame_tx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[0].subframe_tx);
//printf("pbch1_before. ue->proc->frame_rx %d, ue->subframe_rx %d, enb->proc->frame_tx %d, enb->subframe_tx %d\n",ue->proc.proc_rxtx[1].frame_rx,ue->proc.proc_rxtx[1].subframe_rx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[1].frame_tx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[1].subframe_tx); //printf("pbch1_before. ue->proc->frame_rx %d, ue->subframe_rx %d, enb->proc->frame_tx %d, enb->subframe_tx %d\n",ue->proc.proc_rxtx[1].frame_rx,ue->proc.proc_rxtx[1].subframe_rx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[1].frame_tx,PHY_vars_eNB_g[eNB_id][0]->proc.proc_rxtx[1].subframe_tx);
...@@ -2921,7 +2922,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin ...@@ -2921,7 +2922,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
for (pbch_trials=0; pbch_trials<4; pbch_trials++) { for (pbch_trials=0; pbch_trials<4; pbch_trials++) {
//for (pbch_phase=0;pbch_phase<4;pbch_phase++) { //for (pbch_phase=0;pbch_phase<4;pbch_phase++) {
//LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id); printf("[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id);
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
pbch_tx_ant = rx_pbch(&ue->common_vars, pbch_tx_ant = rx_pbch(&ue->common_vars,
ue->pbch_vars[eNB_id], ue->pbch_vars[eNB_id],
...@@ -4436,7 +4437,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { ...@@ -4436,7 +4437,7 @@ void *UE_thread_slot1_dl_processing(void *arg) {
l, l,
slot1, slot1,
0); 0);
ue_measurement_procedures(l-1,ue,proc,0,1+(subframe_rx<<1),0,ue->mode); ue_measurement_procedures(l-1,ue,proc,ue->common_vars.eNb_id,1+(subframe_rx<<1),0,ue->mode);
} }
//printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,next_subframe_slot0,pilot0); //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,next_subframe_slot0,pilot0);
front_end_chanEst(ue, front_end_chanEst(ue,
......
...@@ -513,6 +513,7 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][ ...@@ -513,6 +513,7 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE
frame_parms->N_RB_DL*12); frame_parms->N_RB_DL*12);
stop_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_dac_fixed_gain_freq); stop_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_dac_fixed_gain_freq);
printf("UE%d,eNB%d: dac_fixed_gain: referenceSignalPower %d\n",UE_id,eNB_id,frame_parms->pdsch_config_common.referenceSignalPower);
#else #else
start_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_dac_fixed_gain_freq); start_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_dac_fixed_gain_freq);
tx_pwr = dac_fixed_gain(s_re_f, tx_pwr = dac_fixed_gain(s_re_f,
...@@ -534,8 +535,10 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][ ...@@ -534,8 +535,10 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
//for (x=0;x<frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti;x++){ //for (x=0;x<frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti;x++){
// fprintf(file1,"%d\t%e\t%e\n",x,s_re_f[0][x],s_im_f[0][x]); // fprintf(file1,"%d\t%e\t%e\n",x,s_re_f[0][x],s_im_f[0][x]);
//} //}
//write_output("chsim_txsigF_DL.m","chsm_txsF_DL", PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.txdataF[0][0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16); if (eNB_id==0 && subframe ==9)
write_output("txsigF0.m","txF0", PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.txdataF[0][0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
else if (eNB_id==1 && subframe ==9)
write_output("txsigF1.m","txF1", PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.txdataF[0][0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
#ifdef DEBUG_SIM #ifdef DEBUG_SIM
LOG_D(OCM,"[SIM][DL] eNB %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n", LOG_D(OCM,"[SIM][DL] eNB %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n",
eNB_id,CC_id, eNB_id,CC_id,
...@@ -574,13 +577,20 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][ ...@@ -574,13 +577,20 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
LOG_D(OCM,"[SIM][DL] Channel eNB %d => UE %d (CCid %d): Channel gain %f dB (%f)\n",eNB_id,UE_id,CC_id,10*log10(rx_pwr),rx_pwr); LOG_D(OCM,"[SIM][DL] Channel eNB %d => UE %d (CCid %d): Channel gain %f dB (%f)\n",eNB_id,UE_id,CC_id,10*log10(rx_pwr),rx_pwr);
#endif #endif
rx_pwr = signal_energy_fp2(eNB2UE[eNB_id][UE_id][CC_id]->chF[0],
frame_parms->N_RB_DL*12+1)*(frame_parms->N_RB_DL*12+1);
printf("[SIM][DL] Channel eNB %d => UE %d (CCid %d): Channel gain %f dB (%f)\n",eNB_id,UE_id,CC_id,10*log10(rx_pwr),rx_pwr);
//#ifdef DEBUG_SIM //#ifdef DEBUG_SIM
if (eNB_id==0 && UE_id ==0 && subframe ==9)
write_output_chFf("channelF00.m","chF00", eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].x,eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y,frame_parms->ofdm_symbol_size,1);
else if (eNB_id==1 && UE_id ==0 && subframe ==9)
write_output_chFf("channelF10.m","chF10", eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].x,eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y,frame_parms->ofdm_symbol_size,1);
else if (eNB_id==0 && UE_id ==1 && subframe ==9)
write_output_chFf("channelF01.m","chF01", eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].x,eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y,frame_parms->ofdm_symbol_size,1);
else if (eNB_id==1 && UE_id ==1 && subframe ==9)
write_output_chFf("channelF11.m","chF11", eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].x,eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y,frame_parms->ofdm_symbol_size,1);
/*for (i=0; i<frame_parms->N_RB_DL*12; i++){ /*for (i=0; i<frame_parms->N_RB_DL*12; i++){
printf("do_DL_sig channel(eNB%d,UE%d)[%d] : (%f,%f)\n",eNB_id,UE_id,i,eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].x[i],eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y[i]); printf("do_DL_sig channel(eNB%d,UE%d)[%d] : (%f,%f)\n",eNB_id,UE_id,i,[i],eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y[i]);
}*/
/*for (i=frame_parms->N_RB_DL*12-10; i<frame_parms->N_RB_DL*12; i++){
printf("do_DL_sig channel(eNB%d,UE%d)[%d] : (%f,%f)\n",eNB_id,UE_id,i,eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].x[i],eNB2UE[eNB_id][UE_id][CC_id]->chFf[0].y[i]);
}*/ }*/
//#endif //#endif
...@@ -726,7 +736,18 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][ ...@@ -726,7 +736,18 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
12); 12);
stop_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_adc_freq); stop_meas(&eNB2UE[eNB_id][UE_id][CC_id]->DL_adc_freq);
#endif #endif
if (eNB_id==0 && subframe ==9){
if (UE_id==0)
write_output("rxsigF00.m","rxF00", PHY_vars_UE_g[UE_id][CC_id]->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
else if (UE_id==1)
write_output("rxsigF01.m","rxF01", PHY_vars_UE_g[UE_id][CC_id]->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
}
else if (eNB_id==1 && subframe ==9){
if (UE_id==0)
write_output("rxsigF10.m","rxF10", PHY_vars_UE_g[UE_id][CC_id]->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
else if (UE_id==1)
write_output("rxsigF11.m","rxF11", PHY_vars_UE_g[UE_id][CC_id]->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0],10*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
}
//for (int idx=0;idx<10;idx++) printf("dumping DL raw subframe %d: r_re_p_f[%d] = (%e,%e)\n", subframe, idx, r_re_p_f[0][idx], r_im_p_f[0][idx]); //for (int idx=0;idx<10;idx++) printf("dumping DL raw subframe %d: r_re_p_f[%d] = (%e,%e)\n", subframe, idx, r_re_p_f[0][idx], r_im_p_f[0][idx]);
//for (int idx=0;idx<10;idx++) printf("dumping DL raw subframe %d,UE %d, eNB_id %d: rxdataF0[%d] = (%d,%d)\n", subframe,UE_id,eNB_id, idx, ((short*)&rxdataF[0][sf_offset+idx])[0], ((short*)&rxdataF[0][sf_offset+idx])[1]); //for (int idx=0;idx<10;idx++) printf("dumping DL raw subframe %d,UE %d, eNB_id %d: rxdataF0[%d] = (%d,%d)\n", subframe,UE_id,eNB_id, idx, ((short*)&rxdataF[0][sf_offset+idx])[0], ((short*)&rxdataF[0][sf_offset+idx])[1]);
//print_meas (&eNB2UE[eNB_id][UE_id][CC_id]->DL_adc,"[DL][adc]", &eNB2UE[eNB_id][UE_id][CC_id]->DL_adc, &eNB2UE[eNB_id][UE_id][CC_id]->DL_adc); //print_meas (&eNB2UE[eNB_id][UE_id][CC_id]->DL_adc,"[DL][adc]", &eNB2UE[eNB_id][UE_id][CC_id]->DL_adc, &eNB2UE[eNB_id][UE_id][CC_id]->DL_adc);
...@@ -950,7 +971,6 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N ...@@ -950,7 +971,6 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
frame_parms->samples_per_tti, frame_parms->samples_per_tti,
12); 12);
stop_meas(&UE2eNB[0][eNB_id][CC_id]->UL_adc); stop_meas(&UE2eNB[0][eNB_id][CC_id]->UL_adc);
#ifdef DEBUG_SIM #ifdef DEBUG_SIM
rx_pwr2 = signal_energy(rxdata[0]+sf_offset,frame_parms->samples_per_tti)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL); rx_pwr2 = signal_energy(rxdata[0]+sf_offset,frame_parms->samples_per_tti)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][UL] eNB %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d)\n",eNB_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset); LOG_D(OCM,"[SIM][UL] eNB %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d)\n",eNB_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset);
......
...@@ -51,7 +51,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -51,7 +51,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_vars_eNB->Mod_id=eNB_id; PHY_vars_eNB->Mod_id=eNB_id;
PHY_vars_eNB->cooperation_flag=0;//cooperation_flag; PHY_vars_eNB->cooperation_flag=0;//cooperation_flag;
memcpy(&(PHY_vars_eNB->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); memcpy(&(PHY_vars_eNB->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB->frame_parms.Nid_cell = ((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3); PHY_vars_eNB->frame_parms.Nid_cell = Nid_cell;
PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6; PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6;
phy_init_lte_eNB(PHY_vars_eNB,0,abstraction_flag); phy_init_lte_eNB(PHY_vars_eNB,0,abstraction_flag);
......
...@@ -1449,15 +1449,68 @@ void init_openair1(void) ...@@ -1449,15 +1449,68 @@ void init_openair1(void)
{ {
module_id_t UE_id; module_id_t UE_id;
uint8_t eNB_id = 0; uint8_t eNB_id = 0;
uint8_t RN_id = 0;
uint8_t CC_id; uint8_t CC_id;
#if ENABLE_RAL #if ENABLE_RAL
int list_index; int list_index;
#endif #endif
// change the nb_connected_eNB // change the nb_connected_eNB
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { mac_xface = malloc(sizeof(MAC_xface));
memset(mac_xface, 0, sizeof(MAC_xface));
init_lte_vars (&frame_parms[CC_id], PHY_vars_eNB_g = (PHY_VARS_eNB***)malloc(NB_eNB_INST*sizeof(PHY_VARS_eNB**));
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
PHY_vars_eNB_g[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_I(PHY,"init lte parms: Nid_cell %d, Frame type %d, N_RB_DL %d, nushift %d\n",enb_properties->properties[eNB_id]->Nid_cell[CC_id],oai_emulation.info.frame_type[CC_id],oai_emulation.info.N_RB_DL[CC_id],((enb_properties->properties[eNB_id]->Nid_cell[CC_id])%6));
frame_parms[CC_id] = calloc(1, sizeof(LTE_DL_FRAME_PARMS));
(frame_parms[CC_id])->frame_type = oai_emulation.info.frame_type[CC_id];
(frame_parms[CC_id])->tdd_config = oai_emulation.info.tdd_config_S[CC_id];
(frame_parms[CC_id])->tdd_config_S = oai_emulation.info.tdd_config_S[CC_id];
(frame_parms[CC_id])->N_RB_DL = oai_emulation.info.N_RB_DL[CC_id];
(frame_parms[CC_id])->N_RB_UL = (frame_parms[CC_id])->N_RB_DL;
(frame_parms[CC_id])->phich_config_common.phich_resource = oneSixth;
(frame_parms[CC_id])->phich_config_common.phich_duration = normal;
(frame_parms[CC_id])->Ncp = oai_emulation.info.extended_prefix_flag[CC_id];
(frame_parms[CC_id])->Ncp_UL = oai_emulation.info.extended_prefix_flag[CC_id];
(frame_parms[CC_id])->Nid_cell = enb_properties->properties[eNB_id]->Nid_cell[CC_id];
(frame_parms[CC_id])->nushift = ((enb_properties->properties[eNB_id]->Nid_cell[CC_id])%6);
(frame_parms[CC_id])->nb_antennas_tx = enb_properties->properties[eNB_id]->nb_antennas_tx[CC_id];
(frame_parms[CC_id])->nb_antennas_rx = enb_properties->properties[eNB_id]->nb_antennas_rx[CC_id];
(frame_parms[CC_id])->nb_antenna_ports_eNB = enb_properties->properties[eNB_id]->nb_antenna_ports[CC_id];
(frame_parms[CC_id])->mode1_flag = (frame_parms[CC_id])->nb_antenna_ports_eNB==1 ? 1 : 0;
init_frame_parms(frame_parms[CC_id],1);
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
(frame_parms[CC_id])->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
init_ul_hopping(frame_parms[CC_id]);
phy_init_lte_top(frame_parms[CC_id]);
PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,enb_properties->properties[eNB_id]->Nid_cell[CC_id],eNodeB_3GPP,abstraction_flag);
PHY_vars_eNB_g[eNB_id][CC_id]->Mod_id=eNB_id;
PHY_vars_eNB_g[eNB_id][CC_id]->CC_id=CC_id;
}
}
PHY_vars_UE_g = (PHY_VARS_UE***)malloc(NB_UE_INST*sizeof(PHY_VARS_UE**));
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
PHY_vars_UE_g[UE_id] = (PHY_VARS_UE**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_UE*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
(frame_parms[CC_id])->nb_antennas_tx = 1;
(frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx_ue;
PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag);
PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id;
PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id;
}
}
if (NB_RN_INST > 0) {
PHY_vars_RN_g = malloc(NB_RN_INST*sizeof(PHY_VARS_RN*));
for (RN_id=0; RN_id<NB_RN_INST; RN_id++) {
PHY_vars_RN_g[RN_id] = init_lte_RN(*frame_parms,RN_id,oai_emulation.info.eMBMS_active_state);
}
}
/*init_lte_vars (&frame_parms[CC_id],
oai_emulation.info.frame_type[CC_id], oai_emulation.info.frame_type[CC_id],
oai_emulation.info.tdd_config[CC_id], oai_emulation.info.tdd_config[CC_id],
oai_emulation.info.tdd_config_S[CC_id], oai_emulation.info.tdd_config_S[CC_id],
...@@ -1470,7 +1523,8 @@ void init_openair1(void) ...@@ -1470,7 +1523,8 @@ void init_openair1(void)
enb_properties->properties[eNB_id]->nb_antennas_rx[CC_id], enb_properties->properties[eNB_id]->nb_antennas_rx[CC_id],
enb_properties->properties[eNB_id]->nb_antennas_tx[CC_id], enb_properties->properties[eNB_id]->nb_antennas_tx[CC_id],
nb_antennas_rx_ue, nb_antennas_rx_ue,
oai_emulation.info.eMBMS_active_state); oai_emulation.info.eMBMS_active_state);*/
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (eNB_id=0;eNB_id<enb_properties->number;eNB_id++) { for (eNB_id=0;eNB_id<enb_properties->number;eNB_id++) {
// This is for IF4p5 RRU, gets done by RRC configuration of eNB // This is for IF4p5 RRU, gets done by RRC configuration of eNB
PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = enb_properties->properties[eNB_id]->prach_config_index[CC_id]; PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = enb_properties->properties[eNB_id]->prach_config_index[CC_id];
......
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