move PL comutation at MAC
This commit is contained in:
@@ -119,7 +119,6 @@ typedef struct {
|
||||
uint16_t cell_id;
|
||||
uint16_t ssb_start_subcarrier;
|
||||
short rsrp_dBm;
|
||||
int16_t pathloss;
|
||||
} fapi_nr_ssb_pdu_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -122,8 +122,6 @@ void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
|
||||
uint32_t rx_power_fil_dB,
|
||||
uint8_t gNB_id);
|
||||
|
||||
void compute_nr_PL(PHY_VARS_NR_UE *ue, int ssb_index);
|
||||
|
||||
void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
|
||||
NR_UE_PDSCH **pdsch_vars,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
@@ -46,31 +46,6 @@
|
||||
//#define DEBUG_MEAS_UE
|
||||
//#define DEBUG_RANK_EST
|
||||
|
||||
// Returns the pathloss in dB for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission
|
||||
// computation according to clause 7.4 (Physical random access channel) of 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
// Assumptions:
|
||||
// - PRACH transmission from a UE is not in response to a detection of a PDCCH order by the UE
|
||||
// Measurement units:
|
||||
// - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm)
|
||||
void compute_nr_PL(PHY_VARS_NR_UE *ue, int ssb_index){
|
||||
|
||||
//TODO improve PL measurements. Probably not correct as it is.
|
||||
|
||||
long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power;
|
||||
int16_t pathloss = (int16_t)(referenceSignalPower - ue->measurements.ssb_rsrp_dBm[ssb_index]);
|
||||
|
||||
LOG_D(PHY, "In %s: pathloss %d dB, UE RX total gain %d dB, referenceSignalPower %ld dBm/RE (%f mW), RSRP %d dBm (%f mW)\n",
|
||||
__FUNCTION__,
|
||||
pathloss,
|
||||
ue->rx_total_gain_dB,
|
||||
referenceSignalPower,
|
||||
pow(10, referenceSignalPower/10),
|
||||
ue->measurements.ssb_rsrp_dBm[ssb_index],
|
||||
pow(10, ue->measurements.ssb_rsrp_dBm[ssb_index]/10));
|
||||
|
||||
ue->measurements.pathloss = pathloss;
|
||||
}
|
||||
|
||||
uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
|
||||
@@ -147,8 +147,6 @@ typedef struct {
|
||||
//! total estimated noise power (dBm)
|
||||
short n0_power_tot_dBm;
|
||||
|
||||
int16_t pathloss;
|
||||
|
||||
// UE measurements
|
||||
//! estimated received spatial signal power (linear)
|
||||
int rx_spatial_power[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
|
||||
@@ -596,7 +594,6 @@ typedef struct {
|
||||
// when off, defaults to frequency domain interpolation
|
||||
int chest_freq;
|
||||
int chest_time;
|
||||
int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX];
|
||||
|
||||
|
||||
@@ -173,7 +173,6 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_start_subcarrier = frame_parms->ssb_start_subcarrier;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index];
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pathloss = ue->measurements.pathloss;
|
||||
break;
|
||||
case FAPI_NR_CSIRS_IND:
|
||||
memcpy(&rx_ind->rx_indication_body[n_pdus - 1].csirs_measurements,
|
||||
@@ -1100,7 +1099,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
|
||||
LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||
nr_ue_pbch_procedures(gNB_id, ue, proc, estimateSz, dl_ch_estimates, phy_pdcch_config);
|
||||
compute_nr_PL(ue, ssb_index);
|
||||
|
||||
if (ue->no_timing_correction==0) {
|
||||
LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_slot_rx, ue->no_timing_correction);
|
||||
|
||||
@@ -213,12 +213,8 @@ void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
|
||||
pucch_pdu = &pucch_vars->pucch_pdu[i];
|
||||
uint16_t nb_of_prbs = pucch_pdu->prb_size;
|
||||
/* Generate PUCCH signal according to its format and parameters */
|
||||
ue->generate_ul_signal[gNB_id] = 1;
|
||||
|
||||
int16_t PL = ue->measurements.pathloss; /* LTE function because NR path loss not yet implemented FFS TODO NR */
|
||||
int contributor = (10 * log10((double)(pow(2,(ue->frame_parms.numerology_index)) * nb_of_prbs)));
|
||||
|
||||
int16_t pucch_tx_power = pucch_pdu->pucch_tx_power + contributor + PL;
|
||||
int16_t pucch_tx_power = pucch_pdu->pucch_tx_power;
|
||||
|
||||
if (pucch_tx_power > ue->tx_power_max_dBm)
|
||||
pucch_tx_power = ue->tx_power_max_dBm;
|
||||
|
||||
@@ -370,8 +370,6 @@ typedef struct {
|
||||
uint32_t ssb_index;
|
||||
/// SSB RSRP in dBm
|
||||
short ssb_rsrp_dBm;
|
||||
/// SSB pathloss
|
||||
int16_t pathloss;
|
||||
|
||||
} NR_PHY_meas_t;
|
||||
|
||||
|
||||
@@ -309,6 +309,7 @@ void select_pucch_resource(NR_UE_MAC_INST_t *mac,
|
||||
PUCCH_sched_t *pucch);
|
||||
|
||||
int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
|
||||
int scs,
|
||||
NR_PUCCH_Config_t *pucch_Config,
|
||||
PUCCH_sched_t *pucch,
|
||||
uint8_t format_type,
|
||||
@@ -462,6 +463,8 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
|
||||
|
||||
void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type);
|
||||
|
||||
int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm);
|
||||
|
||||
// PUSCH scheduler:
|
||||
// - Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||
// - where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||
|
||||
@@ -125,7 +125,7 @@ int16_t get_prach_tx_power(module_id_t mod_id) {
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
int16_t pathloss = mac->phy_measurements.pathloss;
|
||||
int16_t pathloss = compute_nr_SSB_PL(mac, mac->phy_measurements.ssb_rsrp_dBm);
|
||||
int16_t ra_preamble_rx_power = (int16_t)(ra->prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER - pathloss + 30);
|
||||
return min(nr_get_Pcmax(mod_id), ra_preamble_rx_power);
|
||||
|
||||
@@ -678,7 +678,7 @@ void nr_get_prach_resources(module_id_t mod_id,
|
||||
} else {
|
||||
/* TODO: This controls the tx_power of UE and the ramping procedure of RA of UE. Later we
|
||||
can abstract this, perhaps in the proxy. But for the time being lets leave it as below. */
|
||||
int16_t dl_pathloss = !get_softmodem_params()->emulate_l1 ? mac->phy_measurements.pathloss : 0;
|
||||
int16_t dl_pathloss = !get_softmodem_params()->emulate_l1 ? compute_nr_SSB_PL(mac, mac->phy_measurements.ssb_rsrp_dBm) : 0;
|
||||
ssb_rach_config(ra, prach_resources, nr_rach_ConfigCommon, prach_pdu);
|
||||
ra_preambles_config(prach_resources, mac, dl_pathloss);
|
||||
LOG_D(MAC, "[RAPROC] - Selected RA preamble index %d for contention-based random access procedure... \n", ra->ra_PreambleIndex);
|
||||
|
||||
@@ -1746,16 +1746,17 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
pucch_pdu->pucch_tx_power = get_pucch_tx_power_ue(mac,
|
||||
scs,
|
||||
pucch_Config,
|
||||
pucch,
|
||||
pucch_pdu->format_type,
|
||||
pucch_pdu->prb_size,
|
||||
pucch_pdu->freq_hop_flag,
|
||||
pucch_pdu->add_dmrs_flag,
|
||||
pucch_pdu->nr_of_symbols,
|
||||
subframe_number,
|
||||
O_ACK, O_SR,
|
||||
O_CSI, O_CRC);
|
||||
pucch_pdu->nr_of_symbols,
|
||||
subframe_number,
|
||||
O_ACK, O_SR,
|
||||
O_CSI, O_CRC);
|
||||
}
|
||||
else AssertFatal(1==0,"problem with pucch configuration\n");
|
||||
|
||||
@@ -1795,6 +1796,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
|
||||
int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
|
||||
int scs,
|
||||
NR_PUCCH_Config_t *pucch_Config,
|
||||
PUCCH_sched_t *pucch,
|
||||
uint8_t format_type,
|
||||
@@ -1901,10 +1903,13 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
|
||||
return (PUCCH_POWER_DEFAULT);
|
||||
}
|
||||
|
||||
int16_t pucch_power = P_O_PUCCH + delta_F_PUCCH + DELTA_TF + G_b_f_c;
|
||||
int16_t pathloss = compute_nr_SSB_PL(mac, mac->phy_measurements.ssb_rsrp_dBm);
|
||||
int M_pucch_component = (10 * log10((double)(pow(2,scs) * nb_of_prbs)));
|
||||
|
||||
int16_t pucch_power = P_O_PUCCH + M_pucch_component + pathloss + delta_F_PUCCH + DELTA_TF + G_b_f_c;
|
||||
|
||||
NR_TST_PHY_PRINTF("PUCCH ( Tx power : %d dBm ) ( 10Log(...) : %d ) ( from Path Loss : %d ) ( delta_F_PUCCH : %d ) ( DELTA_TF : %d ) ( G_b_f_c : %d ) \n",
|
||||
pucch_power, contributor, PL, delta_F_PUCCH, DELTA_TF, G_b_f_c);
|
||||
pucch_power, M_pucch_component, pathloss, delta_F_PUCCH, DELTA_TF, G_b_f_c);
|
||||
|
||||
return (pucch_power);
|
||||
}
|
||||
@@ -4225,5 +4230,32 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Returns the pathloss in dB for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission
|
||||
// computation according to clause 7.4 (Physical random access channel) of 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
// Assumptions:
|
||||
// - PRACH transmission from a UE is not in response to a detection of a PDCCH order by the UE
|
||||
// Measurement units:
|
||||
// - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm)
|
||||
int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm)
|
||||
{
|
||||
|
||||
long referenceSignalPower;
|
||||
//TODO improve PL measurements. Probably not correct as it is.
|
||||
if (mac->scc)
|
||||
referenceSignalPower = mac->scc->ss_PBCH_BlockPower;
|
||||
else
|
||||
referenceSignalPower = mac->scc_SIB->ss_PBCH_BlockPower;
|
||||
|
||||
int16_t pathloss = (int16_t)(referenceSignalPower - ssb_rsrp_dBm);
|
||||
|
||||
LOG_D(NR_MAC, "pathloss %d dB, referenceSignalPower %ld dBm/RE (%f mW), RSRP %d dBm (%f mW)\n",
|
||||
pathloss,
|
||||
referenceSignalPower,
|
||||
pow(10, referenceSignalPower/10),
|
||||
ssb_rsrp_dBm,
|
||||
pow(10, ssb_rsrp_dBm/10));
|
||||
|
||||
return pathloss;
|
||||
}
|
||||
|
||||
@@ -1085,12 +1085,10 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t
|
||||
|
||||
}
|
||||
|
||||
void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm, int16_t pathloss) {
|
||||
|
||||
void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm)
|
||||
{
|
||||
mac->phy_measurements.ssb_index = ssb_index;
|
||||
mac->phy_measurements.ssb_rsrp_dBm = rsrp_dbm;
|
||||
mac->phy_measurements.pathloss = pathloss;
|
||||
|
||||
}
|
||||
|
||||
// L2 Abstraction Layer
|
||||
@@ -1235,8 +1233,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
case FAPI_NR_RX_PDU_TYPE_SSB:
|
||||
handle_ssb_meas(mac,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.rsrp_dBm,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pathloss);
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.rsrp_dBm);
|
||||
ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->phy_data,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.additional_bits,
|
||||
|
||||
Reference in New Issue
Block a user