adapting nr_feptx_prec function to analog beam management

This commit is contained in:
francescomani
2025-06-10 12:11:51 +02:00
parent 3743719b88
commit e15631b23c
+24 -42
View File
@@ -175,57 +175,39 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
}
void nr_feptx_prec(RU_t *ru, int frame_tx, int tti_tx)
void nr_feptx_prec(RU_t *ru, int frame_tx, int slot_tx)
{
PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
PHY_VARS_gNB **gNB_list = ru->gNB_list;
AssertFatal(ru->num_gNB == 1, "Cannot handle more than 1 gNB\n");
PHY_VARS_gNB *gNB = gNB_list[0];
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
int slot_tx = tti_tx;
int txdataF_offset = (tti_tx*fp->samples_per_slot_wCP);
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
int txdataF_offset = slot_tx * fp->samples_per_slot_wCP;
start_meas(&ru->precoding_stats);
AssertFatal(ru->nb_log_antennas > 0, "ru->nb_log_antennas is 0!\n");
if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT)
return;
if (ru->num_gNB == 1) {
gNB = gNB_list[0];
if (gNB->common_vars.analog_bf) {
for (int i = 0; i < ru->num_beams_period; i++) {
memcpy((void*) &ru->common.beam_id[i][slot_tx * fp->symbols_per_slot],
(void*) &gNB->common_vars.beam_id[i][slot_tx * fp->symbols_per_slot],
(fp->symbols_per_slot) * sizeof(int));
}
}
if (ru->config.dbt_config.num_dig_beams != 0) {
for(int i = 0; i < gNB->common_vars.num_beams_period; ++i) {
memcpy((void*) &ru->common.beam_id[i][slot_tx * fp->symbols_per_slot],
(void*) &gNB->common_vars.beam_id[i][slot_tx * fp->symbols_per_slot],
(fp->symbols_per_slot) * sizeof(int));
}
}
if (ru->config.dbt_config.num_dig_beams == 0 || gNB->common_vars.analog_bf) {
for (int i = 0; i < ru->nb_log_antennas; ++i) {
// TODO hardcoded beam to 0, still need to understand how to handle this properly
memcpy(ru->common.txdataF_BF[i], &gNB->common_vars.txdataF[0][i][txdataF_offset], fp->samples_per_slot_wCP * sizeof(int32_t));
}
}
else {
for(int i = 0; i < ru->nb_log_antennas; ++i) {
// TODO hardcoded beam to 0, still need to understand how to handle this properly
memcpy(ru->common.txdataF[i], &gNB->common_vars.txdataF[0][i][txdataF_offset], fp->samples_per_slot_wCP * sizeof(int32_t));
}
for (int l = 0; l < fp->symbols_per_slot; l++) {
for (int aa = 0; aa < ru->nb_tx; aa++) {
AssertFatal(false, "This needs to be fixed by using appropriate beams from config\n");
nr_beam_precoding((c16_t **)ru->common.txdataF,
(c16_t **)ru->common.txdataF_BF,
fp,
ru->beam_weights[0],
tti_tx,
l,
aa,
ru->nb_log_antennas,
0);
}
// If there is no digital beamforming we just need to copy the data to RU
if (ru->config.dbt_config.num_dig_beams == 0 || ru->gNB_list[0]->common_vars.analog_bf) {
for (int b = 0; b < ru->num_beams_period; b++) {
for (int i = 0; i < ru->nb_tx; ++i) {
int tx_idx = i + b * ru->nb_tx;
memcpy((void*)&ru->common.txdataF_BF[tx_idx][txdataF_offset],
(void*)&gNB->common_vars.txdataF[b][i][txdataF_offset],
fp->samples_per_slot_wCP * sizeof(int32_t));
}
}
} else {
AssertFatal(false, "This needs to be fixed by using appropriate beams from config\n");
}
stop_meas(&ru->precoding_stats);
}
@@ -264,7 +246,7 @@ void nr_feptx(void *arg)
(void*)&ru->gNB_list[0]->common_vars.txdataF[bb][aa][txdataF_offset],
numSamples * sizeof(int32_t));
else {
AssertFatal(false, "This needs to be fixed by using appropriate beams from config\n");
AssertFatal(false, "This needs to be fixed by using appropriate beams from config\n");
}
if (tx_idx == 0)