Commit d5456c7b authored by Hongzhi Wang's avatar Hongzhi Wang

adding command line option for beam configuration

parent 49ea6c42
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n" #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_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_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_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_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" #define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
...@@ -63,6 +64,7 @@ ...@@ -63,6 +64,7 @@
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n" #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_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\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_DLF "Set the downlink frequency for all component carriers\n"
#define CONFIG_HLP_CHOFF "Channel id offset\n" #define CONFIG_HLP_CHOFF "Channel id offset\n"
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n" #define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
......
...@@ -106,6 +106,7 @@ unsigned int mmapped_dma=0; ...@@ -106,6 +106,7 @@ unsigned int mmapped_dma=0;
int single_thread_flag=1; int single_thread_flag=1;
int8_t threequarter_fs=0; int8_t threequarter_fs=0;
uint8_t gNB_beam_config = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
...@@ -839,6 +840,9 @@ int main( int argc, char **argv ) ...@@ -839,6 +840,9 @@ int main( int argc, char **argv )
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); 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) ) { if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n"); fprintf(stderr,"Getting configuration failed\n");
exit(-1); exit(-1);
...@@ -990,6 +994,9 @@ if(!IS_SOFTMODEM_NOS1) ...@@ -990,6 +994,9 @@ if(!IS_SOFTMODEM_NOS1)
load_softscope("nr",&p); 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) { if (nfapi_mode != 1 && nfapi_mode != 2) {
printf("Not NFAPI mode - call init_eNB_afterRU()\n"); printf("Not NFAPI mode - call init_eNB_afterRU()\n");
init_eNB_afterRU(); init_eNB_afterRU();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ {"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}, \ {"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}, \ {"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" #include "threads_t.h"
......
...@@ -785,6 +785,25 @@ void *UE_thread(void *arg) { ...@@ -785,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", 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 ); 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 flags = 0;
int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH; int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH;
if (slot_tx_usrp%10==7) if (slot_tx_usrp%10==7)
......
...@@ -126,6 +126,7 @@ uint32_t timing_advance = 0; ...@@ -126,6 +126,7 @@ uint32_t timing_advance = 0;
char *usrp_args = NULL; char *usrp_args = NULL;
char *rrc_config_path = NULL; char *rrc_config_path = NULL;
int dumpframe = 0; int dumpframe = 0;
uint8_t UE_beam_config = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[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){ ...@@ -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->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_total_gain_dB = (int)tx_gain[CC_id][0];
UE->tx_power_max_dBm = tx_max_power[CC_id]; 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 // Set FP variables
NR_DL_FRAME_PARMS *fp = &UE->frame_parms; NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \ {"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-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-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}, \ {"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}, \ {"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} \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \
......
...@@ -278,7 +278,13 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue, ...@@ -278,7 +278,13 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
} }
} }
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; 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 { } else {
......
...@@ -780,6 +780,8 @@ typedef struct PHY_VARS_gNB_s { ...@@ -780,6 +780,8 @@ typedef struct PHY_VARS_gNB_s {
unsigned char first_run_I0_measurements; unsigned char first_run_I0_measurements;
uint8_t gNB_beam_config;
unsigned char is_secondary_gNB; // primary by default unsigned char is_secondary_gNB; // primary by default
unsigned char is_init_sync; /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system. unsigned char is_init_sync; /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
......
...@@ -853,6 +853,7 @@ typedef struct { ...@@ -853,6 +853,7 @@ typedef struct {
/// \brief Frame parame before ho used to recover if ho fails. /// \brief Frame parame before ho used to recover if ho fails.
NR_DL_FRAME_PARMS frame_parms_before_ho; NR_DL_FRAME_PARMS frame_parms_before_ho;
NR_UE_COMMON common_vars; NR_UE_COMMON common_vars;
uint8_t UE_beam_config;
nr_ue_if_module_t *if_inst; nr_ue_if_module_t *if_inst;
......
...@@ -76,6 +76,15 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -76,6 +76,15 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
uint16_t ssb_start_symbol, rel_slot; uint16_t ssb_start_symbol, rel_slot;
int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP;
uint16_t slots_per_hf = (fp->slots_per_frame)>>1; 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; n_hf = fp->half_frame_bit;
...@@ -106,14 +115,16 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -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 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); 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_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, 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) 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 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)) { if (T_ACTIVE(T_GNB_PHY_MIB)) {
unsigned char bch[3]; unsigned char bch[3];
...@@ -127,7 +138,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -127,7 +138,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
&gNB->ssb_pdu, &gNB->ssb_pdu,
gNB->nr_pbch_interleaver, gNB->nr_pbch_interleaver,
&txdataF[0][txdataF_offset], &txdataF[0][txdataF_offset],
AMP, amp_beam[beamid],
ssb_start_symbol, ssb_start_symbol,
n_hf, frame, cfg, fp); n_hf, frame, cfg, fp);
...@@ -137,7 +148,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -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"); LOG_W(PHY,"beamforming currently not supported for more than one SSB per slot\n");
} }
else if (ssb_per_slot==1) { 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++) 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; gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value;
} }
......
...@@ -1684,7 +1684,7 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL ...@@ -1684,7 +1684,7 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
int ssb_slot_decoded = (fp->ssb_index>>1) + ((fp->ssb_index>>4)<<1); //slot in which the decoded SSB can be found 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); //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) { if (config->ssb_table.ssb_period == 0) {
// check for pbch in corresponding slot each half frame // check for pbch in corresponding slot each half frame
...@@ -1705,14 +1705,14 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL ...@@ -1705,14 +1705,14 @@ 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) { 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); //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) if (ue->measurements.first_beam_meas)
{ {
ue->measurements.frame_last_beam = frame_rx; ue->measurements.frame_last_beam = frame_rx;
ue->measurements.first_beam_meas = 0; 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); //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) //if (ue->measurements.ue_beam_cnt == -1)
// ue->measurements.beam_select_ready = 0; // ue->measurements.beam_select_ready = 0;
...@@ -1727,7 +1727,7 @@ void nr_get_beam_cnt(PHY_VARS_NR_UE *ue, int frame_rx, uint16_t nb_ssbri_cri) { ...@@ -1727,7 +1727,7 @@ void nr_get_beam_cnt(PHY_VARS_NR_UE *ue, int frame_rx, uint16_t nb_ssbri_cri) {
ue->measurements.gnb_beam_cnt = 0; 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); //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) { void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri) {
...@@ -1735,9 +1735,9 @@ void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri) ...@@ -1735,9 +1735,9 @@ void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri)
uint32_t rsrp_temp = 0; uint32_t rsrp_temp = 0;
int ue_beam_temp = 0; int ue_beam_temp = 0;
int gnb_beam_temp = 0; int gnb_beam_temp = 0;
printf("nb_ssbri_cri %d\n", nb_ssbri_cri); //printf("nb_ssbri_cri %d\n", nb_ssbri_cri);
if ((ue->measurements.ue_beam_cnt ==3) && ((nb_ssbri_cri-1)==ue->measurements.gnb_beam_cnt)){ 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 i = 0; i < 4; i++){
for (int j = 0; j < nb_ssbri_cri; j++){ for (int j = 0; j < nb_ssbri_cri; j++){
if (ue->measurements.rsrp[gNB_id][i][j] > rsrp_temp){ if (ue->measurements.rsrp[gNB_id][i][j] > rsrp_temp){
...@@ -1745,7 +1745,7 @@ void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri) ...@@ -1745,7 +1745,7 @@ void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri)
ue_beam_temp = i; ue_beam_temp = i;
gnb_beam_temp = j; gnb_beam_temp = j;
//beam_pair[cnt_gnb_beam]= cnt_ue_beam; //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); //printf("loop temp %d beam ue %d gnb %d rsrp %d\n",ue_beam_temp,i,j,rsrp_temp);
} }
} }
} }
...@@ -1753,7 +1753,9 @@ void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri) ...@@ -1753,7 +1753,9 @@ void nr_get_best_beam(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint16_t nb_ssbri_cri)
ue->measurements.best_beam_gnb = gnb_beam_temp; ue->measurements.best_beam_gnb = gnb_beam_temp;
ue->measurements.ue_beam_cnt = -1; ue->measurements.ue_beam_cnt = -1;
ue->measurements.beam_select_ready = 1; ue->measurements.beam_select_ready = 1;
printf("best ue beam %d gnb %d ready %d\n",ue_beam_temp, gnb_beam_temp, ue->measurements.beam_select_ready); printf("============================================\n");
printf("Best UE beam ID %d gNB beam ID %d \n",ue_beam_temp, gnb_beam_temp);
printf("============================================\n");
} }
} }
...@@ -1778,6 +1780,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1778,6 +1780,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
NR_UE_MAC_INST_t *mac = get_mac_inst(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; 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; 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); //printf("nb ssbri cri %d\n", nb_ssbri_cri);
...@@ -1842,8 +1845,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1842,8 +1845,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
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); 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); nr_ue_pbch_procedures(gNB_id, ue, proc, 0);
if (ue->measurements.best_beam_gnb == ue->measurements.gnb_beam_cnt) //gnb_ssb_table[ue->measurements.gnb_beam_cnt]= mac->mib_ssb;
mac->best_init_ssb_id = 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) { if (ue->no_timing_correction==0) {
LOG_I(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);
......
...@@ -1803,11 +1803,12 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1803,11 +1803,12 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
mac->generate_nr_prach = 0; // Reset flag for PRACH generation mac->generate_nr_prach = 0; // Reset flag for PRACH generation
best_ssb_id = mac->best_init_ssb_id; best_ssb_id = mac->best_init_ssb_id;
printf("mac best init beam id %d\n", best_ssb_id); //printf("mac best init beam id %d\n", best_ssb_id);
if (is_nr_UL_slot(scc, slotP)) { 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 // 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, is_nr_prach_slot = get_nr_prach_info_from_ssb_index(selected_gnb_ssb_idx,
......
...@@ -416,7 +416,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp ...@@ -416,7 +416,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
int flags_msb = (flags>>8)&0xff; int flags_msb = (flags>>8)&0xff;
int beam_enabled = (flags_msb>>3)&1; int beam_enabled = (flags_msb>>3)&1;
int beam_id = flags_msb&7; 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++) { for (int i=0; i<FD_SETSIZE; i++) {
......
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