Commit 350ee35d authored by Florian Kaltenberger's avatar Florian Kaltenberger

moving old simulators

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7233 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0cb714db
This diff is collapsed.
include $(OPENAIR_HOME)/common/utils/Makefile.inc
TOP_DIR = $(OPENAIR1_DIR)
OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR)
OPENAIR3 = $(OPENAIR3_DIR)
CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1
LFLAGS = -lm -lblas
CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
#CFLAGS += -DTBS_FIX
CFLAGS += -DCELLULAR
ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
ifdef EMOS
CFLAGS += -DEMOS
endif
ifdef DEBUG_PHY
CFLAGS += -DDEBUG_PHY
endif
ifdef MeNBMUE
CFLAGS += -DMeNBMUE
endif
ifdef MU_RECEIVER
CFLAGS += -DMU_RECEIVER
endif
ifdef ZBF_ENABLED
CFLAGS += -DNULL_SHAPE_BF_ENABLED
endif
ifdef RANDOM_BF
CFLAGS += -DRANDOM_BF
endif
ifdef PBS_SIM
CFLAGS += -DPBS_SIM
endif
ifdef XFORMS
CFLAGS += -DXFORMS
LFLAGS += -lforms
endif
ifdef PERFECT_CE
CFLAGS += -DPERFECT_CE
endif
CFLAGS += -DNO_RRM -DOPENAIR2 -DPHY_ABSTRACTION
CFLAGS += -I/usr/include/X11 -I/usr/X11R6/include
include $(TOP_DIR)/PHY/Makefile.inc
SCHED_OBJS = $(TOP_DIR)/SCHED/phy_procedures_lte_common.o $(TOP_DIR)/SCHED/phy_procedures_lte_eNb.o $(TOP_DIR)/SCHED/phy_procedures_lte_ue.o
#include $(TOP_DIR)/SCHED/Makefile.inc
include $(TOP_DIR)/SIMULATION/Makefile.inc
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
CFLAGS += $(L2_incl) -I$(ASN1_MSG_INC) -I$(TOP_DIR) -I$(OPENAIR3)
EXTRA_CFLAGS =
#STATS_OBJS += $(TOP_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_proc.o
#LAYER2_OBJ += $(OPENAIR2_DIR)/LAYER2/MAC/rar_tools.o
LAYER2_OBJ = $(OPENAIR2_DIR)/LAYER2/MAC/lte_transport_init.o
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(LAYER2_OBJ) #$(ASN1_MSG_OBJS)
#OBJ2 = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS)
ifdef XFORMS
OBJ += ../../USERSPACE_TOOLS/SCOPE/lte_scope.o
endif
all: dlsim pbchsim pdcchsim ulsim pucchsim
test: $(SIMULATION_OBJS) $(TOOLS_OBJS) $(TOP_DIR)/PHY/INIT/lte_init.o test.c
$(CC) test.c -I$(TOP_DIR) -o test $(CFLAGS) $(SIMULATION_OBJS) $(TOOLS_OBJS) -lm
$(OBJ) : %.o : %.c
@echo
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) -o $@ $<
recsim : $(OBJ) recsim.c
@echo "Compiling recsim.c ..."
@$(CC) recsim.c -o recsim $(CFLAGS) $(OBJ) $(LFLAGS) #-static -L/usr/lib/libblas
recsim_eNB2UE : $(OBJ) recsim_eNB2UE.c
@echo "Compiling recsim_eNB2UE.c ..."
@$(CC) recsim_eNB2UE.c -o recsim_eNB2UE $(CFLAGS) $(OBJ) $(LFLAGS) #-static -L/usr/lib/libblas
recsim_eNBUE4 : $(OBJ) recsim_eNBUE4.c
@echo "Compiling recsim_eNBUE4.c ..."
@$(CC) recsim_eNBUE4.c -o recsim_eNBUE4 $(CFLAGS) $(OBJ) $(LFLAGS) #-static -L/usr/lib/libblas
clean :
rm -f $(OBJ)
rm -f *.o
cleanall : clean
rm -f dlsim pbchsim pdcchsim ulsim pucchsim
rm -f *.exe*
showcflags :
@echo $(CFLAGS)
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
double s_coeffs_eNB[11] = {-0.0031, 0.0131, -0.0101, -0.0843, 0.2630, 0.6428, 0.2630, -0.0843, -0.0101, 0.0131, -0.0031};
int s_ord_fir_eNB = 11;
double r_coeffs_eNB[6] = {-0.0098, 0.0104, 0.4995, 0.4995, 0.0104, -0.0098};
int r_ord_fir_eNB = 6;
double s_coeffs_UE[9] = {0.0062, -0.0054, -0.0661, 0.2471, 0.6365, 0.2471, -0.0661, -0.0054, 0.0062};
int s_ord_fir_UE = 9;
double r_coeffs_UE[8] = {0.0050, -0.0303, 0.0163, 0.5090, 0.5090, 0.0163, -0.0303, 0.0050};
int r_ord_fir_UE = 8;/*
double s_coeffs_eNB[2] = {1, 0};
int s_ord_fir_eNB = 2;
double r_coeffs_eNB[2] = {1, 0};
int r_ord_fir_eNB = 2;
double s_coeffs_UE[2] = {1, 0};
int s_ord_fir_UE = 2;
double r_coeffs_UE[2] = {1, 0};
int r_ord_fir_UE = 2;*/
function[x]=basictls(A,B);
%TLS de base voir Overview...
%[U D V]=svd([A B]);
%m=size(A,1);d=size(B,2);n=size(A,2);
%Vdd=V((n+1):(n+d),(n+1):(n+d));
%if det(Vdd)~=0 %non singular
% x=-V(1:size(A,2),(size(A,2)+1):(n+d)) * inv(Vdd);
% x=-V(1:n,(n+1):(n+d)) / Vdd;
%else
% fprintf('\n*******Pas de solution, matrice singuliere Vdd********\n')
%end
px =[A B]' * [A B];
ar=real(px(1,1));
ai=imag(px(1,1));
br=real(px(1,2));
bi=imag(px(1,2));
cr=real(px(2,1));
ci=imag(px(2,1));
dr=real(px(2,2));
di=imag(px(2,2));
if((ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4)))~=0)
x=2*br/(ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4))) + 2i*bi/(ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4)));
else
x=0+1i*0;
end
close all;clear all;
vulb;cal1;
vdlb;
aue1;
aenb1;
figure(1),subplot(231),plot(real(vdl(1537:1836)))
title("dlchest et drschest")
subplot(232),plot(imag(vdl(1537:1836)))
subplot(233),plot(angle(vdl(1537:1836)),"m");
subplot(234),plot(real(vul(901:1200)),"r")
subplot(235),plot(imag(vul(901:1200)),"r")
subplot(236),plot(angle(vul(901:1200)),"m")
dec_f = 4;
figure(2),subplot(231),plot(real(aenb(1:dec_f:300)))
title("dlchest et drschest avec doquant")
subplot(232),plot(imag(aenb(1:dec_f:300)))
subplot(233),plot(angle(aenb(1:dec_f:300)),"m");
subplot(234),plot(real(aue(1:dec_f:300)),"r")
subplot(235),plot(imag(aue(1:dec_f:300)),"r")
subplot(236),plot(angle(aue(1:dec_f:300)),"m")
figure(3),subplot(131),plot(real(cal(1:dec_f:300)),"g");
title("facteur de calib")
subplot(132),plot(imag(cal(1:dec_f:300)),"g");
subplot(133),plot(angle(cal(1:dec_f:300)),"g");
figure(4),
subplot(131),plot(real(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
title("dl reconstruit")
subplot(132),plot(imag(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
subplot(133),plot(angle(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
%figure(5),
break
vdrs2;vdrs4;cal1;
vdl2;vdl4
aue1;
aenb1;
figure(20),subplot(231),plot(real(vudl2(1:300)))
title("dlchest et drschest")
subplot(232),plot(imag(vudl2(1:300)))
subplot(233),plot(angle(vudl2(1:300)),"m");
subplot(234),plot(real(vudrs2(1:300)),"r")
subplot(235),plot(imag(vudrs2(1:300)),"r")
subplot(236),plot(angle(vudrs2(1:300)),"m")
figure(21),subplot(231),plot(real(vudl4(1:300)))
title("dlchest et drschest")
subplot(232),plot(imag(vudl4(1:300)))
subplot(233),plot(angle(vudl4(1:300)),"m");
subplot(234),plot(real(vudrs4(1:300)),"r")
subplot(235),plot(imag(vudrs4(1:300)),"r")
subplot(236),plot(angle(vudrs4(1:300)),"m")
close all;clear all;
vulb;cal1;
vdlb;
aue1;
aenb1;
dec_f = 1;
figure(1),subplot(131),plot(real(aenb(1:dec_f:300))), hold on, plot(real(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
title("dlchest")
subplot(132),plot(imag(aenb(1:dec_f:300))), hold on, plot(imag(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
subplot(133),plot(angle(aenb(1:dec_f:300))); hold on, plot(angle(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
figure(2), plot(real(aenb(1:dec_f:300))), hold on, plot(real(aue(1:dec_f:300)),"r")
%figure(5),
% Comparaison Matlab FACTEUR P
clear all
clc
K=10;
SC=300;
M=1;N=1;
H_h=zeros(N,M,300,K);
G_g=zeros(M,N,300,K);
Vis=zeros(SC,N,M,8);
vudl0;
vudrs0;
vudl1;
vudrs1;
vudl2;
vudrs2;
vudl3;
vudrs3;
vudl4;
vudrs4;
vudl5;
vudrs5;
vudl6;
vudrs6;
vudl7;
vudrs7;
vudl8;
vudrs8;
vudl9;
vudrs9;
cal1;
vul1;
vdl1;
for s_c=1:SC
for n_k=1:K
eval(['H_h(1,1,' int2str(s_c) ',' int2str(n_k) ')=vudrs' int2str(n_k-1) '(' int2str(s_c) ');']);
eval(['G_g(1,1,' int2str(s_c) ',' int2str(n_k) ')=vudl' int2str(n_k-1) '(' int2str(s_c) ');']);
end
end
Psyst(1,1,:)=cal;
for s_c=1:SC
for ii= 1:N % nb antennes emission
for jj= 1:M % nb antennes reception
%if(max(abs(squeeze(H_h(ii,jj,s_c,1:K))))~=0 && max(abs(squeeze(G_g(jj,ii,s_c,1:K))))~=0)
Pud(ii,jj,s_c)=basictls(squeeze(H_h(ii,jj,s_c,1:K)),squeeze(G_g(jj,ii,s_c,1:K)) );
C=squeeze(H_h(ii,jj,s_c,1:K));
D=squeeze(G_g(jj,ii,s_c,1:K));
px =[C D]'*[C D];
ar=real(px(1,1));
ai=imag(px(1,1));
br=real(px(1,2));
bi=imag(px(1,2));
dr=real(px(2,2));
di=imag(px(2,2));
r1=2*br/(ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4)));
r2=2*bi/(ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4)));
Vis(s_c,ii,jj,:)=[ar ai br bi dr di r1 r2 ];
end
end
end
figure,plot(abs(cal(1:300).*vul(901:1200)));
figure,plot(abs(vdl(1537:1836)),"r");
break
figure,plot(abs(cal(1:300).*aue(1:300)));
figure,plot(abs(aenb(1:300)),"r");
A=vul(1:300);
B=vdl(1:300);
figure,plot(abs(fft(ifft(A,512),300)),"b");
figure,plot(abs(fft(ifft(B,512),300)),"b");
close all;clear all;
vul1;cal1;
vdl1;
aue1;
aenb1;
figure(1),subplot(231),plot(real(vdl(1537:1836)))
title("dlchest et drschest")
subplot(232),plot(imag(vdl(1537:1836)))
subplot(233),plot(angle(vdl(1537:1836)),"m");
subplot(234),plot(real(vul(901:1200)),"r")
subplot(235),plot(imag(vul(901:1200)),"r")
subplot(236),plot(angle(vul(901:1200)),"m")
dec_f = 4;
figure(2),subplot(231),plot(real(aenb(1:dec_f:300)))
title("dlchest et drschest avec doquant")
subplot(232),plot(imag(aenb(1:dec_f:300)))
subplot(233),plot(angle(aenb(1:dec_f:300)),"m");
subplot(234),plot(real(aue(1:dec_f:300)),"r")
subplot(235),plot(imag(aue(1:dec_f:300)),"r")
subplot(236),plot(angle(aue(1:dec_f:300)),"m")
figure(3),subplot(131),plot(real(cal(1:dec_f:300)),"g");
title("facteur de calib")
subplot(132),plot(imag(cal(1:dec_f:300)),"g");
subplot(133),plot(angle(cal(1:dec_f:300)),"g");
figure(4),
subplot(131),plot(real(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
title("dl reconstruit")
subplot(132),plot(imag(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
subplot(133),plot(angle(cal(1:dec_f:300).*aue(1:dec_f:300)),"r")
%figure(5),
%title("Dif dlchest et dlcal")
norm(vdl(1537:1836)-(cal(1:300).*aue(1:300)),2)
% Comparaison Matlab FACTEUR P
clear all
clc
K=10;
SC=300;
M=1;N=1;
H_h=zeros(N,M,300,K);
G_g=zeros(M,N,300,K);
Vis=zeros(SC,N,M,8);
vudl0;
vudrs0;
vudl1;
vudrs1;
vudl2;
vudrs2;
vudl3;
vudrs3;
vudl4;
vudrs4;
vudl5;
vudrs5;
vudl6;
vudrs6;
vudl7;
vudrs7;
vudl8;
vudrs8;
vudl9;
vudrs9;
cal1;
vul1;
vdl1;
for s_c=1:SC
for n_k=1:K
eval(['H_h(1,1,' int2str(s_c) ',' int2str(n_k) ')=vudrs' int2str(n_k-1) '(' int2str(s_c) ');']);
eval(['G_g(1,1,' int2str(s_c) ',' int2str(n_k) ')=vudl' int2str(n_k-1) '(' int2str(s_c) ');']);
end
end
Psyst(1,1,:)=cal;
for s_c=1:SC
for ii= 1:N % nb antennes emission
for jj= 1:M % nb antennes reception
%if(max(abs(squeeze(H_h(ii,jj,s_c,1:K))))~=0 && max(abs(squeeze(G_g(jj,ii,s_c,1:K))))~=0)
Pud(ii,jj,s_c)=basictls(squeeze(H_h(ii,jj,s_c,1:K)),squeeze(G_g(jj,ii,s_c,1:K)) );
C=squeeze(H_h(ii,jj,s_c,1:K));
D=squeeze(G_g(jj,ii,s_c,1:K));
px =[C D]'*[C D];
ar=real(px(1,1));
ai=imag(px(1,1));
br=real(px(1,2));
bi=imag(px(1,2));
dr=real(px(2,2));
di=imag(px(2,2));
r1=2*br/(ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4)));
r2=2*bi/(ar-dr+sqrt((ar-dr)*(ar-dr)+((br*br+bi*bi)*4)));
Vis(s_c,ii,jj,:)=[ar ai br bi dr di r1 r2 ];
end
end
end
figure,plot(abs(cal(1:300).*vul(901:1200)));
figure,plot(abs(vdl(1537:1836)),"r");
break
figure,plot(abs(cal(1:300).*aue(1:300)));
figure,plot(abs(aenb(1:300)),"r");
A=vul(1:300);
B=vdl(1:300);
figure,plot(abs(fft(ifft(A,512),300)),"b");
figure,plot(abs(fft(ifft(B,512),300)),"b");
close all;clear all;
vul1;
vdl1;
aue1;
aenb1;
figure(1),subplot(231),plot(real(vdl(1537:1836)))
subplot(232),plot(imag(vdl(1537:1836)))
subplot(233),plot(angle(vdl(1537:1836)),"m");
subplot(234),plot(real(vul(901:1200)),"r")
subplot(235),plot(imag(vul(901:1200)),"r")
subplot(236),plot(angle(vul(901:1200)),"m")
figure(2),subplot(231),plot(real(aenb(1:300)))
subplot(232),plot(imag(aenb(1:300)))
subplot(233),plot(angle(aenb(1:300)),"m");
subplot(234),plot(real(aue(1:300)),"r")
subplot(235),plot(imag(aue(1:300)),"r")
subplot(236),plot(angle(aue(1:300)),"m")
cal1;
figure,plot(real(cal(1:300)),"m");
figure,plot(imag(cal(1:300)),"m");
figure,plot(angle(cal(1:300)),"m");
%% Verif Calibration
close all, clear all;
run("./LTE_RECIPROCITY/aue1.m");
run("./LTE_RECIPROCITY/aenb1.m");
run("./LTE_RECIPROCITY/cal1.m");
run("./LTE_RECIPROCITY/vul1.m");
run("./LTE_RECIPROCITY/vdl1.m");
ul=vul(901:1200);
dl=vdl(1537:1836);
dl_est=cal(1:300).*ul;
res=abs(dl)-abs(dl_est);
%plot(res);
figure();plot(abs(dl(50:150)),"g"),figure,plot(abs(ul(50:150)),"r");
figure,plot(abs(cal(50:150)),"r");
%figure(),plot(abs(ul),"m");
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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