Revert "ue_sync: set default offset correction interval to 0. chest_dl: added option to average estimates per subframe"

This reverts commit 10cbb9ad92.
master
Ismael Gomez 8 years ago
parent 4f7b372711
commit 850259e2f7

@ -6,13 +6,13 @@ clear
plot_noise_estimation_only=false;
SNR_values_db=linspace(0,20,8);
Nrealizations=10;
SNR_values_db=100;%linspace(20,35,8);
Nrealizations=1;
w1=0.1;
w2=0.3;
enb.NDLRB = 25; % Number of resource blocks
enb.NDLRB = 6; % Number of resource blocks
enb.CellRefP = 1; % One transmit antenna port
enb.NCellID = 0; % Cell ID
@ -181,8 +181,8 @@ for i=1:10
rxGrid_sf = rxGrid(:,(i-1)*14+1:i*14);
%% Channel Estimation with Matlab
[hest{1}(:,(1:14)+(i-1)*14), tmpnoise{1}(i)] = ...
lteDLChannelEstimate(enb,cec,rxGrid_sf);
[hest{1}(:,(1:14)+(i-1)*14), tmpnoise{1}(i), hls(:,(1:4*P)+(i-1)*4*P)] = ...
lteDLChannelEstimate2(enb,cec,rxGrid_sf);
tmpnoise{1}(i)=tmpnoise{1}(i)*sqrt(2)*enb.CellRefP;
%% LS-Linear estimation with srsLTE
@ -227,12 +227,17 @@ if (length(SNR_values_db) == 1)
tmp{Ntests+1}='Real';
legend(tmp)
xlabel('Sample')
xlabel('SNR (dB)')
ylabel('Channel Gain')
grid on;
% 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)))
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

