Commit e70f131a authored by Florian Kaltenberger's avatar Florian Kaltenberger

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4435 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b8a66a0f
...@@ -30,14 +30,14 @@ autocal_mode=active_rf; ...@@ -30,14 +30,14 @@ autocal_mode=active_rf;
%rf_mode=(TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF25+LNA1ON+LNAMax+RFBBNORM) * active_rf; %rf_mode=(TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF25+LNA1ON+LNAMax+RFBBNORM) * active_rf;
% we have to enable both DMA transfers so that the switching signal in the LSB of the TX buffer gets set % we have to enable both DMA transfers so that the switching signal in the LSB of the TX buffer gets set
rf_mode=(TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF25+LNA1ON+LNAMax+RFBBNORM+DMAMODE_TX+TXEN+DMAMODE_RX+RXEN) * active_rf; rf_mode=(TXLPFNORM+TXLPFEN+TXLPF25+RXLPFNORM+RXLPFEN+RXLPF25+LNA1ON+LNAMax+RFBBNORM+DMAMODE_TX+TXEN+DMAMODE_RX+RXEN) * active_rf;
tdd_config = DUPLEXMODE_FDD+TXRXSWITCH_LSB; LSBSWITCH_FLAG=false; %we also need the LSB switching for the woduplex script, otherwise we don't receive anything tdd_config = DUPLEXMODE_FDD+TXRXSWITCH_LSB; %we also need the LSB switching for the woduplex script, otherwise we don't receive anything
%tdd_config = DUPLEXMODE_FDD+TXRXSWITCH_LSB; LSBSWITCH_FLAG=true; %tdd_config = DUPLEXMODE_FDD+TXRXSWITCH_LSB;
syncmode = SYNCMODE_FREE; syncmode = SYNCMODE_FREE;
rf_local = [8254744 8255063 8257340 8257340]; %eNB2tx 1.9GHz rf_local = [8254744 8255063 8257340 8257340]; %eNB2tx 1.9GHz
rf_vcocal=rf_vcocal_19G*active_rf; rf_vcocal=rf_vcocal_19G*active_rf;
rffe_rxg_low = 63*active_rf; rffe_rxg_low = 63*active_rf;
rffe_rxg_final = [30 40 30 20]; rffe_rxg_final = [30 30 30 30];
rffe_band = B19G_TDD*active_rf; rffe_band = B19G_TDD*active_rf;
rf_rxdc = rf_rxdc*active_rf; rf_rxdc = rf_rxdc*active_rf;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
% Organisation: Eurecom (and Linkoping University) % Organisation: Eurecom (and Linkoping University)
% E-mail: mirsad.cirkic@liu.se % E-mail: mirsad.cirkic@liu.se
if(paramsinitialized && ~LSBSWITCH_FLAG) if(paramsinitialized)
disp(['\n\n------------\nThis code is, so far, only written for single runs. Multiple ' ... disp(['\n\n------------\nThis code is, so far, only written for single runs. Multiple ' ...
'runs will overwrite the previous measurement data, i.e., the ' ... 'runs will overwrite the previous measurement data, i.e., the ' ...
'data structures are not defined for multiple runs. You will need to ' ... 'data structures are not defined for multiple runs. You will need to ' ...
...@@ -115,9 +115,9 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -115,9 +115,9 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
end end
HB2A=conj(repmat(Db2a_T,Niter,1)).*repmat(Db2a_R(:,:,meas),1,Nantb); HB2A=conj(repmat(Db2a_T,Niter,1)).*repmat(Db2a_R(:,:,meas),1,Nantb);
phasesB2A=unwrap(angle(HB2A)); phasesB2A=unwrap(angle(HB2A));
if(mean(var(phasesB2A))>0.5) #if(mean(var(phasesB2A))>0.5)
disp('The phases of your estimates from B to A are a bit high (larger than 0.5 rad.), something is wrong.'); # disp('The phases of your estimates from B to A are a bit high (larger than 0.5 rad.), something is wrong.');
end #end
if (chanest_full) if (chanest_full)
chanestsB2A(:,:,meas)=zeros(301,Nantb); chanestsB2A(:,:,meas)=zeros(301,Nantb);
...@@ -140,15 +140,17 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -140,15 +140,17 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
end end
%% -- Some plotting code -- %% (you can uncomment what you see fit) %% -- Some plotting code -- %% (you can uncomment what you see fit)
received = receivedB2A; received = [receivedB2A(:,indA) receivedA2B(:,indB)];
phases = phasesB2A; phases = phasesB2A;
tchanests = [tchanestsA2B(:,:,end), tchanestsB2A(:,:,end)]; tchanests = [tchanestsA2B(:,:,end), tchanestsB2A(:,:,end)];
fchanests = [fchanestsA2B(:,:,end), fchanestsB2A(:,:,end)]; fchanests = [fchanestsA2B(:,:,end), fchanestsB2A(:,:,end)];
clf clf
figure(1) figure(1)
for i=1:4 for i=1:size(received,2);
subplot(220+i);plot(20*log10(abs(fftshift(fft(received(:,i)))))); subplot(220+i);
plot(20*log10(abs(fftshift(fft(received(:,i))))));
ylim([20 140])
end end
figure(2) figure(2)
...@@ -159,7 +161,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -159,7 +161,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
legend('A->B1','A->B2','A->B3','B1->A','B2->A','B3->A'); legend('A->B1','A->B2','A->B3','B1->A','B2->A','B3->A');
%legend('A->B1','A->B2','B1->A','B2->A'); %legend('A->B1','A->B2','B1->A','B2->A');
figure(4) figure(3)
plot(20*log10(abs(fchanests))); plot(20*log10(abs(fchanests)));
ylim([40 100]) ylim([40 100])
xlabel('freq') xlabel('freq')
...@@ -168,7 +170,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -168,7 +170,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
%legend('A->B1','A->B2','B1->A','B2->A'); %legend('A->B1','A->B2','B1->A','B2->A');
if (0) if (0)
figure(3) figure(4)
wndw = 50; wndw = 50;
for i=1:5:Nantb*301 %# sliding window size for i=1:5:Nantb*301 %# sliding window size
phamean = filter(ones(wndw,1)/wndw, 1, phases(:,i)); %# moving average phamean = filter(ones(wndw,1)/wndw, 1, phases(:,i)); %# moving average
...@@ -203,15 +205,16 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -203,15 +205,16 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
end end
figure(5) figure(5)
plot_style={'rx','bo','gs'}; plot_style={'rx','go','bs'};
hold off hold off
for n=1:Nantb for n=1:Nantb
plot((squeeze(Fhatloc(:,:,n))),plot_style{n}) plot((squeeze(Fhatloc(:,:,n))),plot_style{n})
hold on hold on
end end
axis([-2 2 -2 2])
disp(squeeze(mean(Fhatloc,2)));
else else
if(LSBSWITCH_FLAG) error('You have to unset the LSB switch flag (LSBSWITCH_FLAG) in initparams.m.\n') error('You have to run init.params.m first!')
else error('You have to run init.params.m first!')
end
end end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
% Organisation: Eurecom (and Linkoping University) % Organisation: Eurecom (and Linkoping University)
% E-mail: mirsad.cirkic@liu.se % E-mail: mirsad.cirkic@liu.se
if(paramsinitialized && ~LSBSWITCH_FLAG) if(paramsinitialized)
disp(['\n\n------------\nThis code is, so far, only written for single runs. Multiple ' ... disp(['\n\n------------\nThis code is, so far, only written for single runs. Multiple ' ...
'runs will overwrite the previous measurement data, i.e., the ' ... 'runs will overwrite the previous measurement data, i.e., the ' ...
'data structures are not defined for multiple runs. You will need to ' ... 'data structures are not defined for multiple runs. You will need to ' ...
...@@ -27,6 +27,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -27,6 +27,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
%% ------- Prepare the signals for A2B ---------- %% %% ------- Prepare the signals for A2B ---------- %%
signalA2B=zeros(N,4,Nmeas); signalA2B=zeros(N,4,Nmeas);
signalB2A=zeros(N,4,Nmeas); signalB2A=zeros(N,4,Nmeas);
Da2b_T=[];
Db2a_T=[]; Db2a_T=[];
for meas=1:Nmeas for meas=1:Nmeas
ia=1; ib=1; ia=1; ib=1;
...@@ -34,7 +35,8 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -34,7 +35,8 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
for i=1:4 for i=1:4
if(indA(ia)==i) if(indA(ia)==i)
[tmpd, tmps]=genrandpskseq(N,M,amp); [tmpd, tmps]=genrandpskseq(N,M,amp);
signalA2B(:,i,meas)=tmps; %make sure LSB is 0 (switch=tx) signalA2B(:,i,meas)=tmps*2; %make sure LSB is 0 (switch=tx)
signalB2A(:,i,meas)=repmat(1+1j,76800,1); %make sure LSB is 1 (switch=rx)
Dtmp=[Dtmp tmpd]; Dtmp=[Dtmp tmpd];
if(length(indA)> ia) ia=ia+1; end if(length(indA)> ia) ia=ia+1; end
end end
...@@ -118,9 +120,9 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -118,9 +120,9 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
%% ------- Do the B to A channel estimation ------- %% %% ------- Do the B to A channel estimation ------- %%
HB2A=conj(Db2a_T.*repmat(Db2a_R,1,Nantb)); HB2A=conj(Db2a_T.*repmat(Db2a_R,1,Nantb));
phasesB2A=unwrap(angle(HB2A)); phasesB2A=unwrap(angle(HB2A));
if(mean(var(phasesB2A))>0.5) #if(mean(var(phasesB2A))>0.5)
disp('The phases of your estimates from B to A are a bit high (larger than 0.5 rad.), something is wrong.'); # disp('The phases of your estimates from B to A are a bit high (larger than 0.5 rad.), something is wrong.');
end #end
if (chanest_full) if (chanest_full)
chanestsB2A=zeros(301,Nantb); chanestsB2A=zeros(301,Nantb);
...@@ -141,20 +143,18 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -141,20 +143,18 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
fchanestsB2A = [zeros(1,Nantb); chanestsB2A([1:150],:); zeros(210,Nantb); chanestsB2A(151:301,:)]; fchanestsB2A = [zeros(1,Nantb); chanestsB2A([1:150],:); zeros(210,Nantb); chanestsB2A(151:301,:)];
tchanestsB2A=ifft(fchanestsB2A); tchanestsB2A=ifft(fchanestsB2A);
% save *chanests*
% save DA2B_T DA2B_R DB2A_T DB2A_R in seperate file
%% -- Some plotting code -- %% (you can uncomment what you see fit) %% -- Some plotting code -- %% (you can uncomment what you see fit)
received = receivedB2A; received = [receivedB2A(:,indA) receivedA2B(:,indB)];
phases = phasesB2A; phases = phasesB2A;
tchanests = [tchanestsA2B(:,:,end), tchanestsB2A(:,:,end)]; tchanests = [tchanestsA2B(:,:,end), tchanestsB2A(:,:,end)];
fchanests = [fchanestsA2B(:,:,end), fchanestsB2A(:,:,end)]; fchanests = [fchanestsA2B(:,:,end), fchanestsB2A(:,:,end)];
clf clf
figure(1) figure(1)
for i=1:4 for i=1:size(received,2)
subplot(220+i);plot(20*log10(abs(fftshift(fft(received(:,i)))))); subplot(220+i);
plot(20*log10(abs(fftshift(fft(received(:,i))))));
ylim([20 140])
end end
figure(2) figure(2)
...@@ -165,7 +165,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -165,7 +165,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
legend('A->B1','A->B2','A->B3','B1->A','B2->A','B3->A'); legend('A->B1','A->B2','A->B3','B1->A','B2->A','B3->A');
%legend('A->B1','A->B2','B1->A','B2->A'); %legend('A->B1','A->B2','B1->A','B2->A');
figure(4) figure(3)
plot(20*log10(abs(fchanests))); plot(20*log10(abs(fchanests)));
ylim([40 100]) ylim([40 100])
xlabel('freq') xlabel('freq')
...@@ -174,7 +174,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -174,7 +174,7 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
%legend('A->B1','A->B2','B1->A','B2->A'); %legend('A->B1','A->B2','B1->A','B2->A');
if (0) if (0)
figure(3) figure(4)
wndw = 50; wndw = 50;
for i=1:5:Nantb*301 %# sliding window size for i=1:5:Nantb*301 %# sliding window size
phamean = filter(ones(wndw,1)/wndw, 1, phases(:,i)); %# moving average phamean = filter(ones(wndw,1)/wndw, 1, phases(:,i)); %# moving average
...@@ -196,9 +196,26 @@ if(paramsinitialized && ~LSBSWITCH_FLAG) ...@@ -196,9 +196,26 @@ if(paramsinitialized && ~LSBSWITCH_FLAG)
xlabel('subcarrier') xlabel('subcarrier')
ylabel('phase variance') ylabel('phase variance')
end end
%% estimate F matrix assuming it is diagonal for sanity checking
Fhatloc = zeros(301,Nantb);
for s=1:301
ya=chanestsB2A(s,:);
yb=chanestsA2B(s,:);
Fhatloc(s,:)=(yb.*conj(ya))./(ya.*conj(ya));
end
else figure(5)
if(LSBSWITCH_FLAG) error('You have to unset the LSB switch flag (LSBSWITCH_FLAG) in initparams.m.\n') plot_style={'rx','go','bs'};
else error('You have to run init.params.m first!') hold off
for n=1:Nantb
plot((squeeze(Fhatloc(:,n))),plot_style{n})
hold on
end end
axis([-2 2 -2 2])
disp(squeeze(mean(Fhatloc,1)));
else
error('You have to run init.params.m first!')
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