Commit 829ee597 authored by Raymond Knopp's avatar Raymond Knopp

fixes for oaisim, testing TM2

parent 574fbd66
......@@ -2735,6 +2735,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
}
} // for l=1..l2
ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode);
// If this is PMCH, call procedures and return
if (pmch_flag == 1) {
......
......@@ -121,6 +121,7 @@ double dac_fixed_gain(double s_re[2][30720],
//printf("DL: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
*/
for (i=0; i<length; i++) {
for (aa=0; aa<nb_tx_antennas; aa++) {
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/amp1; ///(1<<(B-1));
......
......@@ -108,10 +108,11 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
uint8_t nb_antennas_rx = eNB2UE[0][0][CC_id]->nb_rx; // number of rx antennas at UE
uint8_t nb_antennas_tx = eNB2UE[0][0][CC_id]->nb_tx; // number of tx antennas at eNB
double s_re[2][PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double s_im[2][PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double r_re0[2][PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double r_im0[2][PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double s_re[2][30720];//PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double s_im[2][30720];//PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double r_re0[2][30720];//PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
double r_im0[2][30720];//PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti];
if (subframe==0)
......@@ -205,11 +206,11 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
}
} // hold channel
}
else { //abstraction_flag
pthread_mutex_lock(&eNB_output_mutex[UE_id]);
if (eNB_output_mask[UE_id] == 0) { // This is the first eNodeB for this UE, clear the buffer
for (aa=0; aa<nb_antennas_rx; aa++) {
......@@ -222,8 +223,8 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
txdata = PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.txdata[0];
sf_offset = subframe*frame_parms->samples_per_tti;
tx_pwr = dac_fixed_gain((double**)s_re,
(double**)s_im,
tx_pwr = dac_fixed_gain(s_re,
s_im,
txdata,
sf_offset,
nb_antennas_tx,
......@@ -243,7 +244,7 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
#endif
//eNB2UE[eNB_id][UE_id]->path_loss_dB = 0;
multipath_channel(eNB2UE[eNB_id][UE_id][CC_id],(double**)s_re,(double**)s_im,(double**)r_re0,(double**)r_im0,
multipath_channel(eNB2UE[eNB_id][UE_id][CC_id],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti,hold_channel);
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp2(eNB2UE[eNB_id][UE_id][CC_id]->ch[0],
......@@ -266,7 +267,7 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB);
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp((double**)r_re0,(double**)r_im0,nb_antennas_rx,
rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,
frame_parms->ofdm_symbol_size,
sf_offset)/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr %f dBm/RE (%f dBm RSSI)for subframe %d\n",UE_id,
......@@ -289,15 +290,15 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB-66.227,subframe);
#endif
rf_rx_simple((double**)r_re0,
(double**)r_im0,
rf_rx_simple(r_re0,
r_im0,
nb_antennas_rx,
frame_parms->samples_per_tti,
1e3/eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp((double**)r_re0,(double**)r_im0,
rx_pwr = signal_energy_fp(r_re0,r_im0,
nb_antennas_rx,
frame_parms->ofdm_symbol_size,
sf_offset)/(12.0*frame_parms->N_RB_DL);
......@@ -326,8 +327,8 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
rxdata = PHY_vars_UE_g[UE_id][CC_id]->common_vars.rxdata;
sf_offset = subframe*frame_parms->samples_per_tti;
adc((double**)r_re_DL[UE_id],
(double**)r_im_DL[UE_id],
adc(r_re_DL[UE_id],
r_im_DL[UE_id],
0,
sf_offset,
rxdata,
......@@ -383,10 +384,10 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
int ulfrrb2 ;
uint8_t harq_pid;
#endif
double s_re[2][PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_im[2][PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_re0[2][PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_im0[2][PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_re[2][30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_im[2][30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_re0[2][30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_im0[2][30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
if (abstraction_flag!=0) {
#ifdef PHY_ABSTRACTION_UL
......@@ -477,7 +478,7 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
hold_channel,UE2eNB[UE_id][eNB_id][CC_id]->channel_length,
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB);
rx_pwr = signal_energy_fp((double**)r_re0,(double**)r_im0,nb_antennas_rx,frame_parms->samples_per_tti,0);
rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->samples_per_tti,0);
LOG_D(OCM,"[SIM][UL] eNB %d : rx_pwr %f dBm (%f) for subframe %d, sptti %d\n",
eNB_id,10*log10(rx_pwr),rx_pwr,subframe,frame_parms->samples_per_tti);
......@@ -497,23 +498,23 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
}
} //UE_id
rf_rx_simple((double**)r_re_UL[eNB_id],
(double**)r_im_UL[eNB_id],
rf_rx_simple(r_re_UL[eNB_id],
r_im_UL[eNB_id],
nb_antennas_rx,
frame_parms->samples_per_tti,
1e3/UE2eNB[0][eNB_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_eNB_g[eNB_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp((double**)r_re_UL[eNB_id],(double**)r_im_UL[eNB_id],nb_antennas_rx,frame_parms->samples_per_tti,0)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
rx_pwr = signal_energy_fp(r_re_UL[eNB_id],r_im_UL[eNB_id],nb_antennas_rx,frame_parms->samples_per_tti,0)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][UL] rx_pwr (ADC in) %f dB for subframe %d\n",10*log10(rx_pwr),subframe);
#endif
rxdata = PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.rxdata[0];
sf_offset = subframe*frame_parms->samples_per_tti;
adc((double**)r_re_UL[eNB_id],
(double**)r_im_UL[eNB_id],
adc(r_re_UL[eNB_id],
r_im_UL[eNB_id],
0,
sf_offset,
rxdata,
......
......@@ -774,16 +774,18 @@ l2l1_task (void *args_p)
if (oai_emulation.info.cli_start_enb[eNB_inst] != 0) {
T(T_ENB_MASTER_TICK, T_INT(eNB_inst), T_INT(frame % 1024), T_INT(slot/2));
/*
LOG_D(EMU,
"PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d) TDD %d/%d Nid_cell %d\n",
eNB_inst,
frame%MAX_FRAME_NUMBER,
slot,
2*sf,
PHY_vars_eNB_g[eNB_inst][0]->proc[slot >> 1].subframe_tx,
PHY_vars_eNB_g[eNB_inst][0]->proc[slot >> 1].subframe_rx,
PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.frame_type,
PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.tdd_config,
PHY_vars_eNB_g[eNB_inst][0]->lte_frame_parms.Nid_cell);
*/
}
for (eNB_inst = oai_emulation.info.first_enb_local;
......@@ -1825,7 +1827,7 @@ oai_shutdown (void)
free(txdata);
#endif
*/
/*
for (int i = 0; i < 2; i++) {
free (s_re[i]);
free (s_im[i]);
......@@ -1840,7 +1842,7 @@ oai_shutdown (void)
s_re = 0;
s_im = 0;
r_re = 0;
r_im = 0;
r_im = 0;*/
lte_sync_time_free ();
}
......
......@@ -1050,11 +1050,12 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
eNB_id,
CC_id);
last_eNB_rx_timestamp[eNB_id][CC_id] += PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti;
sample_count += PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti;
}
return(nsamps);
}
......@@ -1070,9 +1071,10 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
*ptimestamp = last_UE_rx_timestamp[UE_id][CC_id];
LOG_D(PHY,"UE_trx_read nsamps %d TS(%llu,%llu)\n",nsamps,
LOG_D(EMU,"UE_trx_read nsamps %d TS(%llu,%llu) antenna %d\n",nsamps,
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
(unsigned long long)last_UE_rx_timestamp[UE_id][CC_id]);
(unsigned long long)last_UE_rx_timestamp[UE_id][CC_id],
cc);
if (nsamps < PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)
read_size = nsamps;
......@@ -1093,7 +1095,7 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
pthread_mutex_lock(&subframe_mutex);
subframe_UE_mask|=(1<<UE_id);
pthread_mutex_unlock(&subframe_mutex);
// if we didn't ask for at least a subframe's worth of samples return
// otherwise we have one subframe here so generate the received signal
subframe = (last_UE_rx_timestamp[UE_id][CC_id]/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10;
......@@ -1117,8 +1119,12 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
UE_id,
CC_id);
printf("Signaling main thread: UE subframe mask %x\n",subframe_UE_mask);
}
return(nsamps);
}
......
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