Commit b1d742e0 authored by Florian Kaltenberger's avatar Florian Kaltenberger

fixed bugs in UL power control

fixed bug in freq_channel when used with perfect channel estimation



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5778 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent edd3e250
......@@ -417,7 +417,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->PHY_measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(phy_vars_ue->PHY_measurements.rx_power_avg[eNB_id],phy_vars_ue->PHY_measurements.n0_power_avg);
phy_vars_ue->PHY_measurements.rx_rssi_dBm[eNB_id] = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id] - phy_vars_ue->rx_total_gain_dB + gain_offset;
#ifdef DEBUG_MEAS
printf("[PHY][eNB %d] lte_ue_measurements: RSSI %d dBm, RSSI (digital) %d dB\n",
LOG_D(PHY,"[eNB %d] lte_ue_measurements: RSSI %d dBm, RSSI (digital) %d dB\n",
eNB_id,phy_vars_ue->PHY_measurements.rx_rssi_dBm[eNB_id],
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]);
#endif
......
......@@ -231,7 +231,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
alpha_ind = 0;
if((cyclic_shift != 0)){
// Compensating for the phase shift introduced at the transmitte
// write_output("drs_est_pre.m","drsest_pre",ul_ch_estimates[0],300*12,1,1);
#ifdef DEBUG_CH
write_output("drs_est_pre.m","drsest_pre",ul_ch_estimates[0],300*12,1,1);
#endif
for(i=symbol_offset;i<symbol_offset+Msc_RS;i++){
ul_ch_estimates_re = ((int16_t*) ul_ch_estimates[aa])[i<<1];
ul_ch_estimates_im = ((int16_t*) ul_ch_estimates[aa])[(i<<1)+1];
......@@ -249,7 +251,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
if (alpha_ind>11)
alpha_ind-=12;
}
// write_output("drs_est_post.m","drsest_post",ul_ch_estimates[0],300*12,1,1);
#ifdef DEBUG_CH
write_output("drs_est_post.m","drsest_post",ul_ch_estimates[0],300*12,1,1);
#endif
}
//copy MIMO channel estimates to temporary buffer for EMOS
......@@ -286,7 +290,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
#ifdef DEBUG_CH
if (aa==0) {
if (Ns == 0) {
write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset<<1],512*2,2,1);
write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
write_output("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
write_output("drs_est0.m","drs0",ul_ch_estimates_time[aa],512*2,2,1);
}
......
......@@ -1270,7 +1270,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue,
}
else {
//#ifdef DEBUG_PHICH
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d\n",
LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d\n",
phy_vars_ue->Mod_id,harq_pid,
phy_vars_ue->frame_rx,
subframe,
......@@ -1360,15 +1360,15 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
}
nseq_PHICH = ((ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) +
ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH);
#ifdef DEBUG_PHICH
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d dci_alloc %d)\n",
//#ifdef DEBUG_PHICH
LOG_I(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d dci_alloc %d)\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->phich_ACK,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->dci_alloc);
#endif
//#endif
if (ulsch_eNB[UE_id]->Msg3_active == 1) {
LOG_D(PHY,"[eNB %d][PUSCH %d][RAPROC] Frame %d, subframe %d: Generating Msg3 PHICH for UE %d, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,
......
......@@ -1224,6 +1224,9 @@ uint32_t get_rballoc(uint8_t vrb_type,uint16_t rb_alloc_dci);
*/
uint8_t get_transmission_mode(uint16_t Mod_id, uint8_t CC_id, uint16_t rnti);
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid);
/* \brief
@param ra_header Header of resource allocation (0,1) (See sections 7.1.6.1/7.1.6.2 of 36.213 Rel8.6)
@param rb_alloc Bitmap allocation from DCI (format 1,2)
......
......@@ -1318,6 +1318,7 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
l%(frame_parms->symbols_per_tti/2),
l/(frame_parms->symbols_per_tti/2),
cooperation_flag);
}
if(cooperation_flag == 2)
{
......@@ -1334,7 +1335,9 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
eNB_pusch_vars->ulsch_power[i] = signal_energy_nodc(eNB_pusch_vars->drs_ch_estimates[eNB_id][i],
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)*rx_power_correction;
}
}
//write_output("rxdataF_ext.m","rxF_ext",eNB_pusch_vars->rxdataF_ext[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
//write_output("ulsch_chest.m","drs_est",eNB_pusch_vars->drs_ch_estimates[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
if(cooperation_flag == 2)
......
lte_dfts: lte_dfts.c
gcc -O3 -msse4.1 -o lte_dfts lte_dfts.c fft.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
gcc -O3 -msse4.1 -o lte_dfts lte_dfts.c fft.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
dft_cycles: lte_dfts
./lte_dfts | egrep cycles
......@@ -14890,9 +14890,11 @@ void dft1200(int16_t *x,int16_t *y,unsigned char scale_flag){
#ifdef MR_MAIN
int opp_enabled=1;
#include <string.h>
#include <stdio.h>
int opp_enabled=1;
int main(int argc, char**argv) {
......@@ -15277,15 +15279,7 @@ int main(int argc, char**argv) {
stop_meas(&ts);
}
printf("\n\n256-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
/* printf("X: ");
for (i=0;i<64;i++)
printf("%d,%d,%d,%d,%d,%d,%d,%d,",((int16_t*)&x[i])[0],((int16_t *)&x[i])[1],((int16_t*)&x[i])[2],((int16_t *)&x[i])[3],((int16_t*)&x[i])[4],((int16_t*)&x[i])[5],((int16_t*)&x[i])[6],((int16_t*)&x[i])[7]);
printf("\nY:");
for (i=0;i<64;i++)
printf("%d,%d,%d,%d,%d,%d,%d,%d,",((int16_t*)&y[i])[0],((int16_t *)&y[i])[1],((int16_t*)&y[i])[2],((int16_t *)&y[i])[3],((int16_t*)&y[i])[4],((int16_t *)&y[i])[5],((int16_t*)&y[i])[6],((int16_t *)&y[i])[7]);
printf("\n");
*/
reset_meas(&ts);
for (i=0;i<10000;i++) {
start_meas(&ts);
......@@ -15294,6 +15288,20 @@ int main(int argc, char**argv) {
}
printf("\n\n512-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
write_output("x.m","x",x,512,1,1);
write_output("y.m","y",y,512,1,1);
/*
printf("X: ");
for (i=0;i<64;i++)
printf("%d,%d,%d,%d,%d,%d,%d,%d,",((int16_t*)&x[i])[0],((int16_t *)&x[i])[1],((int16_t*)&x[i])[2],((int16_t *)&x[i])[3],((int16_t*)&x[i])[4],((int16_t*)&x[i])[5],((int16_t*)&x[i])[6],((int16_t*)&x[i])[7]);
printf("\nY:");
for (i=0;i<64;i++)
printf("%d,%d,%d,%d,%d,%d,%d,%d,",((int16_t*)&y[i])[0],((int16_t *)&y[i])[1],((int16_t*)&y[i])[2],((int16_t *)&y[i])[3],((int16_t*)&y[i])[4],((int16_t *)&y[i])[5],((int16_t*)&y[i])[6],((int16_t *)&y[i])[7]);
printf("\n");
*/
reset_meas(&ts);
for (i=0;i<10000;i++) {
start_meas(&ts);
......
......@@ -90,6 +90,7 @@ int eNB_sync_buffer0[640*6] __attribute__ ((aligned(16)));
int eNB_sync_buffer1[640*6] __attribute__ ((aligned(16)));
int *eNB_sync_buffer[2] = {eNB_sync_buffer0, eNB_sync_buffer1};
extern uint16_t hundred_times_log10_NPRB[100];
unsigned int max_peak_val;
int max_sect_id, max_sync_pos;
......@@ -2890,7 +2891,13 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
for (j=0;j<phy_vars_eNB->lte_frame_parms.nb_antennas_rx;j++)
phy_vars_eNB->eNB_UE_stats[i].UL_rssi[j] = dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[j]) - phy_vars_eNB->rx_total_gain_eNB_dB;
//this is the RSSI per RB
phy_vars_eNB->eNB_UE_stats[i].UL_rssi[j] =
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[j]*
(phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->nb_rb*12)/
phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) -
phy_vars_eNB->rx_total_gain_eNB_dB -
hundred_times_log10_NPRB[phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->nb_rb-1]/100;
start_meas(&phy_vars_eNB->ulsch_decoding_stats);
if (abstraction_flag == 0) {
......@@ -2912,12 +2919,14 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
stop_meas(&phy_vars_eNB->ulsch_decoding_stats);
//#ifdef DEBUG_PHY_PROC
LOG_I(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
LOG_I(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
phy_vars_eNB->Mod_id,harq_pid,
frame,subframe,
phy_vars_eNB->ulsch_eNB[i]->rnti,
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[0]),
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[1]),
phy_vars_eNB->eNB_UE_stats[i].UL_rssi[0],
phy_vars_eNB->eNB_UE_stats[i].UL_rssi[1],
phy_vars_eNB->PHY_measurements_eNB->n0_power_dB[0],
phy_vars_eNB->PHY_measurements_eNB->n0_power_dB[1],
phy_vars_eNB->ulsch_eNB[i]->o_ACK[0],
......@@ -2943,18 +2952,8 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
}
else {
*/
for (j=0;j<phy_vars_eNB->lte_frame_parms.nb_antennas_rx;j++)
phy_vars_eNB->eNB_UE_stats[i].UL_rssi[j] = dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[j])
- phy_vars_eNB->rx_total_gain_eNB_dB;
#ifdef DEBUG_PHY_PROC
LOG_I(PHY,"[eNB %d] Frame %d subframe %d: ULSCH %d RX power (%d,%d) dB\n",
phy_vars_eNB->Mod_id,frame,subframe,i,
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[0]),
dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[1]));
#endif
// }
//dump_ulsch(phy_vars_eNB, sched_subframe, i);
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round]++;
#ifdef DEBUG_PHY_PROC
......@@ -3472,6 +3471,23 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#endif //PUCCH
if ((frame % 100 == 0) && (subframe == 4)) {
for (round=0;round<phy_vars_eNB->ulsch_eNB[i]->Mdlharq;round++) {
if ((phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][round] -
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts_last[harq_pid][round]) != 0)
phy_vars_eNB->eNB_UE_stats[i].ulsch_round_fer[harq_pid][round] =
(100*(phy_vars_eNB->eNB_UE_stats[i].ulsch_round_errors[harq_pid][round] -
phy_vars_eNB->eNB_UE_stats[i].ulsch_round_errors_last[harq_pid][round]))/
(phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][round] -
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts_last[harq_pid][round]);
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts_last[harq_pid][round] =
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][round];
phy_vars_eNB->eNB_UE_stats[i].ulsch_round_errors_last[harq_pid][round] =
phy_vars_eNB->eNB_UE_stats[i].ulsch_round_errors[harq_pid][round];
}
}
if ((frame % 100 == 0) && (subframe==4)) {
for (round=0;round<phy_vars_eNB->ulsch_eNB[i]->Mdlharq;round++) {
if ((phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][round] -
......
......@@ -209,10 +209,9 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) {
#ifdef EXMIMO
unsigned int prach_gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
unsigned int get_tx_amp(int gain_dBm, int gain_max_dBm) {
unsigned int get_tx_amp(int power_dBm, int power_max_dBm) {
//int gain_dB = gain_dBm - gain_max_dBm;
int gain_dB = gain_max_dBm;
int gain_dB = power_dBm - power_max_dBm;
if (gain_dB < -30) {
return(AMP/32);
......@@ -711,6 +710,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
generate_ul_signal = 1;
// FK 20140908: the power control cannot be done here, since we do not have the spectral efficiency yet. this is only done in ulsch_encoding
/*
#ifdef OPENAIR2
pusch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,1, abstraction_flag);
phy_vars_ue->tx_power_dBm = phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH;
......@@ -721,6 +722,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d harq pid %d, Po_PUSCH : %d dBm\n",
Mod_id,harq_pid,frame_tx,subframe_tx,harq_pid, phy_vars_ue->tx_power_dBm);
*/
// deactivate service request
phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
......@@ -766,18 +768,6 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif
#ifdef EXMIMO
if (abstraction_flag==0) {
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),subframe_tx,first_rb,nb_rb,aa);
}
#else
if (abstraction_flag==0) {
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(phy_vars_ue,eNB_id,AMP,subframe_tx,first_rb,nb_rb,aa);
}
#endif
//#ifdef DEBUG_PHY_PROC
// debug_LOG_D(PHY,"[UE %d] Frame %d, Subframe %d ulsch harq_pid %d : O %d, O_ACK %d, O_RI %d, TBS %d\n",Mod_id,phy_vars_ue->frame,subframe_tx,harq_pid,phy_vars_ue->ulsch_ue[eNB_id]->O,phy_vars_ue->ulsch_ue[eNB_id]->O_ACK,phy_vars_ue->ulsch_ue[eNB_id]->O_RI,phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS);
//#endif
......@@ -856,14 +846,14 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
}
*/
}
//#ifdef DEBUG_PHY_PROC
//#ifdef DEBUG_ULSCH
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_ULSCH
LOG_I(PHY,"[UE] Frame %d, subframe %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",frame_tx,subframe_tx,harq_pid, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3);
for (i=0;i<phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3;i++)
LOG_T(PHY,"%x.",ulsch_input_buffer[i]);
LOG_T(PHY,"\n");
//#endif
//#endif
#endif
#endif
#else //OPENAIR2
// the following lines were necessary for the calibration in CROWN
/*
......@@ -917,6 +907,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
}
if (abstraction_flag == 0) {
#ifdef OPENAIR2
pusch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,1, abstraction_flag);
phy_vars_ue->tx_power_dBm = phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH;
#else
phy_vars_ue->tx_power_dBm = UE_TX_POWER;
......@@ -930,9 +921,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#else
AMP
#endif
);
);
start_meas(&phy_vars_ue->ulsch_modulation_stats);
#ifdef OFDMA_ULSCH
ulsch_modulation(phy_vars_ue->lte_ue_common_vars.txdataF,
#ifdef EXMIMO
get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),
......@@ -944,21 +934,17 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
&phy_vars_ue->lte_frame_parms,
phy_vars_ue->ulsch_ue[eNB_id]);
#else //OFDMA_ULSCH
ulsch_modulation(phy_vars_ue->lte_ue_common_vars.txdataF,
#ifdef EXMIMO
get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),
#ifdef EXMIMO
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),subframe_tx,first_rb,nb_rb,aa);
#else
AMP,
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(phy_vars_ue,eNB_id,AMP,subframe_tx,first_rb,nb_rb,aa);
#endif
frame_tx,
subframe_tx,
&phy_vars_ue->lte_frame_parms,
phy_vars_ue->ulsch_ue[eNB_id]);
#endif //OFDMA_ULSCH
start_meas(&phy_vars_ue->ulsch_modulation_stats);
stop_meas(&phy_vars_ue->ulsch_modulation_stats);
}
if (abstraction_flag==1) {
// clear SR
phy_vars_ue->sr[subframe_tx]=0;
......@@ -1015,6 +1001,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
Mod_id, frame_tx,subframe_tx);
}
}
#ifdef PUCCH
else if (phy_vars_ue->UE_mode[eNB_id] == PUSCH){ // check if we need to use PUCCH 1a/1b
// debug_LOG_D(PHY,"[UE%d] Frame %d, subframe %d: Checking for PUCCH 1a/1b\n",Mod_id,frame_tx,subframe_tx);
......
......@@ -42,6 +42,11 @@
#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/extern.h"
// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25
int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255};
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid) {
uint32_t Nre = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->Nsymb_initial *
......@@ -50,15 +55,16 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8
if (Nre==0)
return(0);
uint32_t MPR = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->sumKr / Nre;
// Note: MPR is the effective spectral efficiency of the PUSCH
uint32_t MPR_x100 = 100*phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->sumKr/Nre;
// Note: MPR=is the effective spectral efficiency of the PUSCH
// FK 20140908 sumKr is only set after the ulsch_encoding
uint16_t beta_offset_pusch = (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->control_only == 1) ?
phy_vars_ue->ulsch_ue[eNB_id]->beta_offset_cqi_times8:8;
if (phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled == 1) {
// This is the formula from Section 5.1.1.1 in 36.213 (deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch
return(100*((((1<<((5*MPR)>>2)) - 1)*beta_offset_pusch)>>3));
// This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch)
return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3));
}
else {
return(0);
......@@ -67,6 +73,7 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8
uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000};
uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100};
void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag) {
......@@ -95,7 +102,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += (mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0) + PL);
LOG_D(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,%d,%d,%d)\n",
LOG_I(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,100*PL=%d,%d,%d)\n",
phy_vars_ue->Mod_id,phy_vars_ue->frame_tx,subframe,phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH,
100*mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0),
hundred_times_log10_NPRB[nb_rb-1],
......@@ -116,7 +123,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
else if (phy_vars_ue->ulsch_ue[eNB_id]->PHR > 40)
phy_vars_ue->ulsch_ue[eNB_id]->PHR = 40;
LOG_D(PHY,"[UE %d][PUSCH %d] frame %d, subframe %d: Po_PUSCH %d dBm : Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n",
LOG_I(PHY,"[UE %d][PUSCH %d] frame %d, subframe %d: Po_PUSCH %d dBm : Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n",
phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame_tx,subframe,
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH,
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
......
......@@ -10,7 +10,7 @@ OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR)
OPENAIR3 = $(OPENAIR3_DIR)
CFLAGS = -g -ggdb -O3 -Wno-strict-aliasing -rdynamic -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 $(CPUFLAGS) -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO # -Wno-packed-bitfield-compat
CFLAGS = -g -ggdb -Wno-strict-aliasing -rdynamic -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 $(CPUFLAGS) -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO # -Wno-packed-bitfield-compat
# DCI Debug
......@@ -91,7 +91,7 @@ ifdef BIT8_TX
CFLAGS += -DBIT8_TX
endif
CFLAGS += -DNO_RRM -DOPENAIR1 #-DOPENAIR2 #-DPHY_ABSTRACTION
CFLAGS += -DNO_RRM -DOPENAIR1 -DPHY_ABSTRACTION #-DOPENAIR2
CFLAGS += -I/usr/include/X11 -I/usr/X11R6/include
......
......@@ -325,7 +325,7 @@ int main(int argc, char **argv) {
int llr8_flag=0;
double effective_rate=0.0;
char channel_model_input[10];
char channel_model_input[10]="I";
opp_enabled=1; // to enable the time meas
cpu_freq_GHz = (double)get_cpu_freq_GHz();
......@@ -406,7 +406,7 @@ int main(int argc, char **argv) {
num_pdcch_symbols=atoi(optarg);
break;
case 'g':
sprintf(channel_model_input,optarg,10);
memcpy(channel_model_input,optarg,10);
switch((char)*optarg) {
case 'A':
channel_model=SCM_A;
......@@ -2508,11 +2508,11 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
for (iii=0; iii<NB_RB; iii++){
//fprintf(csv_fd, "%d, %d", (PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]),(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id_i]->pmi_ext[iii]));
fprintf(csv_fd,"%x,%x,",(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]),(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]));
msg(" %x",(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]));
printf("%x ",(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]));
}
}
}
PHY_vars_UE->dlsch_ue[0][0]->rnti = (common_flag==0) ? n_rnti: SI_RNTI;
coded_bits_per_codeword = get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->dlsch_eNB[0][0]->nb_rb,
......
......@@ -452,7 +452,8 @@ DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2
break;
}
}
/*
// add common dci
DCI_pdu.dci_alloc[0].dci_length = BCCH_pdu_size_bits;
DCI_pdu.dci_alloc[0].L = log2Lcommon;
......@@ -470,13 +471,13 @@ DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2
DCI_pdu.dci_alloc[1].ra_flag = 0;
memcpy((void*)&DCI_pdu.dci_alloc[1].dci_pdu[0], &DLSCH_alloc_pdu[0], dci_length_bytes);
DCI_pdu.Num_ue_spec_dci++;
*/
DCI_pdu.dci_alloc[2].dci_length = UL_pdu_size_bits;
DCI_pdu.dci_alloc[2].L = log2L;
DCI_pdu.dci_alloc[2].rnti = rnti;
DCI_pdu.dci_alloc[2].format = format0;
DCI_pdu.dci_alloc[2].ra_flag = 0;
DCI_pdu.dci_alloc[0].dci_length = UL_pdu_size_bits;
DCI_pdu.dci_alloc[0].L = log2L;
DCI_pdu.dci_alloc[0].rnti = rnti;
DCI_pdu.dci_alloc[0].format = format0;
DCI_pdu.dci_alloc[0].ra_flag = 0;
memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &UL_alloc_pdu[0], UL_pdu_size_bytes);
DCI_pdu.Num_ue_spec_dci++;
......@@ -929,6 +930,13 @@ int main(int argc, char **argv) {
DCI_pdu.dci_alloc, frame_parms, subframe);
DCI_pdu.nCCE = get_nCCE(num_pdcch_symbols,&PHY_vars_eNB->lte_frame_parms,get_mi(&PHY_vars_eNB->lte_frame_parms,subframe));
if (n_frames==1) {
printf("num_dci %d, num_pddch_symbols %d, nCCE %d\n",
DCI_pdu.Num_common_dci+DCI_pdu.Num_ue_spec_dci,
num_pdcch_symbols,
DCI_pdu.nCCE);
}
// apply RNTI-based nCCE allocation
for (i = 0; i < DCI_pdu.Num_common_dci + DCI_pdu.Num_ue_spec_dci; i++) {
// SI RNTI
......
......@@ -26,7 +26,7 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define DEBUG_DAC 1
//#define DEBUG_DAC 1
#include <math.h>
#include <stdio.h>
#include "PHY/TOOLS/defs.h"
......
......@@ -46,7 +46,7 @@ extern int write_output(const char *,const char *,void *,int,int,char);
//double pn[1024];
#define DEBUG_RF 1
//#define DEBUG_RF 1
//free(input_data);
void rf_rx(double **r_re,
......
......@@ -85,33 +85,38 @@ void init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
void freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
int16_t f;
int16_t f,f2,d;
uint8_t aarx,aatx,l;
double *clut,*slut;
static int freq_channel_init=0;
static int n_samples_max=0;
// printf("no of samples:%d,",n_samples);
// printf("no of taps:%d,",(int)desc->nb_taps);
if (freq_channel_init == 0) {
init_freq_channel(desc,nb_rb,n_samples);
// we are initializing the lut for the largets possible n_samples=12*nb_rb+1
// if called with n_samples<12*nb_rb+1, we decimate the lut
n_samples_max=12*nb_rb+1;
init_freq_channel(desc,nb_rb,n_samples_max);
freq_channel_init=1;
}
d=n_samples_max/n_samples;
start_meas(&desc->interp_freq);
for (f=-n_samples/2;f<n_samples/2;f++) {
clut = cos_lut[n_samples/2+f];
slut = sin_lut[n_samples/2+f];
for (f=-n_samples_max/2,f2=-n_samples/2;f<n_samples_max/2;f+=d,f2++) {
clut = cos_lut[n_samples_max/2+f];
slut = sin_lut[n_samples_max/2+f];
for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) {
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f].x=0.0;
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f].y=0.0;
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x=0.0;
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
for (l=0;l<(int)desc->nb_taps;l++) {
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
}
}
......
......@@ -1521,7 +1521,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover(
// UplinkPowerControlDedicated__deltaMCS_Enabled_en1);
physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled =
UplinkPowerControlDedicated__deltaMCS_Enabled_en1;
physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // FALSE
physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 0; // FALSE
physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB
physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB
physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient =
......
......@@ -19,9 +19,9 @@ linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi)
ifdef DEBUG
CFLAGS += -g -ggdb -DDEBUG_PHY -DDEBUG_MEAS
CFLAGS += -DTRACE_RLC_UM_PDU
#CFLAGS += -DTRACE_RLC_UM_PDU
else
CFLAGE += -O2
CFLAGS += -O2
endif
CFLAGS += -Wstrict-prototypes -Wpointer-sign
......
......@@ -983,26 +983,31 @@ void *l2l1_task(void *args_p) {
}//end of slot
if ((frame >= 1) && (frame <= 9) && (abstraction_flag == 0)
if ((frame >= 10) && (frame <= 11) && (abstraction_flag == 0)
#ifdef PROC
&&(Channel_Flag==0)
#endif
) {
write_output ("UEtxsig0.m", "txs0", PHY_vars_UE_g[0][0]->lte_ue_common_vars.txdata[0], PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,
1, 1);
sprintf (fname, "UEtxsig%d.m", frame);
sprintf (vname, "txs%d", frame);
write_output (fname, vname, PHY_vars_UE_g[0][0]->lte_ue_common_vars.txdata[0],
PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,1,1);
sprintf (fname, "eNBtxsig%d.m", frame);
sprintf (vname, "txs%d", frame);
write_output (fname, vname, PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0], PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10, 1,
1);
write_output (
"eNBtxsigF0.m", "txsF0", PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdataF[0][0],
PHY_vars_eNB_g[0][0]->lte_frame_parms.symbols_per_tti * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size, 1,
1);
write_output ("UErxsig0.m", "rxs0", PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0], PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,
1, 1);
write_output ("eNBrxsig0.m", "rxs0", PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.rxdata[0][0],
PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10, 1, 1);
write_output (fname, vname, PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0],
PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,1,1);
sprintf (fname, "eNBtxsigF%d.m", frame);
sprintf (vname, "txsF%d", frame);
write_output (fname, vname, PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdataF[0][0],
PHY_vars_eNB_g[0][0]->lte_frame_parms.symbols_per_tti * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size,1,1);
sprintf (fname, "UErxsig%d.m", frame);
sprintf (vname, "rxs%d", frame);
write_output (fname, vname, PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0],
PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,1,1);
sprintf (fname, "eNBrxsig%d.m", frame);
sprintf (vname, "rxs%d", frame);
write_output (fname, vname, PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.rxdata[0][0],
PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti*10,1,1);
}
#ifdef XFORMS
......
......@@ -1053,13 +1053,13 @@ void update_ocm() {
/* check if the openair channel model is activated used for PHY abstraction : path loss*/
if ((oai_emulation.info.ocm_enabled == 1)&& (ethernet_flag == 0 )) {
//LOG_D(OMG," extracting position of eNb...\n");
//LOG_D(OMG," extracting position of eNb...\n");
//display_node_list(enb_node_list);
// display_node_list(ue_node_list);
extract_position(enb_node_list, enb_data, NB_eNB_INST);
//extract_position_fixed_enb(enb_data, NB_eNB_INST,frame);
//LOG_D(OMG," extracting position of UE...\n");
// if (oai_emulation.info.omg_model_ue == TRACE)
extract_position(enb_node_list, enb_data, NB_eNB_INST);
//extract_position_fixed_enb(enb_data, NB_eNB_INST,frame);
//LOG_D(OMG," extracting position of UE...\n");
// if (oai_emulation.info.omg_model_ue == TRACE)
extract_position(ue_node_list, ue_data, NB_UE_INST);
/* if (frame % 50 == 0)
......@@ -1094,9 +1094,9 @@ void update_ocm() {
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
}
LOG_I(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d)\n",eNB_id,UE_id,CC_id,
LOG_I(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",eNB_id,UE_id,CC_id,
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB,
PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower);
PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
// printf("[SIM] Path loss from UE %d to eNB %d => %f dB\n",UE_id,eNB_id,UE2eNB[UE_id][eNB_id]->path_loss_dB);
}
}
......
......@@ -201,7 +201,7 @@ void calc_path_loss(node_desc_t* enb_data, node_desc_t* ue_data, channel_desc_t
LOG_D(OCM,"dist %f, Path loss %f\n",dist,ch_desc->path_loss_dB);