From a3cc9f730be04d1385a198dfba0bf8fdba9ea500 Mon Sep 17 00:00:00 2001 From: ChiehChun Date: Mon, 9 Nov 2020 22:30:49 +0100 Subject: [PATCH] Add dlsch_current_bytes and Calculate throughput --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 13 ++++++++++++- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 925d8fa807..6eb328c3d3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -435,6 +435,8 @@ bool allocate_retransmission(module_id_t module_id, return true; } +float thr_ue[MAX_MOBILES_PER_GNB]; + void pf_dl(module_id_t module_id, frame_t frame, sub_frame_t slot, @@ -445,6 +447,10 @@ void pf_dl(module_id_t module_id, const int UE_id = 0; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + float coeff_ue[MAX_MOBILES_PER_GNB]; + // UEs that could be scheduled + int ue_array[MAX_MOBILES_PER_GNB]; + NR_list_t UE_sched = { .head = -1, .next = ue_array, .tail = -1, .len = MAX_MOBILES_PER_GNB }; /* Loop UE_info->list to check retransmission */ for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { @@ -456,7 +462,10 @@ void pf_dl(module_id_t module_id, const rnti_t rnti = UE_info->rnti[UE_id]; /* Calculate Throughput */ - + const float a = 0.0005f; // corresponds to 200ms window + const uint32_t b = UE_info->mac_stats[UE_id].dlsch_current_bytes; + thr_ue[UE_id] = (1 - a) * thr_ue[UE_id] + a * b; + LOG_I(MAC,"thr_ue[%d] %f\n",UE_id, thr_ue[UE_id]); /* retransmission */ if (sched_ctrl->dl_harq_pid >= 0) { @@ -653,6 +662,7 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + UE_info->mac_stats[UE_id].dlsch_current_bytes = 0; /* update TA and set ta_apply every 10 frames. * Possible improvement: take the periodicity from input file. @@ -1068,6 +1078,7 @@ void nr_schedule_ue_spec(module_id_t module_id, } UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS; + UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS; UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; retInfo->rbSize = sched_ctrl->rbSize; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 5725e968fe..65aa1a1263 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -475,6 +475,7 @@ typedef struct { int dlsch_rounds[8]; int dlsch_errors; int dlsch_total_bytes; + int dlsch_current_bytes; int ulsch_rounds[8]; int ulsch_errors; int ulsch_total_bytes_scheduled;