Commit f52f4bab authored by Khodr Saaifan's avatar Khodr Saaifan Committed by Thomas Schlichter

Code Clean Up: UE Measurements are working fine includes RSRP, RSSI, Noise...

Code Clean Up: UE Measurements are working fine includes RSRP, RSSI, Noise Floor, Rank calc, and pmi. In addition, the UE meas is corrected in print_stats.c
parent 2d7336a6
......@@ -40,7 +40,7 @@
//#define DEBUG_MEAS_UE
//#define DEBUG_RANK_EST
int16_t cond_num_threshold = 5;
int16_t cond_num_threshold = 5;//change threshold to 5 dB
#ifdef USER_MODE
void print_shorts(char *s,short *x)
......@@ -181,7 +181,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
int aarx,rb;
uint8_t pss_symb;
uint8_t sss_symb;
uint8_t rx_power_correction=2;
int gain_offset=49;
int32_t **rxdataF;
int16_t *rxF,*rxF_pss,*rxF_sss;
......@@ -190,230 +191,211 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
uint16_t off;
uint8_t previous_thread_id = ue->current_thread_id[subframe]==0 ? (RX_NB_TH-1):(ue->current_thread_id[subframe]-1);
//uint8_t isPss; // indicate if this is a slot for extracting PSS
//uint8_t isSss; // indicate if this is a slot for extracting SSS
//int32_t pss_ext[4][72]; // contain the extracted 6*12 REs for mapping the PSS
//int32_t sss_ext[4][72]; // contain the extracted 6*12 REs for mapping the SSS
//int32_t (*xss_ext)[72]; // point to either pss_ext or sss_ext for common calculation
//int16_t *re,*im; // real and imag part of each 32-bit xss_ext[][] value
//LOG_I(PHY,"UE RRC MEAS Start Subframe %d Frame Type %d slot %d \n",subframe,ue->frame_parms.frame_type,slot);
for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) {
if (eNB_offset==0) {
ue->measurements.rssi = 0;
//ue->measurements.n0_power_tot = 0;
if (abstraction_flag == 0) {
if ( ((ue->frame_parms.frame_type == FDD) && ((subframe == 0) || (subframe == 5))) ||
((ue->frame_parms.frame_type == TDD) && ((subframe == 1) || (subframe == 6)))
)
{ // FDD PSS/SSS, compute noise in DTX REs
ue->measurements.n0_power_tot = 0;//clear to avoid accum
if (ue->frame_parms.Ncp==NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
if(ue->frame_parms.frame_type == FDD)
{
//rxF_sss points to OFDM symbol 5*N, thus the +ve subcarrier starts from rxF_sss[0]:dc rxF_sss[1] ... rxF_sss[150]
//rxF_sss points to OFDM symbol 6*N, thus the +ve subcarrier starts from rxF_pss[0]:dc rxF_pss[1] ... rxF_pss[150]
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)];
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)];
}
else
{
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)];
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)];
}
//+ve spectrum from SSS//0 dc 1:1:31 sss (2k 2k+1): k=32 33 34 35 36 are null signal
ue->measurements.n0_power[aarx] = (int32_t)(rxF_sss[66]*rxF_sss[66])+(int32_t)(rxF_sss[67]*rxF_sss[67]);//k=33 ->(66 67)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[68]*rxF_sss[68])+(int32_t)(rxF_sss[69]*rxF_sss[69]);//k=34 ->(68 69)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[70]*rxF_sss[70])+(int32_t)(rxF_sss[71]*rxF_sss[71]);//k=35 ->(70 71)
//+ve spectrum from PSS//0 dc 1:1:31 sss (2k 2k+1): k=32 33 34 35 36 37
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[66]*rxF_pss[66])+(int32_t)(rxF_pss[67]*rxF_pss[67]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[68]*rxF_pss[68])+(int32_t)(rxF_pss[69]*rxF_pss[69]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[70]*rxF_pss[70])+(int32_t)(rxF_pss[71]*rxF_pss[71]);//>>15
if(ue->frame_parms.frame_type == FDD)
{
//rxF_sss points to OFDM symbol 6*N, thus the -ve subcarrier of sss starts from rxF_sss[-1] ... rxF_sss[-150]
//rxF_sss points to OFDM symbol 7*N, thus the -ve subcarrier of pss starts from rxF_pss[-1] ... rxF_pss[-150]
rxF_sss = (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)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)];
}
else
{
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].rxdataF[aarx][(14*ue->frame_parms.ofdm_symbol_size)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(3*ue->frame_parms.ofdm_symbol_size)];
}
//-ve spectrum from SSS// -1:-1:-31 sss (2k+1 2k): k=-32 -33 -34 -35 -36 -37 are null signal
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[-70]*rxF_pss[-70])+(int32_t)(rxF_pss[-69]*rxF_pss[-69]);//k=-35 ->(-69 -70)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[-68]*rxF_pss[-68])+(int32_t)(rxF_pss[-67]*rxF_pss[-67]);//k=-34 ->(-67 -68)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[-66]*rxF_pss[-66])+(int32_t)(rxF_pss[-65]*rxF_pss[-65]);//k=-33 ->(-65 -66)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[-70]*rxF_sss[-70])+(int32_t)(rxF_sss[-69]*rxF_sss[-69]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[-68]*rxF_sss[-68])+(int32_t)(rxF_sss[-67]*rxF_sss[-67]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[-66]*rxF_sss[-66])+(int32_t)(rxF_sss[-65]*rxF_sss[-65]);
ue->measurements.n0_power[aarx]=(ue->measurements.n0_power[aarx])/12;//per one antenna
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_tot += ue->measurements.n0_power[aarx];//per two antenna
}
//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/aarx);//(unsigned short) dB_fixed(ue->measurements.n0_power_tot/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);
} else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
}
}
else if ((ue->frame_parms.frame_type == TDD) &&
((subframe == 1) || (subframe == 6))) { // TDD PSS/SSS, compute noise in DTX REs // 2016-09-29 wilson fix incorrect noise power calculation
pss_symb = 2;
sss_symb = ue->frame_parms.symbols_per_tti-1;
if (ue->frame_parms.Ncp==NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(ue->current_thread_id[subframe])].rxdataF;
rxF_pss = (int16_t *) &rxdataF[aarx][((pss_symb*(ue->frame_parms.ofdm_symbol_size)))];
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].rxdataF;
rxF_sss = (int16_t *) &rxdataF[aarx][((sss_symb*(ue->frame_parms.ofdm_symbol_size)))];
//-ve spectrum from SSS
// printf("slot %d: SSS DTX: %d,%d, non-DTX %d,%d\n",slot,rxF_pss[-72],rxF_pss[-71],rxF_pss[-36],rxF_pss[-35]);
// ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71]));
// printf("sssn36 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// printf("sssm32 %d\n",ue->measurements.n0_power[aarx]);
//+ve spectrum from SSS
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63]));
// printf("sssp32 %d\n",ue->measurements.n0_power[aarx]);
//+ve spectrum from PSS n0_power
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+70]*rxF_pss[2+70])+((int32_t)rxF_pss[2+69]*rxF_pss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+68]*rxF_pss[2+68])+((int32_t)rxF_pss[2+67]*rxF_pss[2+67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+66]*rxF_pss[2+66])+((int32_t)rxF_pss[2+65]*rxF_pss[2+65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63]));
// printf("pss32 %d\n",ue->measurements.n0_power[aarx]); //-ve spectrum from PSS
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)];
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71]));
// printf("pssm36 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// 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_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(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);
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
}
}
}
}
if (eNB_offset==0)
{
ue->measurements.rssi = 0;
//ue->measurements.n0_power_tot = 0;
if (abstraction_flag == 0)
{
if (((ue->frame_parms.frame_type == FDD) && ((subframe == 0) || (subframe == 5))) ||
((ue->frame_parms.frame_type == TDD) && ((subframe == 1) || (subframe == 6))))
{// FDD PSS/SSS, compute noise in DTX REs (Null REs)
ue->measurements.n0_power_tot = 0;//clear to avoid accuma
if (ue->frame_parms.Ncp==NORMAL)
{
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
{
if(ue->frame_parms.frame_type == FDD)
{
/*SFN:
* +ve spectrum
* rxF_sss points to OFDM symbol l=5*N, thus the +ve subcarrier starts from rxF_sss[0]:dc rxF_sss[1] ... rxF_sss[150]
* rxF_pss points to OFDM symbol l=6*N, thus the +ve subcarrier starts from rxF_pss[0]:dc rxF_pss[1] ... rxF_pss[150]
* */
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)];
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)];
}
else
{
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)];
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)];
}
/*SFN:
* * +ve spectrum
* k=0 (dc component)
* k=1,2,...,31 for sss/pss +ve portion
* k=32 33 34 35 36 are null REs --> int16_t index is (2k 2k+1)
* */
ue->measurements.n0_power[aarx] = (int32_t)(rxF_sss[66]*rxF_sss[66])+(int32_t)(rxF_sss[67]*rxF_sss[67]);//k=33 ->(66 67)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[68]*rxF_sss[68])+(int32_t)(rxF_sss[69]*rxF_sss[69]);//k=34 ->(68 69)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[70]*rxF_sss[70])+(int32_t)(rxF_sss[71]*rxF_sss[71]);//k=35 ->(70 71)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[66]*rxF_pss[66])+(int32_t)(rxF_pss[67]*rxF_pss[67]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[68]*rxF_pss[68])+(int32_t)(rxF_pss[69]*rxF_pss[69]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[70]*rxF_pss[70])+(int32_t)(rxF_pss[71]*rxF_pss[71]);
if(ue->frame_parms.frame_type == FDD)
{
/*SFN:
* * -ve spectrum
* rxF_sss points to OFDM symbol l=6*N. Thus, the -ve subcarrier of sss starts from rxF_sss[-1] ... rxF_sss[-150]
* rxF_sss points to OFDM symbol l=7*N. Thus, the -ve subcarrier of pss starts from rxF_pss[-1] ... rxF_pss[-150]
* */
rxF_sss = (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)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)];
}
else
{
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].rxdataF[aarx][(14*ue->frame_parms.ofdm_symbol_size)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(3*ue->frame_parms.ofdm_symbol_size)];
}
/*SFN:
* * +ve spectrum
* k=-1,-2,...,-31 for sss/pss -ve portion
* k=-32 -33 -34 -35 -36 are null REs --> int16_t index is (2k+1 2k)
* */
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[-70]*rxF_pss[-70])+(int32_t)(rxF_pss[-69]*rxF_pss[-69]);//k=-35 ->(-69 -70)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[-68]*rxF_pss[-68])+(int32_t)(rxF_pss[-67]*rxF_pss[-67]);//k=-34 ->(-67 -68)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_pss[-66]*rxF_pss[-66])+(int32_t)(rxF_pss[-65]*rxF_pss[-65]);//k=-33 ->(-65 -66)
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[-70]*rxF_sss[-70])+(int32_t)(rxF_sss[-69]*rxF_sss[-69]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[-68]*rxF_sss[-68])+(int32_t)(rxF_sss[-67]*rxF_sss[-67]);
ue->measurements.n0_power[aarx] += (int32_t)(rxF_sss[-66]*rxF_sss[-66])+(int32_t)(rxF_sss[-65]*rxF_sss[-65]);
//results: multiply by cos2pifct-->(0.5)*nb_antennas_rx*(Noise_floor)*N*df
ue->measurements.n0_power[aarx]=rx_power_correction*(ue->measurements.n0_power[aarx])/12;//12 is the number of REs
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]);//
ue->measurements.n0_power_tot += ue->measurements.n0_power[aarx];//total Noise power from nb_antennas_rx
}
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
/*SFN:
* * ue->measurements.n0_power_tot denotes the total Rx power from the Rx antenna
* ue->measurements.n0_power_tot= (1/2).*sum_nbRx(N_F*N_sc*df)./nbRx watt, where N_F is the noise floor W/Hz
* Hence, to compute the Noise floor at the Rx frontend, we should subtract USRP_Rx_Gain not ue->rx_total_gain_dB
* Since ue->rx_total_gain_dB=USRP_Rx_Gain+Gain_offest
* The gain offset can be obtained from URSP driver which is 49 dB
* The max gain of the AD936x is 76 dB for Rx chain and 89 dB for Tx chain.
* hese ranges will be printed out when you run 'uhd_usrp_probe' for any USRP
* */
ue->measurements.n0_power_tot/=ue->frame_parms.nb_antennas_rx;
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot);
/*SFN:
* we correct n0_power_tot_dBm, but still for the correct result we should subtract the fixed point gain
* Fixed_point_Gain=20log10(2^15)=(15)*6 dB=90 dB
* */
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - (ue->rx_total_gain_dB-gain_offset) - dB_fixed(ue->frame_parms.ofdm_symbol_size)+30;//
} else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
}
}
else if ((ue->frame_parms.frame_type == TDD) &&((subframe == 1) || (subframe == 6)))
{ // TDD PSS/SSS, compute noise in DTX REs // 2016-09-29 wilson fix incorrect noise power calculation
pss_symb = 2;
sss_symb = ue->frame_parms.symbols_per_tti-1;
if (ue->frame_parms.Ncp==NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
{
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(ue->current_thread_id[subframe])].rxdataF;
rxF_pss = (int16_t *) &rxdataF[aarx][((pss_symb*(ue->frame_parms.ofdm_symbol_size)))];
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].rxdataF;
rxF_sss = (int16_t *) &rxdataF[aarx][((sss_symb*(ue->frame_parms.ofdm_symbol_size)))];
//-ve spectrum from SSS
// printf("slot %d: SSS DTX: %d,%d, non-DTX %d,%d\n",slot,rxF_pss[-72],rxF_pss[-71],rxF_pss[-36],rxF_pss[-35]);
// ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71]));
// printf("sssn36 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65]));
//ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
//printf("sssm32 %d\n",ue->measurements.n0_power[aarx]);
//+ve spectrum from SSS
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65]));
//ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63]));
//printf("sssp32 %d\n",ue->measurements.n0_power[aarx]);
//+ve spectrum from PSS n0_power
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+70]*rxF_pss[2+70])+((int32_t)rxF_pss[2+69]*rxF_pss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+68]*rxF_pss[2+68])+((int32_t)rxF_pss[2+67]*rxF_pss[2+67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+66]*rxF_pss[2+66])+((int32_t)rxF_pss[2+65]*rxF_pss[2+65]));
//ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63]));
//printf("pss32 %d\n",ue->measurements.n0_power[aarx]); //-ve spectrum from PSS
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)];
//ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71]));
//printf("pssm36 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65]));
//ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
//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_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(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);
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
}
}
}
}
// recompute nushift with eNB_offset corresponding to adjacent eNB on which to perform channel estimation
// printf("[PHY][UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, Nid2 %d, nushift %d, eNB_offset %d)\n",ue->Mod_id,ue->frame,slot,Nid_cell,Nid2,nushift,eNB_offset);
if (eNB_offset > 0)
Nid_cell = ue->measurements.adj_cell_id[eNB_offset-1];
Nid_cell = ue->measurements.adj_cell_id[eNB_offset-1];
nushift = Nid_cell%6;
ue->measurements.rsrp[eNB_offset] = 0;
///////////////////////we are here
if (abstraction_flag == 0) {
// compute RSRP using symbols 0 and 4-frame_parms->Ncp
for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3) {
if (abstraction_flag == 0)
{
/*SFN: compute RSRP using symbols 0 and 4-frame_parms->Ncp
* RSRP: Reference Signal Rx power (dBm/RE)
* we use Rx RS from symbol l=0 and l=4
* After Normalized FFT, the Rx signal on Reference SC is X_k=A_rx.*sqrt(N), where k=0,6df, .....
* The power on each RE is |X_k|^2/N
* Still to get RSRP we should subtract USRP_Gain=(ue->rx_total_gain_dB-49)
* */
for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3)
{
k = (nu + nushift)%6;
#ifdef DEBUG_MEAS_RRC
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)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift,
eNB_offset,k,l);
#endif
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)];
off = (ue->frame_parms.first_carrier_offset+k)<<1;
if (l==(4-ue->frame_parms.Ncp)) { // compute RSRP using symbols 4-frame_parms->Ncp
for (rb=0; rb<ue->frame_parms.N_RB_DL; rb++) {
if (l==(4-ue->frame_parms.Ncp))
{ // compute RSRP using symbols 4-frame_parms->Ncp
for (rb=0; rb<ue->frame_parms.N_RB_DL; rb++)
{
//starts RB0 two pilots at off and off+12
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));//pilot symbol at reference signal +ve
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));//pilot symbol at reference signal -ve
off+=12;//2 pilot per RB (2*6=12)
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));//pilot symbol at reference signal +ve
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));//pilot symbol at reference signal -ve
off+=12;//2 pilot per RB (2*6=12)
if (off>=(ue->frame_parms.ofdm_symbol_size<<1))
{
off = (1+k)<<1;//start second half of the spectrum
off = (1+k)<<1;//start the +ve spectrum RS
}
//off+=12;//one pilot per RB
//check for +ve freq portion
//if (off>=(ue->frame_parms.ofdm_symbol_size<<1))
//{
// off = (1+k)<<1;
// ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
// printf("rb %d, off %d : %d\n",rb,off,(((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])));
/*
if ((ue->frame_rx&0x3ff) == 0)
printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])));
*/
//off+=12;
//}
//else//we start with -ve spectrum starts from off to
//{
// ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));//pilot symbol at reference signal +ve
// off+=12;//2 pilot per RB (2*6=12)
//}
}
/*
if ((eNB_offset==0)&&(l==0)) {
for (i=0;i<6;i++,off2+=4)
ue->measurements.rssi += ((rxF[off2]*rxF[off2])+(rxF[off2+1]*rxF[off2+1]));
if (off2==(ue->frame_parms.ofdm_symbol_size<<2))
off2=4;
for (i=0;i<6;i++,off2+=4)
ue->measurements.rssi += ((rxF[off2]*rxF[off2])+(rxF[off2+1]*rxF[off2+1]));
}
*/
// printf("slot %d, rb %d => rsrp %d, rssi %d\n",slot,rb,ue->measurements.rsrp[eNB_offset],ue->measurements.rssi);
}
}
}
// 2 RE per PRB l=4 only
//I am here
// ue->measurements.rsrp[eNB_offset]/=(ue->frame_parms.N_RB_DL);
ue->measurements.rsrp[eNB_offset]/=(2*ue->frame_parms.N_RB_DL*ue->frame_parms.ofdm_symbol_size);//we read
// LOG_I(PHY,"eNB: %d, RSRP: %d \n",eNB_offset,ue->measurements.rsrp[eNB_offset]);
/*SFN:
* Since 2 RE per PRB, the Number of RS per l=4 can be given as 2*N_RB_DL
* */
ue->measurements.rsrp[eNB_offset]/=(ue->frame_parms.nb_antennas_rx*(2*ue->frame_parms.N_RB_DL)*ue->frame_parms.ofdm_symbol_size);//we read
ue->measurements.rsrp[eNB_offset]*=rx_power_correction;
if (eNB_offset == 0) {
// ue->measurements.rssi/=(24*ue->frame_parms.N_RB_DL);
// ue->measurements.rssi*=rx_power_correction;
// ue->measurements.rssi=ue->measurements.rsrp[0]*24/2;
ue->measurements.rssi=ue->measurements.rsrp[0]*(12*ue->frame_parms.N_RB_DL);//watt
}
......@@ -421,20 +403,14 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
ue->measurements.rsrq[eNB_offset] = 100*ue->measurements.rsrp[eNB_offset]*ue->frame_parms.N_RB_DL/ue->measurements.rssi;
else
ue->measurements.rsrq[eNB_offset] = -12000;
//((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
ue->measurements.rssi = ue->measurements.rx_power_avg[0];
// dummay value for the moment
ue->measurements.rsrp[eNB_offset] = -93 ;
ue->measurements.rsrq[eNB_offset] = 3;
}
#ifdef DEBUG_MEAS_RRC
// if (slot == 0) {
if (eNB_offset == 0)
LOG_I(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",ue->Mod_id,
ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
......@@ -449,17 +425,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
10*log10(ue->measurements.rsrp[eNB_offset])-ue->rx_total_gain_dB,
ue->measurements.rsrp[eNB_offset],
(10*log10(ue->measurements.rsrq[eNB_offset])));
//LOG_D(PHY,"RSRP_total_dB: %3.2f \n",(dB_fixed_times10(ue->measurements.rsrp[eNB_offset])/10.0)-ue->rx_total_gain_dB-dB_fixed(ue->frame_parms.N_RB_DL*12));
//LOG_D(PHY,"RSRP_dB: %3.2f \n",(dB_fixed_times10(ue->measurements.rsrp[eNB_offset])/10.0));
//LOG_D(PHY,"gain_loss_dB: %d \n",ue->rx_total_gain_dB);
//LOG_D(PHY,"gain_fixed_dB: %d \n",dB_fixed(ue->frame_parms.N_RB_DL*12));
// }
#endif
}
}
}
void lte_ue_measurements(PHY_VARS_UE *ue,
......@@ -471,8 +438,8 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
{
int aarx,aatx,eNB_id=0; //,gain_offset=0;
//int rx_power[NUMBER_OF_CONNECTED_eNB_MAX];
int aarx,aatx,eNB_id=0;
int gain_offset=49;
int i;
unsigned int limit,subband;
#if defined(__x86_64__) || defined(__i386__)
......@@ -486,23 +453,12 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
int nb_subbands,subband_size,last_subband_size;
int N_RB_DL = frame_parms->N_RB_DL;
#ifdef FHG_TM4_LOG
static int rx_spatial_power_UE_I=0;
static int rx_ri_UE_I=0;
#endif
#ifdef FHG_TM4_LOG_CQI
static int rx_cqi_UE_I=0;
#endif
int rank_tm3_tm4=0;
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
int rank_tm3_tm4=0;
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
switch (N_RB_DL) {
case 6:
switch (N_RB_DL)
{
case 6:
nb_subbands = 6;
subband_size = 12;
last_subband_size = 0;
......@@ -528,17 +484,43 @@ int rank_tm3_tm4=0;
break;
}
// signal measurements
for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) {
/*SFN:
* Channel Index [(aatx<<1) + aarx]
*
* Tx0 --------H[0]------> Rx0
* H[2]
*
* H[1]
* Tx1 --------H[3]------> Rx1
*
* */
/*SFN:
* Rx Power Calc from (aatx, aaRx) MIMO Channel:
* ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]=E{|H_k[(aatx<<1) + aarx]|^2}, aatx=0, 1 and aarx=0, 1
* =E{A_k^2[(aatx<<1) + aarx]}.*N
*Hence, we obtain
*ue->measurements.rx_power[eNB_id][0]= E{|H[0]|^2} + E{|H[2]|^2}, at Rx0
*ue->measurements.rx_power[eNB_id][1]= E{|H[3]|^2} + E{|H[1]|^2}, at Rx1
*
*Total Rx power:
*ue->measurements.rx_power_tot[eNB_id]= ue->measurements.rx_power[eNB_id][0]+ue->measurements.rx_power[eNB_id][1]
*/
for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++)
{
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
{
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++)
{
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] =
(signal_energy_nodc(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0],
(N_RB_DL*12)));//signal power is NE{|A_k|^2}--> should divide by 2^15 back to fixed point due to mult
if (ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]<0)
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = 0; //ue->measurements.n0_power[aarx];
(signal_energy_nodc(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0],
(N_RB_DL*12)));
if (ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]<0)
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = 0;
ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]);
ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]);
if (aatx==0)
ue->measurements.rx_power[eNB_id][aarx] = ue->measurements.rx_spatial_power[eNB_id][aatx][aarx];
......@@ -554,69 +536,60 @@ int rank_tm3_tm4=0;
ue->measurements.rx_power_tot[eNB_id] += ue->measurements.rx_power[eNB_id][aarx];
} //aarx
//SFN: Correction Rx should be divided by frame_parms->nb_antenna_ports_eNB
ue->measurements.rx_power_tot[eNB_id] /= frame_parms->nb_antenna_ports_eNB;
ue->measurements.rx_power_tot_dB[eNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[eNB_id]);
} //eNB_id
eNB_id=0;
//sfn: I shall enable rank estimation first
//Then, I can read the rank value.
//hardcoded
//if (ue->transmission_mode[0]==4 || ue->transmission_mode[0]==3){
//if (rank_adaptation == 1)
/*SFN:
* Rank Estimation:
* We shall control the function according to ue->transmission_mode[eNB_id]
* where ue->transmission_mode[eNB_id]=3 or 4 for TM3/TM4
*
* */
#ifdef FHG_TM4
rank_tm3_tm4 = rank_estimation_tm3_tm4(&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][0][4],
&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][2][4],//2
&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][1][4],//1
&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][3][4],//3
N_RB_DL);
#endif
//sfn:
//else
// rank_tm3_tm4=1;
//#ifdef DEBUG_RANK_EST
// printf("rank tm3 or tm4 %d\n", rank_tm3_tm4);
//#endif
// }
// if (ue->transmission_mode[eNB_id]!=4 && ue->transmission_mode[eNB_id]!=3)
// ue->measurements.rank[eNB_id] = 0;
// else
#ifdef FHG_TM4_LOG
rx_ri_UE_I++;
if (rx_ri_UE_I>6000)
{
rx_ri_UE_I=0;
LOG_I(PHY,"[UE][UCI--->PUSCH] meas->rank %d\n",rank_tm3_tm4);
}
#endif
ue->measurements.rank[eNB_id] = rank_tm3_tm4;
// printf ("tx mode %d\n", ue->transmission_mode[eNB_id]);
// printf ("rank %d\n", ue->PHY_measurements.rank[eNB_id]);
// filter to remove jitter
if (ue->init_averaging == 0) {
ue->measurements.rank[eNB_id] = rank_tm3_tm4;
/*SFN:
* IIR low pass average filter:
*
* y[n]=(k1/2^10)*y[n-1] + (k2/2^10)*x[n]
*
* IIR=Y[z]/X[z]= az/(z-b),
* where b = k1/2^10 and a = k2/2^10 --> (k1=1000, k2=24)
* b = 32,000/2^15=(0.9765*2^15)/2^15
* a = 768/2^15
* Zero: z=0
* Pole: z=0.9765
*
* Fixed Point Units:
* x[n] is given by (2^15)(2^15*q[n])
* y[n] can also be expressed as (2^15)(2^15*r[n])
* */
// Rx Power Computation
if (ue->init_averaging == 0)
{
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++)
ue->measurements.rx_power_avg[eNB_id] = (int)
(((k1*((long long int)(ue->measurements.rx_power_avg[eNB_id]))) +
(k2*((long long int)(ue->measurements.rx_power_tot[eNB_id]))))>>10);
//LOG_I(PHY,"Noise Power Computation: k1 %d k2 %d n0 avg %d n0 tot %d\n", k1, k2, ue->measurements.n0_power_avg,
// ue->measurements.n0_power_tot);
// Noise Power Computation
ue->measurements.n0_power_avg = (int)
(((k1*((long long int) (ue->measurements.n0_power_avg))) +
(k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
} else {
}
else {
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++)
ue->measurements.rx_power_avg[eNB_id] = ue->measurements.rx_power_tot[eNB_id];
......@@ -624,52 +597,45 @@ int rank_tm3_tm4=0;
ue->init_averaging = 0;
}
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
ue->measurements.rx_power_avg_dB[eNB_id] = dB_fixed(ue->measurements.rx_power_avg[eNB_id])-45 -3;//we subtract correction factor since channel estimation add 3 dB to signal power
ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot)-3-3;//we subtract correction factor since channel estimation add 3 dB to signal power. Furthermore, we subtract 3 dB since rx power is collected from 2 antennas
ue->measurements.wideband_cqi_avg[eNB_id] =dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg)-3-3;
ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id]-ue->rx_total_gain_dB+30-2;//-2.3: correction factor 10log10(300/512)
ue->measurements.rx_power_avg_dB[eNB_id] = dB_fixed(ue->measurements.rx_power_avg[eNB_id]);// -90
ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot);
ue->measurements.wideband_cqi_avg[eNB_id] =dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg);
//SFN:-2.3 dB : correction factor 10log10(300/512)
ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id]-(ue->rx_total_gain_dB-gain_offset)+30 -2;// dB_fixed(ue->frame_parms.ofdm_symbol_size) + dB_fixed(12*frame_parms->N_RB_DL);
#ifdef DEBUG_MEAS_UE
LOG_I(PHY,"Subframe %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
LOG_I(PHY,"Subframe %d, RSSI %d dBm, %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
subframe,
ue->measurements.rx_rssi_dBm[eNB_id],
ue->measurements.rx_power_avg_dB[eNB_id],
ue->measurements.rx_rssi_dBm[eNB_id]-90,
ue->measurements.wideband_cqi_avg[eNB_id],
ue->measurements.rx_power_avg[eNB_id],
ue->measurements.n0_power_tot);
#endif
#ifdef FHG_TM4_LOG_CQI
rx_cqi_UE_I++;
if (rx_cqi_UE_I>6000)
{
rx_cqi_UE_I=0;
LOG_I(PHY,"rx1_p %d, rx2_p %d, rxtot_p %d rxtot_p %d dB\n",
ue->measurements.rx_power[eNB_id][0],
ue->measurements.rx_power[eNB_id][1],
ue->measurements.rx_power_tot[eNB_id],
ue->measurements.rx_power_tot_dB[eNB_id]);
LOG_I(PHY,"rx_p_avg %d, n0PwrAvg %d, rx_p_tot %d n0Pwrtot %d\n",
ue->measurements.rx_power_avg[eNB_id],
ue->measurements.n0_power_avg,
ue->measurements.rx_power_tot[eNB_id],
ue->measurements.n0_power_tot);
LOG_I(PHY,"rx_p_avg/n0Pwravg %d dB, rx_p_tot/n0Pwrtot %d dB\n",
ue->measurements.wideband_cqi_avg[eNB_id],
ue->measurements.wideband_cqi_tot[eNB_id]
);
LOG_I(PHY,"RSSI (digital) %d dB RSSI %d dBm\n",
ue->measurements.rx_power_avg_dB[eNB_id],
ue->measurements.rx_rssi_dBm[eNB_id]
);
}
#endif
}
ue->measurements.n0_power_avg_dB = dB_fixed( ue->measurements.n0_power_avg);
/*SFN:
* For CQI reporting
* Tx0 --------H[0]------> Rx0
* H[2]
*
* H[1]
* Tx1 --------H[3]------> Rx1
*
* ue->measurements.subband_cqi[eNB_id][0][subband] = E{|H[0]|^2} + E{|H2]|^2}
*
* ue->measurements.subband_cqi[eNB_id][1][subband] = E{|H[3]|^2} + E{|H1]|^2}
*
* ue->measurements.subband_cqi_tot[eNB_id][subband] = ue->measurements.subband_cqi[eNB_id][0][subband]
* + ue->measurements.subband_cqi[eNB_id][1][subband]
* */
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
if (frame_parms->mode1_flag==0) {
// cqi/pmi information
......@@ -684,23 +650,32 @@ int rank_tm3_tm4=0;
if (aarx==0)
ue->measurements.subband_cqi_tot[eNB_id][subband]=0;
if ((subband<(nb_subbands-1))||(N_RB_DL==6)) {
if ((subband<(nb_subbands-1))||(N_RB_DL==6))
{
ue->measurements.subband_cqi[eNB_id][aarx][subband] =
(signal_energy_nodc(dl_ch0,subband_size) + signal_energy_nodc(dl_ch1,subband_size))>>1;//divide by to correct sqrt(2)
(signal_energy_nodc(dl_ch0,subband_size) + signal_energy_nodc(dl_ch1,subband_size));
if ( ue->measurements.subband_cqi[eNB_id][aarx][subband] < 0)
ue->measurements.subband_cqi[eNB_id][aarx][subband]=0;
ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband];
if (aarx==(frame_parms->nb_antennas_rx-1))
ue->measurements.subband_cqi_tot[eNB_id][subband] /=frame_parms->nb_antennas_rx;
ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband],
ue->measurements.n0_power[aarx]);
} else { // this is for the last subband which is smaller in size
}
else
{ // this is for the last subband which is smaller in size
ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,last_subband_size) +
signal_energy_nodc(dl_ch1,last_subband_size))>>1;
signal_energy_nodc(dl_ch1,last_subband_size));
if ( ue->measurements.subband_cqi[eNB_id][aarx][subband] < 0)
ue->measurements.subband_cqi[eNB_id][aarx][subband]=0;
ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband];
if (aarx==(frame_parms->nb_antennas_rx-1))
ue->measurements.subband_cqi_tot[eNB_id][subband] /=frame_parms->nb_antennas_rx;
ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband],
ue->measurements.n0_power[aarx]);
}
......@@ -708,15 +683,17 @@ int rank_tm3_tm4=0;
dl_ch1+=subband_size;
dl_ch0+=subband_size;
// msg("subband_cqi[%d][%d][%d] => %d (%d dB)\n",eNB_id,aarx,subband,ue->measurements.subband_cqi[eNB_id][aarx][subband],ue->measurements.subband_cqi_dB[eNB_id][aarx][subband]);
}
}//subband
}//aarx
}
for (subband=0; subband<nb_subbands; subband++) {
ue->measurements.subband_cqi_tot_dB[eNB_id][subband] = dB_fixed2(ue->measurements.subband_cqi_tot[eNB_id][subband],ue->measurements.n0_power_tot);
// msg("subband_cqi_tot[%d][%d] => %d dB (n0 %d)\n",eNB_id,subband,ue->measurements.subband_cqi_tot_dB[eNB_id][subband],ue->measurements.n0_power_tot);
}
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
//printf("aarx=%d", aarx);
// skip the first 4 RE due to interpolation filter length of 5 (not possible to skip 5 due to 128i alignment, must be multiple of 128bit)
......@@ -779,11 +756,11 @@ int rank_tm3_tm4=0;
// print_ints("mm_madd_epi16",&mmtmpPMI1);
// mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit)
//sfn avoid overflow due to summing up
//sfn: mmtmpPMI0=_mm_srai_epi32(mmtmpPMI0, 15);//fixed point handling
mmtmpPMI0=_mm_srai_epi32(mmtmpPMI0, 15);//fixed point handling
pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0);
// print_ints(" pmi128_re 0",&pmi128_re);
//sfn avoid overflow due to summing up
//sfn: mmtmpPMI1=_mm_srai_epi32(mmtmpPMI1, 15);//fixed point handling
mmtmpPMI1=_mm_srai_epi32(mmtmpPMI1, 15);//fixed point handling
pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1);
// print_ints(" pmi128_im 0 ",&pmi128_im);
......@@ -831,8 +808,14 @@ int rank_tm3_tm4=0;
ue->measurements.wideband_pmi_re[eNB_id][aarx]=ue->measurements.wideband_pmi_re[eNB_id][aarx]/((int )nb_subbands);
ue->measurements.wideband_pmi_im[eNB_id][aarx]=ue->measurements.wideband_pmi_im[eNB_id][aarx]/((int )nb_subbands);
} // rx antenna loop
/*pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,25));//should be 25
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7));*/
} // if frame_parms->mode1_flag == 0
else {
else //SFN: we need still to fix here for SISO
{
// cqi information only for mode 1
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
dl_ch0 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4];
......
......@@ -6792,7 +6792,7 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
int i, aarx;
uint16_t pmiq=0;
uint32_t pmivect = 0;
uint8_t rank = meas->rank[eNB_id];
uint8_t rank = meas->rank[eNB_id];//sfn: rank is 1
int pmi_re,pmi_im;
int nb_subbands=0;
......@@ -6828,13 +6828,13 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
// pmi_im = meas->subband_pmi_im[eNB_id][i][meas->selected_rx_antennas[eNB_id][i]];
// printf("pmi => (%d,%d)\n",pmi_re,pmi_im);
if ((pmi_re > pmi_im) && (pmi_re > -pmi_im))
if ((pmi_re > pmi_im) && (pmi_re > -pmi_im))//angle -45 to 45
pmiq = PMI_2A_11;
else if ((pmi_re < pmi_im) && (pmi_re > -pmi_im))
else if ((pmi_re < pmi_im) && (pmi_re > -pmi_im))//angle 45 to 135
pmiq = PMI_2A_1j;
else if ((pmi_re < pmi_im) && (pmi_re < -pmi_im))
else if ((pmi_re < pmi_im) && (pmi_re < -pmi_im))//angle 135 to 225
pmiq = PMI_2A_1m1;
else if ((pmi_re > pmi_im) && (pmi_re < -pmi_im))
else if ((pmi_re > pmi_im) && (pmi_re < -pmi_im))//angle 225 to 315
pmiq = PMI_2A_1mj;
// printf("subband %d, pmi%d \n",i,pmiq);
......@@ -6898,9 +6898,16 @@ uint16_t quantize_subband_pmi2(PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_i
pmiq = PMI_2A_1mj;
pmivect |= (pmiq<<(2*i));
} else {
// This needs to be done properly!!!
pmivect = 0;
} else if (rank==1)
{
pmi_re = meas->subband_pmi_re[eNB_id][i][a_id];
pmi_im = meas->subband_pmi_im[eNB_id][i][a_id];
if (pmi_re >= pmi_im)
pmiq = PMI_2A_R1_11;
else
pmiq = PMI_2A_R1_1j;
pmivect |= ((pmiq-1)<<(i)); //shift 1 since only one bit
}
}
......@@ -7138,13 +7145,13 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
switch (uci_format) {
case wideband_cqi_rank1_2A:
((wideband_cqi_rank1_2A_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode);
((wideband_cqi_rank1_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,7);
((wideband_cqi_rank1_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,25);
break;
case wideband_cqi_rank2_2A:
((wideband_cqi_rank2_2A_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi
((wideband_cqi_rank2_2A_5MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi
((wideband_cqi_rank2_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,7);
((wideband_cqi_rank2_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,25);
break;
case HLC_subband_cqi_nopmi:
......
......@@ -37,6 +37,8 @@
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/defs.h"
//SFN
#include "sudas_tm4.h"
#ifndef USER_MODE
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
......@@ -1431,6 +1433,9 @@ void rx_phich(PHY_VARS_UE *ue,
ulsch->O_RI = 0;
ulsch->O = 0;
ulsch->uci_format = HLC_subband_cqi_nopmi;
//sfn
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"last ret: format HLC_subband_cqi_nopmi\n");
// fflush(debug_sudas_LOG_PHY);
// disable phich decoding since it is the last retransmission
ulsch->harq_processes[harq_pid]->status = IDLE;
......@@ -1443,6 +1448,10 @@ void rx_phich(PHY_VARS_UE *ue,
}
else
{
//sfn
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"ret: format HLC_subband_cqi_nopmi\n");
// fflush(debug_sudas_LOG_PHY);
// ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3];
ulsch->O_RI = 0;
......@@ -1610,6 +1619,10 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
ulsch[UE_id]->harq_processes[harq_pid]->Or1 = 0;
ulsch[UE_id]->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
//sfn
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"ACK : format HLC_subband_cqi_nopmi\n");
// fflush(debug_sudas_LOG_PHY);
} else {
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d PHICH ACK (no format0 DCI) Clearing subframe_scheduling_flag, setting round to 0\n",
eNB->Mod_id,harq_pid,proc->frame_tx,subframe);
......
......@@ -61,32 +61,28 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
return 0;
if ((mode == normal_txrx) || (mode == no_L2_connect)) {
len += sprintf(&buffer[len], "/////////////////////****************Rx Measurements/Pilots****************////////////////////\n");
len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x UE Rx Gain in dB %d\n",ue->Mod_id, ue->pdcch_vars[0][0]->crnti,ue->rx_total_gain_dB);
len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, NoisePower/RE %f dBm (Measured Noise Figure %.1f dB)\n",
10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB+30-10*log10(1<<15),
10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB+30-10*log10(1<<15),
10*log10(ue->measurements.rsrq[0])-10*log10(1<<15),
(double)ue->measurements.n0_power_tot_dBm+30-10*log10(1<<15),
(double)ue->measurements.n0_power_tot_dBm+30-10*log10(1<<15)-(-174+10*log10(15000)));//(-174+10*log10(15000))=132.24 dBm
/*/*- ue->rx_total_gain_dB+30-10*dB_fixed(1<<15)*/
len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE/Rx_Antenna, RSSI %.2f dBm/Rx_Antenna, RSRQ[0] %.2f dB, NoisePower/RE %f dBm (Measured Noise Figure %.1f dB)\n",
10*log10(ue->measurements.rsrp[0])-(ue->rx_total_gain_dB-49)+30-90,
10*log10(ue->measurements.rssi)-(ue->rx_total_gain_dB-49)+30-90,
(double)10*log10((double)ue->measurements.rsrq[0]/100),
(double)ue->measurements.n0_power_tot_dBm-90,
(double)ue->measurements.n0_power_tot_dBm-90-(-174+10*log10(15000)));//(-174+10*log10(15000))=132.24 dBm
len += sprintf(&buffer[len], "/////////////////////**********Rx Measurements/Channel estimation*********////////////////////\n");
//we are here now
len += sprintf(&buffer[len],
"[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n",
"[UE PROC] Frame count: %d\n eNB0 RSSI %d dBm (W Rx Gain %d dB, %d dB)\n N0 %d dBm/RE, %f dBm (%d PRB) (W Rx Gain %d dB, %d dB)\n",
proc->frame_rx,
ue->measurements.rx_rssi_dBm[0],
ue->measurements.rx_power_dB[0][0],
ue->measurements.rx_power_dB[0][1],
ue->measurements.rx_rssi_dBm[1],
ue->measurements.rx_power_dB[1][0],
ue->measurements.rx_power_dB[1][1],
ue->measurements.rx_rssi_dBm[2],
ue->measurements.rx_power_dB[2][0],
ue->measurements.rx_power_dB[2][1],
ue->measurements.n0_power_tot_dBm,
ue->measurements.n0_power_tot_dBm+10*log10(12*ue->frame_parms.N_RB_DL),
ue->measurements.rx_rssi_dBm[0]-90,
ue->measurements.rx_power_dB[0][0]-90,
ue->measurements.rx_power_dB[0][1]-90,
ue->measurements.n0_power_tot_dBm-90,
ue->measurements.n0_power_tot_dBm+10*log10(12*ue->frame_parms.N_RB_DL)-90,
ue->frame_parms.N_RB_DL,
ue->measurements.n0_power_dB[0],
ue->measurements.n0_power_dB[1]);
ue->measurements.n0_power_dB[0]-90,
ue->measurements.n0_power_dB[1]-90);
#ifdef EXMIMO
......@@ -115,15 +111,15 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
}
//for (eNB=0;eNB<NUMBER_OF_eNB_MAX;eNB++) {
for (eNB=0; eNB<1; eNB++) {
len += sprintf(&buffer[len], "/////////////////////****RX spatial power****////////////////////\n");
len += sprintf(&buffer[len], "[UE PROC] MIMO Channel FRank Indicator :) %d \n",ue->measurements.rank[eNB]);
len += sprintf(&buffer[len], "/////////////////////**********RX spatial power**********////////////////////\n");
len += sprintf(&buffer[len], "[UE PROC] MIMO Channel Rank Indicator :) %d \n",ue->measurements.rank[eNB]);
len += sprintf(&buffer[len], "[UE PROC] RX spatial power eNB%d at Rx N_Power=%.2f dBm/Re : P11=%.2f dBm/RE, P21=%.2f dBm/RE, P12=%.2f dBm/RE, and P22=%.2f dBm/RE\n",
eNB,
(double)ue->measurements.n0_power_tot_dBm-20*log10(1<<15)+30+ue->rx_total_gain_dB,
(double)ue->measurements.rx_spatial_power_dB[eNB][0][0]-20*log10(1<<15)-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][0][1]-20*log10(1<<15)-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][1][0]-20*log10(1<<15)-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][1][1]-20*log10(1<<15)-10*log10(512)+30);
(double)ue->measurements.n0_power_tot_dBm+(ue->rx_total_gain_dB-49)-90,
(double)ue->measurements.rx_spatial_power_dB[eNB][0][0]-90-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][0][1]-90-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][1][0]-90-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][1][1]-90-10*log10(512)+30);
len += sprintf(&buffer[len], "[UE PROC] RX spatial power eNB: \n"
" Tx1 ----- P11=%.2f dBm/RE -----> Rx1\n"
......@@ -135,11 +131,13 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
(double)ue->measurements.rx_spatial_power_dB[eNB][1][0]-20*log10(1<<15)-10*log10(512)+30,
(double)ue->measurements.rx_spatial_power_dB[eNB][1][1]-20*log10(1<<15)-10*log10(512)+30);
len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,ue->measurements.rx_power_tot_dB[eNB],ue->measurements.rx_power_avg_dB[eNB]);
len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,ue->measurements.rx_power_tot_dB[eNB]-90,ue->measurements.rx_power_avg_dB[eNB]-90);
len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",ue->measurements.rx_power_tot[eNB],
ue->measurements.rx_power_avg[eNB], ue->measurements.n0_power_tot, ue->measurements.n0_power_avg);
len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",ue->sinr_eff);
len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,ue->measurements.wideband_cqi_tot[eNB],ue->measurements.wideband_cqi_avg[eNB]);
len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",ue->sinr_eff);// SFN: we need to check where is it calc!
len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: tot: %d dB, avg: %d dB\n",eNB,ue->measurements.wideband_cqi_tot[eNB],ue->measurements.wideband_cqi_avg[eNB]);
switch (ue->frame_parms.N_RB_DL) {
case 6:
......@@ -207,11 +205,22 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,6)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,6)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,6)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,6)));
break;
case 25:
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d subband_cqi_tot_dB %d %d %d %d %d %d %d dB\n",
eNB,
ue->measurements.subband_cqi_tot_dB[eNB][0],
ue->measurements.subband_cqi_tot_dB[eNB][1],
ue->measurements.subband_cqi_tot_dB[eNB][2],
ue->measurements.subband_cqi_tot_dB[eNB][3],
ue->measurements.subband_cqi_tot_dB[eNB][4],
ue->measurements.subband_cqi_tot_dB[eNB][5],
ue->measurements.subband_cqi_tot_dB[eNB][6]);
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][0][0],
......@@ -232,23 +241,23 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
ue->measurements.subband_cqi_dB[eNB][1][5],
ue->measurements.subband_cqi_dB[eNB][1][6]);
//we are here sfn
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f)]\n",
eNB,
(double)ue->measurements.subband_pmi_re[eNB][0][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][0][0]/32768,
(double)ue->measurements.subband_pmi_re[eNB][1][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][1][0]/32768,
(double)ue->measurements.subband_pmi_re[eNB][2][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][2][0]/32768,
(double)ue->measurements.subband_pmi_re[eNB][3][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][3][0]/32768,
(double)ue->measurements.subband_pmi_re[eNB][4][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][4][0]/32768,
(double)ue->measurements.subband_pmi_re[eNB][5][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][5][0]/32768,
(double)ue->measurements.subband_pmi_re[eNB][6][0]/32768,
(double)ue->measurements.subband_pmi_im[eNB][6][0]/32768);
(double)ue->measurements.subband_pmi_re[eNB][0][0],
(double)ue->measurements.subband_pmi_im[eNB][0][0],
(double)ue->measurements.subband_pmi_re[eNB][1][0],
(double)ue->measurements.subband_pmi_im[eNB][1][0],
(double)ue->measurements.subband_pmi_re[eNB][2][0],
(double)ue->measurements.subband_pmi_im[eNB][2][0],
(double)ue->measurements.subband_pmi_re[eNB][3][0],
(double)ue->measurements.subband_pmi_im[eNB][3][0],
(double)ue->measurements.subband_pmi_re[eNB][4][0],
(double)ue->measurements.subband_pmi_im[eNB][4][0],
(double)ue->measurements.subband_pmi_re[eNB][5][0],
(double)ue->measurements.subband_pmi_im[eNB][5][0],
(double)ue->measurements.subband_pmi_re[eNB][6][0],
(double)ue->measurements.subband_pmi_im[eNB][6][0]);
len += sprintf(&buffer[len], "[UE PROC] Phase diff PMI eNB%d (Rx Ant 0): [(%.2f) (%.2f) (%.2f) (%.2f) (%.2f) (%.2f)]\n",
eNB,
atan((double)ue->measurements.subband_pmi_im[eNB][0][0]/ue->measurements.subband_pmi_re[eNB][0][0]),
......@@ -261,20 +270,20 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f) (%f +j%f)]\n",
eNB,
(double)ue->measurements.subband_pmi_re[eNB][0][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][0][1]/32768,
(double)ue->measurements.subband_pmi_re[eNB][1][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][1][1]/32768,
(double)ue->measurements.subband_pmi_re[eNB][2][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][2][1]/32768,
(double)ue->measurements.subband_pmi_re[eNB][3][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][3][1]/32768,
(double)ue->measurements.subband_pmi_re[eNB][4][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][4][1]/32768,
(double)ue->measurements.subband_pmi_re[eNB][5][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][5][1]/32768,
(double)ue->measurements.subband_pmi_re[eNB][6][1]/32768,
(double)ue->measurements.subband_pmi_im[eNB][6][1]/32768);
(double)ue->measurements.subband_pmi_re[eNB][0][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][0][1],///32768,
(double)ue->measurements.subband_pmi_re[eNB][1][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][1][1],///32768,
(double)ue->measurements.subband_pmi_re[eNB][2][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][2][1],///32768,
(double)ue->measurements.subband_pmi_re[eNB][3][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][3][1],///32768,
(double)ue->measurements.subband_pmi_re[eNB][4][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][4][1],///32768,
(double)ue->measurements.subband_pmi_re[eNB][5][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][5][1],///32768,
(double)ue->measurements.subband_pmi_re[eNB][6][1],///32768,
(double)ue->measurements.subband_pmi_im[eNB][6][1]);///32768);
len += sprintf(&buffer[len], "[UE PROC] Phase diff PMI eNB%d (Rx Ant 1): [(%.2f) (%.2f) (%.2f) (%.2f) (%.2f) (%.2f)]\n",
eNB,
......@@ -296,10 +305,10 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
ue->measurements.selected_rx_antennas[eNB][5],
ue->measurements.selected_rx_antennas[eNB][6]);
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,7)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,ue->measurements.rank[eNB] ? pmi2hex_2Ar2(quantize_subband_pmi(&ue->measurements,eNB,25)):pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,25)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7)));
ue->measurements.rank[eNB] ? pmi2hex_2Ar2(quantize_subband_pmi2(&ue->measurements,eNB,0,7)):pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)),
ue->measurements.rank[eNB] ? pmi2hex_2Ar2(quantize_subband_pmi2(&ue->measurements,eNB,1,7)):pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7)));
break;
case 50:
......@@ -562,7 +571,7 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
}
} else {
} else {//we need to correct here for this mode sfn:
len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n",
proc->frame_rx,
10*log10(ue->measurements.rssi),
......
......@@ -36,6 +36,8 @@
#include "LAYER2/MAC/defs.h"
#include "SCHED/defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//SFN
#include "sudas_tm4.h"
#include "assertions.h"
......@@ -269,16 +271,28 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue,
ulsch->O_RI = 1;
if (meas->rank[eNB_id] == 1) {
//SFN
// sudas_LOG_PHY(debug_sudas_LOG_PHY,"Rank 2, format wideband_cqi_rank2_2A\n");
// fflush(debug_sudas_LOG_PHY);
ulsch->uci_format = wideband_cqi_rank2_2A;
ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->o_RI[0] = 1;
} else {
//SFN
// sudas_LOG_PHY(debug_sudas_LOG_PHY,"Rank 1, format wideband_cqi_rank1_2A\n");
// fflush(debug_sudas_LOG_PHY);
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->o_RI[0] = 0;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
//sfn
// sudas_LOG_PHY(debug_sudas_LOG_PHY,"default, format HLC_subband_cqi_nopmi\n");
// fflush(debug_sudas_LOG_PHY);
fill_CQI(ulsch,meas,eNB_id,0,ue->frame_parms.N_RB_DL,0, transmission_mode,ue->sinr_eff);
if (((proc->frame_tx % 100) == 0) || (proc->frame_tx < 10))
......
......@@ -541,7 +541,7 @@ int trx_usrp_set_gains(openair0_device* device,
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(0);
// limit to maximum gain
if (openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] > gain_range.stop()) {
LOG_E(PHY,"RX Gain 0 too high, reduce by %f dB\n",
LOG_E(PHY,"RX Gain 0 too high, reduce by %f dB\n",openair0_cfg[0].rx_gain_offset[0],
openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] - gain_range.stop());
exit(-1);
}
......
......@@ -721,7 +721,7 @@ static void check_dev_config( rrh_module_t *mod_enb) {
mod_enb->devs->openair0_cfg->rx_freq[3],
mod_enb->devs->openair0_cfg->tx_freq[3],
mod_enb->devs->openair0_cfg->rxg_mode[0],
mod_enb->devs->openair0_cfg->tx_gain[0],
mod_enb->devs->openair0_cfg->rx_gain[0],
mod_enb->devs->openair0_cfg->tx_gain[0],
mod_enb->devs->openair0_cfg->rx_gain[1],
mod_enb->devs->openair0_cfg->tx_gain[1],
......
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