CLEANUP - changes to folder structure
This commit is contained in:
47
projects/MPI/MPI_April/auswertung_1.m
Normal file
47
projects/MPI/MPI_April/auswertung_1.m
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
vp = wh.parameter.vp.values(2);
|
||||
vb = wh.parameter.vb.values(1);
|
||||
rop = wh.parameter.rop.values;
|
||||
|
||||
|
||||
f=figure(1113);
|
||||
tiledlayout(2,3)
|
||||
for sir = [36,26]
|
||||
for lw = wh.parameter.laser_linewidth.values
|
||||
nexttile
|
||||
cols = linspecer(9);
|
||||
cnt = 1;
|
||||
for bias = wh.parameter.vb.values
|
||||
curber = [];
|
||||
curstd = [];
|
||||
rop_meas = [];
|
||||
txpow_meas = wh.getStoValue('mod_out_pow',sir,lw,1,vp,bias,rop(1));
|
||||
for pn_key = wh.parameter.pn_key.values
|
||||
curber(end+1,:) = wh.getStoValue('ber',sir,lw,pn_key,vp,bias,rop);
|
||||
rop_meas(end+1,:) = wh.getStoValue('rop_save',sir,lw,pn_key,vp,bias,rop);
|
||||
|
||||
plot(rop_meas(end,:)-txpow_meas, curber(end,:) ,'LineStyle',':','Color',cols(cnt,:),'LineWidth',0.1,'Marker','o','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:),'HandleVisibility','off','MarkerSize',1);
|
||||
hold on
|
||||
end
|
||||
[wrst,idx]=max(curber);
|
||||
for i = 1:numel(idx)
|
||||
rop_wrst(i)=rop_meas(idx(i),i);
|
||||
end
|
||||
plot( rop_wrst-txpow_meas, wrst ,'LineStyle',':','Color',cols(cnt,:),'LineWidth',1,'Marker','^','MarkerSize',5,'MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:),'HandleVisibility','off');
|
||||
plot(mean(rop_meas,1)-txpow_meas, mean(curber,1),'DisplayName',['Vbias: ',num2str(bias),' V'],'LineStyle','-','Color',cols(cnt,:),'LineWidth',1,'Marker','o','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:));
|
||||
hold on
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
title(['SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz; Vpeakpeak: ',num2str(2*vp)])
|
||||
set(gca,'YScale','log');
|
||||
legend('Location','southwest')
|
||||
xlabel("measured ROP in dBm")
|
||||
ylabel("BER")
|
||||
yline(3.8e-3,'DisplayName','FEC');
|
||||
xlim([-5,3]);
|
||||
ylim([1e-4,3e-1]);
|
||||
drawnow
|
||||
end
|
||||
end
|
||||
|
||||
42
projects/MPI/MPI_April/auswertung_2.m
Normal file
42
projects/MPI/MPI_April/auswertung_2.m
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
vp = wh.parameter.vp.values(1);
|
||||
vb = wh.parameter.vb.values(1);
|
||||
rop = wh.parameter.rop.values;
|
||||
|
||||
|
||||
f=figure(113);
|
||||
tiledlayout(2,4)
|
||||
for sir = [20,36]
|
||||
for lw = wh.parameter.laser_linewidth.values
|
||||
nexttile
|
||||
cols = linspecer(9);
|
||||
cnt = 1;
|
||||
for bias = wh.parameter.vb.values(1:2:end-1)
|
||||
curber = [];
|
||||
curstd = [];
|
||||
rop_meas = [];
|
||||
txpow_meas = wh.getStoValue('mod_out_pow',sir,lw,1,vp,bias,rop(1));
|
||||
|
||||
for pn_key = wh.parameter.pn_key.values
|
||||
rop_meas(end+1,:) = wh.getStoValue('rop_save',sir,lw,pn_key,vp,bias,rop);
|
||||
curstd(end+1,:,:) = wh.getStoValue('level_std',sir,lw,pn_key,vp,bias,rop);
|
||||
end
|
||||
|
||||
std_ = squeeze(mean(curstd,1))';
|
||||
symbols = ["square",'o','+','x'];
|
||||
for l =1:size(std_,1)
|
||||
plot(mean(rop_meas,1)-txpow_meas, std_(l,:) ,'DisplayName',['Vbias: ',num2str(bias),' V; Pam-lvl: ',num2str(l)],'LineStyle','-','Color',cols(cnt,:),'LineWidth',1,'Marker',symbols(l),'MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:));
|
||||
hold on
|
||||
end
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
title(['SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz; Vpeakpeak: ',num2str(2*vp)])
|
||||
legend('Location','northeast')
|
||||
xlabel("measured ROP in dBm")
|
||||
ylabel("Std")
|
||||
ylim([0.12,0.27]);
|
||||
drawnow
|
||||
end
|
||||
end
|
||||
|
||||
89
projects/MPI/MPI_April/auswertung_3.m
Normal file
89
projects/MPI/MPI_April/auswertung_3.m
Normal file
@@ -0,0 +1,89 @@
|
||||
|
||||
|
||||
files = ["imdd_simulation\projects\MPI_April\wh_pam4_dienstag.mat","imdd_simulation\projects\MPI_April\wh_pam6_dienstag.mat"];
|
||||
linesstyles = ["-","--"];
|
||||
|
||||
vp = wh.parameter.vp.values;
|
||||
vb = wh.parameter.vb.values;
|
||||
sir = wh.parameter.sir.values(end); % 20 22 24 26 28 30 32 34 36
|
||||
rop = wh.parameter.rop.values(end);
|
||||
lw = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
bias = wh.parameter.vb.values(1:end-2);
|
||||
figure()
|
||||
tiledlayout(2,3)
|
||||
cols = linspecer(4);
|
||||
|
||||
for d = 1:2
|
||||
load(files(d));
|
||||
for lw = wh.parameter.laser_linewidth.values
|
||||
nexttile
|
||||
|
||||
curber = [];
|
||||
|
||||
for v = 1:numel(wh.parameter.vp.values)
|
||||
vp_ = wh.parameter.vp.values(v);
|
||||
for b = 1:numel(bias)
|
||||
|
||||
for k = pn_key
|
||||
curber(k,b) = wh.getStoValue('ber',sir,lw,k,vp_,bias(b),rop);
|
||||
end
|
||||
|
||||
end
|
||||
meanber = mean(curber,1);
|
||||
hold on
|
||||
|
||||
delta = meanber-curber;
|
||||
yneg = abs(max(delta));
|
||||
ypos = abs(min(delta));
|
||||
|
||||
|
||||
|
||||
if d == 1
|
||||
curvename = ['PAM4, Vpp:',num2str((vp_/2*2)*100),' %'];
|
||||
[hl,hp] = boundedline(2-bias,meanber,([yneg;ypos]'),'-o','alpha','Color',cols(v,:),'transparency', 0.1,'linewidth',0.7);
|
||||
hl.MarkerFaceColor = cols(v,:);
|
||||
hl.MarkerSize = 3;
|
||||
hl.LineStyle = '-';
|
||||
hl.DisplayName = curvename;
|
||||
set(hp,'HandleVisibility','off');
|
||||
|
||||
ho = outlinebounds(hl,hp);
|
||||
set(ho, 'linestyle', ':', 'color', cols(v,:),'Linewidth',0.5);
|
||||
set(ho,'HandleVisibility','off');
|
||||
% errorbar(2-bias,meanber,yneg,ypos,'LineStyle',linesstyles(d),'Marker','o','Color',cols(v,:),'MarkerSize',4,'MarkerFaceColor',cols(v,:),'MarkerEdgeColor',cols(v,:),'DisplayName',curvename);
|
||||
elseif d == 2
|
||||
curvename = ['PAM6, Vpp:',num2str((vp_/2*2)*100),' %'];
|
||||
[hl,hp] = boundedline(2-bias,meanber,([yneg;ypos]'),'-o','alpha','Color',cols(v,:),'transparency', 0.1,'linewidth',0.7);
|
||||
hl.MarkerFaceColor = cols(v,:);
|
||||
hl.MarkerSize = 3;
|
||||
hl.LineStyle = '--';
|
||||
hl.DisplayName = curvename;
|
||||
set(hp,'HandleVisibility','off');
|
||||
|
||||
ho = outlinebounds(hl,hp);
|
||||
set(ho, 'linestyle', ':', 'color', cols(v,:),'Linewidth',0.5);
|
||||
set(ho,'HandleVisibility','off');
|
||||
|
||||
% errorbar(2-bias,meanber,yneg,ypos,'LineStyle',linesstyles(d),'Marker','square','Color',cols(v,:),'MarkerSize',4,'MarkerFaceColor',cols(v,:),'MarkerEdgeColor',cols(v,:),'DisplayName',curvename);
|
||||
end
|
||||
|
||||
%
|
||||
% plot(2-bias, meanber,'LineStyle',linesstyles(d),'LineWidth',0.5,'DisplayName',curvename,'Color',cols(v,:));
|
||||
% scatter(2-bias,curber,4,'o','MarkerFaceColor',cols(v,:),'MarkerEdgeColor',cols(v,:),'HandleVisibility','off');
|
||||
hold on
|
||||
title(['SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
|
||||
set(gca,'YScale','log');
|
||||
legend('Location','southwest')
|
||||
xlabel("Bias in V")
|
||||
ylabel("BER")
|
||||
|
||||
xlim([0.4,1]);
|
||||
ylim([1e-4,3e-1]);
|
||||
|
||||
end
|
||||
yline(3.8e-3,'DisplayName','FEC');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
52
projects/MPI/MPI_April/auswertung_4.m
Normal file
52
projects/MPI/MPI_April/auswertung_4.m
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
files = ["imdd_simulation\projects\MPI_April\wh_pam4_dienstag.mat","imdd_simulation\projects\MPI_April\wh_pam6_dienstag.mat"];
|
||||
linesstyles = ["-","--"];
|
||||
|
||||
vp = wh.parameter.vp.values;
|
||||
vb = wh.parameter.vb.values;
|
||||
sir = wh.parameter.sir.values(4);
|
||||
rop = wh.parameter.rop.values(end);
|
||||
lw = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
bias = wh.parameter.vb.values(1:end-3);
|
||||
|
||||
figure()
|
||||
tiledlayout(2,3)
|
||||
cols = flip(cbrewer2("RdYlBu",32));
|
||||
|
||||
for d = 1:2
|
||||
load(files(d));
|
||||
|
||||
for lw = wh.parameter.laser_linewidth.values
|
||||
nexttile
|
||||
|
||||
curber = [];
|
||||
meanber = [];
|
||||
for v = 1:numel(wh.parameter.vp.values)
|
||||
vp_ = wh.parameter.vp.values(v);
|
||||
for b = 1:numel(bias)
|
||||
for k = pn_key
|
||||
curber(k,b) = wh.getStoValue('ber',sir,lw,k,vp_,bias(b),rop);
|
||||
end
|
||||
end
|
||||
meanber(v,:) = mean(curber,1);
|
||||
end
|
||||
|
||||
levels = [1e-4, reshape([1e-4; 1e-3; 1e-2]*[2:2:10],1,[])];
|
||||
contourf(2-bias,wh.parameter.vp.values*100, meanber,levels,'DisplayName',"BER","EdgeAlpha",0.5,'LineStyle','--');
|
||||
colormap(cols)
|
||||
set(gca,'ColorScale','log');
|
||||
xlabel('bias ')
|
||||
ylabel('vpp in %')
|
||||
clim([1e-4 3e-1]);
|
||||
|
||||
if d == 1
|
||||
title(['PAM4 - SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
|
||||
elseif d == 2
|
||||
title(['PAM6 - SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
49
projects/MPI/MPI_April/auswertung_5.m
Normal file
49
projects/MPI/MPI_April/auswertung_5.m
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
|
||||
files = ["imdd_simulation\projects\MPI_April\wh_pam4_dienstag.mat","imdd_simulation\projects\MPI_April\wh_pam6_dienstag.mat"];
|
||||
linesstyles = ["-","--"];
|
||||
|
||||
vp = wh.parameter.vp.values;
|
||||
vb = wh.parameter.vb.values;
|
||||
sir = wh.parameter.sir.values(end);
|
||||
rop = wh.parameter.rop.values(end);
|
||||
lw = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
bias = wh.parameter.vb.values(1:end-3);
|
||||
|
||||
figure()
|
||||
tiledlayout(2,3)
|
||||
cols = flip(cbrewer2("RdYlBu",32));
|
||||
|
||||
for d = 1:2
|
||||
load(files(d));
|
||||
nexttile
|
||||
for lw = wh.parameter.laser_linewidth.values
|
||||
|
||||
curcspr = [];
|
||||
meancspr = [];
|
||||
for v = 1:numel(wh.parameter.vp.values)
|
||||
vp_ = wh.parameter.vp.values(v);
|
||||
|
||||
for b = 1:numel(bias)
|
||||
for k = pn_key
|
||||
curcspr(k,b) = wh.getStoValue('cspr',sir,lw,k,vp_,bias(b),rop);
|
||||
end
|
||||
end
|
||||
|
||||
meancspr(v,:) = mean(curcspr,1);
|
||||
hold on
|
||||
plot(2-bias,meancspr(v,:),'DisplayName',['vpp: ',num2str(vp_)]);
|
||||
|
||||
end
|
||||
|
||||
|
||||
if d == 1
|
||||
title(['PAM4 - SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
|
||||
elseif d == 2
|
||||
title(['PAM6 - SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
246
projects/MPI/MPI_April/mpi_simulation_cspr.m
Normal file
246
projects/MPI/MPI_April/mpi_simulation_cspr.m
Normal file
@@ -0,0 +1,246 @@
|
||||
%% Settings
|
||||
|
||||
clear
|
||||
for M=[8]
|
||||
|
||||
filename = '112G_2';
|
||||
load_sequence = 0;
|
||||
|
||||
datarate = 224e9;
|
||||
|
||||
kover = 16;
|
||||
fsym = round(datarate*1e-9 / log2(M))*1e9;
|
||||
|
||||
fdac = 256e9;%fsym;
|
||||
fadc = 256e9;
|
||||
|
||||
lowpass_cutoff = fsym/2 * 1.1;
|
||||
awg_bw = lowpass_cutoff;
|
||||
mod_bw = lowpass_cutoff;
|
||||
phd_bw = lowpass_cutoff;
|
||||
scp_bw = lowpass_cutoff;
|
||||
|
||||
LP_awg = Filter('filtdegree',4,"f_cutoff",75e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true);
|
||||
LP_modulator= Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true);
|
||||
LP_opt = Filter('filtdegree',3,"f_cutoff",fsym/log2(M).*1.5,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true);
|
||||
LP_phd = Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true);
|
||||
LP_scpe = Filter('filtdegree',4,"f_cutoff",110e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true);
|
||||
|
||||
% 1) PRBS Generation
|
||||
O = 18; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
if M == 6
|
||||
bitpattern = reshape(bitpattern,[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
end
|
||||
|
||||
% 2 ) Build Inf. signal class
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
% 3) Digi modulation -> PAM-M signal
|
||||
digimod_out = PAMmapper(M,0).map(bits);
|
||||
digimod_out.fs = fsym;
|
||||
|
||||
sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
laser_linewidth = [1e5 1e6 10e6];
|
||||
pn_key = [1:10];
|
||||
vp = [0.25,0.5,0.75,1];
|
||||
vb = [1:0.1:1.8];
|
||||
|
||||
rop = 0;
|
||||
sir = 25;
|
||||
laser_linewidth = 0;
|
||||
pn_key = 9;
|
||||
vp = 1;%0.5;
|
||||
vb = 1;%[1:0.1:1.8];
|
||||
mpi_path = 0;
|
||||
|
||||
cnt = 1;
|
||||
|
||||
for s = 1:length(sir)
|
||||
for l = 1:length(laser_linewidth)
|
||||
for pnk = 1:length(pn_key)
|
||||
for n = 1:length(vp)
|
||||
for m = 1:length(vb)
|
||||
|
||||
%digimod_out = digimod_out.normalize("mode","oneone");
|
||||
|
||||
% cnt = cnt+1;
|
||||
%X = Pulseformer("fsym",fsym,"fdac",fdac,"pulse","rrc","pulselength",16,"rrcalpha",0.05).process(digimod_out);
|
||||
X = digimod_out;
|
||||
|
||||
% 5) AWG (lowpass, quantization, sample and hold)
|
||||
X = AWG("fdac",fdac,"dac_min",-1,"dac_max",1,"lpf_active",1,"H_lpf",LP_awg,"kover",kover,"bit_resolution",16,"normalize2dac",1,"upsampling_method","samplehold").process(X);
|
||||
|
||||
% 6) Lowpass behavior before laser
|
||||
X = LP_modulator.process(X);
|
||||
|
||||
% % 7) Normalize signal
|
||||
% X = X.normalize("mode","oneone");
|
||||
|
||||
% 1) Laser; Modulation -> OPTICAL DOMAIN
|
||||
u_pi = 2;
|
||||
vbias = -vb(m);
|
||||
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",X.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth(l),"randomkey",pn_key(pnk));
|
||||
E = X.*vp(n);
|
||||
|
||||
[Opt,extmodlaser] = extmodlaser.process(E);
|
||||
|
||||
figure(m)
|
||||
hold on
|
||||
scatter(E.signal(1:100000),(abs(Opt.signal(1:100000)).^2)*1e3,0.1,'.','DisplayName','Modulator TF')
|
||||
xlabel('Input in V')
|
||||
ylabel('abs(Output) in mW')
|
||||
|
||||
% ER = 10*log10(max(abs(Opt.signal).^2)/min(abs(Opt.signal).^2));
|
||||
|
||||
Opt = LP_opt.process(Opt);
|
||||
|
||||
cspr(s,l,pnk,n,m) = Opt.cspr;
|
||||
mod_out_pow(s,l,pnk,n,m) = Opt.power;
|
||||
|
||||
% 2) ping pong fiber propagation
|
||||
Interference_sig = Fiber("fsimu",Opt.fs,"fiber_length",mpi_path*2/1000,"alpha",0,"D",0,"lambda0",1310,"gamma",0).process(Opt);
|
||||
|
||||
Interference_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",-sir(s)).process(Interference_sig);
|
||||
|
||||
% In the meantime: delay the main signal
|
||||
[Main_sig,dly] = Opt.delay("delay_meter",mpi_path*2);
|
||||
|
||||
% Add
|
||||
Combined_sig = Main_sig + Interference_sig;
|
||||
|
||||
% Cut (due to the delays there is a jump in the signals)
|
||||
if dly == 0;dly = 1;end
|
||||
Combined_sig.signal = Combined_sig.signal(ceil(dly):end);
|
||||
|
||||
% Fiber
|
||||
Combined_sig = Fiber("fsimu",Combined_sig.fs,"fiber_length",0,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.08).process(Combined_sig);
|
||||
|
||||
for i = 1:length(rop)
|
||||
|
||||
% Set ROP
|
||||
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop(i)).process(Combined_sig);
|
||||
rop_save(s,l,pnk,n,m,i) = Rx_sig.power;
|
||||
|
||||
% Square Law
|
||||
Rx_sig = Photodiode("fsimu",Rx_sig.fs,"dark_current",2e-08,"responsivity",1,"temperature",20).process(Rx_sig);
|
||||
|
||||
%Lowpass PhDiode
|
||||
Rx_sig = LP_phd.process(Rx_sig);
|
||||
|
||||
% Scope
|
||||
Scpe_sig = Scope("fsimu",Rx_sig.fs,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"lpf_bw",scp_bw,"filtertype",filtertypes.butterworth,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",16,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',LP_scpe).process(Rx_sig);
|
||||
|
||||
% Sample to 2x fsym
|
||||
Scpe_sig = Scpe_sig.resample("fs_in",fadc,"fs_out",2*fsym);
|
||||
|
||||
% Sync Rx signal with reference
|
||||
[Scpe_sig,D,cuts] = Scpe_sig.tsynch("reference",digimod_out,"fs_ref",fsym);
|
||||
|
||||
Scpe_sig.spectrum;
|
||||
[EQ_sig,EQ_sym] = EQ_silas("Ne",[50,8,8],"Nb",[2,0,0],"trainlength",4096,...
|
||||
"sps",2,...
|
||||
"mu_dc_dd",0.00,...
|
||||
"mu_dc_train",0.0,...
|
||||
"mu_ffe_train",0.00,...
|
||||
"mu_dfe_train",0.005,...
|
||||
"mu_ffe_dd",[0.0004 0.0006 0.0003],...
|
||||
"mu_dfe_dd",0.005,...
|
||||
"ddloops",3,...
|
||||
"trainloops",3,...
|
||||
"eq_parallelization_blocklength",1, ...
|
||||
"eq_updatelatency",0,...
|
||||
"eq_avg_blocklength",0).process(Scpe_sig,digimod_out);
|
||||
|
||||
% Demap
|
||||
|
||||
Rx_Bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
|
||||
% BER
|
||||
[~,errors_bm,BER(s,l,pnk,n,m,i),errors] = calc_ber(Rx_Bits.signal,bitpattern,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
formatted_ber = sprintf('%.1e', BER(s,l,pnk,n,m,i));
|
||||
disp(['SIR: ',num2str(sir(s)),'; Lw:',num2str(laser_linewidth(l)),'; Key:',num2str(pn_key(pnk)),'; Vpeak: ',num2str(vp(n)),'; Vbias',num2str(vbias),'; BER: ',formatted_ber,'; run: ',num2str(cnt),' / 12961']);
|
||||
|
||||
% plot_analysis_window;
|
||||
% drawnow;
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
% save('pam4_level_comp');
|
||||
disp('saved_run2');
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% BER plot
|
||||
figure(340)
|
||||
cols = linspecer(7);
|
||||
for m = 1:size(BER,1)
|
||||
hold on
|
||||
plot(rop,BER(m,:),'DisplayName',['Bias: ',num2str(vb(m)), ' V; PAM', num2str(M)],'LineStyle','--','Color',cols(M/2,:),'LineWidth',1,'Marker','square','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(M/2,:));
|
||||
end
|
||||
set(gca,'YScale','log');
|
||||
legend
|
||||
xlabel("ROP in dBm")
|
||||
yline(3.8e-3,'DisplayName','FEC');
|
||||
|
||||
end
|
||||
|
||||
figure(2)
|
||||
LP_awg.showHere;
|
||||
LP_modulator.showHere;
|
||||
LP_opt.showHere;
|
||||
LP_phd.showHere;
|
||||
LP_scpe.showHere;
|
||||
|
||||
% figure('Name','spectrum')
|
||||
% tiledlayout(4,1)
|
||||
% nexttile
|
||||
% spectrum_plot(E.signal,E.fs,'spectrum');
|
||||
% nexttile
|
||||
% spectrum_plot(Opt.signal,Opt.fs,'spectrum');
|
||||
% nexttile;
|
||||
% spectrum_plot(Rx_sig.signal,Rx_sig.fs,'spectrum');
|
||||
% nexttile
|
||||
% spectrum_plot(EQ_sig.signal,EQ_sig.fs,'spectrum');
|
||||
|
||||
|
||||
|
||||
% save(['C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\MPI\Investigation_April_2024\','PAM_',num2str(M),'_mpi_',num2str(mpi_path),'_lw_',num2str(laser_linewidth)],"BER");
|
||||
|
||||
%
|
||||
%
|
||||
% figure(21)
|
||||
% hold on
|
||||
% plot(rop,mean(BER),'DisplayName',['Modulation: ',num2str(2*vp/extmodlaser.u_pi*100), ' $\%$'],'LineStyle','-','Color',cols(2,:),'LineWidth',1);
|
||||
% set(gca,'YScale','log');
|
||||
% legend
|
||||
% ylabel("ROP in dBm")
|
||||
% yline(3.8e-3,'DisplayName','FEC');
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% %check Rx and TX symbols
|
||||
% figure(101)
|
||||
% scatter(1:100,Rx_symboldecision.signal(1:100),10,'o');
|
||||
% hold on
|
||||
% scatter(1:100,digimod_out.signal(1:100),5,'x');
|
||||
9
projects/MPI/MPI_April/mzm_er.m
Normal file
9
projects/MPI/MPI_April/mzm_er.m
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
field=sqrt(10^(3/10-3)); %dbm to sqrt(mw)
|
||||
|
||||
vpi = 2;
|
||||
vbias = 1;
|
||||
vin = 0.1;
|
||||
|
||||
(field * cos(pi/2*(vin+vbias)/vpi)).^2
|
||||
70
projects/MPI/MPI_April/plot_analysis_window.m
Normal file
70
projects/MPI/MPI_April/plot_analysis_window.m
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
%straight outta workspace, show everything I want
|
||||
|
||||
cols = linspecer(8);
|
||||
colpairs = cbrewer2('paired',8);
|
||||
|
||||
f=figure(20);
|
||||
clf(f)
|
||||
f.Name="Optspec";
|
||||
%Spectrum of Optical Signal after superposition
|
||||
subplot(3,2,1:2)
|
||||
spectrum_plot(Combined_sig.normalize("mode","rms").signal',Combined_sig.fs,'Optspec',['Papr: ',num2str(Combined_sig.papr), '; CSPR: ',num2str(Combined_sig.cspr)]);
|
||||
hold on
|
||||
ylim([-100,0]);
|
||||
|
||||
%Phase Investigation
|
||||
subplot(3,2,3)
|
||||
hold on
|
||||
phase_int = extmodlaser.phase(ceil(dly):end);
|
||||
phase_main = delayseq(extmodlaser.phase,ceil(dly));
|
||||
phase_main = phase_main(ceil(dly):end);
|
||||
phase_diff = phase_int - phase_main;
|
||||
t = (1:length(phase_int))' ./ extmodlaser.fsimu ;
|
||||
plot(t*1e6,phase_int,'Color',colpairs(1,:),'DisplayName','Interferer Phase');
|
||||
plot(t*1e6,phase_main,'Color',colpairs(2,:),'DisplayName','Signal Phase (delayed)');
|
||||
plot(t*1e6,phase_diff,'Color',colpairs(4,:),'DisplayName','Delta Phase');
|
||||
legend
|
||||
|
||||
subplot(3,2,4)
|
||||
%Received Signal after Phdiode
|
||||
yyaxis left
|
||||
t = (1:Rx_sig.length)' ./ Rx_sig.fs;
|
||||
scatter(t*1e6,Rx_sig.normalize("mode","oneone").signal.*max(unique(digimod_out.signal)),1,'.','MarkerEdgeColor',cols(6,:));
|
||||
hold on
|
||||
errors_t = errors./Rx_Bits.fs;
|
||||
errors_sym = Rx_symboldecision.signal(errors);
|
||||
scatter(errors_t*1e6,errors_sym,2,'x','LineWidth',1);
|
||||
yline(PAMmapper(M,0).thresholds);
|
||||
|
||||
%Again: Phase Diff
|
||||
yyaxis right
|
||||
t = (1:length(phase_int))' ./ extmodlaser.fsimu ;
|
||||
plot(t*1e6,phase_diff,'Color',colpairs(4,:),'DisplayName','Delta Phase');
|
||||
|
||||
title(['Lwidth:',num2str(laser_linewidth) ,'; SIR: ', num2str(sir) ,'dB; ROP: ',num2str(rop(i)),' dBm'])
|
||||
xlabel('t in $\mu$s')
|
||||
legend
|
||||
|
||||
%Equalized Signal
|
||||
subplot(3,2,5)
|
||||
t = (1:EQ_sig.length)' ./ EQ_sig.fs;
|
||||
for h = 1:size(levels,2)
|
||||
scatter(t*1e6,levels(:,h),1,'.');
|
||||
hold on
|
||||
end
|
||||
%yline(PAMmapper(M,0).thresholds);
|
||||
title(['BER: ',sprintf('%.1e', BER(s,l,pnk,n,m,i))]);
|
||||
|
||||
%Histogram of EQzed Signal
|
||||
subplot(3,2,6)
|
||||
for h = 1:size(levels,2)
|
||||
std_dev = std(levels(:,h),'omitnan');
|
||||
mean_val = mean(levels(:,h),'omitnan');
|
||||
hold on
|
||||
histogram(levels(:,h),1000,"EdgeColor","none","Normalization","pdf");
|
||||
text(mean_val, 0.1, ['$\sigma^2:$ ',sprintf('%.2f', std_dev)], 'HorizontalAlignment', 'center');
|
||||
end
|
||||
hold on
|
||||
xline(PAMmapper(M,0).thresholds);
|
||||
xticks(sort([unique(digimod_out.signal);PAMmapper(M,0).thresholds']));
|
||||
BIN
projects/MPI/MPI_April/results_ber.png
Normal file
BIN
projects/MPI/MPI_April/results_ber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
69
projects/MPI/MPI_April/save_to_warehouse.m
Normal file
69
projects/MPI/MPI_April/save_to_warehouse.m
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
laser_linewidth = [1e5 1e6 3e6 10e6];
|
||||
pn_key = [1:10];
|
||||
vp = [0.25];
|
||||
vb = [1:0.1:1.8];
|
||||
rop = -9:3;
|
||||
|
||||
sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
laser_linewidth = [1e5 1e6 10e6];
|
||||
pn_key = [1:10];
|
||||
vp = [0.25,0.5,0.75,1];
|
||||
vb = [1:0.1:1.8];
|
||||
rop = -5:0;
|
||||
|
||||
params = struct;
|
||||
params.sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
params.laser_linewidth = [1e5 1e6 10e6];
|
||||
params.pn_key = [1:10];
|
||||
params.vp = [0.25,0.5,0.75,1];
|
||||
params.vb = [1:0.1:1.8];
|
||||
params.rop = -5:0;
|
||||
wh = DataStorage(params);
|
||||
wh.addStorage("ber");
|
||||
wh.addStorage("level_avg");
|
||||
wh.addStorage("level_std");
|
||||
wh.addStorage("rop_save");
|
||||
wh.addStorage("cspr");
|
||||
wh.addStorage("mod_out_pow");
|
||||
|
||||
|
||||
cnt = 1;
|
||||
for s = 1:length(sir)
|
||||
for l = 1:length(laser_linewidth)
|
||||
for pnk = 1:length(pn_key)
|
||||
for n = 1:length(vp)
|
||||
for m = 1:length(vb)
|
||||
for i = 1:length(rop)
|
||||
cnt = cnt +1;
|
||||
|
||||
wh.addValueToStorage(BER(s,l,pnk,n,m,i),'ber',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
% wh.addValueToStorage(level_avg(s,l,pnk,n,m,i,:),'level_avg',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
% wh.addValueToStorage(level_std(s,l,pnk,n,m,i,:),'level_std',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(rop_save(s,l,pnk,n,m,i),'rop_save',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(cspr(s,l,pnk,n,m),'cspr',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(mod_out_pow(s,l,pnk,n,m),'mod_out_pow',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 4) Hey! the warehouse is here and (hopefully) filled with data :-)
|
||||
|
||||
% Create a save dialog
|
||||
defaultDir = 'C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_April';
|
||||
defaultExt = '*.mat';
|
||||
[filename, pathname] = uiputfile(fullfile(defaultDir, defaultExt),'', 'wh.mat');
|
||||
|
||||
% Check if the user pressed Cancel
|
||||
if isequal(filename, 0) || isequal(pathname, 0)
|
||||
disp('Save operation canceled.');
|
||||
else
|
||||
% Save the variable to the selected file
|
||||
save(fullfile(pathname, filename), 'wh');
|
||||
disp(['Variable "wh" saved to: ', fullfile(pathname, filename)]);
|
||||
end
|
||||
53
projects/MPI/MPI_April/simulate_tx_sig.m
Normal file
53
projects/MPI/MPI_April/simulate_tx_sig.m
Normal file
@@ -0,0 +1,53 @@
|
||||
function simulate_tx_sig(filename)
|
||||
|
||||
%% Params
|
||||
M=4;
|
||||
digimod = PAMmapper(M,0);
|
||||
|
||||
fdac = 120e9;
|
||||
fsym = 112e9;
|
||||
pulseform = Pulseformer("pulseform","rrc","fdac",fdac,"fsym",fsym,"pulselength",32,"rrcalpha",0.027);
|
||||
|
||||
kover = 16;
|
||||
awg = AWG('fdac',fdac,'kover',kover,'lpf_active',1,'f_cutoff',56e9,'lpf_type',filtertypes.gaussian,'bit_resolution',5.5);
|
||||
%awg = M8199B();
|
||||
|
||||
lp_laser = Filter('filtdegree',2,"f_cutoff",50e9,"fsamp",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
|
||||
%% PROCESS TX
|
||||
|
||||
% 1) PRBS Generation
|
||||
O = 20; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
% 2 ) Build Inf. signal class
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
% 3) Digi modulation -> PAM-M signal
|
||||
digimod_out = digimod.map(bits);
|
||||
|
||||
% 4) Pulse shaping -> racos
|
||||
X = pulseform.process(digimod_out);
|
||||
|
||||
% 5) AWG (lowpass, quantization, sample and hold)
|
||||
X = awg.process(X);
|
||||
|
||||
% 6) Lowpass behavior before laser
|
||||
X = lp_laser.process(X);
|
||||
|
||||
% 7) Normalize signal
|
||||
X = X.normalize("mode","oneone");
|
||||
X.signal = X.signal;
|
||||
|
||||
spectrum_plot(X.signal',X.fs,'spectrum');
|
||||
|
||||
if nargin == 1
|
||||
save(['C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\',char(filename)],'X');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user