From: drowe67 Date: Thu, 22 Mar 2018 07:11:41 +0000 (+0000) Subject: normalised correlation of coarse timing, to assist with initial sync at different... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=2d5018b56f72cb492f35e19b46352689d5a69561;p=freetel-svn-tracking.git normalised correlation of coarse timing, to assist with initial sync at different rx levels git-svn-id: https://svn.code.sf.net/p/freetel/code@3424 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/octave/ofdm_dev.m b/codec2-dev/octave/ofdm_dev.m index 48059ade..520eb1fc 100644 --- a/codec2-dev/octave/ofdm_dev.m +++ b/codec2-dev/octave/ofdm_dev.m @@ -849,7 +849,7 @@ function [delta_ct delta_foff] = acquisition_test(Ntests=10, EbNodB=100, foff_hz sim_in.Tcp = 0.002; sim_in.Rs = 1/Ts; sim_in.bps = 2; sim_in.Nc = 16; sim_in.Ns = 8; - sim_in.Nsec = Ntests*(sim_in.Ns+1)/sim_in.Rs; + sim_in.Nsec = (Ntests+1)*(sim_in.Ns+1)/sim_in.Rs; sim_in.EbNodB = EbNodB; sim_in.verbose = 0; @@ -861,8 +861,8 @@ function [delta_ct delta_foff] = acquisition_test(Ntests=10, EbNodB=100, foff_hz sim_in.ldpc_en = 0; [sim_out rx states] = run_sim(sim_in); - - states.verbose = 0; + + states.verbose = 2; % set up acquistion @@ -906,7 +906,7 @@ function [delta_ct delta_foff] = acquisition_test(Ntests=10, EbNodB=100, foff_hz en = 2.5*Nsamperframe - 1; ct_target = Nsamperframe/2; - for w=1:Nsamperframe:length(rx)-3*Nsamperframe + for w=1:Nsamperframe:length(rx)-4*Nsamperframe %st = w+0.5*Nsamperframe; en = st+2*Nsamperframe-1; %[ct_est foff_est] = coarse_sync(states, rx(st:en), rate_fs_pilot_samples); [ct_est foff_est] = coarse_sync(states, rx(w+st:w+en), rate_fs_pilot_samples); @@ -1010,5 +1010,5 @@ init_cml('/home/david/Desktop/cml/'); %run_single %run_curves %run_curves_estimators -acquisition_histograms(0, 0) -%acquisition_test(10, 4, 5) +%acquisition_histograms(0, 0) +acquisition_test(10, -3, 5) diff --git a/codec2-dev/octave/ofdm_lib.m b/codec2-dev/octave/ofdm_lib.m index a71481da..bd0303b9 100644 --- a/codec2-dev/octave/ofdm_lib.m +++ b/codec2-dev/octave/ofdm_lib.m @@ -71,13 +71,16 @@ function [t_est foff_est] = coarse_sync(states, rx, rate_fs_pilot_samples) Ncorr = length(rx) - (Nsamperframe+Npsam) + 1; assert(Ncorr > 0); corr1 = corr2 = zeros(1,Ncorr); + av_level = Npsam*sqrt(rx*rx')/Ncorr + 1E-12; for i=1:Ncorr - corr1(i) = rx(i:i+Npsam-1) * rate_fs_pilot_samples'; - corr2(i) += rx(i+Nsamperframe:i+Nsamperframe+Npsam-1) * rate_fs_pilot_samples'; + rx1 = rx(i:i+Npsam-1); rx2 = rx(i+Nsamperframe:i+Nsamperframe+Npsam-1); + corr1(i) = rx1 * rate_fs_pilot_samples'; + corr2(i) = rx2 * rate_fs_pilot_samples'; end - corr = abs(corr1) + abs(corr2); + corr = (abs(corr1) + abs(corr2))/av_level; [mx t_est] = max(corr); + printf(" max: %f t_est: %d\n", mx, t_est); #{ % original freq offset est code that never made it into C. Have some concerns about CPU @@ -110,6 +113,7 @@ function [t_est foff_est] = coarse_sync(states, rx, rate_fs_pilot_samples) %printf("t_est: %d\n", t_est); figure(7); clf; plot(abs(corr)) + axis([1 Ncorr 0 2]) #{ figure(8) plot(C) @@ -305,7 +309,7 @@ function [rx_bits states aphase_est_pilot_log rx_np rx_amp] = ofdm_demod(states, % update timing estimate -------------------------------------------------- - delta_t = 0; + delta_t = coarse_foff_est_hz = 0; if timing_en % update timing at start of every frame