diff --git a/matlab/tests/equalizer_test.m b/matlab/tests/equalizer_test.m index fbd36bfdc..cc0a700fb 100644 --- a/matlab/tests/equalizer_test.m +++ b/matlab/tests/equalizer_test.m @@ -6,13 +6,13 @@ clear plot_noise_estimation_only=false; -SNR_values_db=100;%linspace(0,30,5); -Nrealizations=1; +SNR_values_db=linspace(0,10,5); +Nrealizations=10; w1=0.1; -w2=0.2; +w2=0.3; -enb.NDLRB = 50; % Number of resource blocks +enb.NDLRB = 25; % Number of resource blocks enb.CellRefP = 1; % One transmit antenna port enb.NCellID = 0; % Cell ID @@ -26,11 +26,11 @@ P=K/6; cfg.Seed = 0; % Random channel seed cfg.InitTime = 0; cfg.NRxAnts = 1; % 1 receive antenna -cfg.DelayProfile = 'EVA'; +cfg.DelayProfile = 'ETU'; % doppler 5, 70 300 -cfg.DopplerFreq = 5; % 120Hz Doppler frequency +cfg.DopplerFreq = 70; % 120Hz Doppler frequency cfg.MIMOCorrelation = 'Low'; % Low (no) MIMO correlation cfg.NTerms = 16; % Oscillators used in fading model cfg.ModelType = 'GMEDS'; % Rayleigh fading model type @@ -232,7 +232,11 @@ if (length(SNR_values_db) == 1) fprintf('Mean MMSE Robust %.2f dB\n', 10*log10(MSE(4,nreal,snr_idx))) fprintf('Mean MMSE matlab %.2f dB\n', 10*log10(MSE(1,nreal,snr_idx))) +<<<<<<< HEAD +======= + +>>>>>>> master end end diff --git a/srslte/include/srslte/enb/enb_dl.h b/srslte/include/srslte/enb/enb_dl.h index 14c93479e..578a52350 100644 --- a/srslte/include/srslte/enb/enb_dl.h +++ b/srslte/include/srslte/enb/enb_dl.h @@ -129,7 +129,7 @@ SRSLTE_API void srslte_enb_dl_put_base(srslte_enb_dl_t *q, SRSLTE_API void srslte_enb_dl_gen_signal(srslte_enb_dl_t *q, cf_t *signal_buffer); -SRSLTE_API int srslte_enb_dl_add_rnti(srslte_enb_dl_t *q, +SRSLTE_API int srslte_enb_dl_cfg_rnti(srslte_enb_dl_t *q, uint32_t idx, uint16_t rnti); diff --git a/srslte/include/srslte/phch/pdcch.h b/srslte/include/srslte/phch/pdcch.h index d7467ad2a..d65c32dc2 100644 --- a/srslte/include/srslte/phch/pdcch.h +++ b/srslte/include/srslte/phch/pdcch.h @@ -128,4 +128,8 @@ SRSLTE_API uint32_t srslte_pdcch_common_locations(srslte_pdcch_t *q, uint32_t max_locations, uint32_t cfi); +SRSLTE_API uint32_t srslte_pdcch_common_locations_ncce(uint32_t nof_cce, + srslte_dci_location_t *c, + uint32_t max_candidates); + #endif diff --git a/srslte/include/srslte/phch/regs.h b/srslte/include/srslte/phch/regs.h index 76203a9b4..f7d5f91f1 100644 --- a/srslte/include/srslte/phch/regs.h +++ b/srslte/include/srslte/phch/regs.h @@ -111,7 +111,12 @@ SRSLTE_API uint32_t srslte_regs_phich_ngroups(srslte_regs_t *h); SRSLTE_API int srslte_regs_phich_reset(srslte_regs_t *h, cf_t *slot_symbols); -SRSLTE_API int srslte_regs_pdcch_nregs(srslte_regs_t *h, uint32_t cfi); +SRSLTE_API int srslte_regs_pdcch_nregs(srslte_regs_t *h, + uint32_t cfi); + +SRSLTE_API int srslte_regs_pdcch_ncce(srslte_regs_t *h, + uint32_t cfi); + SRSLTE_API int srslte_regs_pdcch_put(srslte_regs_t *h, cf_t *d, cf_t *slot_symbols); diff --git a/srslte/lib/ch_estimation/chest_dl.c b/srslte/lib/ch_estimation/chest_dl.c index 9326fd0cf..1b9a27250 100644 --- a/srslte/lib/ch_estimation/chest_dl.c +++ b/srslte/lib/ch_estimation/chest_dl.c @@ -146,8 +146,15 @@ float estimate_noise_pilots(srslte_chest_dl_t *q, uint32_t port_id) q->pilot_estimates_average, q->tmp_noise, nref); - - return (1/q->smooth_filter[0])*q->cell.nof_ports*power; + + /* Compute average power. Normalized for filter len 3 using matlab */ + float norm = 1; + if (q->smooth_filter_len == 3) { + float a = q->smooth_filter[0]; + float norm3 = 6.143*a*a+0.04859*a-0.002774; + norm /= norm3; + } + return norm*q->cell.nof_ports*power; } #ifdef ESTIMATE_NOISE_LS_PSS @@ -166,7 +173,7 @@ static float estimate_noise_pss(srslte_chest_dl_t *q, cf_t *input, cf_t *ce) srslte_vec_sub_ccc(q->tmp_pss_noisy, q->tmp_pss, q->tmp_pss_noisy, SRSLTE_PSS_LEN); /* Compute average power */ - float power = q->cell.nof_ports*srslte_vec_avg_power_cf(q->tmp_pss_noisy, SRSLTE_PSS_LEN); + float power = q->cell.nof_ports*srslte_vec_avg_power_cf(q->tmp_pss_noisy, SRSLTE_PSS_LEN)/sqrt(2); return power; } @@ -283,20 +290,18 @@ int srslte_chest_dl_estimate_port(srslte_chest_dl_t *q, cf_t *input, cf_t *ce, u interpolate_pilots(q, q->pilot_estimates_average, ce, port_id); /* If averaging, compute noise from difference between received and averaged estimates */ - if (sf_idx == 0 || sf_idx == 5) { - q->noise_estimate[port_id] = estimate_noise_pilots(q, port_id); - } + q->noise_estimate[port_id] = estimate_noise_pilots(q, port_id); } else { interpolate_pilots(q, q->pilot_estimates, ce, port_id); /* If not averaging, compute noise from empty subcarriers */ - if (sf_idx == 0 || sf_idx == 5) { #ifdef ESTIMATE_NOISE_LS_PSS + if (sf_idx == 0 || sf_idx == 5) { q->noise_estimate[port_id] = estimate_noise_pss(q, input, ce); -#else - q->noise_estimate[port_id] = estimate_noise_empty_sc(q, input); -#endif } +#else + q->noise_estimate[port_id] = estimate_noise_empty_sc(q, input); +#endif } } diff --git a/srslte/lib/enb/enb_dl.c b/srslte/lib/enb/enb_dl.c index 6c228a19c..e66969cf5 100644 --- a/srslte/lib/enb/enb_dl.c +++ b/srslte/lib/enb/enb_dl.c @@ -210,7 +210,7 @@ void srslte_enb_dl_gen_signal(srslte_enb_dl_t *q, cf_t *signal_buffer) srslte_vec_sc_prod_cfc(signal_buffer, 0.2, signal_buffer, SRSLTE_SF_LEN_PRB(q->cell.nof_prb)); } -int srslte_enb_dl_add_rnti(srslte_enb_dl_t *q, uint32_t idx, uint16_t rnti) +int srslte_enb_dl_cfg_rnti(srslte_enb_dl_t *q, uint32_t idx, uint16_t rnti) { return srslte_pdsch_set_rnti_multi(&q->pdsch, idx, rnti); } diff --git a/srslte/lib/phch/pdcch.c b/srslte/lib/phch/pdcch.c index 19256eb14..a218a1445 100644 --- a/srslte/lib/phch/pdcch.c +++ b/srslte/lib/phch/pdcch.c @@ -227,17 +227,21 @@ uint32_t srslte_pdcch_ue_locations(srslte_pdcch_t *q, srslte_dci_location_t *c, uint32_t srslte_pdcch_common_locations(srslte_pdcch_t *q, srslte_dci_location_t *c, uint32_t max_candidates, uint32_t cfi) { - uint32_t i, l, L, k; - set_cfi(q, cfi); + return srslte_pdcch_common_locations_ncce(q->nof_cce, c, max_candidates); +} + +uint32_t srslte_pdcch_common_locations_ncce(uint32_t nof_cce, srslte_dci_location_t *c, uint32_t max_candidates) +{ + uint32_t i, l, L, k; k = 0; for (l = 3; l > 1; l--) { L = (1 << l); - for (i = 0; i < SRSLTE_MIN(q->nof_cce, 16) / (L); i++) { + for (i = 0; i < SRSLTE_MIN(nof_cce, 16) / (L); i++) { if (k < max_candidates) { c[k].L = l; - c[k].ncce = (L) * (i % (q->nof_cce / (L))); + c[k].ncce = (L) * (i % (nof_cce / (L))); DEBUG("Common SS Candidate %d: nCCE: %d, L: %d\n", k, c[k].ncce, c[k].L); k++; diff --git a/srslte/lib/phch/regs.c b/srslte/lib/phch/regs.c index 1f1465ae2..9c2764866 100644 --- a/srslte/lib/phch/regs.c +++ b/srslte/lib/phch/regs.c @@ -167,6 +167,15 @@ int srslte_regs_pdcch_nregs(srslte_regs_t *h, uint32_t cfi) { } } +int srslte_regs_pdcch_ncce(srslte_regs_t *h, uint32_t cfi) { + int nregs = srslte_regs_pdcch_nregs(h, cfi); + if (nregs > 0) { + return (uint32_t) (nregs / 9); + } else { + return SRSLTE_ERROR; + } +} + /** Copy quadruplets to REGs and cyclic shift them, according to the * second part of 6.8.5 in 36.211 */