From 3519e2f15a5a55db7afd344d95fee2e03c5b3661 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 11 May 2016 21:00:12 +0100 Subject: [PATCH 1/3] Calibrated noise estimation using matlab for length 3 filters. Fixed compilation of volk for MEX. --- matlab/tests/equalizer_test.m | 10 +++------- srslte/lib/CMakeLists.txt | 1 + srslte/lib/ch_estimation/chest_dl.c | 10 ++++++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/matlab/tests/equalizer_test.m b/matlab/tests/equalizer_test.m index 8cbf99373..e04a34028 100644 --- a/matlab/tests/equalizer_test.m +++ b/matlab/tests/equalizer_test.m @@ -7,10 +7,10 @@ clear plot_noise_estimation_only=false; SNR_values_db=linspace(0,30,5); -Nrealizations=4; +Nrealizations=10; w1=0.1; -w2=0.2; +w2=0.3; enb.NDLRB = 50; % Number of resource blocks @@ -26,7 +26,7 @@ P=K/6; cfg.Seed = 0; % Random channel seed cfg.InitTime = 0; cfg.NRxAnts = 1; % 1 receive antenna -cfg.DelayProfile = 'EVA'; +cfg.DelayProfile = 'EPA'; % doppler 5, 70 300 @@ -203,7 +203,6 @@ end %% Plot a single realization if (length(SNR_values_db) == 1) - subplot(2,1,1) sym=1; ref_idx=1:P; ref_idx_x=[1:6:K];% (292:6:360)-216];% 577:6:648]; @@ -227,9 +226,6 @@ 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))) - - subplot(2,1,2) - plot(1:P,abs(W3(P/2,:))) end diff --git a/srslte/lib/CMakeLists.txt b/srslte/lib/CMakeLists.txt index d5c1e0feb..0621232ee 100644 --- a/srslte/lib/CMakeLists.txt +++ b/srslte/lib/CMakeLists.txt @@ -92,6 +92,7 @@ endif(RF_FOUND) if(VOLK_FOUND) target_link_libraries(srslte ${VOLK_LIBRARIES}) + target_link_libraries(srslte_static ${VOLK_LIBRARIES}) endif(VOLK_FOUND) INSTALL(TARGETS srslte DESTINATION ${LIBRARY_DIR}) diff --git a/srslte/lib/ch_estimation/chest_dl.c b/srslte/lib/ch_estimation/chest_dl.c index 8409476b6..0a23b73ec 100644 --- a/srslte/lib/ch_estimation/chest_dl.c +++ b/srslte/lib/ch_estimation/chest_dl.c @@ -178,8 +178,14 @@ static float estimate_noise_pilots(srslte_chest_dl_t *q, uint32_t port_id) srslte_vec_fprint_f(stdout, q->snr_vector, nref); #endif - /* Compute average power */ - float power = (1/q->smooth_filter[0])*q->cell.nof_ports*srslte_vec_avg_power_cf(q->tmp_noise, nref); + /* 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; + } + float power = norm*q->cell.nof_ports*srslte_vec_avg_power_cf(q->tmp_noise, nref); return power; } From 50cfec8829d4d442d2f38e52a3123c08b24b2026 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 11 May 2016 21:07:26 +0100 Subject: [PATCH 2/3] Compute noise in all subframes --- matlab/tests/equalizer_test.m | 6 +++--- srslte/lib/ch_estimation/chest_dl.c | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/matlab/tests/equalizer_test.m b/matlab/tests/equalizer_test.m index e04a34028..fc6b18c66 100644 --- a/matlab/tests/equalizer_test.m +++ b/matlab/tests/equalizer_test.m @@ -6,7 +6,7 @@ clear plot_noise_estimation_only=false; -SNR_values_db=linspace(0,30,5); +SNR_values_db=linspace(0,10,5); Nrealizations=10; w1=0.1; @@ -26,11 +26,11 @@ P=K/6; cfg.Seed = 0; % Random channel seed cfg.InitTime = 0; cfg.NRxAnts = 1; % 1 receive antenna -cfg.DelayProfile = 'EPA'; +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 diff --git a/srslte/lib/ch_estimation/chest_dl.c b/srslte/lib/ch_estimation/chest_dl.c index 0a23b73ec..05b15f841 100644 --- a/srslte/lib/ch_estimation/chest_dl.c +++ b/srslte/lib/ch_estimation/chest_dl.c @@ -326,20 +326,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 } } From 8a060558894fa41f25cdc3b5cef13a3a5226e437 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 11 May 2016 21:17:26 +0100 Subject: [PATCH 3/3] Fixed srslte_static link with volk when disableMEX. Calibrated PSS-based noise estimation --- matlab/tests/equalizer_test.m | 2 +- srslte/lib/CMakeLists.txt | 4 +++- srslte/lib/ch_estimation/chest_dl.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/matlab/tests/equalizer_test.m b/matlab/tests/equalizer_test.m index fc6b18c66..a8fa65edc 100644 --- a/matlab/tests/equalizer_test.m +++ b/matlab/tests/equalizer_test.m @@ -12,7 +12,7 @@ Nrealizations=10; w1=0.1; 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 diff --git a/srslte/lib/CMakeLists.txt b/srslte/lib/CMakeLists.txt index 0621232ee..4e0990563 100644 --- a/srslte/lib/CMakeLists.txt +++ b/srslte/lib/CMakeLists.txt @@ -92,7 +92,9 @@ endif(RF_FOUND) if(VOLK_FOUND) target_link_libraries(srslte ${VOLK_LIBRARIES}) - target_link_libraries(srslte_static ${VOLK_LIBRARIES}) + if(NOT DisableMEX) + target_link_libraries(srslte_static ${VOLK_LIBRARIES}) + endif(NOT DisableMEX) endif(VOLK_FOUND) INSTALL(TARGETS srslte DESTINATION ${LIBRARY_DIR}) diff --git a/srslte/lib/ch_estimation/chest_dl.c b/srslte/lib/ch_estimation/chest_dl.c index 05b15f841..e5963aac7 100644 --- a/srslte/lib/ch_estimation/chest_dl.c +++ b/srslte/lib/ch_estimation/chest_dl.c @@ -205,7 +205,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; }