Commit 3fe96776 authored by Raymond Knopp's avatar Raymond Knopp

extra tracing in MAC stats for deltaMCS

parent a2637621
......@@ -63,7 +63,7 @@ int get_ul_tda(gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int
return 0; // if FDD or not mixed slot in TDD, for now use default TDA (TODO handle CSI-RS slots)
}
static int compute_ph_factor(int mu, int tbs_bits, int rb, int n_layers, int n_symbols, int n_dmrs, long *deltaMCS, int include_bw)
static int compute_ph_factor(int mu, int tbs_bits, int rb, int n_layers, int n_symbols, int n_dmrs, long *deltaMCS, int include_bw,int dump)
{
// 38.213 7.1.1
// if the PUSCH transmission is over more than one layer delta_tf = 0
......@@ -71,10 +71,10 @@ static int compute_ph_factor(int mu, int tbs_bits, int rb, int n_layers, int n_s
if(deltaMCS != NULL && n_layers == 1) {
const int n_re = (NR_NB_SC_PER_RB * n_symbols - n_dmrs) * rb;
const float BPRE = (float) tbs_bits/n_re; //TODO change for PUSCH with CSI
const float f = pow(2, BPRE * /*1.25*/1.5);
const float f = pow(2, BPRE * 1.25);
const float beta = 1.0f; //TODO change for PUSCH with CSI
delta_tf = (10 * log10((f - 1) * beta));
LOG_D(NR_MAC,"compute_ph_factor delta_tf %f (n_re %d, n_rb %d, n_dmrs %d, n_symbols %d, tbs %d BPRE %f f %f)\n",delta_tf,n_re,rb, n_dmrs, n_symbols, tbs_bits, BPRE,f);
if (dump==1) LOG_I(NR_MAC,"compute_ph_factor delta_tf %f (n_re %d, n_rb %d, n_dmrs %d, n_symbols %d, tbs %d BPRE %f f %f)\n",delta_tf,n_re,rb, n_dmrs, n_symbols, tbs_bits, BPRE,f);
}
const float bw_factor = (include_bw>0) ? 10 * log10(rb << mu) : 0;
......@@ -271,7 +271,7 @@ static int nr_process_mac_pdu(instance_t module_idP,
sched_pusch->tda_info.nrOfSymbols, // n_symbols
sched_pusch->dmrs_info.num_dmrs_symb * sched_pusch->dmrs_info.N_PRB_DMRS, // n_dmrs
deltaMCS,
1);
1,0);
sched_ctrl->ph0 = PH;
/* 38.133 Table10.1.18.1-1 */
sched_ctrl->pcmax = PCMAX - 29;
......@@ -637,6 +637,8 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
// if not missed detection (10dB threshold for now)
if (rssi>0) {
int txpower_calc = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.phr_txpower_calc;
UE->mac_stats.deltaMCS = txpower_calc;
UE->mac_stats.NPRB = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.rbSize;
UE_scheduling_control->tpc0 = nr_get_tpc(target_snrx10,ul_cqi,30,txpower_calc);
if (UE_scheduling_control->ph <0 && UE_scheduling_control->tpc0 > 1)
UE_scheduling_control->tpc0 = 1;
......@@ -1454,7 +1456,7 @@ static void nr_ue_max_mcs_min_rb(int mu,
update_ul_ue_R_Qm(*mcs, ul_bwp->mcs_table, ul_bwp->pusch_Config, &R, &Qm);
long *deltaMCS = ul_bwp->pusch_Config ? ul_bwp->pusch_Config->pusch_PowerControl->deltaMCS : NULL;
if (ul_bwp->mcs_table == 1) R>>=1;
// if (ul_bwp->mcs_table == 1) R>>=1;
tbs_bits = nr_compute_tbs(Qm, R, *Rb,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
......@@ -1468,7 +1470,7 @@ static void nr_ue_max_mcs_min_rb(int mu,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
1);
1,0);
while (ph_limit < tx_power && *Rb > minRb) {
(*Rb)--;
......@@ -1485,14 +1487,14 @@ static void nr_ue_max_mcs_min_rb(int mu,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
1);
1,0);
LOG_D(NR_MAC, "Checking %d RBs, MCS %d, ph_limit %d, tx_power %d\n",*Rb,*mcs,ph_limit,tx_power);
}
while (ph_limit < tx_power && *mcs > 0) {
(*mcs)--;
update_ul_ue_R_Qm(*mcs, ul_bwp->mcs_table, ul_bwp->pusch_Config, &R, &Qm);
if (ul_bwp->mcs_table == 1) R>>=1;
// if (ul_bwp->mcs_table == 1) R>>=1;
tbs_bits = nr_compute_tbs(Qm, R, *Rb,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
......@@ -1506,7 +1508,7 @@ static void nr_ue_max_mcs_min_rb(int mu,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
1);
1,0);
LOG_D(NR_MAC, "Checking %d RBs, MCS %d, ph_limit %d, tx_power %d\n",*Rb,*mcs,ph_limit,tx_power);
}
......@@ -1526,7 +1528,16 @@ static void nr_ue_max_mcs_min_rb(int mu,
*Rb,
*mcs,
ph_limit);
/*else if (*Rb<10) LOG_I(NR_MAC,"Qm %d (table %d), R %d, Nl %d, nb_rb %d, mcs %d, ph_limit %d, tx_power %d, tbs_bits %d,nrOfSymbols %d, dmrs_re %d\n",Qm,ul_bwp->mcs_table,R,sched_pusch->nrOfLayers,*Rb,*mcs,ph_limit,tx_power,tbs_bits,sched_pusch->tda_info.nrOfSymbols,sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb);*/
/*else if (*Rb<10) { LOG_I(NR_MAC,"Qm %d (table %d), R %d, Nl %d, nb_rb %d, mcs %d, ph_limit %d, tx_power %d, tbs_bits %d,nrOfSymbols %d, dmrs_re %d\n",Qm,ul_bwp->mcs_table,R,sched_pusch->nrOfLayers,*Rb,*mcs,ph_limit,tx_power,tbs_bits,sched_pusch->tda_info.nrOfSymbols,sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb);
tx_power = compute_ph_factor(mu,
tbs_bits,
*Rb,
sched_pusch->nrOfLayers,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
1,1);
}*/
}
static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
......@@ -1846,7 +1857,7 @@ static void pf_ul(module_id_t module_id,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
0);
0,0);
LOG_D(NR_MAC,
"pf_ul %d.%d UE %x Scheduling PUSCH (no data) nrb %d mcs %d tbs %d bits phr_txpower %d\n",
frame,
......@@ -1985,7 +1996,7 @@ static void pf_ul(module_id_t module_id,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
0);
0,0);
sched_pusch->rbSize = rbSize;
sched_pusch->tb_size = TBS;
LOG_D(NR_MAC,
......@@ -2395,7 +2406,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
deltaMCS,
0);
0,0);
if(current_BWP->pusch_servingcellconfig &&
current_BWP->pusch_servingcellconfig->rateMatching) {
// TBS_LBRM according to section 5.4.2.1 of 38.212
......
......@@ -154,15 +154,20 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
output += snprintf(output, end - output, "%"PRIu64, stats->ul.rounds[0]);
for (int i = 1; i < gNB->ul_bler.harq_round_max; i++)
output += snprintf(output, end - output, "/%"PRIu64, stats->ul.rounds[i]);
char deltaMCS_str[100]="\0";
if (UE->current_UL_BWP.pusch_Config && UE->current_UL_BWP.pusch_Config->pusch_PowerControl->deltaMCS) {
sprintf(deltaMCS_str,"deltaMCS %d\n",UE->mac_stats.deltaMCS);
}
output += snprintf(output,
end - output,
", ulsch_DTX %d, ulsch_errors %" PRIu64 ", BLER %.5f MCS %d (Qm %d) SNR %d.%d dB\n",
", ulsch_DTX %d, ulsch_errors %" PRIu64 ", BLER %.5f MCS %d (Qm %d %s dB) NPRB %d SNR %d.%d dB\n",
stats->ulsch_DTX,
stats->ul.errors,
sched_ctrl->ul_bler_stats.bler,
sched_ctrl->ul_bler_stats.mcs,
nr_get_Qm_ul(sched_ctrl->ul_bler_stats.mcs,UE->current_UL_BWP.mcs_table),
deltaMCS_str,UE->mac_stats.NPRB,
sched_ctrl->pusch_snrx10 / 10,
sched_ctrl->pusch_snrx10 % 10);
output += snprintf(output,
......
......@@ -673,6 +673,8 @@ typedef struct NR_mac_stats {
uint8_t num_rsrp_meas;
char srs_stats[50]; // Statistics may differ depending on SRS usage
int pusch_snrx10;
int deltaMCS;
int NPRB;
} NR_mac_stats_t;
typedef struct NR_bler_options {
......
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