Commit af6f5a38 authored by Florian Kaltenberger's avatar Florian Kaltenberger

bugfixes - now works with dual carrier EMOS files


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5324 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 9026fda4
...@@ -13,7 +13,6 @@ primary_synch; %loads the primary sync signal ...@@ -13,7 +13,6 @@ primary_synch; %loads the primary sync signal
load('ofdm_pilots_sync_30MHz.mat'); load('ofdm_pilots_sync_30MHz.mat');
n_carriers = 2; % use 1 for UHF and 2 for 2.6GHz n_carriers = 2; % use 1 for UHF and 2 for 2.6GHz
nframes = 100; % frames in one block
symbols_per_slot = 6; symbols_per_slot = 6;
slots_per_frame = 20; slots_per_frame = 20;
...@@ -25,13 +24,18 @@ switch n_carriers ...@@ -25,13 +24,18 @@ switch n_carriers
%filename = 'E:\EMOS\corridor\trials1\eNB_data_20140331_UHF_run1.EMOS'; %filename = 'E:\EMOS\corridor\trials1\eNB_data_20140331_UHF_run1.EMOS';
filename = 'D:\trials1 train extracted\eNB_data_20140331_UHF_run1.EMOS'; filename = 'D:\trials1 train extracted\eNB_data_20140331_UHF_run1.EMOS';
nframes = 100; % frames in one block
threshold = 3e+4 ; % maybe should change that !!!!
case 2, case 2,
p(1) = init_params(50,2,4); p(1) = init_params(100,2,4);
p(2) = init_params(100,2,4); p(2) = init_params(50,2,4);
pss_t = upsample(primary_synch0_time,4*2); % this assumes we are doing the sync on the first carrier, which is 10MHz pss_t = upsample(primary_synch0_time,4*4); % this assumes we are doing the sync on the first carrier, which is 10MHz
%filename = 'E:\EMOS\corridor\trials1\eNB_data_20140331_UHF_run1.EMOS'; %filename = 'E:\EMOS\corridor\trials1\eNB_data_20140331_UHF_run1.EMOS';
filename = 'D:\trials1 train extracted\eNB_data_20140331_2.6GHz_run1.EMOS'; filename = 'D:\trials1 train extracted\eNB_data_20140331_2.6GHz_run1.EMOS';
nframes = 50; % frames in one block
threshold = 1e+4 ; % maybe should change that !!!!
end end
destdir = 'E:\EMOS\corridor\trials1 train'; destdir = 'E:\EMOS\corridor\trials1 train';
...@@ -54,9 +58,7 @@ block = 1; ...@@ -54,9 +58,7 @@ block = 1;
flag1 = 1; flag1 = 1;
start=2; start=2;
threshold = 3e+4 ; % maybe should change that !!!! %fseek(fid,samples_slot_agg*slots_per_frame*nframes*120*2,'bof'); %advance 30 sec
fseek(fid,samples_slot_agg*slots_per_frame*nframes*120*2,'bof'); %advance 30 sec
while ~feof(fid) while ~feof(fid)
fprintf(1,'Processing block %d of %d',block,nblocks); fprintf(1,'Processing block %d of %d',block,nblocks);
...@@ -68,21 +70,21 @@ while ~feof(fid) ...@@ -68,21 +70,21 @@ while ~feof(fid)
v0 = double(v(1:2:end))+1j*double(v(2:2:end)); v0 = double(v(1:2:end))+1j*double(v(2:2:end));
v1 = zeros(p(1).samples_slot*slots_per_frame*nframes,p(1).nant_rx); v1 = zeros(p(1).samples_slot*slots_per_frame*nframes,p(1).nant_rx);
if n_carriers==2
v2 = zeros(p(2).samples_slot*slots_per_frame*nframes,p(2).nant_rx);
end
for slot=1:slots_per_frame*nframes for slot=1:slots_per_frame*nframes
for a=1:p(1).nant_rx for a=1:p(1).nant_rx
v1((slot-1)*p(1).samples_slot+1:slot*p(1).samples_slot,a) = ... v1((slot-1)*p(1).samples_slot+1:slot*p(1).samples_slot,a) = ...
v0((slot-1)*samples_slot_agg+(a-1)*p(1).samples_slot+1:... v0((slot-1)*samples_slot_agg+(a-1)*p(1).samples_slot+1:...
(slot-1)*samples_slot_agg+ a *p(1).samples_slot,1); (slot-1)*samples_slot_agg+ a *p(1).samples_slot,1);
end end
end
if n_carriers==2 if n_carriers==2
v2 = zeros(p(2).samples_slot*slots_per_frame*nframes,p(2).nant_rx);
for slot=1:slots_per_frame*nframes
for a=1:p(2).nant_rx for a=1:p(2).nant_rx
v2((slot-1)*p(2).samples_slot+1:slot*p(2).samples_slot,a) = ... v2((slot-1)*p(2).samples_slot+1:slot*p(2).samples_slot,a) = ...
v0((slot-1)*samples_slot_agg+(a-1)*p(2).samples_slot+1:... v0((slot-1)*samples_slot_agg+p(1).nant_rx*p(1).samples_slot+(a-1)*p(2).samples_slot+1:...
(slot-1)*samples_slot_agg+ a *p(2).samples_slot,1); (slot-1)*samples_slot_agg+p(1).nant_rx*p(1).samples_slot+ a *p(2).samples_slot,1);
end end
end end
end end
...@@ -96,10 +98,10 @@ while ~feof(fid) ...@@ -96,10 +98,10 @@ while ~feof(fid)
end end
if n_carriers==2 if n_carriers==2
v2 = [vStorage1; v2] ; v2 = [vStorage2; v2] ;
if size(v2,1) > p(2).frame_length*nframes ; if size(v2,1) > p(2).frame_length*nframes ;
nframes = floor(size(v2,1) / p(2).frame_length) ; nframes = floor(size(v2,1) / p(2).frame_length) ;
vStorage1 = v2(p(2).frame_length*nframes+1:end,:) ; vStorage2 = v2(p(2).frame_length*nframes+1:end,:) ;
v2(p(2).frame_length*nframes + 1 : end,:) = [] ; v2(p(2).frame_length*nframes + 1 : end,:) = [] ;
start = 1 ; start = 1 ;
end end
...@@ -158,7 +160,7 @@ while ~feof(fid) ...@@ -158,7 +160,7 @@ while ~feof(fid)
fprintf(1,'.'); fprintf(1,'.');
frame_start1 = (slots_per_frame*p(1).samples_slot)*(i-1)+frame_offset+1; frame_start1 = (slots_per_frame*p(1).samples_slot)*(i-1)+frame_offset+1;
if n_carriers==2 if n_carriers==2
frame_start2 = (slots_per_frame*p(2).samples_slot)*(i-1)+frame_offset*2+1; frame_start2 = (slots_per_frame*p(2).samples_slot)*(i-1)+round(frame_offset/2)+1;
end end
if i<nframes if i<nframes
...@@ -172,14 +174,15 @@ while ~feof(fid) ...@@ -172,14 +174,15 @@ while ~feof(fid)
if n_carriers==2 if n_carriers==2
vStorage2 = [v2(frame_start2:end,:) ; vStorage2]; %% vStorage2 = [v2(frame_start2:end,:) ; vStorage2]; %%
end end
break
end end
%% MIMO channel estimation %% MIMO channel estimation
if (n_carriers==1) if (n_carriers==1)
transmit_f1 = f3; transmit_f1 = f3;
else else
transmit_f1 = f2; transmit_f1 = f1;
transmit_f2 = f1; transmit_f2 = f2;
end end
for carrier=1:n_carriers for carrier=1:n_carriers
if (carrier==1) if (carrier==1)
...@@ -232,19 +235,21 @@ while ~feof(fid) ...@@ -232,19 +235,21 @@ while ~feof(fid)
end end
drawnow drawnow
end end
end
if carrier==1
% adjust frame offset base on channel estimate to compensate for % adjust frame offset base on channel estimate to compensate for
% timing drift. We try to keep the peak of the impulse response at % timing drift. We try to keep the peak of the impulse response at
% sample prefix_length/8. % sample prefix_length/8.
[m,idx] = max(fft(ifft(PDP_all),p(1).num_carriers)); [m,idx] = max(fft(ifft(PDP_all),p(carrier).num_carriers));
offset = idx - p(1).prefix_length/8; offset = idx - p(carrier).prefix_length/8;
if offset > p(1).prefix_length if offset > p(carrier).prefix_length
offset = offset - p(1).num_carriers; offset = offset - p(carrier).num_carriers;
end end
if abs(offset) > 5 if abs(offset) > 5
frame_offset = frame_offset + round(offset/4); frame_offset = frame_offset + round(offset/4);
end end
end
end
end end
end end
......
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