mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Compare commits
3 Commits
multipleam
...
NR_beam_si
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5456c7b00 | ||
|
|
49ea6c4234 | ||
|
|
c2b067013c |
@@ -53,6 +53,7 @@
|
||||
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
|
||||
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
|
||||
#define CONFIG_HLP_UEFO "set UE to enable estimation and compensation of frequency offset\n"
|
||||
#define CONFIG_HLP_UEBC "set UE beam configuration\n"
|
||||
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
|
||||
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
|
||||
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
|
||||
@@ -63,6 +64,7 @@
|
||||
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
|
||||
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
|
||||
#define CONFIG_HLP_TADV "Set timing_advance\n"
|
||||
#define CONFIG_HLP_GNBBC "Set gNB beam configuration\n"
|
||||
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
|
||||
#define CONFIG_HLP_CHOFF "Channel id offset\n"
|
||||
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
|
||||
|
||||
@@ -106,6 +106,7 @@ unsigned int mmapped_dma=0;
|
||||
int single_thread_flag=1;
|
||||
|
||||
int8_t threequarter_fs=0;
|
||||
uint8_t gNB_beam_config = 0;
|
||||
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
@@ -838,6 +839,9 @@ int main( int argc, char **argv )
|
||||
configure_linux();
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
|
||||
//RC.gNB[0]->gNB_beam_config = gNB_beam_config;
|
||||
printf("gnb beam config %d\n", gNB_beam_config);
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
@@ -989,6 +993,9 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
p.ru=RC.ru[0];
|
||||
load_softscope("nr",&p);
|
||||
}
|
||||
|
||||
RC.gNB[0]->gNB_beam_config = gNB_beam_config;
|
||||
printf("rc.gnb 0 beam config %d\n", RC.gNB[0]->gNB_beam_config);
|
||||
|
||||
if (nfapi_mode != 1 && nfapi_mode != 2) {
|
||||
printf("Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
|
||||
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
|
||||
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
|
||||
{"gnb-beam-config" , CONFIG_HLP_GNBBC, 0, u8ptr:&gNB_beam_config, defintval:0, TYPE_UINT8, 0}, \
|
||||
}
|
||||
|
||||
#include "threads_t.h"
|
||||
|
||||
@@ -144,6 +144,11 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||
ue->Mod_id = UE_id;
|
||||
ue->mac_enabled = 1;
|
||||
ue->if_inst = nr_ue_if_module_init(0);
|
||||
ue->measurements.gnb_beam_cnt = -1;
|
||||
ue->measurements.ue_beam_cnt = 0;
|
||||
ue->measurements.first_beam_meas = 1;
|
||||
ue->measurements.frame_last_beam = 0;
|
||||
ue->measurements.beam_select_ready = 0;
|
||||
|
||||
// Setting UE mode to NOT_SYNCHED by default
|
||||
for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){
|
||||
@@ -780,6 +785,25 @@ void *UE_thread(void *arg) {
|
||||
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
|
||||
decoded_frame_rx, curMsg->proc.frame_rx );
|
||||
|
||||
/*int slot_type;
|
||||
|
||||
for (int i =0 ; i< slots_per_frame;i++){
|
||||
slot_type = nr_ue_slot_select(cfg, proc->frame_rx, i);
|
||||
if (slot_type == NR_UPLINK_SLOT && !first_uplink_save){
|
||||
slot_first_uplink = i;
|
||||
first_uplink_save = 1;
|
||||
}
|
||||
|
||||
if (slot_type == NR_DOWNLINK_SLOT && first_uplink_save){
|
||||
slot_last_uplink = i-1;
|
||||
first_uplink_save = 0;
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
int flags = 0;
|
||||
int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH;
|
||||
if (slot_tx_usrp%10==7)
|
||||
|
||||
@@ -126,6 +126,7 @@ uint32_t timing_advance = 0;
|
||||
char *usrp_args = NULL;
|
||||
char *rrc_config_path = NULL;
|
||||
int dumpframe = 0;
|
||||
uint8_t UE_beam_config = 0;
|
||||
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
@@ -306,8 +307,9 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
||||
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
||||
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
||||
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
||||
UE->UE_beam_config = UE_beam_config;
|
||||
|
||||
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction);
|
||||
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d UE_beam_config %d\n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction,UE_beam_config);
|
||||
|
||||
// Set FP variables
|
||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&UE_fo_compensation, defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-beam-config", CONFIG_HLP_UEBC, 0, u8ptr:&UE_beam_config, defintval:0, TYPE_UINT8, 0}, \
|
||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
|
||||
{"r" , CONFIG_HLP_PRB, 0, iptr:&(N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
|
||||
|
||||
@@ -267,6 +267,8 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
||||
|
||||
int Ncp = NFAPI_CP_NORMAL;
|
||||
int mu = cfg->ssb_config.scs_common.value;
|
||||
|
||||
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d l_ssb %lx \n",mu, fp->N_RB_DL, Ncp, fp->L_ssb);
|
||||
|
||||
#if DISABLE_LOG_X
|
||||
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
|
||||
|
||||
@@ -100,7 +100,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
//printf("adjust sync count_max_pos_ok = %d\n",count_max_pos_ok);
|
||||
|
||||
if(count_max_pos_ok > 10 && first_time == 1)
|
||||
if((count_max_pos_ok > 10) && (first_time == 1)&& (ue->measurements.beam_select_ready))
|
||||
{
|
||||
first_time = 0;
|
||||
ue->time_sync_cell = 1;
|
||||
|
||||
@@ -116,6 +116,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
|
||||
uint16_t rnti,
|
||||
RX_type_t rx_type);
|
||||
|
||||
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
|
||||
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index,int i, int j);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,7 +72,7 @@ int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
||||
10*log10((double)ue->measurements.rsrp[eNB_index]),
|
||||
ue->frame_parms.pdsch_config_common.referenceSignalPower);*/
|
||||
|
||||
return((int16_t)(((10*ue->rx_total_gain_dB) - dB_fixed_times10(ue->measurements.rsrp[gNB_index]))/10));
|
||||
return((int16_t)(((10*ue->rx_total_gain_dB) - dB_fixed_times10(ue->measurements.rsrp[gNB_index][0][0]))/10));
|
||||
// dB_fixed_times10(RSoffset*12*ue_g[Mod_id][CC_id]->frame_parms.N_RB_DL) +
|
||||
//(ue->frame_parms.pdsch_config_common.referenceSignalPower*10))/10));
|
||||
}
|
||||
@@ -89,7 +89,7 @@ uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||
}
|
||||
|
||||
|
||||
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index)
|
||||
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index,int i, int j)
|
||||
{
|
||||
|
||||
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is null\n");
|
||||
@@ -99,7 +99,7 @@ float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index)
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
if (ue)
|
||||
return (10*log10(ue->measurements.rsrp[gNB_index])-
|
||||
return (10*log10(ue->measurements.rsrp[gNB_index][i][j])-
|
||||
get_nr_rx_total_gain_dB(Mod_id,0) -
|
||||
10*log10(20*12));
|
||||
return -140.0;
|
||||
@@ -231,9 +231,11 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
{
|
||||
int aarx,rb, symbol_offset;
|
||||
int16_t *rxF;
|
||||
int beam_idx_gnb = ue->measurements.gnb_beam_cnt;
|
||||
int beam_idx_ue = ue->measurements.ue_beam_cnt;
|
||||
|
||||
uint16_t Nid_cell = ue->frame_parms.Nid_cell;
|
||||
uint8_t eNB_offset=0,l,nushift;
|
||||
uint8_t gNB_offset=0,l,nushift;
|
||||
uint16_t off,nb_rb;
|
||||
// NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
|
||||
@@ -245,7 +247,7 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
|
||||
symbol_offset = ue->frame_parms.ofdm_symbol_size*((ue->symbol_offset+1)%(ue->frame_parms.symbols_per_slot));
|
||||
|
||||
ue->measurements.rsrp[eNB_offset] = 0;
|
||||
ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb] = 0;
|
||||
|
||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
||||
nb_rb = 20;
|
||||
@@ -257,8 +259,8 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
|
||||
for (l=0; l<1; l++) {
|
||||
|
||||
LOG_D(PHY,"[UE %d] slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, l %d)\n",ue->Mod_id,slot,Nid_cell,nushift,
|
||||
eNB_offset,l);
|
||||
LOG_D(PHY,"[UE %d] slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, gNB_offset %d, l %d)\n",ue->Mod_id,slot,Nid_cell,nushift,
|
||||
gNB_offset,l);
|
||||
|
||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+ssb_offset+nushift)];
|
||||
@@ -267,7 +269,7 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
if (l==0) {
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
|
||||
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
|
||||
ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
|
||||
//printf("rb %d, off %d : %d\n",rb,off,((((int32_t)rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])));
|
||||
|
||||
off = (off+4) % ue->frame_parms.ofdm_symbol_size;
|
||||
@@ -276,21 +278,27 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
}
|
||||
|
||||
ue->measurements.rsrp[eNB_offset]/=nb_rb;
|
||||
if (beam_idx_ue == ue->UE_beam_config){
|
||||
// printf("ue beam config %d\n",ue->UE_beam_config);
|
||||
ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb]/=nb_rb;
|
||||
}
|
||||
else{
|
||||
ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb]/=(10*nb_rb);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
ue->measurements.rsrp[eNB_offset] = -93 ;
|
||||
ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb] = -93 ;
|
||||
}
|
||||
|
||||
|
||||
if (eNB_offset == 0)
|
||||
if (gNB_offset == 0)
|
||||
|
||||
LOG_I(PHY,"[UE %d] slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d)\n",
|
||||
ue->Mod_id,
|
||||
slot,eNB_offset,
|
||||
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
|
||||
10*log10(ue->measurements.rsrp[eNB_offset])-ue->rx_total_gain_dB,
|
||||
ue->measurements.rsrp[eNB_offset]);
|
||||
slot,gNB_offset,
|
||||
(gNB_offset>0) ? ue->measurements.adj_cell_id[gNB_offset-1] : ue->frame_parms.Nid_cell,
|
||||
10*log10(ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb])-ue->rx_total_gain_dB,
|
||||
ue->measurements.rsrp[gNB_offset][beam_idx_ue][beam_idx_gnb]);
|
||||
|
||||
}
|
||||
|
||||
@@ -395,8 +395,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
|
||||
10*log10(ue->measurements.rssi),
|
||||
ue->rx_total_gain_dB,
|
||||
ue->measurements.n0_power_tot_dBm,
|
||||
10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB,
|
||||
(10*log10(ue->measurements.rsrq[0])));
|
||||
10*log10(ue->measurements.rsrp[0][0][0])-ue->rx_total_gain_dB,
|
||||
(10*log10(ue->measurements.rsrq[0][0][0])));
|
||||
|
||||
/* LOG_I(PHY, "[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n",
|
||||
ue->Mod_id,
|
||||
|
||||
@@ -443,6 +443,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
//time_stats_t path_metric,sorting,update_LLR;
|
||||
// FT ?? cppcheck fix memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
|
||||
|
||||
// NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
|
||||
pbch_e_rx = &nr_ue_pbch_vars->llr[0];
|
||||
// clear LLR buffer
|
||||
@@ -606,6 +608,14 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
#endif
|
||||
|
||||
//if (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt)
|
||||
//mac->best_init_ssb_id = i_ssb;
|
||||
|
||||
//if (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt || ue->measurements.first_beam_meas)
|
||||
|
||||
|
||||
//if (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt || ue->measurements.first_beam_meas)
|
||||
{
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t rx_ind;
|
||||
|
||||
@@ -628,6 +638,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -779,6 +779,8 @@ typedef struct PHY_VARS_gNB_s {
|
||||
double N0;
|
||||
|
||||
unsigned char first_run_I0_measurements;
|
||||
|
||||
uint8_t gNB_beam_config;
|
||||
|
||||
|
||||
unsigned char is_secondary_gNB; // primary by default
|
||||
|
||||
@@ -185,10 +185,17 @@ typedef struct {
|
||||
uint32_t rssi;
|
||||
int n_adj_cells;
|
||||
unsigned int adj_cell_id[6];
|
||||
uint32_t rsrq[7];
|
||||
uint32_t rsrp[7];
|
||||
uint32_t rsrq[7][8][64];
|
||||
uint32_t rsrp[7][8][64];
|
||||
float rsrp_filtered[7]; // after layer 3 filtering
|
||||
float rsrq_filtered[7];
|
||||
int gnb_beam_cnt;
|
||||
int ue_beam_cnt;
|
||||
int first_beam_meas;
|
||||
int frame_last_beam;
|
||||
int best_beam_ue;
|
||||
int best_beam_gnb;
|
||||
int beam_select_ready;
|
||||
// common measurements
|
||||
//! estimated noise power (linear)
|
||||
unsigned int n0_power[NB_ANTENNAS_RX];
|
||||
@@ -846,6 +853,7 @@ typedef struct {
|
||||
/// \brief Frame parame before ho used to recover if ho fails.
|
||||
NR_DL_FRAME_PARMS frame_parms_before_ho;
|
||||
NR_UE_COMMON common_vars;
|
||||
uint8_t UE_beam_config;
|
||||
|
||||
nr_ue_if_module_t *if_inst;
|
||||
|
||||
|
||||
@@ -76,6 +76,15 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
|
||||
uint16_t ssb_start_symbol, rel_slot;
|
||||
int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP;
|
||||
uint16_t slots_per_hf = (fp->slots_per_frame)>>1;
|
||||
int16_t amp_beam[4] = {AMP, AMP, AMP, AMP};
|
||||
int beamid = 0;
|
||||
|
||||
for (int i= 0; i<4; i++){
|
||||
if (gNB->gNB_beam_config !=i)
|
||||
{
|
||||
amp_beam[i] = amp_beam[i]-60;
|
||||
}
|
||||
}
|
||||
|
||||
n_hf = fp->half_frame_bit;
|
||||
|
||||
@@ -106,14 +115,16 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
|
||||
|
||||
nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier
|
||||
|
||||
beamid = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value;
|
||||
|
||||
LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol);
|
||||
nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], amp_beam[beamid], ssb_start_symbol, cfg, fp);
|
||||
nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], amp_beam[beamid], ssb_start_symbol, cfg, fp);
|
||||
|
||||
if (cfg->carrier_config.num_tx_ant.value <= 4)
|
||||
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], amp_beam[beamid], ssb_start_symbol, cfg, fp);
|
||||
else
|
||||
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], amp_beam[beamid], ssb_start_symbol, cfg, fp);
|
||||
|
||||
if (T_ACTIVE(T_GNB_PHY_MIB)) {
|
||||
unsigned char bch[3];
|
||||
@@ -127,7 +138,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
|
||||
&gNB->ssb_pdu,
|
||||
gNB->nr_pbch_interleaver,
|
||||
&txdataF[0][txdataF_offset],
|
||||
AMP,
|
||||
amp_beam[beamid],
|
||||
ssb_start_symbol,
|
||||
n_hf, frame, cfg, fp);
|
||||
|
||||
@@ -137,7 +148,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
|
||||
LOG_W(PHY,"beamforming currently not supported for more than one SSB per slot\n");
|
||||
}
|
||||
else if (ssb_per_slot==1) {
|
||||
LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value);
|
||||
LOG_D(PHY,"slot %d, ssb_index %d, beam %d AMP %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value,amp_beam[beamid]);
|
||||
for (int j=0;j<fp->symbols_per_slot;j++)
|
||||
gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0
|
||||
#if T_TRACER
|
||||
if(slot == 0)
|
||||
T(T_UE_PHY_MEAS, T_INT(eNB_id), T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(nr_slot_rx),
|
||||
T_INT((int)(10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB)),
|
||||
T_INT((int)(10*log10(ue->measurements.rsrp[0][0][0])-ue->rx_total_gain_dB)),
|
||||
T_INT((int)ue->measurements.rx_rssi_dBm[0]),
|
||||
T_INT((int)(ue->measurements.rx_power_avg_dB[0] - ue->measurements.n0_power_avg_dB)),
|
||||
T_INT((int)ue->measurements.rx_power_avg_dB[0]),
|
||||
@@ -1683,6 +1683,8 @@ int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_
|
||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp) {
|
||||
|
||||
int ssb_slot_decoded = (fp->ssb_index>>1) + ((fp->ssb_index>>4)<<1); //slot in which the decoded SSB can be found
|
||||
|
||||
//printf("ssb_slot_decoded %d fp ssb index %d period %d\n", ssb_slot_decoded,fp->ssb_index,config->ssb_table.ssb_period);
|
||||
|
||||
if (config->ssb_table.ssb_period == 0) {
|
||||
// check for pbch in corresponding slot each half frame
|
||||
@@ -1701,6 +1703,62 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
|
||||
}
|
||||
|
||||
|
||||
|
||||
void nr_get_beam_cnt(PHY_VARS_NR_UE *ue, int frame_rx, uint16_t nb_ssbri_cri) {
|
||||
//printf("before frame temp %d frame rx %d first_beam_meas %d \n", ue->measurements.frame_last_beam, frame_rx, ue->measurements.first_beam_meas);
|
||||
if (ue->measurements.first_beam_meas)
|
||||
{
|
||||
ue->measurements.frame_last_beam = frame_rx;
|
||||
ue->measurements.first_beam_meas = 0;
|
||||
}
|
||||
|
||||
//printf("frame temp %d frame rx %d gnb beam %d ue beam %d\n", ue->measurements.frame_last_beam, frame_rx, ue->measurements.gnb_beam_cnt,ue->measurements.ue_beam_cnt);
|
||||
|
||||
//if (ue->measurements.ue_beam_cnt == -1)
|
||||
// ue->measurements.beam_select_ready = 0;
|
||||
|
||||
if (ue->measurements.frame_last_beam == frame_rx){
|
||||
ue->measurements.gnb_beam_cnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ue->measurements.ue_beam_cnt++;
|
||||
ue->measurements.frame_last_beam = frame_rx;
|
||||
ue->measurements.gnb_beam_cnt = 0;
|
||||
}
|
||||
|
||||
//printf("ue procedure gnb beam cnt %d frame_temp %d ue beam %d ready %d\n", ue->measurements.gnb_beam_cnt, ue->measurements.frame_last_beam,ue->measurements.ue_beam_cnt,ue->measurements.beam_select_ready);
|
||||
}
|
||||
|
||||
void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri) {
|
||||
|
||||
uint32_t rsrp_temp = 0;
|
||||
int ue_beam_temp = 0;
|
||||
int gnb_beam_temp = 0;
|
||||
//printf("nb_ssbri_cri %d\n", nb_ssbri_cri);
|
||||
|
||||
if ((ue->measurements.ue_beam_cnt ==4) && ((nb_ssbri_cri-1)==ue->measurements.gnb_beam_cnt)){
|
||||
for (int i = 0; i < 4; i++){
|
||||
for (int j = 0; j < nb_ssbri_cri; j++){
|
||||
if (ue->measurements.rsrp[gNB_id][i][j] > rsrp_temp){
|
||||
rsrp_temp = ue->measurements.rsrp[gNB_id][i][j];
|
||||
ue_beam_temp = i;
|
||||
gnb_beam_temp = j;
|
||||
//beam_pair[cnt_gnb_beam]= cnt_ue_beam;
|
||||
//printf("loop temp %d beam ue %d gnb %d rsrp %d\n",ue_beam_temp,i,j,rsrp_temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
ue->measurements.best_beam_ue = ue_beam_temp;
|
||||
ue->measurements.best_beam_gnb = gnb_beam_temp;
|
||||
ue->measurements.ue_beam_cnt = -1;
|
||||
ue->measurements.beam_select_ready = 1;
|
||||
printf("============================================\n");
|
||||
printf("Best UE beam ID %d gNB beam ID %d \n",ue_beam_temp, gnb_beam_temp);
|
||||
printf("============================================\n");
|
||||
}
|
||||
}
|
||||
|
||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t gNB_id,
|
||||
@@ -1717,7 +1775,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
uint8_t dci_cnt = 0;
|
||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
|
||||
//NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
uint16_t nb_ssbri_cri = 0;
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = mac->scg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
|
||||
uint16_t gnb_ssb_table[4] = {0,16,32,48};
|
||||
nb_ssbri_cri = 4; //*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1;
|
||||
|
||||
//printf("nb ssbri cri %d\n", nb_ssbri_cri);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
|
||||
|
||||
@@ -1739,7 +1805,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
|
||||
// looking for pbch only in slot where it is supposed to be
|
||||
if (slot_ssb) {
|
||||
LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||
LOG_I(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||
for (int i=1; i<4; i++) {
|
||||
|
||||
nr_slot_fep(ue,
|
||||
@@ -1757,18 +1823,40 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||
#endif
|
||||
}
|
||||
|
||||
nr_get_beam_cnt(ue,frame_rx, nb_ssbri_cri);
|
||||
|
||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
||||
nr_ue_rsrp_measurements(ue,proc,nr_slot_rx,0);
|
||||
if (ue->measurements.gnb_beam_cnt<nb_ssbri_cri)
|
||||
nr_ue_rsrp_measurements(ue,proc,nr_slot_rx, 0);
|
||||
//}
|
||||
|
||||
nr_get_best_beam(ue, gNB_id, nb_ssbri_cri);
|
||||
|
||||
//mac->best_init_ssb_id = ue->measurements.best_beam_gnb;
|
||||
|
||||
//if (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt || ue->measurements.first_beam_meas)
|
||||
//LOG_I(PHY," ------ before frame.slot %d.%d ------ best beam %d gnb beam cnt %d\n", frame_rx%1024, nr_slot_rx, ue->measurements.best_beam_gnb, ue->measurements.gnb_beam_cnt);
|
||||
|
||||
|
||||
if ((ue->decode_MIB == 1) && slot_pbch) {
|
||||
//if ((ue->decode_MIB == 1) && (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt)) { //&& slot_pbch
|
||||
if ((ue->decode_MIB == 1) ) { //&& slot_pbch
|
||||
|
||||
LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||
LOG_I(PHY," ------ Decode MIB: frame.slot %d.%d ------ best beam %d gnb beam cnt %d\n", frame_rx%1024, nr_slot_rx, ue->measurements.best_beam_gnb, ue->measurements.gnb_beam_cnt);
|
||||
nr_ue_pbch_procedures(gNB_id, ue, proc, 0);
|
||||
|
||||
//gnb_ssb_table[ue->measurements.gnb_beam_cnt]= mac->mib_ssb;
|
||||
|
||||
//printf("gnb_ssb_table %d gnb beamid %d best beam %d\n", gnb_ssb_table[ue->measurements.gnb_beam_cnt], ue->measurements.gnb_beam_cnt, ue->measurements.best_beam_gnb);
|
||||
|
||||
//if (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt)
|
||||
mac->best_init_ssb_id = gnb_ssb_table[ue->measurements.best_beam_gnb];
|
||||
|
||||
//for (int i=0; i<4; i++)
|
||||
//printf("loop gnb ssb table %d index %d\n",gnb_ssb_table[i],i);
|
||||
|
||||
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);
|
||||
LOG_I(PHY,"start adjust sync slot = %d no timing %d\n", nr_slot_rx, ue->no_timing_correction);
|
||||
nr_adjust_synch_ue(fp,
|
||||
ue,
|
||||
gNB_id,
|
||||
|
||||
@@ -95,6 +95,8 @@ binary_search_float_nr(
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
float diff_rsrp_meas[16] = {0,-2,-4,-6,-8,-10,-12,-14,-16,-18,-20,-22,-24,-26,-28,-30};
|
||||
/*
|
||||
void nr_generate_pucch0(int32_t **txdataF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
@@ -1361,9 +1363,18 @@ int get_csi_nr(NR_UE_MAC_INST_t *mac, PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32
|
||||
int nElem = 98;
|
||||
int rsrp_offset = 17;
|
||||
int csi_status = 0;
|
||||
uint16_t nb_ssbri_cri = 0;
|
||||
int best_beam_ue = ue->measurements.best_beam_ue;
|
||||
int best_beam_gnb = ue->measurements.best_beam_gnb;
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = mac->scg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
|
||||
if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)
|
||||
nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1;
|
||||
else
|
||||
nb_ssbri_cri = 1;
|
||||
|
||||
csi_status = get_nr_csi_bitlen(mac);
|
||||
rsrp_db[0] = get_nr_RSRP(0,0,0);
|
||||
rsrp_db[0] = get_nr_RSRP(0,0,0,best_beam_ue,best_beam_gnb);
|
||||
|
||||
|
||||
if (csi_status == 0) {
|
||||
@@ -1371,6 +1382,12 @@ int get_csi_nr(NR_UE_MAC_INST_t *mac, PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32
|
||||
}
|
||||
else {
|
||||
*csi_payload = binary_search_float_nr(RSRP_meas_mapping_nr,nElem, rsrp_db[0]) + rsrp_offset;
|
||||
|
||||
for (int i=1; i < nb_ssbri_cri; i++){
|
||||
if (i==best_beam_gnb) i++;
|
||||
rsrp_db[i] = get_nr_RSRP(0,0,0,best_beam_ue,i);
|
||||
*csi_payload = *csi_payload | binary_search_float_nr(diff_rsrp_meas,16,(rsrp_db[i]-rsrp_db[0]));
|
||||
}
|
||||
}
|
||||
|
||||
return (csi_status);
|
||||
|
||||
@@ -252,6 +252,10 @@ typedef struct {
|
||||
uint8_t generate_nr_prach;
|
||||
/// SSB index from MIB decoding
|
||||
uint8_t mib_ssb;
|
||||
/// TCI ssb index
|
||||
uint8_t tci_ssb_id;
|
||||
/// Best init ssb index
|
||||
uint8_t best_init_ssb_id;
|
||||
|
||||
//// FAPI-like interface message
|
||||
fapi_nr_ul_config_request_t *ul_config_request;
|
||||
|
||||
@@ -1784,6 +1784,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
uint16_t format, format0, format1, ncs;
|
||||
int is_nr_prach_slot;
|
||||
prach_occasion_info_t *prach_occasion_info_p;
|
||||
int best_ssb_id;
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
||||
|
||||
@@ -1800,10 +1801,14 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
|
||||
mac->RA_offset = 2; // to compensate the rx frame offset at the gNB
|
||||
mac->generate_nr_prach = 0; // Reset flag for PRACH generation
|
||||
|
||||
best_ssb_id = mac->best_init_ssb_id;
|
||||
//printf("mac best init beam id %d\n", best_ssb_id);
|
||||
|
||||
if (is_nr_UL_slot(scc, slotP)) {
|
||||
|
||||
uint8_t selected_gnb_ssb_idx = mac->mib_ssb;
|
||||
uint8_t selected_gnb_ssb_idx = best_ssb_id; //mac->mib_ssb;
|
||||
//printf("mac selected gnb beam id %d\n", mac->mib_ssb);
|
||||
|
||||
// Get any valid PRACH occasion in the current slot for the selected SSB index
|
||||
is_nr_prach_slot = get_nr_prach_info_from_ssb_index(selected_gnb_ssb_idx,
|
||||
@@ -4715,6 +4720,11 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
|
||||
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
|
||||
|
||||
NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated;
|
||||
NR_SetupRelease_PDSCH_Config_t *pdsch_Config = dl_bwp_Dedicated->pdsch_Config;
|
||||
|
||||
|
||||
//NR_UE_MAC_INST_t *UE_mac_inst = get_mac_inst(module_idP);
|
||||
//uint8_t scs = UE_mac_inst->mib->subCarrierSpacingCommon;
|
||||
//uint16_t bwp_ul_NB_RB = UE_mac_inst->initial_bwp_ul.N_RB;
|
||||
@@ -4829,6 +4839,9 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
|
||||
case DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH:
|
||||
// 38.321 Ch6.1.3.15
|
||||
mac_ce_len = 2;
|
||||
uint8_t tci_stateid = ((NR_TCI_PDCCH *)pdu_ptr)[1].TciStateId;
|
||||
uint8_t ssb_id = pdsch_Config->choice.setup->tci_StatesToAddModList->list.array[tci_stateid]->qcl_Type1.referenceSignal.choice.ssb;
|
||||
mac->tci_ssb_id = ssb_id;
|
||||
break;
|
||||
case DL_SCH_LCID_DUPLICATION_ACT:
|
||||
// 38.321 Ch6.1.3.11
|
||||
|
||||
@@ -416,7 +416,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
|
||||
int flags_msb = (flags>>8)&0xff;
|
||||
int beam_enabled = (flags_msb>>3)&1;
|
||||
int beam_id = flags_msb&7;
|
||||
LOG_I(HW,"sending %d samples at time: %ld, beam_enabled %d, beam_id %d\n", nsamps, timestamp, beam_enabled, beam_id);
|
||||
LOG_D(HW,"sending %d samples at time: %ld, beam_enabled %d, beam_id %d\n", nsamps, timestamp, beam_enabled, beam_id);
|
||||
|
||||
|
||||
for (int i=0; i<FD_SETSIZE; i++) {
|
||||
|
||||
Reference in New Issue
Block a user