diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index ac081f840bce6448f0403344ec7447c344f16db0..49966f9910ae0d1b44a9dd6fd48cbd78d84c6eb6 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -2865,7 +2865,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars, } } - LOG_D(PHY,"DCI decoding CRNTI [format_c: %d, nCCE[subframe: %d]: %d ]\n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe]); + LOG_D(PHY,"DCI decoding CRNTI [format: %d, nCCE[subframe: %d]: %d ], AggregationLevel %d \n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe],L2); // memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_decoded_output,sizeof_bytes); diff --git a/openair1/PHY/LTE_TRANSPORT/group_hopping.c b/openair1/PHY/LTE_TRANSPORT/group_hopping.c index 64c0830386faabed6f6d028a28edad8c42acbbeb..ed3cb11c083078c35e64b75462d5cbd38823d9fe 100644 --- a/openair1/PHY/LTE_TRANSPORT/group_hopping.c +++ b/openair1/PHY/LTE_TRANSPORT/group_hopping.c @@ -50,6 +50,8 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms) // This is from Section 5.5.1.3 uint32_t fss_pusch = frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH; + uint32_t fss_pucch = frame_parms->Nid_cell; + x2 = frame_parms->Nid_cell/30; #ifdef DEBUG_GROUPHOP printf("[PHY] GroupHop:"); @@ -57,7 +59,10 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms) for (ns=0; ns<20; ns++) { if (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == 0) + { frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[ns] = fss_pusch%30; + frame_parms->pucch_config_common.grouphop[ns] = fss_pucch%30; + } else { if ((ns&3) == 0) { s = lte_gold_generic(&x1,&x2,reset); @@ -65,6 +70,7 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms) } frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[ns] = (((uint8_t*)&s)[ns&3]+fss_pusch)%30; + frame_parms->pucch_config_common.grouphop[ns] = (((uint8_t*)&s)[ns&3]+fss_pucch)%30; } #ifdef DEBUG_GROUPHOP diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c index cb5d6539099387cad941c3d40a3a98b79d40004e..8f2ad8907abdbf7ac93fcf4ed4c0e4141715e149 100644 --- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c @@ -137,11 +137,10 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; - int32_t *txdataF = ue->common_vars.txdataF[0]; + int32_t **txdataF = ue->common_vars.txdataF; uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset; uint16_t *Msc_idx_ptr; int32_t k0; - uint32_t T_SFC; uint32_t subframe_offset; uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; @@ -149,6 +148,16 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, uint8_t n_RRC = soundingrs_ul_config_dedicated->freqDomainPosition; uint8_t kTC = soundingrs_ul_config_dedicated->transmissionComb; + // u is the PUCCH sequence-group number defined in Section 5.5.1.3 + // ν is the base sequence number defined in Section 5.5.1.4 + uint32_t u=frame_parms->pucch_config_common.grouphop[1+(subframe<<1)];; + uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + + LOG_D(PHY,"SRS root sequence: u %d, v %d\n",u,v); + LOG_D(PHY,"CommonSrsConfig: Csrs %d, Ssrs %d, AnSrsSimultan %d \n",Csrs,Ssrs,frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); + LOG_D(PHY,"DedicatedSrsConfig: Bsrs %d, bhop %d, nRRC %d, Isrs %d, kTC %d, n_SRS %d\n",Bsrs,soundingrs_ul_config_dedicated->srs_HoppingBandwidth,n_RRC + ,soundingrs_ul_config_dedicated->srs_ConfigIndex,kTC + ,soundingrs_ul_config_dedicated->cyclicShift); if (frame_parms->N_RB_UL < 41) { msrs0 = msrsb_6_40[Csrs][0]; @@ -169,7 +178,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, } Msc_RS = msrsb * 6; - k0 = (((frame_parms->N_RB_UL>>1)-(msrs0>>1))*12) + kTC; + k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC; nb = (4*n_RRC/msrsb)%Nb; for (b=0; b<=Bsrs; b++) { @@ -208,53 +217,32 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, msg("generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d\n",Msc_RS, Msc_RS_idx); #endif - T_SFC = (Ssrs<=7 ? 5 : 10); - - if ((1<<(subframe%T_SFC))&transmission_offset_tdd[Ssrs]) { + carrier_pos = (frame_parms->first_carrier_offset + k0); + if (carrier_pos>frame_parms->ofdm_symbol_size) { + carrier_pos -= frame_parms->ofdm_symbol_size; + } + uint16_t nsymb = (frame_parms->Ncp==0) ? 14:12; + symbol_offset = (int)frame_parms->ofdm_symbol_size*((subframe*nsymb)+(nsymb-1)); -#ifndef IFFT_FPGA_UE - carrier_pos = (frame_parms->first_carrier_offset + k0) % frame_parms->ofdm_symbol_size; //msg("carrier_pos = %d\n",carrier_pos); + //subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size; + //symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size; - subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size; - symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size; + int32_t *txptr; + txptr = &txdataF[0][symbol_offset]; for (k=0; k<Msc_RS; k++) { - ((short*) txdataF)[2*(symbol_offset + carrier_pos)] = (short) (((int32_t) amp * (int32_t) ul_ref_sigs[0][0][Msc_RS_idx][k<<1])>>15); - ((short*) txdataF)[2*(symbol_offset + carrier_pos)+1] = (short) (((int32_t) amp * (int32_t) ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1])>>15); - carrier_pos+=2; + int32_t real = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][k<<1]) >> 15; + int32_t imag = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][(k<<1)+1]) >> 15; + txptr[carrier_pos] = (real&0xFFFF) + ((imag<<16)&0xFFFF0000); - if (carrier_pos >= frame_parms->ofdm_symbol_size) - carrier_pos=1; - } -#else - carrier_pos = (frame_parms->N_RB_UL*12/2 + k0) % (frame_parms->N_RB_UL*12); - //msg("carrier_pos = %d\n",carrier_pos); + carrier_pos = carrier_pos+2; - subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->N_RB_UL*12; - symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->N_RB_UL*12; - - for (k=0; k<Msc_RS; k++) { - if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] >= 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] >= 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 4; - else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] >= 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] < 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 2; - else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] < 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] >= 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 3; - else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] < 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] < 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 1; - - carrier_pos+=2; - - if (carrier_pos >= frame_parms->N_RB_UL*12) - carrier_pos=0; + if (carrier_pos >= frame_parms->ofdm_symbol_size) + carrier_pos=carrier_pos-frame_parms->ofdm_symbol_size; } -#endif - // write_output("srs_txF.m","srstxF",&txdataF[symbol_offset],512,1,1); - } - return(0); } diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 4ec446cd5f989782cd5f39ba41fa024131268dfa..30dbff7b86c3bbe7acb95e29cb37590e0c9f6d56 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -148,6 +148,11 @@ typedef struct { uint8_t nCS_AN; /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]} uint16_t n1PUCCH_AN; + + /// group hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification. + uint8_t grouphop[20]; + /// sequence hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification. + uint8_t seqhop[20]; } PUCCH_CONFIG_COMMON; /// UL-ReferenceSignalsPUSCH from 36.331 RRC spec diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 9670df5b4ac51105ad4a2134318ee7d6257e55d3..f3ed4ec645b4131bdee4fa36e14a50bb4e0eaf0e 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -205,7 +205,6 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb int gain_dB = power_dBm - power_max_dBm; double gain_lin; - LOG_I(PHY,"Get Tx Amp; Gain[dB]: %d, AMP: %d\n",gain_dB,AMP); if (gain_dB < -20) return(AMP/10); @@ -492,17 +491,19 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id int frame_tx = proc->frame_tx; int subframe_tx = proc->subframe_tx; uint8_t isSubframeSRS = 0; // SRS Cell Occasion - uint8_t isSubframeSRSTx = 0; // SRS UE Occasion SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; // check for SRS opportunity pSoundingrs_ul_config_dedicated->srsUeSubframe = 0; pSoundingrs_ul_config_dedicated->srsCellSubframe = 0; + + ue->ulsch[eNB_id]->srs_active = 0; + ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; if(frame_parms->soundingrs_ul_config_common.enabled_flag) { - LOG_I(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); + LOG_D(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); uint8_t TSFC; uint16_t deltaTSFC; // bitmap @@ -536,12 +537,14 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id isSubframeSRS = 1; pSoundingrs_ul_config_dedicated->srsCellSubframe = 1; } - LOG_I(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d, srsCellSubframe: %d \n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx, pSoundingrs_ul_config_dedicated->srsCellSubframe); - + LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d, srsCellSubframe: %d \n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx, pSoundingrs_ul_config_dedicated->srsCellSubframe); + LOG_D(PHY," SrsDedicatedSetup: %d \n",pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup); if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) { compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); + LOG_D(PHY," srsPeriodicity: %d srsOffset: %d isSubframeSRS %d \n",srsPeriodicity,srsOffset,isSubframeSRS); + // transmit SRS if the four following constraints are respected: // - UE is configured to transmit SRS // - SRS are configured in current subframe @@ -553,11 +556,12 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id //(! is_pucch_per_cqi_report)) ) { - isSubframeSRSTx = 1; pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; + ue->ulsch[eNB_id]->srs_active = 1; + ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; } - LOG_I(PHY," isSubframeSRS: %d, isSubframeSRSTx: %d \n", isSubframeSRS, isSubframeSRSTx); } + LOG_D(PHY," srsCellSubframe: %d, srsUeSubframe: %d, Nsymb-pusch: %d \n", pSoundingrs_ul_config_dedicated->srsCellSubframe, pSoundingrs_ul_config_dedicated->srsUeSubframe, ue->ulsch[eNB_id]->Nsymb_pusch); } } @@ -1289,14 +1293,21 @@ void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8 } #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + if (ue->mac_enabled==1) + { tx_amp = get_tx_amp(Po_SRS, ue->tx_power_max_dBm, ue->frame_parms.N_RB_UL, nb_rb_srs); + } + else + { + tx_amp = AMP; + } #else tx_amp = AMP; #endif - LOG_I(PHY,"SRS PROC; TX_MAX_POWER %d, Po_SRS %d, NB_RB_UL %d, NB_RB_SRS %d TX_AMPL %d\n",ue->tx_power_max_dBm, + LOG_D(PHY,"SRS PROC; TX_MAX_POWER %d, Po_SRS %d, NB_RB_UL %d, NB_RB_SRS %d TX_AMPL %d\n",ue->tx_power_max_dBm, Po_SRS, ue->frame_parms.N_RB_UL, nb_rb_srs, @@ -1323,7 +1334,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin int8_t Po_PUCCH; SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; - uint8_t isShortenPucch = pSoundingrs_ul_config_dedicated->srsCellSubframe; + uint8_t isShortenPucch = (pSoundingrs_ul_config_dedicated->srsCellSubframe && frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; @@ -1397,9 +1408,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #endif if (SR_payload>0) { - LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n", + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, isShortenPucch, frame_tx, subframe_tx, pucch_ack_payload[0],pucch_ack_payload[1], @@ -1407,10 +1419,11 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin Po_PUCCH, tx_amp); } else { - LOG_I(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", + LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, frame_tx, subframe_tx, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, isShortenPucch, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, Po_PUCCH, @@ -1460,10 +1473,11 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #else tx_amp = AMP; #endif - LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, frame_tx, subframe_tx, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, isShortenPucch, ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, Po_PUCCH); @@ -1526,14 +1540,14 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui } if (ue->UE_mode[eNB_id] != PRACH) { + // check cell srs subframe and ue srs subframe. This has an impact on pusch encoding + ue_compute_srs_occasion(ue,proc,eNB_id); ue_ulsch_uespec_procedures(ue,proc,eNB_id,abstraction_flag); } if (ue->UE_mode[eNB_id] == PUSCH) { - // check cell srs subframe and ue srs subframe - ue_compute_srs_occasion(ue,proc,eNB_id); // check if we need to use PUCCH 1a/1b ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); // check if we need to use SRS diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED/srs_pc.c index 3ec5f00f9a0cfbc9693d19f146438ed2a451e763..461d23097561490f4884eff5b5bf97f559d8cd04 100644 --- a/openair1/SCHED/srs_pc.c +++ b/openair1/SCHED/srs_pc.c @@ -46,7 +46,8 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t { int16_t PL; - int8_t P_opusch; + int8_t p0_NominalPUSCH; + int8_t p0_UE_PUSCH; int8_t Psrs_offset; int16_t P_srs; int16_t f_pusch; @@ -59,7 +60,7 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t uint8_t Bsrs = psoundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Csrs = pframe_parms->soundingrs_ul_config_common.srs_BandwidthConfig; - LOG_I(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, N_RB_UL %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,pframe_parms->N_RB_UL,Bsrs,Csrs); + LOG_D(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, N_RB_UL %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,pframe_parms->N_RB_UL,Bsrs,Csrs); if (pframe_parms->N_RB_UL < 41) { @@ -81,20 +82,27 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t // SRS Power control 36.213 5.1.3.1 // P_srs = P_srs_offset+ 10log10(Msrs) + P_opusch(j) + alpha*PL + f(i)) - Psrs_offset = (ue->ul_power_control_dedicated[eNB_id].pSRS_Offset - 3); - P_opusch = ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; + p0_NominalPUSCH = ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; + p0_UE_PUSCH = ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH; + Psrs_offset = (ue->ul_power_control_dedicated[eNB_id].pSRS_Offset - 3); + + f_pusch = ue->ulsch[eNB_id]->f_pusch; alpha = alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]; PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id); - LOG_I(PHY," SRS Power Control; eNB_id %d, p0_NominalPUSCH %d, alpha %d \n",eNB_id,P_opusch,alpha); - LOG_I(PHY," SRS Power Control; eNB_id %d, pSRS_Offset[dB] %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); + LOG_D(PHY," SRS Power Control; eNB_id %d, p0_NominalPUSCH %d, p0_UE_PUSCH %d, alpha %d \n",eNB_id,p0_NominalPUSCH,p0_UE_PUSCH,alpha); + LOG_D(PHY," SRS Power Control; eNB_id %d, pSRS_Offset[dB] %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); - P_srs = P_opusch + Psrs_offset + f_pusch; + P_srs = (p0_NominalPUSCH + p0_UE_PUSCH) + Psrs_offset + f_pusch; P_srs += (((int32_t)alpha * (int32_t)PL) + hundred_times_log10_NPRB[Msrs-1])/100 ; - ue->ulsch[eNB_id]->Po_SRS = P_srs < ue->tx_power_max_dBm ? P_srs:ue->tx_power_max_dBm; // MIN(PcMax,Psrs) + ue->ulsch[eNB_id]->Po_SRS = P_srs; + if(ue->ulsch[eNB_id]->Po_SRS > ue->tx_power_max_dBm) + { + ue->ulsch[eNB_id]->Po_SRS = ue->tx_power_max_dBm; + } pnb_rb_srs[0] = Msrs; - LOG_I(PHY," SRS Power Control; eNB_id %d, P_srs[dBm] %d, P_cmax[dBm] %d, Psrs[dBm] %d\n",eNB_id,P_srs,ue->tx_power_max_dBm,ue->ulsch[eNB_id]->Po_SRS); + LOG_D(PHY," SRS Power Control; eNB_id %d, Psrs_pc[dBm] %d, Pcmax[dBm] %d, Psrs[dBm] %d\n",eNB_id,P_srs,ue->tx_power_max_dBm,ue->ulsch[eNB_id]->Po_SRS); }