Commit f68c1d82 authored by Arvanita's avatar Arvanita
Browse files

new version of emos_read_v2.m handles frame boundaries

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5232 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent be2b2ca2
...@@ -15,8 +15,8 @@ ofdm_symbol_length = num_carriers + prefix_length; ...@@ -15,8 +15,8 @@ ofdm_symbol_length = num_carriers + prefix_length;
frame_length = ofdm_symbol_length*num_symbols_frame; frame_length = ofdm_symbol_length*num_symbols_frame;
useful_carriers = num_carriers-num_zeros-1; useful_carriers = num_carriers-num_zeros-1;
filename = 'E:\EMOS\corridor\lab tests\eNB_data_20140321_184441.EMOS'; %filename = 'E:\EMOS\corridor\lab tests\eNB_data_20140321_184441.EMOS';
%filename = 'D:\711MHz\eNB_data_20140324_113931.EMOS'; filename = 'E:\EMOS\corridor\711MHz\eNB_data_20140324_113931.EMOS';
%filename = 'D:\trials1 day 1 771.5MHz\eNB_data_20140327_153151.EMOS'; %filename = 'D:\trials1 day 1 771.5MHz\eNB_data_20140327_153151.EMOS';
destdir = 'E:\EMOS\corridor\trials1 day1\711.5MHz'; destdir = 'E:\EMOS\corridor\trials1 day1\711.5MHz';
...@@ -31,7 +31,12 @@ PDP_total = zeros(nblocks*nframes,useful_carriers/4); ...@@ -31,7 +31,12 @@ PDP_total = zeros(nblocks*nframes,useful_carriers/4);
%% main loop %% main loop
fid = fopen(filename,'r'); fid = fopen(filename,'r');
vStorage = []; %%
block = 1; block = 1;
start=2;
while ~feof(fid) while ~feof(fid)
fprintf(1,'Processing block %d of %d',block,nblocks); fprintf(1,'Processing block %d of %d',block,nblocks);
...@@ -41,6 +46,8 @@ while ~feof(fid) ...@@ -41,6 +46,8 @@ while ~feof(fid)
end end
v1 = double(v(1:2:end))+1j*double(v(2:2:end)); v1 = double(v(1:2:end))+1j*double(v(2:2:end));
nframes = 100;
v2 = zeros(samples_slot*slots_per_frame*nframes,nant); v2 = zeros(samples_slot*slots_per_frame*nframes,nant);
for slot=1:slots_per_frame*nframes for slot=1:slots_per_frame*nframes
for a=1:nant for a=1:nant
...@@ -50,13 +57,22 @@ while ~feof(fid) ...@@ -50,13 +57,22 @@ while ~feof(fid)
end end
end end
v2 = [vStorage; v2] ;%%
if size(v2,1) > frame_length*nframes ;
nframes = floor(size(v2,1) / frame_length) ;
vStorage = v2(frame_length*nframes+1:end,:) ;
v2(frame_length*nframes + 1 : end,:) = [] ;
start = 1 ;
end
if enable_plots>=2 if enable_plots>=2
figure(1) figure(1)
plot(20*log10(abs(fftshift(fft(v2))))) plot(20*log10(abs(fftshift(fft(v2)))))
end end
%% frame start detection %% frame start detection
if block==1 % if block==1
[corr,lag] = xcorr(v2(:,1),pss_t); [corr,lag] = xcorr(v2(:,1),pss_t);
%[m,idx]=max(abs(corr)); %[m,idx]=max(abs(corr));
%[m,idx]=peaksfinder(corr,frame_length); %[m,idx]=peaksfinder(corr,frame_length);
...@@ -74,20 +90,24 @@ while ~feof(fid) ...@@ -74,20 +90,24 @@ while ~feof(fid)
plot(frame_offset,m(1),'ro') plot(frame_offset,m(1),'ro')
end end
start=2;
else
start=1; % end
end
%%
for i=start:nframes; for i=start:nframes;
fprintf(1,'.'); fprintf(1,'.');
frame_start = (slots_per_frame*samples_slot)*(i-1)+frame_offset+1; frame_start = (slots_per_frame*samples_slot)*(i-1)+frame_offset+1;
%frame_start = lag(idx(i))-prefix_length; %frame_start = lag(idx(i))-prefix_length;
% frame_start = lag(i) - prefix_length; % frame_start = lag(i) - prefix_length;
%% ofdm receiver
received_f = OFDM_RX(v2(frame_start:frame_start+frame_length,:),num_carriers,useful_carriers,prefix_length,num_symbols_frame);
if i<nframes
%% ofdm receiver
received_f = OFDM_RX(v2(frame_start:frame_start+frame_length,:),num_carriers,useful_carriers,prefix_length,num_symbols_frame);
else
vStorage = [v2(frame_start:end,:) ; vStorage]; %%
end
%% channel estimation %% channel estimation
H=conj(squeeze(f3(1,3:2:end,1:4:end))).*received_f(3:2:end,1:4:end,1); H=conj(squeeze(f3(1,3:2:end,1:4:end))).*received_f(3:2:end,1:4:end,1);
Ht = ifft(H,[],2); Ht = ifft(H,[],2);
...@@ -100,14 +120,14 @@ while ~feof(fid) ...@@ -100,14 +120,14 @@ while ~feof(fid)
offset = offset - num_carriers; offset = offset - num_carriers;
end end
if abs(offset) > 5 if abs(offset) > 5
frame_offset = frame_offset + offset; frame_offset = frame_offset + round(offset/4);
end end
if enable_plots>=1 if enable_plots>=1
figure(3) figure(3)
surf(20*log10(abs(Ht))) surf(20*log10(abs(Ht)))
xlabel('time [OFDM symbol]') xlabel('delay time [samples]')
ylabel('delay time [samples]') ylabel('time [OFDM symbol]')
zlabel('power [dB]') zlabel('power [dB]')
shading interp shading interp
figure(4) figure(4)
......
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