Commit 16ab5979 authored by Khodr Saaifan's avatar Khodr Saaifan

Extend rfsim to enable muti transmit antennas for gNB+solve beamforming ssb_index 0 when nb_tx>1

parent f7dc17ec
...@@ -121,9 +121,9 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -121,9 +121,9 @@ int nr_phy_init_RU(RU_t *ru) {
LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst); LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst);
int beam_count = 0; int beam_count = 0;
if (ru->nb_log_antennas>1) { if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
for (p=0;p<ru->nb_log_antennas;p++) { for (p=0;p<ru->nb_log_antennas;p++) {
if ((fp->L_ssb >> p) & 0x01) if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
beam_count++; beam_count++;
} }
AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
...@@ -131,7 +131,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -131,7 +131,7 @@ int nr_phy_init_RU(RU_t *ru) {
int l_ind = 0; int l_ind = 0;
for (i=0; i<RC.nb_nr_L1_inst; i++) { for (i=0; i<RC.nb_nr_L1_inst; i++) {
for (p=0;p<ru->nb_log_antennas;p++) { for (p=0;p<ru->nb_log_antennas;p++) {
if ((fp->L_ssb >> p) & 0x01) { if ((fp->L_ssb >> (63-p)) & 0x01) {
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; j<ru->nb_tx; j++) { for (j=0; j<ru->nb_tx; j++) {
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
......
...@@ -308,7 +308,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, ...@@ -308,7 +308,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
int num_tx_ant = (cfg == NULL) ? fp->Lmax : cfg->carrier_config.num_tx_ant.value; int num_tx_ant = (cfg == NULL) ? fp->Lmax : cfg->carrier_config.num_tx_ant.value;
for (int p=0; p<num_tx_ant; p++) for (int p=0; p<num_tx_ant; p++)
fp->N_ssb += ((fp->L_ssb >> p) & 0x01); fp->N_ssb += ((fp->L_ssb >> (63-p)) & 0x01);
return 0; return 0;
...@@ -389,7 +389,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -389,7 +389,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->N_ssb = 0; fp->N_ssb = 0;
for (int p=0; p<fp->Lmax; p++) for (int p=0; p<fp->Lmax; p++)
fp->N_ssb += ((fp->L_ssb >> p) & 0x01); fp->N_ssb += ((fp->L_ssb >> (63-p)) & 0x01);
return 0; return 0;
} }
......
...@@ -155,7 +155,7 @@ int nr_beam_precoding(int32_t **txdataF, ...@@ -155,7 +155,7 @@ int nr_beam_precoding(int32_t **txdataF,
memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
for (p=0; p<nb_antenna_ports; p++) { for (p=0; p<nb_antenna_ports; p++) {
if ((frame_parms->L_ssb >> p) & 0x01) { if ((frame_parms->L_ssb >> (63-p)) & 0x01) {
multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size], multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size],
(int16_t*)beam_weights[p][aa], (int16_t*)beam_weights[p][aa],
(int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],
......
...@@ -510,7 +510,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi ...@@ -510,7 +510,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
LOG_E(HW,"UEsock: %d Tx/Rx shift too large Tx:%lu, Rx:%lu\n", fd, t->lastWroteTS, b->lastReceivedTS); LOG_E(HW,"UEsock: %d Tx/Rx shift too large Tx:%lu, Rx:%lu\n", fd, t->lastWroteTS, b->lastReceivedTS);
pthread_mutex_unlock(&Sockmutex); pthread_mutex_unlock(&Sockmutex);
b->transferPtr=(char *)&b->circularBuf[b->lastReceivedTS%CirSize]; b->transferPtr=(char *)&b->circularBuf[(b->lastReceivedTS*b->th.nbAnt)%CirSize];
b->remainToTransfer=sampleToByte(b->th.size, b->th.nbAnt); b->remainToTransfer=sampleToByte(b->th.size, b->th.nbAnt);
} }
...@@ -641,7 +641,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -641,7 +641,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
if (reGenerateChannel) if (reGenerateChannel)
random_channel(ptr->channel_model,0); random_channel(ptr->channel_model,0);
for (int a=0; a<nbAnt; a++) { for (int a=0; a<nbAnt; a++) {//loop over number of Rx antennas
if ( ptr->channel_model != NULL ) // apply a channel model if ( ptr->channel_model != NULL ) // apply a channel model
rxAddInput( ptr->circularBuf, (struct complex16 *) samplesVoid[a], rxAddInput( ptr->circularBuf, (struct complex16 *) samplesVoid[a],
a, a,
...@@ -652,14 +652,16 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -652,14 +652,16 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
); );
else { // no channel modeling else { // no channel modeling
sample_t *out=(sample_t *)samplesVoid[a]; sample_t *out=(sample_t *)samplesVoid[a];
const int64_t base=t->nextTimestamp*nbAnt+a; int nbAnt_tx = ptr->th.nbAnt;//number of Tx antennas
for ( int i=0; i < nsamps; i++ ) { //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx);
const int idx=(i*nbAnt+base)%CirSize; for (int i=0; i < nsamps; i++) {//loop over nsamps
out[i].r+=ptr->circularBuf[idx].r; for (int a_tx=0; a_tx<nbAnt_tx; a_tx++){//sum up signals from nbAnt_tx antennas
out[i].i+=ptr->circularBuf[idx].i; out[i].r+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r;
} out[i].i+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i;
} // end for a_tx
} // end for i (number of samps)
} // end of no channel modeling } // end of no channel modeling
} // end for a... } // end for a (number of rx antennas)
} }
} }
......
...@@ -248,6 +248,8 @@ RUs = ( ...@@ -248,6 +248,8 @@ RUs = (
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 114; max_rxgain = 114;
eNB_instances = [0]; eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2";
clock_src = "external"; clock_src = "external";
} }
......
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