Commit 3a924009 authored by Bo Zhao's avatar Bo Zhao Committed by Thomas Schlichter

DL AMC based on the SINR report from UE

- get the reported SINR value from the index
- use BLER vs SNR look-up table from dlsim simulation (BLER threshold 10^-3)
- add a flag at gNB from CML to activate AMC
- add additional SINR offset at gNB from CML, to apply to the reported value for DL AMC
parent c61d0b6c
...@@ -130,13 +130,15 @@ ...@@ -130,13 +130,15 @@
#define CONFIG_HLP_FI_ScalingFD "Set the I scaling factor (denominator) of the PID controller for the Doppler compensation at UE side" #define CONFIG_HLP_FI_ScalingFD "Set the I scaling factor (denominator) of the PID controller for the Doppler compensation at UE side"
#define CONFIG_HLP_FD_ScalingFN "Set the D scaling factor (numerator) of the PID controller for the Doppler compensation at UE side" #define CONFIG_HLP_FD_ScalingFN "Set the D scaling factor (numerator) of the PID controller for the Doppler compensation at UE side"
#define CONFIG_HLP_FD_ScalingFD "Set the D scaling factor (denominator) of the PID controller for the Doppler compensation at UE side" #define CONFIG_HLP_FD_ScalingFD "Set the D scaling factor (denominator) of the PID controller for the Doppler compensation at UE side"
#define CONFIG_HLP_FO_PScaling "set P scaling factor of the PID controller for the frequency offset compensation" #define CONFIG_HLP_FO_PScaling "set P scaling factor of the PID controller for the frequency offset compensation"
#define CONFIG_HLP_FO_IScaling "set I scaling factor of the PID controller for the frequency offset compensation" #define CONFIG_HLP_FO_IScaling "set I scaling factor of the PID controller for the frequency offset compensation"
#define CONFIG_HLP_TP_Scaling "set scaling P for TO" #define CONFIG_HLP_TP_Scaling "set scaling P for TO"
#define CONFIG_HLP_TI_Scaling "set scaling I for TO" #define CONFIG_HLP_TI_Scaling "set scaling I for TO"
#define CONFIG_HLP_TO_Iinit "Init the I part of the PI controller for timing offset compensation" #define CONFIG_HLP_TO_Iinit "Init the I part of the PI controller for timing offset compensation"
#define CONFIG_HLP_AGC "Enable Receive Automatic Gain control" #define CONFIG_HLP_AGC "Enable Receive Automatic Gain control"
#define CONFIG_HLP_ULPC "Enable NR Uplink power control for PUSCH and PUCCH" #define CONFIG_HLP_ULPC "Enable NR Uplink power control for PUSCH and PUCCH"
#define CONFIG_HLP_AMC "flag to use adaptive modulation and coding: 1 = use AMC \n"
#define CONFIG_HLP_SINR_OSET_DL "Additional SINR offset in [dB] applied to the reported SINR from UE for DL AMC \n"
/*--------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */ /* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
......
...@@ -42,10 +42,14 @@ ...@@ -42,10 +42,14 @@
{"PET" , CONFIG_HLP_PathEnd, 0, .u16ptr=&pathEndingTime, .defintval=1280, TYPE_UINT16, 0}, \ {"PET" , CONFIG_HLP_PathEnd, 0, .u16ptr=&pathEndingTime, .defintval=1280, TYPE_UINT16, 0}, \
{"ue_PosY" , CONFIG_HLP_uePosY, 0, .iptr=&uePosY, .defintval=0, TYPE_INT, 0}, \ {"ue_PosY" , CONFIG_HLP_uePosY, 0, .iptr=&uePosY, .defintval=0, TYPE_INT, 0}, \
{"FDC" , CONFIG_HLP_FDopplerPrePost,0, .iptr=&fdopplerPrePost, .defintval=0, TYPE_INT32, 0}, \ {"FDC" , CONFIG_HLP_FDopplerPrePost,0, .iptr=&fdopplerPrePost, .defintval=0, TYPE_INT32, 0}, \
{"FC" , CONFIG_HLP_FDopplerComp, 0, .iptr=&fdopplerComp, .defintval=0, TYPE_INT32, 0} \ {"FC" , CONFIG_HLP_FDopplerComp, 0, .iptr=&fdopplerComp, .defintval=0, TYPE_INT32, 0}, \
{"amc" , CONFIG_HLP_AMC, 0, .u8ptr=&amc_flag, .defdblval=0, TYPE_UINT8, 0}, \
{"sinr-offset-dl" , CONFIG_HLP_SINR_OSET_DL, 0, .dblptr=&sinr_offset_dl, .defdblval=0, TYPE_DOUBLE, 0} \
} }
// clang-format on // clang-format on
extern uint8_t amc_flag; // flag to use adaptive modulation and coding
extern double sinr_offset_dl; // additional SINR offset in [dB] applied to the reported SINR from UE for DL AMC
extern uint32_t target_dl_mcs; extern uint32_t target_dl_mcs;
extern uint32_t target_dl_Nl; extern uint32_t target_dl_Nl;
extern uint32_t target_ul_Nl; extern uint32_t target_ul_Nl;
......
...@@ -53,6 +53,13 @@ ...@@ -53,6 +53,13 @@
#define WORD 32 #define WORD 32
//#define SIZE_OF_POINTER sizeof (void *) //#define SIZE_OF_POINTER sizeof (void *)
// look-up table for AMC. Based on BLER vs SNR curves from the DLsim simulation
// SNR Thresholds for MCS 0 - 28; with a resolution of 0.5dB; to maintain a BLER of 10^-3;
// [min <= ... < max] for each MCS
const uint8_t Nr_MCS = 29; // 0-28
float SINR_MCS_mapping[29] = {3, 3, 3.5, 4, 4.5, 5, 5.5, 6, 7, 7.5, 9.5, 10, 11, 11.5, 12.5,
13, 13.5, 15, 16, 16.5, 17.5, 18, 19, 20, 21, 22, 23, 24, 25.5};
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot) { const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot) {
/* we assume that this function is mutex-protected from outside */ /* we assume that this function is mutex-protected from outside */
...@@ -583,6 +590,19 @@ static int comparator(const void *p, const void *q) { ...@@ -583,6 +590,19 @@ static int comparator(const void *p, const void *q) {
return ((UEsched_t*)p)->coef < ((UEsched_t*)q)->coef; return ((UEsched_t*)p)->coef < ((UEsched_t*)q)->coef;
} }
uint8_t get_MCS_from_SINR(float SINR)
{
for (int i = Nr_MCS - 1; i >= 0; i--) {
if (SINR >= SINR_MCS_mapping[i])
return i;
}
LOG_I(MAC, "SINR (%f dB) too low, no MCS possible to achieve BLER of 10^-3\n", SINR);
return 0;
}
extern uint8_t amc_flag; // flag to use adaptive modulation and coding
extern double sinr_offset_dl; // additional SINR offset in [dB] applied to the reported SINR from UE for DL AMC
static void pf_dl(module_id_t module_id, static void pf_dl(module_id_t module_id,
frame_t frame, frame_t frame,
sub_frame_t slot, sub_frame_t slot,
...@@ -657,7 +677,10 @@ static void pf_dl(module_id_t module_id, ...@@ -657,7 +677,10 @@ static void pf_dl(module_id_t module_id,
const NR_bler_options_t *bo = &mac->dl_bler; const NR_bler_options_t *bo = &mac->dl_bler;
const int max_mcs_table = current_BWP->mcsTableIdx == 1 ? 27 : 28; const int max_mcs_table = current_BWP->mcsTableIdx == 1 ? 27 : 28;
const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table); const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table);
if (bo->harq_round_max == 1) if (amc_flag) {
float SINR = get_measured_sinr(sched_ctrl->CSI_report.ssb_cri_report.SINR);
sched_pdsch->mcs = min(get_MCS_from_SINR(SINR + sinr_offset_dl), max_mcs);
} else if (bo->harq_round_max == 1)
sched_pdsch->mcs = max_mcs; sched_pdsch->mcs = max_mcs;
else else
sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame);
......
...@@ -41,6 +41,8 @@ extern RAN_CONTEXT_t RC; ...@@ -41,6 +41,8 @@ extern RAN_CONTEXT_t RC;
//#define ENABLE_MAC_PAYLOAD_DEBUG 1 //#define ENABLE_MAC_PAYLOAD_DEBUG 1
uint8_t amc_flag = 0; // flag to use adaptive modulation and coding
double sinr_offset_dl = 0.0; // additional SINR offset in [dB] applied to the reported SINR from UE for DL AMC
uint32_t target_dl_mcs = 9; uint32_t target_dl_mcs = 9;
uint32_t target_dl_Nl = 1; uint32_t target_dl_Nl = 1;
uint32_t target_dl_bw = 50; uint32_t target_dl_bw = 50;
...@@ -154,7 +156,13 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -154,7 +156,13 @@ void nr_preprocessor_phytest(module_id_t module_id,
&tda_info, &tda_info,
target_dl_Nl); target_dl_Nl);
sched_pdsch->mcs = target_dl_mcs; if (amc_flag) {
if (sched_ctrl->retrans_dl_harq.head == -1) { // first transmission only
float SINR = get_measured_sinr(sched_ctrl->CSI_report.ssb_cri_report.SINR);
sched_pdsch->mcs = get_MCS_from_SINR(SINR + sinr_offset_dl);
}
} else
sched_pdsch->mcs = target_dl_mcs;
sched_pdsch->nrOfLayers = target_dl_Nl; sched_pdsch->nrOfLayers = target_dl_Nl;
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
......
...@@ -113,40 +113,51 @@ int ssb_rsrp_sorted[MAX_NUM_SSB] = {0}; ...@@ -113,40 +113,51 @@ int ssb_rsrp_sorted[MAX_NUM_SSB] = {0};
//Stored all the upper limits[Max RSRP Value of corresponding index] //Stored all the upper limits[Max RSRP Value of corresponding index]
//stored -1 for invalid values //stored -1 for invalid values
static const int L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[128] = { static const int L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 - 9 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 - 9
-1, -1, -1, -1, -1, -1, INT_MIN, -140, -139, -138, // 10 - 19 -1, -1, -1, -1, -1, -1, INT_MIN, -140, -139, -138, // 10 - 19
-137, -136, -135, -134, -133, -132, -131, -130, -129, -128, // 20 - 29 -137, -136, -135, -134, -133, -132, -131, -130, -129, -128, // 20 - 29
-127, -126, -125, -124, -123, -122, -121, -120, -119, -118, // 30 - 39 -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, // 30 - 39
-117, -116, -115, -114, -113, -112, -111, -110, -109, -108, // 40 - 49 -117, -116, -115, -114, -113, -112, -111, -110, -109, -108, // 40 - 49
-107, -106, -105, -104, -103, -102, -101, -100, -99, -98, // 50 - 59 -107, -106, -105, -104, -103, -102, -101, -100, -99, -98, // 50 - 59
-97, -96, -95, -94, -93, -92, -91, -90, -89, -88, // 60 - 69 -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, // 60 - 69
-87, -86, -85, -84, -83, -82, -81, -80, -79, -78, // 70 - 79 -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, // 70 - 79
-77, -76, -75, -74, -73, -72, -71, -70, -69, -68, // 80 - 89 -77, -76, -75, -74, -73, -72, -71, -70, -69, -68, // 80 - 89
-67, -66, -65, -64, -63, -62, -61, -60, -59, -58, // 90 - 99 -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, // 90 - 99
-57, -56, -55, -54, -53, -52, -51, -50, -49, -48, // 100 - 109 -57, -56, -55, -54, -53, -52, -51, -50, -49, -48, // 100 - 109
-47, -46, -45, -44, INT_MAX, -1, -1, -1, -1, -1, // 110 - 119 -47, -46, -45, -44, INT_MAX, -1, -1, -1, -1, -1, // 110 - 119
-1, -1, -1, -1, -1, -1, -1, -1 // 120 - 127 -1, -1, -1, -1, -1, -1, -1, -1 // 120 - 127
}; };
//Differential RSRP values Table 10.1.6.1-2 from 36.133 //Differential RSRP values Table 10.1.6.1-2 from 36.133
//Stored the upper limits[MAX RSRP Value] //Stored the upper limits[MAX RSRP Value]
static const int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = { static const int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = {
0, 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, // 0 - 9
-2, -20, -22, -24, -26, -28, -30 // 10 - 15
-4, };
-6,
-8, // Measured SINR Values Table 10.1.16.1-1 from 38.133 V16.7.0
-10, // Stored all the lower limits[Min SINR Value of corresponding index]
-12, float L1_SSB_CSI_SINR_measReport_mapping_38133_10_1_16_1_1[128] = {
-14, INT_MIN, -23, -22.5, -22, -21.5, -21, -20.5, -20, -19.5, -19, // 0 - 9
-16, -18.5, -18, -17.5, -17, -16.5, -16, -15.5, -15, -14.5, -14, // 10 - 19
-18, // 0 - 9 -13.5, -13, -12.5, -12, -11.5, -11, -10.5, -10, -9.5, -9, // 20 - 29
-20, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, // 30 - 39
-22, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, // 40 - 49
-24, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, // 50 - 59
-26, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, // 60 - 69
-28, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 15, 15.5, 16, // 70 - 79
-30 // 10 - 15 16.5, 17, 17.5, 18, 18.5, 19, 19.5, 20, 20.5, 21, // 80 - 89
21.5, 22, 22.5, 23, 23.5, 24, 24.5, 25, 25.5, 26, // 90 - 99
26.5, 27, 27.5, 28, 28.5, 29, 29.5, 30, 30.5, 31, // 100 - 109
31.5, 32, 32.5, 33, 33.5, 34, 34.5, 35, 35.5, 36, // 110 - 119
36.5, 37, 37.5, 38, 38.5, 39, 39.5, 40 // 120 - 127
};
// Differential SINR values Table 10.1.16.1-2 from 38.133 V16.7.0
// Stored the upper limits[MAX delta SINR Value]
int diff_sinr_ssb_csi_meas_10_1_16_1_2[16] = {
0, -1, -2, -3, -4, -5, -6, -7, -8, -9, // 0 - 9
-10, -11, -12, -13, -14, -15 // 10 - 15
}; };
static int get_pucch_index(int frame, int slot, int n_slots_frame, const NR_TDD_UL_DL_Pattern_t *tdd, int sched_pucch_size) static int get_pucch_index(int frame, int slot, int n_slots_frame, const NR_TDD_UL_DL_Pattern_t *tdd, int sched_pucch_size)
...@@ -488,6 +499,18 @@ static int get_diff_rsrp(uint8_t index, int strongest_rsrp) { ...@@ -488,6 +499,18 @@ static int get_diff_rsrp(uint8_t index, int strongest_rsrp) {
return MIN_RSRP_VALUE; return MIN_RSRP_VALUE;
} }
// returns the measured SINR value (lower limit)
float get_measured_sinr(uint8_t index)
{
// if index is invalid, return minimum value
if (index > 127) {
LOG_E(MAC, "%s: invalid SINR report index: %d\n", __func__, index);
return INT_MIN; // invalid index
}
return L1_SSB_CSI_SINR_measReport_mapping_38133_10_1_16_1_1[index];
}
//identifies the target SSB Beam index //identifies the target SSB Beam index
//keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally //keeps the required date for PDCCH and PDSCH TCI state activation/deactivation CE consutruction globally
//handles triggering of PDCCH and PDSCH MAC CEs //handles triggering of PDCCH and PDSCH MAC CEs
......
...@@ -455,4 +455,7 @@ void nr_mac_check_ul_failure(const gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ct ...@@ -455,4 +455,7 @@ void nr_mac_check_ul_failure(const gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ct
void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE); void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE);
float get_measured_sinr(uint8_t index);
uint8_t get_MCS_from_SINR(float SINR);
#endif /*__LAYER2_NR_MAC_PROTO_H__*/ #endif /*__LAYER2_NR_MAC_PROTO_H__*/
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