Commit 0e38bd23 authored by rmagueta's avatar rmagueta

Use signed types for dB measurements to support negative values

parent 46b76706
......@@ -87,12 +87,12 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
measurements->n0_power[aarx] = ((k1*signal_energy(&common_vars->rxdata[aarx][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size)) + k2*measurements->n0_power[aarx])>>10;
//measurements->n0_power[aarx] = (measurements->n0_power[aarx]) * 12*frame_parms->N_RB_DL)/(frame_parms->ofdm_symbol_size);
measurements->n0_power_dB[aarx] = (unsigned short) dB_fixed(measurements->n0_power[aarx]);
measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]);
measurements->n0_power_tot += measurements->n0_power[aarx];
}
measurements->n0_power_tot_dB = (unsigned short) dB_fixed(measurements->n0_power_tot);
measurements->n0_power_tot_dB = dB_fixed(measurements->n0_power_tot);
measurements->n0_power_tot_dBm = measurements->n0_power_tot_dB - eNB->rx_total_gain_dB;
// printf("n0_power %d\n",measurements->n0_power_tot_dB);
......@@ -183,14 +183,14 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
measurements->rx_spatial_power[srs_id][0][aarx]<<=1; // because of noise only in odd samples
measurements->rx_spatial_power_dB[srs_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[srs_id][0][aarx]);
measurements->rx_spatial_power_dB[srs_id][0][aarx] = dB_fixed(measurements->rx_spatial_power[srs_id][0][aarx]);
measurements->wideband_cqi[srs_id][aarx] = measurements->rx_spatial_power[srs_id][0][aarx];
// measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx;
measurements->wideband_cqi_dB[srs_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[srs_id][aarx]);
measurements->wideband_cqi_dB[srs_id][aarx] = dB_fixed(measurements->wideband_cqi[srs_id][aarx]);
rx_power += measurements->wideband_cqi[srs_id][aarx];
// measurements->rx_avg_power_dB[UE_id] += measurements->rx_power_dB[UE_id][aarx];
}
......@@ -206,7 +206,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
measurements->wideband_cqi_tot[srs_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
// times 2 since we have noise only in the odd carriers of the srs comb
measurements->rx_rssi_dBm[srs_id] = (int32_t)dB_fixed(rx_power_avg_eNB[srs_id])-eNB->rx_total_gain_dB;
measurements->rx_rssi_dBm[srs_id] = dB_fixed(rx_power_avg_eNB[srs_id])-eNB->rx_total_gain_dB;
......
......@@ -254,13 +254,13 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_dB[aarx] = dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dB = dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
} else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length == EXTENDED\n");
......@@ -311,11 +311,11 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_dB[aarx] = dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dB = dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
......@@ -1034,7 +1034,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
if (ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]<0)
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = 0; //ue->measurements.n0_power[aarx];
ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]);
ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]);
if (aatx==0)
ue->measurements.rx_power[eNB_id][aarx] = ue->measurements.rx_spatial_power[eNB_id][aatx][aarx];
......@@ -1042,7 +1042,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
ue->measurements.rx_power[eNB_id][aarx] += ue->measurements.rx_spatial_power[eNB_id][aatx][aarx];
} //aatx
ue->measurements.rx_power_dB[eNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[eNB_id][aarx]);
ue->measurements.rx_power_dB[eNB_id][aarx] = dB_fixed(ue->measurements.rx_power[eNB_id][aarx]);
if (aarx==0)
ue->measurements.rx_power_tot[eNB_id] = ue->measurements.rx_power[eNB_id][aarx];
......@@ -1050,7 +1050,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
ue->measurements.rx_power_tot[eNB_id] += ue->measurements.rx_power[eNB_id][aarx];
} //aarx
ue->measurements.rx_power_tot_dB[eNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[eNB_id]);
ue->measurements.rx_power_tot_dB[eNB_id] = dB_fixed(ue->measurements.rx_power_tot[eNB_id]);
} //eNB_id
......
......@@ -48,7 +48,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t *avg_preamble_energy,
int16_t *avg_preamble_energy,
uint16_t Nf,
uint8_t tdd_mapindex,
uint8_t br_flag,
......@@ -639,7 +639,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t *avg_preamble_energy,
int16_t *avg_preamble_energy,
uint16_t Nf,
uint8_t tdd_mapindex,
uint8_t br_flag) {
......
......@@ -593,7 +593,7 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t *avg_preamble_energy,
int16_t *avg_preamble_energy,
uint16_t Nf, uint8_t tdd_mapindex,
uint8_t br_flag
);
......
......@@ -1177,7 +1177,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
uint64_t decodedPayload[nb_symbols];
memset(decodedPayload,0,sizeof(decodedPayload));
uint8_t corr_dB;
int8_t corr_dB;
int decoderState = 2;
if (pucch2_levdB < gNB->measurements.n0_subband_power_avg_dB + (gNB->pucch0_thres / 10))
decoderState = 1; // assuming missed detection, only attempt to decode for polar case (with CRC)
......
......@@ -73,7 +73,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
cmax(frame_parms->nb_antennas_rx, 1),
false);
allocCast3D(rx_spatial_power_dB,
unsigned short,
short,
ue->measurements.rx_spatial_power_dB,
NUMBER_OF_CONNECTED_gNB_MAX,
cmax(frame_parms->nb_antenna_ports_gNB, 1),
......@@ -96,16 +96,16 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
if (rx_spatial_power[gNB_id][aatx][aarx] < 0)
rx_spatial_power[gNB_id][aatx][aarx] = 0;
rx_spatial_power_dB[gNB_id][aatx][aarx] = (unsigned short)dB_fixed(rx_spatial_power[gNB_id][aatx][aarx]);
rx_spatial_power_dB[gNB_id][aatx][aarx] = dB_fixed(rx_spatial_power[gNB_id][aatx][aarx]);
ue->measurements.rx_power[gNB_id][aarx] += rx_spatial_power[gNB_id][aatx][aarx];
}
ue->measurements.rx_power_dB[gNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[gNB_id][aarx]);
ue->measurements.rx_power_dB[gNB_id][aarx] = dB_fixed(ue->measurements.rx_power[gNB_id][aarx]);
ue->measurements.rx_power_tot[gNB_id] += ue->measurements.rx_power[gNB_id][aarx];
}
ue->measurements.rx_power_tot_dB[gNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[gNB_id]);
ue->measurements.rx_power_tot_dB[gNB_id] = dB_fixed(ue->measurements.rx_power_tot[gNB_id]);
}
......@@ -565,12 +565,12 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
}
ue->measurements.n0_power[aarx] /= 2*k_length;
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = dB_fixed(ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_tot += ue->measurements.n0_power[aarx];
}
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot);
ue->measurements.n0_power_tot_dB = dB_fixed(ue->measurements.n0_power_tot);
#ifdef DEBUG_MEAS_RRC
const int psd_awgn = -174;
......
......@@ -581,7 +581,7 @@ int nr_csi_rs_pmi_estimation(const PHY_VARS_NR_UE *ue,
const int16_t log2_re,
uint8_t *i1,
uint8_t *i2,
uint32_t *precoded_sinr_dB)
int32_t *precoded_sinr_dB)
{
const NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
......@@ -948,7 +948,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
uint8_t i1[3] = {0};
uint8_t i2[1] = {0};
uint8_t cqi = 0;
uint32_t precoded_sinr_dB = 0;
int32_t precoded_sinr_dB = 0;
// bit 3 in bitmap to indicate RI measurment
if (csirs_config_pdu->measurement_bitmap & 8) {
nr_csi_rs_pmi_estimation(ue,
......
......@@ -206,15 +206,15 @@ typedef struct {
//! estimated noise power (linear)
unsigned int n0_power[NB_ANTENNAS_RX];
//! estimated noise power (dB)
unsigned short n0_power_dB[NB_ANTENNAS_RX];
short n0_power_dB[NB_ANTENNAS_RX];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! total estimated noise power (dB)
unsigned short n0_power_tot_dB;
short n0_power_tot_dB;
//! average estimated noise power (linear)
unsigned int n0_power_avg;
//! average estimated noise power (dB)
unsigned short n0_power_avg_dB;
short n0_power_avg_dB;
//! total estimated noise power (dBm)
short n0_power_tot_dBm;
......@@ -222,24 +222,24 @@ typedef struct {
//! estimated received spatial signal power (linear)
int rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
/// estimated received signal power (sum over all TX antennas)
//int wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX antennas)
//int wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX/RX antennas)
int rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
/// estimated received signal power (sum over all TX/RX antennas)
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
//! estimated received signal power (sum of all TX/RX antennas, time average)
int rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX];
//! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
/// SINR (sum of all TX/RX antennas, in dB)
int wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX];
......
......@@ -419,17 +419,17 @@ typedef struct {
//! estimated noise power (linear)
unsigned int n0_power[MAX_NUM_RU_PER_eNB];
//! estimated noise power (dB)
unsigned short n0_power_dB[MAX_NUM_RU_PER_eNB];
short n0_power_dB[MAX_NUM_RU_PER_eNB];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! estimated avg noise power (dB)
unsigned short n0_power_tot_dB;
short n0_power_tot_dB;
//! estimated avg noise power (dB)
short n0_power_tot_dBm;
//! estimated avg noise power per RB per RX ant (lin)
unsigned short n0_subband_power[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[100];
//! estimated avg noise power per RB (dBm)
......@@ -440,7 +440,7 @@ typedef struct {
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_SRS_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_SRS_MAX][2][2];
short rx_spatial_power_dB[NUMBER_OF_SRS_MAX][2][2];
//! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_SRS_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
......@@ -453,7 +453,7 @@ typedef struct {
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_SRS_MAX];
int wideband_cqi_tot[NUMBER_OF_SRS_MAX];
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB (= SINR)
......
......@@ -319,17 +319,17 @@ typedef struct {
//! estimated noise power (linear)
unsigned int n0_power[MAX_NUM_RU_PER_gNB];
//! estimated noise power (dB)
unsigned int n0_power_dB[MAX_NUM_RU_PER_gNB];
int n0_power_dB[MAX_NUM_RU_PER_gNB];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! estimated avg noise power (dB)
unsigned int n0_power_tot_dB;
int n0_power_tot_dB;
//! estimated avg noise power per RB per RX ant (lin)
fourDimArray_t *n0_subband_power;
//! estimated avg subband noise power (dB)
unsigned int n0_subband_power_avg_dB;
int n0_subband_power_avg_dB;
//! estimated avg subband noise power per antenna (dB)
unsigned int n0_subband_power_avg_perANT_dB[MAX_ANT];
int n0_subband_power_avg_perANT_dB[MAX_ANT];
//! estimated avg noise power per RB (dB)
int n0_subband_power_tot_dB[275];
/// PRACH background noise level
......
......@@ -147,15 +147,15 @@ typedef struct {
//! estimated noise power (linear)
unsigned int n0_power[NB_ANTENNAS_RX];
//! estimated noise power (dB)
unsigned short n0_power_dB[NB_ANTENNAS_RX];
short n0_power_dB[NB_ANTENNAS_RX];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! total estimated noise power (dB)
unsigned short n0_power_tot_dB;
short n0_power_tot_dB;
//! average estimated noise power (linear)
unsigned int n0_power_avg;
//! average estimated noise power (dB)
unsigned short n0_power_avg_dB;
short n0_power_avg_dB;
//! total estimated noise power (dBm)
short n0_power_tot_dBm;
......@@ -168,17 +168,17 @@ typedef struct {
/// estimated received signal power (sum over all TX antennas)
int rx_power[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX antennas)
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
short rx_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX/RX antennas)
int rx_power_tot[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
/// estimated received signal power (sum over all TX/RX antennas)
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
short rx_power_tot_dB[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
//! estimated received signal power (sum of all TX/RX antennas, time average)
int rx_power_avg[NUMBER_OF_CONNECTED_gNB_MAX];
//! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_gNB_MAX];
short rx_power_avg_dB[NUMBER_OF_CONNECTED_gNB_MAX];
/// SINR (sum of all TX/RX antennas, in dB)
int wideband_cqi_tot[NUMBER_OF_CONNECTED_gNB_MAX];
......
......@@ -55,15 +55,15 @@ typedef struct {
//! estimated noise power (linear)
unsigned int n0_power[NB_ANTENNAS_RX];
//! estimated noise power (dB)
unsigned short n0_power_dB[NB_ANTENNAS_RX];
short n0_power_dB[NB_ANTENNAS_RX];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! total estimated noise power (dB)
unsigned short n0_power_tot_dB;
short n0_power_tot_dB;
//! average estimated noise power (linear)
unsigned int n0_power_avg;
//! average estimated noise power (dB)
unsigned short n0_power_avg_dB;
short n0_power_avg_dB;
//! total estimated noise power (dBm)
short n0_power_tot_dBm;
......@@ -71,24 +71,24 @@ typedef struct {
//! estimated received spatial signal power (linear)
int rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
/// estimated received signal power (sum over all TX antennas)
//int wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX antennas)
//int wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX/RX antennas)
int rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
/// estimated received signal power (sum over all TX/RX antennas)
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
//! estimated received signal power (sum of all TX/RX antennas, time average)
int rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX];
//! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
/// SINR (sum of all TX/RX antennas, in dB)
int wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX];
......@@ -141,17 +141,17 @@ typedef struct {
//! estimated noise power (linear)
unsigned int n0_power[NB_ANTENNAS_RX];
//! estimated noise power (dB)
unsigned short n0_power_dB[NB_ANTENNAS_RX];
short n0_power_dB[NB_ANTENNAS_RX];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! estimated avg noise power (dB)
unsigned short n0_power_tot_dB;
short n0_power_tot_dB;
//! estimated avg noise power (dB)
short n0_power_tot_dBm;
//! estimated avg noise power per RB per RX ant (lin)
unsigned short n0_subband_power[NB_ANTENNAS_RX][100];
//! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[NB_ANTENNAS_RX][100];
short n0_subband_power_dB[NB_ANTENNAS_RX][100];
//! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[100];
//! estimated avg noise power per RB (dBm)
......@@ -160,7 +160,7 @@ typedef struct {
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
//! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_UE_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
......@@ -173,7 +173,7 @@ typedef struct {
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_UE_MAX][NB_ANTENNAS_RX];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_UE_MAX];
int wideband_cqi_tot[NUMBER_OF_UE_MAX];
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_UE_MAX][NB_ANTENNAS_RX][100];
/// Total Subband CQI and RB (= SINR)
......
......@@ -47,11 +47,12 @@
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
void prach_procedures(PHY_VARS_eNB *eNB,
int br_flag ) {
uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0},avg_preamble_energy[4]={0};
void prach_procedures(PHY_VARS_eNB *eNB, int br_flag)
{
uint16_t max_preamble[4] = {0}, max_preamble_energy[4] = {0}, max_preamble_delay[4] = {0};
int16_t avg_preamble_energy[4] = {0};
uint16_t i;
int frame,subframe;
int frame, subframe;
if (br_flag==1) {
subframe = eNB->proc.subframe_prach_br;
......
......@@ -520,7 +520,8 @@ int main(int argc, char **argv) {
DCI_ALLOC_t da;
DCI_ALLOC_t *dci_alloc = &da;
unsigned int coded_bits_per_codeword=0,nsymb; //,tbs=0;
unsigned int tx_lev=0,tx_lev_dB=0,trials;
unsigned int tx_lev = 0, trials;
int tx_lev_dB = 0;
unsigned int errs[4],errs2[4],round_trials[4],dci_errors[4];//,num_layers;
memset(errs,0,4*sizeof(unsigned int));
memset(errs2,0,4*sizeof(unsigned int));
......@@ -1494,7 +1495,7 @@ int main(int argc, char **argv) {
eNB->frame_parms.samples_per_tti);
}
tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
tx_lev_dB = dB_fixed(tx_lev);
if (n_frames==1) {
printf("tx_lev = %u (%u dB)\n",tx_lev,tx_lev_dB);
......
......@@ -393,7 +393,7 @@ int main(int argc, char **argv) {
subframe,
0); //Nf
/* tx_lev_dB not used later, no need to set */
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
//tx_lev_dB = dB_fixed(tx_lev);
LOG_M("txsig0_new.m","txs0", &txdata[0][subframe*frame_parms->samples_per_tti],frame_parms->samples_per_tti,1,1);
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
// multipath channel
......
......@@ -343,7 +343,8 @@ int main(int argc, char **argv) {
unsigned short input_buffer_length;
unsigned int ret;
unsigned int coded_bits_per_codeword,nsymb;
unsigned int tx_lev = 0, tx_lev_dB = 0, trials, errs[6] = {0}, round_trials[4] = {0};
unsigned int tx_lev = 0, trials, errs[6] = {0}, round_trials[4] = {0};
int tx_lev_dB = 0;
FILE *bler_fd=NULL;
char bler_fname[512];
FILE *time_meas_fd=NULL;
......@@ -894,7 +895,7 @@ int main(int argc, char **argv) {
// LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
tx_lev = signal_energy(&txdata[0][0],
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
tx_lev_dB = dB_fixed(tx_lev);
}
iter_trials=0;
......
......@@ -667,7 +667,7 @@ int main(int argc, char **argv){
generate_nr_prach(UE, 0, frame, slot, tx);
/* tx_lev_dB not used later, no need to set */
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
//tx_lev_dB = dB_fixed(tx_lev);
#ifdef NR_PRACH_DEBUG
LOG_M("txsig0.m", "txs0", &txdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
......
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