Commit 765bb64b authored by rmagueta's avatar rmagueta

Fix SNR based on SRS

parent e15fa14c
...@@ -495,7 +495,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) ...@@ -495,7 +495,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB)
gNB->max_nb_pucch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1; gNB->max_nb_pucch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1; gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot gNB->max_nb_srs = buffer_ul_slots ? buffer_ul_slots << 1 : 1; // assuming at most 2 SRS per slot
gNB->pucch = (NR_gNB_PUCCH_t *)malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t)); gNB->pucch = (NR_gNB_PUCCH_t *)malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t));
for (int i = 0; i < gNB->max_nb_pucch; i++) { for (int i = 0; i < gNB->max_nb_pucch; i++) {
......
...@@ -111,7 +111,7 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length) ...@@ -111,7 +111,7 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
return((temp>0)?temp:1); return((temp>0)?temp:1);
} }
int32_t signal_energy_nodc(const c16_t *input, uint32_t length) uint32_t signal_energy_nodc(const c16_t *input, uint32_t length)
{ {
// init // init
simde__m128 mm0 = simde_mm_setzero_ps(); simde__m128 mm0 = simde_mm_setzero_ps();
...@@ -134,7 +134,7 @@ int32_t signal_energy_nodc(const c16_t *input, uint32_t length) ...@@ -134,7 +134,7 @@ int32_t signal_energy_nodc(const c16_t *input, uint32_t length)
// Ave // Ave
float sums[4]; float sums[4];
simde_mm_store_ps(sums, mm0); simde_mm_store_ps(sums, mm0);
return (int)((sums[0] + sums[1] + sums[2] + sums[3] + leftover_sum) / (float)length); return (uint32_t)((sums[0] + sums[1] + sums[2] + sums[3] + leftover_sum) / (float)length);
} }
double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uint32_t length,uint32_t offset) double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uint32_t length,uint32_t offset)
......
#include <gtest/gtest.h> #include <gtest/gtest.h>
extern "C" { extern "C" {
#include "openair1/PHY/TOOLS/tools_defs.h" #include "openair1/PHY/TOOLS/tools_defs.h"
extern int32_t signal_energy_nodc(const c16_t *input, uint32_t length); extern uint32_t signal_energy_nodc(const c16_t *input, uint32_t length);
} }
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
......
...@@ -758,10 +758,10 @@ int32_t signal_energy_amp_shift(int32_t *input, uint32_t length); ...@@ -758,10 +758,10 @@ int32_t signal_energy_amp_shift(int32_t *input, uint32_t length);
int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16_t rx_power_correction); int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16_t rx_power_correction);
#endif #endif
/*!\fn int32_t signal_energy_nodc(int32_t *,uint32_t); /*!\fn uint32_t signal_energy_nodc(c16_t *,uint32_t);
\brief Computes the signal energy per subcarrier, without DC removal \brief Computes the signal energy per subcarrier, without DC removal
*/ */
int32_t signal_energy_nodc(const c16_t *input, uint32_t length); uint32_t signal_energy_nodc(const c16_t *input, uint32_t length);
int32_t signal_power(int32_t *,uint32_t); int32_t signal_power(int32_t *,uint32_t);
int32_t interference_power(int32_t *,uint32_t); int32_t interference_power(int32_t *,uint32_t);
......
...@@ -729,8 +729,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -729,8 +729,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size; const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
int offset = 10 * gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset; int offset = 10 * gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
LOG_D(PHY, LOG_D(NR_PHY,
"frame %d, slot %d: UL signal energy %d\n", "frame %d, slot %d: UL signal energy %u\n",
frame_rx, frame_rx,
slot_rx, slot_rx,
signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset + (47 * 12)], 12 * 18)); signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset + (47 * 12)], 12 * 18));
...@@ -761,8 +761,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -761,8 +761,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1; nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12); offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
LOG_D(PHY, LOG_D(NR_PHY,
"frame %d, slot %d: PUCCH signal energy %d\n", "frame %d, slot %d: PUCCH signal energy %u\n",
frame_rx, frame_rx,
slot_rx, slot_rx,
signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset], 12)); signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset], 12));
......
...@@ -723,7 +723,7 @@ int main(int argc, char *argv[]) ...@@ -723,7 +723,7 @@ int main(int argc, char *argv[])
NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); NR_Sched_Rsp_t *Sched_INFO = malloc16_clear(sizeof(*Sched_INFO));
memset((void*)Sched_INFO,0,sizeof(*Sched_INFO)); memset((void*)Sched_INFO,0,sizeof(*Sched_INFO));
nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req; nfapi_nr_ul_tti_request_t *UL_tti_req = &Sched_INFO->UL_tti_req;
Sched_INFO->sched_response_id = -1; Sched_INFO->sched_response_id = -1;
...@@ -1070,6 +1070,7 @@ int main(int argc, char *argv[]) ...@@ -1070,6 +1070,7 @@ int main(int argc, char *argv[])
srs_pdu->subcarrier_spacing = frame_parms->subcarrier_spacing; srs_pdu->subcarrier_spacing = frame_parms->subcarrier_spacing;
srs_pdu->num_ant_ports = n_tx == 4 ? 2 : n_tx == 2 ? 1 : 0; srs_pdu->num_ant_ports = n_tx == 4 ? 2 : n_tx == 2 ? 1 : 0;
srs_pdu->sequence_id = 40; srs_pdu->sequence_id = 40;
srs_pdu->time_start_position = frame_parms->symbols_per_slot - 1;
srs_pdu->config_index = rrc_get_max_nr_csrs(srs_pdu->bwp_size, srs_pdu->bandwidth_index); srs_pdu->config_index = rrc_get_max_nr_csrs(srs_pdu->bwp_size, srs_pdu->bandwidth_index);
srs_pdu->resource_type = NR_SRS_Resource__resourceType_PR_periodic; srs_pdu->resource_type = NR_SRS_Resource__resourceType_PR_periodic;
srs_pdu->t_srs = 1; srs_pdu->t_srs = 1;
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
{CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=100, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=100, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=150, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=150, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_SRS_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_SRS_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=30, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, .uptr=NULL, .defintval=8, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, .uptr=NULL, .defintval=8, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \
......
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