@ -116,7 +116,7 @@ for snr_idx=1:length(SNR_values)
rmccFgOut.TotSubframes=1;
% Perform channel estimation
[hest, nest] = lteDLChannelEstimate(rmccFgOut, cec, subframe_rx);
[hest, nest,estimates] = lteDLChannelEstimate2(rmccFgOut, cec, subframe_rx);
[cws,symbols] = ltePDSCHDecode(rmccFgOut,rmccFgOut.PDSCH,subframe_rx,hest,nest);
[trblkout,blkcrc,dstate] = lteDLSCHDecode(rmccFgOut,rmccFgOut.PDSCH, ...
@ -156,7 +156,6 @@ if (length(SNR_values)>1)
axis([min(SNR_values) max(SNR_values) 1/Npackets/(Nsf+1) 1])
else
scatter(real(symbols{1}),imag(symbols{1}))
plot(
fprintf('Matlab: %d OK\nsrsLTE: %d OK\n',decoded, decoded_srslte);
end

@ -583,13 +583,11 @@ int main(int argc, char **argv) {
sfn++;
if (sfn == 1024) {
sfn = 0;
/*
printf("\n");
ue_dl.pkt_errors = 0;
ue_dl.pkts_total = 0;
ue_dl.nof_detected = 0;
nof_trials = 0;
*/
}
}

@ -39,8 +39,6 @@
#include "srslte/utils/vector.h"
#include "srslte/utils/convolution.h"
#define AVERAGE_SUBFRAME
//#define DEFAULT_FILTER_LEN 3
#ifdef DEFAULT_FILTER_LEN
@ -167,18 +165,7 @@ void srslte_chest_dl_free(srslte_chest_dl_t *q)
/* Uses the difference between the averaged and non-averaged pilot estimates */
static float estimate_noise_pilots(srslte_chest_dl_t *q, uint32_t port_id)
{
float norm = sqrt(2);
#ifdef AVERAGE_SUBFRAME
int nref=2*q->cell.nof_prb;
#else
int nref=SRSLTE_REFSIGNAL_NUM_SF(q->cell.nof_prb, port_id);
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;
}
#endif
/* Substract noisy pilot estimates */
srslte_vec_sub_ccc(q->pilot_estimates_average, q->pilot_estimates, q->tmp_noise, nref);
@ -192,6 +179,12 @@ static float estimate_noise_pilots(srslte_chest_dl_t *q, uint32_t port_id)
#endif
/* 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;
}
@ -232,29 +225,19 @@ static float estimate_noise_empty_sc(srslte_chest_dl_t *q, cf_t *input) {
static void interpolate_pilots(srslte_chest_dl_t *q, cf_t *pilot_estimates, cf_t *ce, uint32_t port_id)
{
#ifdef AVERAGE_SUBFRAME
// Interpolate symbol 0 in the frequency domain
uint32_t fidx_offset = srslte_refsignal_cs_fidx(q->cell, 0, port_id, 0);
srslte_interp_linear_offset(&q->srslte_interp_lin, pilot_estimates,
&ce[srslte_refsignal_cs_nsymbol(0,q->cell.cp, port_id) * q->cell.nof_prb * SRSLTE_NRE],
fidx_offset, SRSLTE_NRE/2-fidx_offset);
// All channel estimates in the subframe are the same
for (int l=1;l<2*SRSLTE_CP_NSYMB(q->cell.cp);l++) {
memcpy(&ce[l*q->cell.nof_prb*SRSLTE_NRE], ce, q->cell.nof_prb*SRSLTE_NRE*sizeof(cf_t));
}
#else
uint32_t l=0;
/* interpolate the symbols with references in the freq domain */
uint32_t l;
uint32_t nsymbols = srslte_refsignal_cs_nof_symbols(port_id);
// Interpolate in the frequency domain
/* Interpolate in the frequency domain */
for (l=0;l<nsymbols;l++) {
uint32_t fidx_offset = srslte_refsignal_cs_fidx(q->cell, l, port_id, 0);
srslte_interp_linear_offset(&q->srslte_interp_lin, &pilot_estimates[2*q->cell.nof_prb*l],
&ce[srslte_refsignal_cs_nsymbol(l,q->cell.cp, port_id) * q->cell.nof_prb * SRSLTE_NRE],
fidx_offset, SRSLTE_NRE/2-fidx_offset);
}
// Interpolate in the time domain between symbols
/* Now interpolate in the time domain between symbols */
if (SRSLTE_CP_ISNORM(q->cell.cp)) {
if (nsymbols == 4) {
srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(0), &cesymb(4), &cesymb(1), 4, 3);
@ -278,7 +261,6 @@ static void interpolate_pilots(srslte_chest_dl_t *q, cf_t *pilot_estimates, cf_t
srslte_interp_linear_vector(&q->srslte_interp_linvec, &cesymb(1), &cesymb(7), &cesymb(8), 6, 4);
}
}
#endif
}
void srslte_chest_dl_set_smooth_filter(srslte_chest_dl_t *q, float *filter, uint32_t filter_len) {
@ -311,17 +293,9 @@ static void average_pilots(srslte_chest_dl_t *q, cf_t *input, cf_t *output, uint
uint32_t nsymbols = srslte_refsignal_cs_nof_symbols(port_id);
uint32_t nref = 2*q->cell.nof_prb;
memcpy(output, input, nref*sizeof(cf_t));
for (int l=1;l<nsymbols;l++) {
#ifdef AVERAGE_SUBFRAME
srslte_vec_sum_ccc(output, &input[l*nref], output, nref);
#else
for (int l=0;l<nsymbols;l++) {
srslte_conv_same_cf(&input[l*nref], q->smooth_filter, &output[l*nref], nref, q->smooth_filter_len);
#endif
}
#ifdef AVERAGE_SUBFRAME
srslte_vec_sc_prod_cfc(output, (float) 1.0/nsymbols, output, nref);
#endif
}
float srslte_chest_dl_rssi(srslte_chest_dl_t *q, cf_t *input, uint32_t port_id) {

@ -44,7 +44,7 @@ cf_t dummy[MAX_TIME_OFFSET];
#define TRACK_MAX_LOST 4
#define TRACK_FRAME_SIZE 32
#define FIND_NOF_AVG_FRAMES 4
#define DEFAULT_SAMPLE_OFFSET_CORRECT_PERIOD 0
#define DEFAULT_SAMPLE_OFFSET_CORRECT_PERIOD 5
#define DEFAULT_SFO_EMA_COEFF 0.1
cf_t dummy_offset_buffer[1024*1024];
@ -358,6 +358,7 @@ static int track_peak_ok(srslte_ue_sync_t *q, uint32_t track_idx) {
{
INFO("Warning: Expected SF idx %d but got %d! (%d frames)\n",
q->sf_idx, srslte_sync_get_sf_idx(&q->strack), q->frame_no_cnt);
q->sf_idx = srslte_sync_get_sf_idx(&q->strack);
q->frame_no_cnt++;
if (q->frame_no_cnt >= TRACK_MAX_LOST) {
INFO("\n%d frames lost. Going back to FIND\n", (int) q->frame_no_cnt);
@ -381,19 +382,18 @@ static int track_peak_ok(srslte_ue_sync_t *q, uint32_t track_idx) {
// Compute cumulative moving average time offset */
if (!frame_idx) {
if (q->sample_offset_correct_period) {
// Adjust RF sampling time based on the mean sampling offset
q->next_rf_sample_offset = (int) round(q->mean_sample_offset);
// Reset PSS averaging if correcting every a period longer than 1
if (q->sample_offset_correct_period > 1) {
srslte_sync_reset(&q->strack);
}
// Compute SFO based on mean sample offset
if (q->sample_offset_correct_period) {
q->mean_sample_offset /= q->sample_offset_correct_period;
} else {
q->next_rf_sample_offset = q->last_sample_offset;
}
q->mean_sfo = SRSLTE_VEC_EMA(q->mean_sample_offset, q->mean_sfo, q->sfo_ema);
INFO("Time offset adjustment: %d samples (%.2f), mean SFO: %.2f Hz, %.5f samples/5-sf, ema=%f, length=%d\n",

Loading…
Cancel
Save