Commit fde840d1 authored by Florian Kaltenberger's avatar Florian Kaltenberger

emos_read_ca.m now synchronizes both carriers independently

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5211 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f650c71f
...@@ -15,7 +15,8 @@ ofdm_symbol_length = num_carriers + prefix_length; ...@@ -15,7 +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\corridor2\eNB_data_20140321_184441.EMOS'; %filename = 'E:\EMOS\corridor2\eNB_data_20140321_184441.EMOS';
filename = 'D:\711MHz\eNB_data_20140324_113931.EMOS';
samples_slot = 7680/2; samples_slot = 7680/2;
slots_per_frame = 20; slots_per_frame = 20;
nframes = 100; nframes = 100;
...@@ -48,7 +49,7 @@ while ~feof(fid) ...@@ -48,7 +49,7 @@ while ~feof(fid)
if enable_plots>=2 if enable_plots>=2
figure(1) figure(1)
plot(abs(fftshift(fft(v2)))) plot(20*log10(abs(fftshift(fft(v2)))))
end end
%% frame start detection %% frame start detection
......
...@@ -12,7 +12,8 @@ pss2_t = upsample(primary_synch0_time,4*2); ...@@ -12,7 +12,8 @@ pss2_t = upsample(primary_synch0_time,4*2);
%load('E:\EMOS\corridor\ofdm_pilots_sync_2048_v7.mat'); %load('E:\EMOS\corridor\ofdm_pilots_sync_2048_v7.mat');
load('ofdm_pilots_sync_30MHz.mat'); load('ofdm_pilots_sync_30MHz.mat');
filename = 'E:\EMOS\corridor\eNB_data_20140319_133327.EMOS'; %filename = 'E:\EMOS\corridor\eNB_data_20140319_133327.EMOS';
filename = 'D:\2.6GHz\eNB_data_20140324_171904.EMOS';
nb_rb1 = 100; %this can be 25, 50, or 100 nb_rb1 = 100; %this can be 25, 50, or 100
num_carriers1 = 2048/100*nb_rb1; num_carriers1 = 2048/100*nb_rb1;
...@@ -40,8 +41,8 @@ slots_per_frame = 20; ...@@ -40,8 +41,8 @@ slots_per_frame = 20;
d = dir(filename); d = dir(filename);
nblocks = floor(d.bytes/(samples_slot_agg*slots_per_frame*nframes*4)); nblocks = floor(d.bytes/(samples_slot_agg*slots_per_frame*nframes*4));
PDP1_total = zeros(nblocks*nframes,useful_carriers1/2); PDP1_total = zeros(nblocks*nframes,useful_carriers1/4);
PDP2_total = zeros(nblocks*nframes,useful_carriers2/2); PDP2_total = zeros(nblocks*nframes,useful_carriers2/4);
%% main loop %% main loop
fid = fopen(filename,'r'); fid = fopen(filename,'r');
...@@ -51,6 +52,7 @@ while ~feof(fid) ...@@ -51,6 +52,7 @@ while ~feof(fid)
%% %%
[v,c]=fread(fid, 2*samples_slot_agg*slots_per_frame*nframes, 'int16',0,'ieee-le'); [v,c]=fread(fid, 2*samples_slot_agg*slots_per_frame*nframes, 'int16',0,'ieee-le');
block = block+1;
if (c==0) if (c==0)
break break
end end
...@@ -73,39 +75,47 @@ while ~feof(fid) ...@@ -73,39 +75,47 @@ while ~feof(fid)
if enable_plots>=2 if enable_plots>=2
figure(1) figure(1)
plot(abs(fftshift(fft(v1)))) plot(20*log10(abs(fftshift(fft(v1)))))
figure(2) figure(2)
plot(abs(fftshift(fft(v2)))) plot(20*log10(abs(fftshift(fft(v2)))))
end end
%% frame start detection %% frame start detection
[corr,lag] = xcorr(v2(:,1),pss2_t); [corr1,lag1] = xcorr(v1(:,1),pss1_t);
[corr2,lag2] = xcorr(v2(:,1),pss2_t);
%[m,idx]=max(abs(corr)); %[m,idx]=max(abs(corr));
[m,idx]=peaksfinder(corr,frame_length2); [m1,idx1]=peaksfinder(corr1,frame_length1);
[m2,idx2]=peaksfinder(corr2,frame_length2);
if (enable_plots>=2) if (enable_plots>=2)
figure(20); figure(20);
hold off hold off
plot(lag,abs(corr)); plot(lag1,abs(corr1));
hold on hold on
plot(lag(idx),m,'ro') plot(lag1(idx1),m1,'ro')
figure(21);
hold off
plot(lag2,abs(corr2));
hold on
plot(lag2(idx2),m2,'ro')
end end
%% %%
for i=1:size(idx,2)-1; % the last frame is not complite for i=1:size(idx1,2)-1; % the last frame is not complite
fprintf(1,'.'); fprintf(1,'.');
%frame_start2 = lag(i) - prefix_length2; %frame_start2 = lag(i) - prefix_length2;
frame_start2 = lag(idx(i))-prefix_length2; frame_start1 = lag1(idx1(i))-prefix_length1;
frame_start1 = frame_start2*2; frame_start2 = lag2(idx2(i))-prefix_length2;
%frame_start1 = frame_start2*2;
% ofdm receiver % ofdm receiver
received_f1 = OFDM_RX(v1(frame_start1:frame_start1+frame_length1,:),num_carriers1,useful_carriers1,prefix_length1,num_symbols_frame); received_f1 = OFDM_RX(v1(frame_start1:frame_start1+frame_length1,:),num_carriers1,useful_carriers1,prefix_length1,num_symbols_frame);
received_f2 = OFDM_RX(v2(frame_start2:frame_start2+frame_length2,:),num_carriers2,useful_carriers2,prefix_length2,num_symbols_frame); received_f2 = OFDM_RX(v2(frame_start2:frame_start2+frame_length2,:),num_carriers2,useful_carriers2,prefix_length2,num_symbols_frame);
% channel estimation (SISO) % channel estimation (SISO)
H1=conj(squeeze(f1(1,3:2:end,1:2:end))).*received_f1(3:2:end,1:2:end,1); H1=conj(squeeze(f1(1,3:2:end,1:4:end))).*received_f1(3:2:end,1:4:end,1);
H2=conj(squeeze(f2(1,3:2:end,1:2:end))).*received_f2(3:2:end,1:2:end,1); H2=conj(squeeze(f2(1,3:2:end,1:4:end))).*received_f2(3:2:end,1:4:end,1);
H1t = ifft(H1,[],2); H1t = ifft(H1,[],2);
H2t = ifft(H2,[],2); H2t = ifft(H2,[],2);
PDP1 = mean(abs(H1t).^2,1); PDP1 = mean(abs(H1t).^2,1);
...@@ -142,7 +152,6 @@ while ~feof(fid) ...@@ -142,7 +152,6 @@ while ~feof(fid)
end end
fprintf(1,'\n'); fprintf(1,'\n');
block = block+1;
end end
fclose(fid); fclose(fid);
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