CLEANUP - changes to folder structure
This commit is contained in:
43
projects/MPI/MPI_August/EQ_development.m
Normal file
43
projects/MPI/MPI_August/EQ_development.m
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
Scope_sig = load("projects/MPI_August/scpe_sig.mat","Scpe_sig");
|
||||
Scope_sig = Scope_sig.Scpe_sig;
|
||||
Symbols = load("projects/MPI_August/symbols.mat","Symbols");
|
||||
Symbols = Symbols.Symbols;
|
||||
Bits = load("projects/MPI_August/bits.mat","Bits");
|
||||
Bits = Bits.Bits;
|
||||
|
||||
mdc = [1e-3,1e-2,2e-2,3e-2,4e-2,5e-2,1e-1];
|
||||
mdc = [0.6, 0.7, 0.8, 1, 1.2];
|
||||
for m = 1:numel(mdc)
|
||||
|
||||
Eq = FFE_DCremoval("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",0,"mu_dc",mdc(m),"dc_buffer_len",112);
|
||||
[EQ_sig] = Eq.process(Scope_sig,Symbols);
|
||||
|
||||
%%%%% DEMAP %%%%%%
|
||||
Rx_bits = PAMmapper(4,0).demap(EQ_sig);
|
||||
|
||||
% BER
|
||||
[~,errors_bm,ber(m),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
end
|
||||
|
||||
figure()
|
||||
scatter(mdc,ber,20);
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Mu DC');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. Mu DC');
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'xscale','log');
|
||||
grid on;
|
||||
legend
|
||||
|
||||
|
||||
%%%% Look at Pam levels %%%%%
|
||||
if 1
|
||||
a = PAMmapper(4,0).separate_pamlevels(EQ_sig);
|
||||
figure(14);hold on;scatter(1:EQ_sig.length,a,1,'.');
|
||||
end
|
||||
|
||||
|
||||
|
||||
56
projects/MPI/MPI_August/EQ_development_ffe_adap_decision.m
Normal file
56
projects/MPI/MPI_August/EQ_development_ffe_adap_decision.m
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
|
||||
Scope_sig = load("projects/MPI_August/scpe_sig.mat","Scpe_sig");
|
||||
Scope_sig = Scope_sig.Scpe_sig;
|
||||
Symbols = load("projects/MPI_August/symbols.mat","Symbols");
|
||||
Symbols = Symbols.Symbols;
|
||||
Bits = load("projects/MPI_August/bits.mat","Bits");
|
||||
Bits = Bits.Bits;
|
||||
|
||||
|
||||
lenbuff = [80];
|
||||
|
||||
for m = 1:numel(lenbuff)
|
||||
|
||||
Eq = FFE_adaptive_decision("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",0,"buffer_length",lenbuff(m));
|
||||
|
||||
[EQ_sig] = Eq.process(Scope_sig,Symbols);
|
||||
|
||||
%%%%% DEMAP %%%%%%
|
||||
Rx_bits = PAMmapper(4,0).demap(EQ_sig);
|
||||
|
||||
% BER
|
||||
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
disp(['BER: ',sprintf('%.1E',ber)]);
|
||||
|
||||
end
|
||||
|
||||
% fs = 2*112e9;
|
||||
% N = 2^(nextpow2(length(Eq.error(1,:)))-6);
|
||||
% [p_lin,w] = pwelch(Eq.error(1,:),hanning(N),N/2,N,fs,"centered","power","mean");
|
||||
% p_dbm = 10*log10(p_lin)+30; %dB to dBm in case of "power"
|
||||
|
||||
% figure(123); % If figure does not exist, create new figure
|
||||
% hold on
|
||||
% plot(w.*1e-9,p_dbm,'DisplayName',['bla'],'LineWidth',1);
|
||||
% xlabel("Frequency in GHz");
|
||||
% %ylabel("Power/frequency (dB/Hz)");
|
||||
% ylabel("Power (dBm)");
|
||||
% xlim([-fs/2 fs/2].*1e-9)
|
||||
% edgetick = 2^(nextpow2(fs*1e-9));
|
||||
% xticks([-edgetick:16:edgetick]);
|
||||
% xlim([-244, 244])
|
||||
% ylim([-120,-0]);
|
||||
% yticks([-200:10:10]);
|
||||
% legend
|
||||
|
||||
|
||||
%%%% Look at Pam levels %%%%%
|
||||
if 1
|
||||
a = PAMmapper(4,0).separate_pamlevels(EQ_sig);
|
||||
figure(15);hold on;scatter(1:EQ_sig.length,a,1,'.');
|
||||
end
|
||||
|
||||
|
||||
56
projects/MPI/MPI_August/EQ_development_ffe_dc_avg.m
Normal file
56
projects/MPI/MPI_August/EQ_development_ffe_dc_avg.m
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
|
||||
Scope_sig = load("projects/MPI_August/scpe_sig.mat","Scpe_sig");
|
||||
Scope_sig = Scope_sig.Scpe_sig;
|
||||
Symbols = load("projects/MPI_August/symbols.mat","Symbols");
|
||||
Symbols = Symbols.Symbols;
|
||||
Bits = load("projects/MPI_August/bits.mat","Bits");
|
||||
Bits = Bits.Bits;
|
||||
|
||||
|
||||
mubuff = [0.5];
|
||||
|
||||
for m = 1:numel(mubuff)
|
||||
|
||||
Eq = FFE_FFDCAVG("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",0,"mu_buff",mubuff(m));
|
||||
|
||||
[EQ_sig] = Eq.process(Scope_sig,Symbols);
|
||||
|
||||
%%%%% DEMAP %%%%%%
|
||||
Rx_bits = PAMmapper(4,0).demap(EQ_sig);
|
||||
|
||||
% BER
|
||||
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
disp(['BER: ',sprintf('%.1E',ber)]);
|
||||
|
||||
end
|
||||
|
||||
% fs = 2*112e9;
|
||||
% N = 2^(nextpow2(length(Eq.error(1,:)))-6);
|
||||
% [p_lin,w] = pwelch(Eq.error(1,:),hanning(N),N/2,N,fs,"centered","power","mean");
|
||||
% p_dbm = 10*log10(p_lin)+30; %dB to dBm in case of "power"
|
||||
|
||||
% figure(123); % If figure does not exist, create new figure
|
||||
% hold on
|
||||
% plot(w.*1e-9,p_dbm,'DisplayName',['bla'],'LineWidth',1);
|
||||
% xlabel("Frequency in GHz");
|
||||
% %ylabel("Power/frequency (dB/Hz)");
|
||||
% ylabel("Power (dBm)");
|
||||
% xlim([-fs/2 fs/2].*1e-9)
|
||||
% edgetick = 2^(nextpow2(fs*1e-9));
|
||||
% xticks([-edgetick:16:edgetick]);
|
||||
% xlim([-244, 244])
|
||||
% ylim([-120,-0]);
|
||||
% yticks([-200:10:10]);
|
||||
% legend
|
||||
|
||||
|
||||
%%%% Look at Pam levels %%%%%
|
||||
if 1
|
||||
a = PAMmapper(4,0).separate_pamlevels(EQ_sig);
|
||||
figure(15);hold on;scatter(1:EQ_sig.length,a,1,'.');
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
65
projects/MPI/MPI_August/auswertung/clipfactor_curve.m
Normal file
65
projects/MPI/MPI_August/auswertung/clipfactor_curve.m
Normal file
@@ -0,0 +1,65 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values(1);
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values(1);
|
||||
rop = wh.parameter.rop.values;
|
||||
cfs = wh.parameter.vbias_rel.values;
|
||||
|
||||
cols = linspecer(6);
|
||||
c_cnt = 0;
|
||||
for c = cfs
|
||||
c_cnt = c_cnt+1;
|
||||
for pnk = pn_key
|
||||
|
||||
%get ROP curve data for cur. sir and realization
|
||||
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,laser_linewidth,pnk,rop,c);
|
||||
|
||||
try
|
||||
rrop_ffe(c_cnt,1) = getIntersection(ber_ffe,rop);
|
||||
end
|
||||
|
||||
if 1
|
||||
% Create rop plot
|
||||
figure(43);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(rop,ber_ffe',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber ffe",'Color',cols(5,:));
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
figure(2243);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(cfs,mean(rrop_ffe,2,"omitnan")',"LineWidth",1,"LineStyle","--","Marker",".","MarkerSize",10,"DisplayName","FFE",'Color',cols(5,:));
|
||||
|
||||
xlabel('Clipfactor');
|
||||
ylabel('Receiver Sensitivity');
|
||||
%title(['Bit Error Rate vs. SIR; SIR: ',num2str(s),' dB']);
|
||||
grid on;
|
||||
legend
|
||||
|
||||
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
59
projects/MPI/MPI_August/auswertung/dc_removal_sir_curve.m
Normal file
59
projects/MPI/MPI_August/auswertung/dc_removal_sir_curve.m
Normal file
@@ -0,0 +1,59 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values;
|
||||
laser_linewidths = wh.parameter.laser_linewidth.values;
|
||||
pnoi = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
winlengths = wh.parameter.winlength.values(1);
|
||||
|
||||
cols = linspecer(numel(winlengths));
|
||||
figure(44);
|
||||
hold on
|
||||
|
||||
|
||||
cntlw = 0;
|
||||
|
||||
for laser_linewidth = laser_linewidths
|
||||
cntlw = cntlw+1;
|
||||
cntsir = 0;
|
||||
for sir = sirs
|
||||
cntsir = cntsir+1;
|
||||
for pnk = pnoi
|
||||
|
||||
|
||||
|
||||
%cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,laser_linewidth,pnk,rop,winlength);
|
||||
rrop_ffe(cntsir) = getIntersection(ber_ffe,rop);
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
plot(sirs,rrop_ffe,'DisplayName',['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz'],"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10)
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Sensitivity in dBm');
|
||||
title('Receiver Sensitivity vs. SIR');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,71 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values;
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pnoi = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
winlengths = wh.parameter.winlength.values;
|
||||
|
||||
cols = linspecer(numel(winlengths));
|
||||
figure(44);
|
||||
hold on
|
||||
|
||||
cnt = 0;
|
||||
for winlength = winlengths
|
||||
cnt = cnt+1;
|
||||
for sir = sirs
|
||||
|
||||
for pnk = pnoi
|
||||
|
||||
|
||||
|
||||
%cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,laser_linewidth,pnk,rop,winlength);
|
||||
rrop_ffe(cnt,pnk) = getIntersection(ber_ffe,rop);
|
||||
|
||||
|
||||
if sum(ber_ffe)
|
||||
|
||||
plot(rop,ber_ffe',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName",['win len: ',num2str(winlength), ' '],"Color",cols(cnt,:));
|
||||
yline(3.8e-3,'DisplayName','HD-FEC','LineStyle','--','HandleVisibility','off');
|
||||
xlabel('Received Optical Power (dBm)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. ROP');
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
figure(123)
|
||||
hold on
|
||||
plot(winlengths,mean(rrop_ffe,2),'DisplayName',['Linewidth: 10 MHz'],"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10)
|
||||
xlabel('Window Length');
|
||||
ylabel('Sensitivity in dBm');
|
||||
title('Receiver Sensitivity vs. Window Length');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
76
projects/MPI/MPI_August/auswertung/hpf_curve.m
Normal file
76
projects/MPI/MPI_August/auswertung/hpf_curve.m
Normal file
@@ -0,0 +1,76 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values;
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pnoi = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
hpf = wh.parameter.hpf.values(2);
|
||||
|
||||
cols = linspecer(16);
|
||||
|
||||
for lw = laser_linewidth
|
||||
cnt = 0;
|
||||
for sir = sirs
|
||||
cnt = cnt+1;
|
||||
for pnk = pnoi
|
||||
|
||||
|
||||
|
||||
%cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,lw,pnk,rop,fc);
|
||||
rrop_ffe(cnt,pnk) = getIntersection(ber_ffe,rop);
|
||||
|
||||
% if 0
|
||||
% % Create the initial plot
|
||||
% figure(44);
|
||||
% a = gca;
|
||||
% cnt = numel(a.Children)+1;
|
||||
% hold on; % Retain the plot so new points can be added without complete redraw
|
||||
% end
|
||||
|
||||
|
||||
|
||||
if sum(ber_ffe)
|
||||
figure(44);
|
||||
plot(rop,ber_ffe',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName","FFE only",'Color',cols(cnt,:));
|
||||
yline(3.8e-3,'DisplayName','HD-FEC','LineStyle','--','HandleVisibility','off');
|
||||
xlabel('Received Optical Power (dBm)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. ROP');
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
figure(123)
|
||||
hold on
|
||||
plot(sirs,mean(rrop_ffe,2),'DisplayName',['lw: ',num2str(lw), ' MHz'],"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10)
|
||||
xlabel('Signal to Interference (dBm)');
|
||||
ylabel('Sensitivity in dBm');
|
||||
title('Receiver Sensitivity vs. SIR');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,59 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values;
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pnoi = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
hpfs = wh.parameter.hpf.values;
|
||||
|
||||
cols = linspecer(16);
|
||||
figure(44);
|
||||
hold on
|
||||
for hpf = hpfs
|
||||
cnt = 0;
|
||||
for sir = sirs
|
||||
cnt = cnt+1;
|
||||
for pnk = pnoi
|
||||
|
||||
|
||||
|
||||
%cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,lw,pnk,rop,hpf);
|
||||
% rrop_ffe(cnt,pnk) = getIntersection(ber_ffe,rop);
|
||||
|
||||
|
||||
if sum(ber_ffe)
|
||||
|
||||
plot(rop,ber_ffe',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName",['fc: ',num2str(hpf.*1e-6), ' MHz']);
|
||||
yline(3.8e-3,'DisplayName','HD-FEC','LineStyle','--','HandleVisibility','off');
|
||||
xlabel('Received Optical Power (dBm)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. ROP');
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
59
projects/MPI/MPI_August/auswertung/mrds_sir_curve.m
Normal file
59
projects/MPI/MPI_August/auswertung/mrds_sir_curve.m
Normal file
@@ -0,0 +1,59 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values;
|
||||
laser_linewidths = wh.parameter.laser_linewidth.values;
|
||||
pnoi = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
winlengths = wh.parameter.winlength.values(1);
|
||||
|
||||
cols = linspecer(numel(winlengths));
|
||||
figure(44);
|
||||
hold on
|
||||
|
||||
|
||||
cntlw = 0;
|
||||
|
||||
for laser_linewidth = laser_linewidths
|
||||
cntlw = cntlw+1;
|
||||
cntsir = 0;
|
||||
for sir = sirs
|
||||
cntsir = cntsir+1;
|
||||
for pnk = pnoi
|
||||
|
||||
|
||||
|
||||
%cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,laser_linewidth,pnk,rop,winlengths);
|
||||
rrop_ffe(cntsir) = getIntersection(ber_ffe,rop);
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
plot(sirs,rrop_ffe,'DisplayName',['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz'],"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10)
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Sensitivity in dBm');
|
||||
title('Receiver Sensitivity vs. SIR');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
52
projects/MPI/MPI_August/auswertung/rop_curve.m
Normal file
52
projects/MPI/MPI_August/auswertung/rop_curve.m
Normal file
@@ -0,0 +1,52 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values(1);
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
|
||||
cols = linspecer(8);
|
||||
|
||||
cnt = 0;
|
||||
for pnk = pn_key
|
||||
|
||||
%cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
ber_dcavg = wh.getStoValue('ber_dcavg',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
ber_adapt = wh.getStoValue('ber_adapt',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
ber_derem = wh.getStoValue('ber_dcrem',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
|
||||
% Create the initial plot
|
||||
figure(44);
|
||||
a = gca;
|
||||
cnt = numel(a.Children)+1;
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
|
||||
if sum(ber_ffe)
|
||||
plot(rop,ber_ffe',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName","FFE only",'Color',cols(cnt,:));
|
||||
end
|
||||
|
||||
if sum(ber_dcavg)
|
||||
plot(rop,ber_dcavg',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName","FFE + FF DC Avg.",'Color',cols(cnt+1,:));
|
||||
end
|
||||
|
||||
if sum(ber_adapt)
|
||||
plot(rop,ber_adapt',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName","FFE + Adaptive Levels",'Color',cols(cnt+2,:));
|
||||
end
|
||||
|
||||
if sum(ber_derem)
|
||||
plot(rop,ber_derem',"LineWidth",0.5,"LineStyle","-","Marker",".","MarkerSize",15,"DisplayName","FFE + Adaptive DC-Subtraction",'Color',cols(cnt+3,:));
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
yline(3.8e-3,'DisplayName','HD-FEC','LineStyle','--','HandleVisibility','off');
|
||||
xlabel('Received Optical Power (dBm)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. ROP');
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'Box','on');
|
||||
grid on;
|
||||
grid minor
|
||||
legend
|
||||
|
||||
81
projects/MPI/MPI_August/auswertung/sensitivity_curve.m
Normal file
81
projects/MPI/MPI_August/auswertung/sensitivity_curve.m
Normal file
@@ -0,0 +1,81 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values(4);
|
||||
laser_linewidths = wh.parameter.laser_linewidth.values;
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
|
||||
cols = linspecer(4);
|
||||
|
||||
for laser_linewidth = laser_linewidths
|
||||
s_cnt = 0;
|
||||
|
||||
for s = sir
|
||||
s_cnt = s_cnt+1;
|
||||
for pnk = pn_key
|
||||
|
||||
%get ROP curve data for cur. sir and realization
|
||||
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,s,laser_linewidth,pnk,rop);
|
||||
ber_dcavg = wh.getStoValue('ber_dcavg',M,datarate,s,laser_linewidth,pnk,rop);
|
||||
ber_adapt = wh.getStoValue('ber_adapt',M,datarate,s,laser_linewidth,pnk,rop);
|
||||
ber_derem = wh.getStoValue('ber_dcrem',M,datarate,s,laser_linewidth,pnk,rop);
|
||||
|
||||
rrop_ffe(s_cnt,pnk) = getIntersection(ber_ffe,rop);
|
||||
rrop_dcavg(s_cnt,pnk) = getIntersection(ber_dcavg,rop);
|
||||
rrop_adapt(s_cnt,pnk) = getIntersection(ber_adapt,rop);
|
||||
rrop_derem(s_cnt,pnk) = getIntersection(ber_derem,rop);
|
||||
|
||||
if 1
|
||||
% Create rop plot
|
||||
figure(43);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(rop,ber_ffe',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber ffe",'Color',cols(1,:));
|
||||
% scatter(rrop_ffe(s_cnt,pnk),3.8e-3,'LineWidth',2);
|
||||
plot(rop,ber_dcavg',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber dcavg",'Color',cols(2,:));
|
||||
plot(rop,ber_adapt',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber adapt",'Color',cols(3,:));
|
||||
plot(rop,ber_derem',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber dcrem",'Color',cols(4,:));
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title(['Bit Error Rate vs. SIR; SIR: ',num2str(s),' dB']);
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
figure(223);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
% plot(sir,mean(rrop_ffe,2,"omitnan")',"LineWidth",1,"LineStyle",":","Marker",".","MarkerSize",10,"DisplayName","FFE",'Color',cols(1,:));
|
||||
% plot(sir,mean(rrop_dcavg,2,"omitnan")',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz'],'Color',cols(2,:));
|
||||
% plot(sir,mean(rrop_adapt,2,"omitnan")',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz']);
|
||||
plot(sir,mean(rrop_derem,2,"omitnan")',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz']);
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Receiver Sensitivity');
|
||||
title(['Bit Error Rate vs. SIR']);
|
||||
grid on;
|
||||
legend
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
function i = getIntersection(ber,rop)
|
||||
|
||||
%get intersection between rop curve and hd-fec limit
|
||||
hdfec = 3.8e-3 .* ones(size(ber));
|
||||
i = InterX([rop;hdfec'],[rop;ber']);
|
||||
|
||||
if isempty(i)
|
||||
i = NaN;
|
||||
else
|
||||
i = i(1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
35
projects/MPI/MPI_August/auswertung/sir_curve.m
Normal file
35
projects/MPI/MPI_August/auswertung/sir_curve.m
Normal file
@@ -0,0 +1,35 @@
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values;
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
rop = wh.parameter.rop.values(1);
|
||||
|
||||
cols = linspecer(4);
|
||||
|
||||
cnt = 0;
|
||||
for pnk = pn_key
|
||||
|
||||
cnt = cnt+1;
|
||||
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
ber_dcavg = wh.getStoValue('ber_dcavg',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
ber_adapt = wh.getStoValue('ber_adapt',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
ber_derem = wh.getStoValue('ber_dcrem',M,datarate,sir,laser_linewidth,pnk,rop);
|
||||
|
||||
% Create the initial plot
|
||||
figure(44);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(sir,ber_ffe',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber ffe",'Color',cols(1,:));
|
||||
plot(sir,ber_dcavg',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber dcavg",'Color',cols(2,:));
|
||||
plot(sir,ber_adapt',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber adapt",'Color',cols(3,:));
|
||||
plot(sir,ber_derem',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber dcrem",'Color',cols(4,:));
|
||||
|
||||
end
|
||||
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. SIR');
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
BIN
projects/MPI/MPI_August/bits.mat
Normal file
BIN
projects/MPI/MPI_August/bits.mat
Normal file
Binary file not shown.
28
projects/MPI/MPI_August/channel_model_mpi.m
Normal file
28
projects/MPI/MPI_August/channel_model_mpi.m
Normal file
@@ -0,0 +1,28 @@
|
||||
function opt_signal = channel_model_mpi(opt_signal,link_total_meter,oneway_interference_meter,sir)
|
||||
|
||||
%%%%% Local Parameter %%%%%%%%
|
||||
|
||||
|
||||
|
||||
%%%%% Ping Pong/ Interference Path %%%%%%
|
||||
interference_sig = Fiber("fsimu",opt_signal.fs,"fiber_length",oneway_interference_meter*2/1000,"alpha",0.3,"D",0,"lambda0",1320,"gamma",0,"Dslope",0.07).process(opt_signal);
|
||||
|
||||
interference_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",-sir).process(interference_sig);
|
||||
|
||||
%%%%% Delay the "main" signal as in reality the interference is "older" than the main signal %%%%%%
|
||||
[main_sig,dly] = opt_signal.delay("delay_meter",oneway_interference_meter*2);
|
||||
|
||||
main_sig.power;
|
||||
interference_sig.power;
|
||||
|
||||
%%%%% ADD Interference and Main Signal %%%%%%
|
||||
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);
|
||||
|
||||
%%%%% Propagate through fiber %%%%%%
|
||||
opt_signal = Fiber("fsimu",combined_sig.fs,"fiber_length",link_total_meter/1000,"alpha",0.3,"D",0,"lambda0",1320,"gamma",0,"Dslope",0.07).process(combined_sig);
|
||||
|
||||
end
|
||||
332
projects/MPI/MPI_August/mpi_uncorrelated.m
Normal file
332
projects/MPI/MPI_August/mpi_uncorrelated.m
Normal file
@@ -0,0 +1,332 @@
|
||||
|
||||
%% Parameter to simulate and save
|
||||
params = struct;
|
||||
|
||||
params.M = [4];
|
||||
params.datarate = [224];
|
||||
params.sir = [35]; %decibel = attenuation of interference path
|
||||
params.laser_linewidth = [1e6];
|
||||
|
||||
params.pn_key = [1];
|
||||
params.rop = [-12:1:-1];
|
||||
params.rop = 0;
|
||||
|
||||
|
||||
usemrds = 0;
|
||||
wl = 512;
|
||||
|
||||
name = ['wh_',strrep(num2str(now),'.','')];
|
||||
|
||||
wh = DataStorage(params);
|
||||
|
||||
wh.addStorage("ber_ffe");
|
||||
wh.addStorage("ber_dcavg");
|
||||
wh.addStorage("ber_adapt");
|
||||
wh.addStorage("ber_dcrem");
|
||||
|
||||
%% Init Params
|
||||
link_length = 10000; %meter
|
||||
|
||||
|
||||
|
||||
endcnt = prod(wh.dim);
|
||||
cnt=0;
|
||||
|
||||
disp(['Start Simulation of ',num2str(endcnt),' loops...'])
|
||||
tic
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for M = wh.parameter.M.values
|
||||
for datarate = wh.parameter.datarate.values
|
||||
for pn_key = wh.parameter.pn_key.values
|
||||
|
||||
|
||||
% SETUP HERE: %%
|
||||
kover = 8;
|
||||
M8199 = M8199A("kover",kover);
|
||||
fdac = M8199.fdac;
|
||||
fsym = round(datarate / log2(M)) * 1e9;
|
||||
rrcalpha = 0.05;
|
||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rrcalpha);
|
||||
|
||||
% MAIN SIGNAL
|
||||
|
||||
%%%%% Symbol Generation %%%%%%
|
||||
[Digi_sig,Symbols,Bits] = PAMsource("fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||
"fs_out",M8199.fdac,"applyclipping",1,"clipfactor",1.4,"applypulseform",1,"pulseformer",Pform,"randkey",pn_key,"mrds_code",usemrds,"mrds_blocklength",wl).process();
|
||||
|
||||
%%%%% AWG %%%%%%
|
||||
El_sig = M8199.process(Digi_sig);
|
||||
%El_sig.signal = awgn(El_sig.signal,20,'measured',pn_key);
|
||||
|
||||
%%%%% Lowpass el. components %%%%%%
|
||||
El_sig = Filter('filtdegree',2,"f_cutoff",60e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(El_sig);
|
||||
|
||||
%%%%% Electrical Driver Amplifier %%%%%%
|
||||
El_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",9).process(El_sig);
|
||||
|
||||
fprintf('Driver output power: %s dBm\n', num2str(El_sig.power));
|
||||
fprintf('Driver output peak voltage: %s Vpp \n', num2str(max(El_sig.signal)-min(El_sig.signal)));
|
||||
|
||||
% INTERFERENCE SIGNAL
|
||||
|
||||
%%%%% Symbol Generation %%%%%%
|
||||
[Digi_sig_i,Symbols_i,Bits_i] = PAMsource("fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||
"fs_out",M8199.fdac,"applyclipping",1,"clipfactor",1.4,"applypulseform",1,"pulseformer",Pform,"randkey",pn_key*2,"mrds_code",usemrds,"mrds_blocklength",wl).process();
|
||||
|
||||
%%%%% AWG %%%%%%
|
||||
El_sig_i = M8199.process(Digi_sig_i);
|
||||
%El_sig_i.signal = awgn(El_sig_i.signal,20,'measured',pn_key*2);
|
||||
|
||||
%%%%% Lowpass before Modulator %%%%%%
|
||||
El_sig_i = Filter('filtdegree',2,"f_cutoff",60e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(El_sig_i);
|
||||
El_sig_i = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",9).process(El_sig_i);
|
||||
|
||||
|
||||
fprintf('Driver output power: %s dBm\n', num2str(El_sig.power));
|
||||
fprintf('Driver output peak voltage: %s Vpp \n', num2str(max(El_sig.signal)-min(El_sig.signal)));
|
||||
|
||||
for laser_linewidth = wh.parameter.laser_linewidth.values
|
||||
|
||||
% MAIN SIGNAL
|
||||
%%%%% MODULATE E/O CONVERSION %%%%%%
|
||||
vbias_rel = 0.6;
|
||||
u_pi = 2.9;
|
||||
vbias = -vbias_rel*u_pi;
|
||||
|
||||
[Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",pn_key).process(El_sig);
|
||||
|
||||
Optfilter = Filter('filtdegree',6,"f_cutoff",fsym.*0.7,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true);
|
||||
Opt_sig = Optfilter.process(Opt_sig);
|
||||
|
||||
Opt_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",0).process(Opt_sig);
|
||||
|
||||
% INTERFERENCE SIGNAL
|
||||
%%%%% MODULATE E/O CONVERSION %%%%%%
|
||||
|
||||
[Opt_sig_i] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",pn_key+1).process(El_sig_i);
|
||||
|
||||
Opt_sig_i = Optfilter.process(Opt_sig_i);
|
||||
|
||||
Opt_sig_i = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",0).process(Opt_sig_i);
|
||||
|
||||
|
||||
j_ = wh.parameter.sir.length;
|
||||
i_ = wh.parameter.rop.length;
|
||||
|
||||
ber_ffe=zeros(j_,i_);
|
||||
ber_dcavg=zeros(j_,i_);
|
||||
ber_adapt=zeros(j_,i_);
|
||||
ber_dcrem=zeros(j_,i_);
|
||||
|
||||
patten=zeros(j_,i_);
|
||||
|
||||
for j = 1:j_
|
||||
|
||||
sir = wh.parameter.sir.values(j);
|
||||
|
||||
|
||||
%%%%% Interference Signal Fiber Prop %%%%%%
|
||||
Opt_sig_i_prop = Fiber("fsimu",Opt_sig_i.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig_i);
|
||||
|
||||
Opt_sig_i_prop = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",Opt_sig.power-sir).process(Opt_sig_i_prop);
|
||||
|
||||
%%%%% ADD Interference and Main Signal %%%%%%
|
||||
Opt_sig_comb = Opt_sig_i_prop + Opt_sig;
|
||||
|
||||
%%%%% Interference Signal Fiber Prop %%%%%%
|
||||
Opt_sig_comb = Fiber("fsimu",Opt_sig_comb.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig_comb);
|
||||
|
||||
% % MPI Channel
|
||||
% Opt = channel_model_mpi(Opt_sig,link_length,mpi_path,sir);
|
||||
|
||||
% Receiver ROP curve
|
||||
|
||||
for i = 1:i_
|
||||
|
||||
rop=wh.parameter.rop.values(i);
|
||||
|
||||
% Set ROP
|
||||
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt_sig_comb);
|
||||
patten(j,i) = Rx_sig.power;
|
||||
|
||||
%%%%%% Square Law %%%%%%
|
||||
Rx_sig = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20,"nep",1.8e-11).process(Rx_sig);
|
||||
|
||||
%%%%%% Lowpass PhDiode %%%%%%
|
||||
Rx_sig = Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true).process(Rx_sig);
|
||||
|
||||
% Rx_sig.signal = Rx_sig.signal - mean(Rx_sig.signal);
|
||||
%
|
||||
% Rx_sig = Rx_sig.setPower(0,"dBm");
|
||||
|
||||
if 0
|
||||
[b, a] = butter(1, 0.1e9/(Rx_sig.fs/2), 'high');
|
||||
% Rx_sig.spectrum("fignum",1111,"displayname","before HPF");
|
||||
Rx_sig.signal = filter(b, a, Rx_sig.signal);
|
||||
% Rx_sig.spectrum("fignum",1111,"displayname","after HPF");
|
||||
end
|
||||
|
||||
% figure(111)
|
||||
% hold on
|
||||
% [h, f] = freqz(b, a, length(Rx_sig), Rx_sig.fs);
|
||||
% plot(f, 20*log10(abs(h)));
|
||||
% title('Magnitude Response of Digital High-Pass Filter');
|
||||
% xlabel('Frequency (Hz)');
|
||||
% ylabel('Magnitude (dB)');
|
||||
% grid on;
|
||||
|
||||
|
||||
%%%%%% Scope %%%%%%
|
||||
fadc = 256e9;
|
||||
Lp_scpe = Filter('filtdegree',4,"f_cutoff",100e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true);
|
||||
Scpe_sig = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"filtertype",filtertypes.butterworth,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",10,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',Lp_scpe).process(Rx_sig);
|
||||
|
||||
|
||||
% Scpe_sig.spectrum("displayname","Received Signal after Scope","fignum",201);
|
||||
|
||||
%%%%%% Sample to 2x fsym %%%%%%
|
||||
Scpe_sig = Scpe_sig.resample("fs_in",fadc,"fs_out",2*fsym);
|
||||
|
||||
if usemrds
|
||||
Scpe_sig = MRDS_coding("blocklength",512).dc_remove(Scpe_sig,"oversampling_factor",2);
|
||||
end
|
||||
%
|
||||
|
||||
rmean = zeros(1,2);
|
||||
if 0
|
||||
|
||||
data_in = Scpe_sig.signal;
|
||||
winlength = wl;
|
||||
|
||||
for k = 1:winlength:length(data_in)
|
||||
|
||||
try
|
||||
|
||||
data = data_in(k:k+winlength-1);
|
||||
|
||||
rmean(1) = mean(data);
|
||||
rmean = circshift(rmean,1);
|
||||
Scpe_sig.signal(k:k+winlength-1) = data - rmean(1);
|
||||
|
||||
catch
|
||||
|
||||
if k+winlength > length(data_in)
|
||||
data = data_in(k:length(data_in));
|
||||
else
|
||||
error('indice problem.')
|
||||
end
|
||||
|
||||
rmean(1) = mean(data);
|
||||
|
||||
Scpe_sig.signal(k:length(data_in)) = data - rmean(1);
|
||||
|
||||
end
|
||||
end
|
||||
% Scpe_sig.signal = data_out;
|
||||
end
|
||||
|
||||
|
||||
% Scpe_sig.plot("fignum",313,"displayname",'after dc removal');
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
[Scpe_sig] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym);
|
||||
|
||||
|
||||
%%%%% EQUALIZE %%%%%%
|
||||
|
||||
if ~usemrds
|
||||
%
|
||||
Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",0);
|
||||
% Eq = VNLE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",[25,2,2],"sps",2,"decide",1);
|
||||
[EQ_sig,Noi] = Eq.process(Scpe_sig,Symbols);
|
||||
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
[~,errors_bm,ber_ffe(j,i),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
disp(['BER: ',sprintf('%.1E',ber_ffe(j,i)),' - - ROP: ',num2str(patten(j,i)),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||
%
|
||||
% %
|
||||
|
||||
|
||||
% Eq = FFE_FFDCAVG("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",1,"mu_buff",0.7);
|
||||
% [EQ_sig] = Eq.process(Scpe_sig,Symbols);
|
||||
% Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
% [~,errors_bm,ber_dcavg(j,i),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
% disp(['BER: ',sprintf('%.1E',ber_dcavg(j,i)),' - - ROP: ',num2str(patten(j,i)),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||
|
||||
|
||||
[Eq] = FFE_adaptive_decision("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",0,"buffer_length",112);
|
||||
[EQ_sig,Noi] = Eq.process(Scpe_sig,Symbols);
|
||||
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
[~,errors_bm,ber_adapt(j,i),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
disp(['BER: ',sprintf('%.1E',ber_adapt(j,i)),' - - ROP: ',num2str(patten(j,i)),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||
|
||||
Noi.spectrum('displayname','Noise PSD','fignum',123)
|
||||
[h,w] = freqz(1,burg_coeff,length(Noi),"whole",Noi.fs);
|
||||
h = h/max(abs(h));
|
||||
hold on
|
||||
w_ = (w - Noi.fs/2);
|
||||
plot(w_.*1e-9,20*log10(fftshift(h)),'DisplayName',['', num2str(nc), ' coefficients for burg alg.']);
|
||||
|
||||
%
|
||||
%
|
||||
% Eq = FFE_DCremoval("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",1,"mu_dc",0.07,"dc_buffer_len",112);
|
||||
% [EQ_sig] = Eq.process(Scpe_sig,Symbols);
|
||||
% Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
% [~,errors_bm,ber_dcrem(j,i),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
% disp(['BER: ',sprintf('%.1E',ber_dcrem(j,i)),' - - ROP: ',num2str(patten(j,i)),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||
|
||||
|
||||
else
|
||||
Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",1);
|
||||
|
||||
[EQ_sig] = Eq.process(Scpe_sig,Symbols);
|
||||
Rx_bits = MRDS_coding("blocklength",wl).decode(EQ_sig);
|
||||
Rx_bits = PAMmapper(M,0).demap(Rx_bits);
|
||||
[~,errors_bm,ber_ffe(j,i),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
disp(['BER: ',sprintf('%.1E',ber_ffe(j,i)),' - - ROP: ',num2str(patten(j,i)),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
for j = 1:j_
|
||||
sir = wh.parameter.sir.values(j);
|
||||
for i = 1:i_
|
||||
rop=wh.parameter.rop.values(i);
|
||||
|
||||
wh.addValueToStorage(ber_ffe(j,i) ,'ber_ffe',M,datarate,sir,laser_linewidth,pn_key,rop);
|
||||
wh.addValueToStorage(ber_dcavg(j,i),'ber_dcavg',M,datarate,sir,laser_linewidth,pn_key,rop);
|
||||
wh.addValueToStorage(ber_adapt(j,i),'ber_adapt',M,datarate,sir,laser_linewidth,pn_key,rop);
|
||||
wh.addValueToStorage(ber_dcrem(j,i),'ber_dcrem',M,datarate,sir,laser_linewidth,pn_key,rop);
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
toc
|
||||
disp(['Simulated: ',num2str(cnt/endcnt*100),' %']);
|
||||
wh.save('C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_August\auswertung\')
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
rop_curve;
|
||||
|
||||
|
||||
|
||||
|
||||
45
projects/MPI/MPI_August/rx_model.m
Normal file
45
projects/MPI/MPI_August/rx_model.m
Normal file
@@ -0,0 +1,45 @@
|
||||
function rx_bits = rx_model(Rx,Ref,Phdiod,Lp_phdiod,Scpe,Eq,Pmap)
|
||||
|
||||
%%%%% Local Parameter %%%%%%%%
|
||||
fsym = Ref.fs;
|
||||
|
||||
|
||||
%%%%%% Square Law %%%%%%
|
||||
Rx_sig = Phdiod.process(Rx);
|
||||
|
||||
%%%%%% Lowpass PhDiode %%%%%%
|
||||
Rx_sig = Lp_phdiod.process(Rx_sig);
|
||||
% Rx_sig.spectrum("displayname","Received Signal after PhD","fignum",201);
|
||||
|
||||
|
||||
%%%%%% Scope %%%%%%
|
||||
Scpe_sig = Scpe.process(Rx_sig);
|
||||
Scpe_sig.plot("displayname","SIgnal after Scope","fignum",1999);
|
||||
% Scpe_sig.spectrum("displayname",'after scope','fignum',123);
|
||||
|
||||
|
||||
%%%%%% Sample to 2x fsym %%%%%%
|
||||
Scpe_sig = Scpe_sig.resample("fs_in",Scpe.fadc,"fs_out",2*fsym);
|
||||
% Scpe_sig.plot('fignum',12345,'displayname','bla')
|
||||
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
[Scpe_sig,D,cuts] = Scpe_sig.tsynch("reference",Ref,"fs_ref",fsym);
|
||||
|
||||
|
||||
%%%%% EQUALIZE %%%%%%
|
||||
[EQ_sig] = Eq.process(Scpe_sig,Ref);
|
||||
% EQ_sig.normalize("mode","rms").plot('fignum',23,'displayname','before eq')
|
||||
|
||||
|
||||
%%%%% DEMAP %%%%%%
|
||||
rx_bits = Pmap.demap(EQ_sig);
|
||||
|
||||
%%%% Look at Pam levels %%%%%
|
||||
if 1
|
||||
a = Pmap.separate_pamlevels(EQ_sig);
|
||||
figure(14);hold on;scatter(1:EQ_sig.length,a,1,'.');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
BIN
projects/MPI/MPI_August/scpe_sig.mat
Normal file
BIN
projects/MPI/MPI_August/scpe_sig.mat
Normal file
Binary file not shown.
117
projects/MPI/MPI_August/simualte_MPI_data.m
Normal file
117
projects/MPI/MPI_August/simualte_MPI_data.m
Normal file
@@ -0,0 +1,117 @@
|
||||
|
||||
usemrds = 0;
|
||||
|
||||
%% Init Params
|
||||
link_length = 10000; %meter
|
||||
|
||||
Optfilter = Filter('filtdegree',6,"f_cutoff",fsym.*0.7,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true);
|
||||
|
||||
tic
|
||||
|
||||
% SETUP HERE: %%
|
||||
kover = 8;
|
||||
M8199 = M8199A("kover",kover);
|
||||
fdac = M8199.fdac;
|
||||
fsym = round(datarate / log2(M)) * 1e9;
|
||||
rrcalpha = 0.05;
|
||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rrcalpha);
|
||||
|
||||
% MAIN SIGNAL
|
||||
|
||||
%%%%% Symbol Generation %%%%%%
|
||||
[Digi_sig,Symbols,Bits] = PAMsource("fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||
"fs_out",M8199.fdac,"applyclipping",1,"clipfactor",1.4,"applypulseform",1,"pulseformer",Pform,"randkey",pn_key,"mrds_code",usemrds).process();
|
||||
|
||||
%%%%% AWG %%%%%%
|
||||
El_sig = M8199.process(Digi_sig);
|
||||
%El_sig.signal = awgn(El_sig.signal,20,'measured',pn_key);
|
||||
|
||||
%%%%% Lowpass el. components %%%%%%
|
||||
El_sig = Filter('filtdegree',2,"f_cutoff",60e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(El_sig);
|
||||
|
||||
%%%%% Electrical Driver Amplifier %%%%%%
|
||||
El_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",9).process(El_sig);
|
||||
|
||||
fprintf('Driver output power: %s dBm\n', num2str(El_sig.power));
|
||||
fprintf('Driver output peak voltage: %s Vpp \n', num2str(max(El_sig.signal)-min(El_sig.signal)));
|
||||
|
||||
% INTERFERENCE SIGNAL
|
||||
|
||||
%%%%% Symbol Generation %%%%%%
|
||||
[Digi_sig_i,Symbols_i,Bits_i] = PAMsource("fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||
"fs_out",M8199.fdac,"applyclipping",1,"clipfactor",1.4,"applypulseform",1,"pulseformer",Pform,"randkey",pn_key*2,"mrds_code",usemrds).process();
|
||||
|
||||
%%%%% AWG %%%%%%
|
||||
El_sig_i = M8199.process(Digi_sig_i);
|
||||
%El_sig_i.signal = awgn(El_sig_i.signal,20,'measured',pn_key*2);
|
||||
|
||||
%%%%% Lowpass before Modulator %%%%%%
|
||||
El_sig_i = Filter('filtdegree',2,"f_cutoff",60e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(El_sig_i);
|
||||
El_sig_i = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",9).process(El_sig_i);
|
||||
|
||||
|
||||
fprintf('Driver output power: %s dBm\n', num2str(El_sig.power));
|
||||
fprintf('Driver output peak voltage: %s Vpp \n', num2str(max(El_sig.signal)-min(El_sig.signal)));
|
||||
|
||||
|
||||
% MAIN SIGNAL
|
||||
%%%%% MODULATE E/O CONVERSION %%%%%%
|
||||
vbias_rel = 0.6;
|
||||
u_pi = 2.9;
|
||||
vbias = -vbias_rel*u_pi;
|
||||
|
||||
[Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",pn_key).process(El_sig);
|
||||
|
||||
Opt_sig = Optfilter.process(Opt_sig);
|
||||
|
||||
Opt_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",0).process(Opt_sig);
|
||||
|
||||
% INTERFERENCE SIGNAL
|
||||
%%%%% MODULATE E/O CONVERSION %%%%%%
|
||||
|
||||
[Opt_sig_i] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",pn_key+1).process(El_sig_i);
|
||||
|
||||
Opt_sig_i = Optfilter.process(Opt_sig_i);
|
||||
|
||||
Opt_sig_i = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",0).process(Opt_sig_i);
|
||||
|
||||
|
||||
|
||||
|
||||
for j = 1:j_
|
||||
|
||||
sir = wh.parameter.sir.values(j);
|
||||
|
||||
%%%%% Interference Signal Fiber Prop %%%%%%
|
||||
Opt_sig_i_prop = Fiber("fsimu",Opt_sig_i.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig_i);
|
||||
|
||||
Opt_sig_i_prop = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",Opt_sig.power-sir).process(Opt_sig_i_prop);
|
||||
|
||||
%%%%% ADD Interference and Main Signal %%%%%%
|
||||
Opt_sig_comb = Opt_sig_i_prop + Opt_sig;
|
||||
|
||||
%%%%% Interference Signal Fiber Prop %%%%%%
|
||||
Opt_sig_comb = Fiber("fsimu",Opt_sig_comb.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig_comb);
|
||||
|
||||
% Receiver ROP curve
|
||||
for i = 1:i_
|
||||
rop=wh.parameter.rop.values(i);
|
||||
|
||||
% Set ROP
|
||||
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt_sig_comb);
|
||||
|
||||
%%%%%% Square Law %%%%%%
|
||||
Rx_sig = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20,"nep",1.8e-11).process(Rx_sig);
|
||||
|
||||
%%%%%% Lowpass PhDiode %%%%%%
|
||||
Rx_sig = Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true).process(Rx_sig);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
rop_curve;
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
projects/MPI/MPI_August/symbols.mat
Normal file
BIN
projects/MPI/MPI_August/symbols.mat
Normal file
Binary file not shown.
66
projects/MPI/MPI_August/tx_model.m
Normal file
66
projects/MPI/MPI_August/tx_model.m
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
function [el_sig,bits,symbol_seq] = tx_model(fsym,Pmap,Pform,Awg,options)
|
||||
|
||||
arguments
|
||||
fsym
|
||||
Pmap
|
||||
Pform
|
||||
Awg
|
||||
options.clipfactor
|
||||
end
|
||||
|
||||
%%%%% Local Parameter %%%%%%%%
|
||||
|
||||
|
||||
%%%%% PRBS Generation in correct shape for Modulation Format %%%%%%
|
||||
O = 17; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
for i = 1:log2(Pmap.M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
if Pmap.M == 6
|
||||
bitpattern = reshape(bitpattern,[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
end
|
||||
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
%%%%% Map to PAM %%%%%%
|
||||
symbol_seq = Pmap.map(bits);
|
||||
symbol_seq.fs = fsym;
|
||||
|
||||
|
||||
|
||||
%%%%% Pulseforming %%%%%%
|
||||
if 1
|
||||
X = Pform.process(symbol_seq);
|
||||
else
|
||||
X = symbol_seq;
|
||||
end
|
||||
|
||||
%%%%% Resample to f DAC %%%%%%
|
||||
X = X.resample("fs_in",X.fs,"fs_out",Awg.fdac,"n",10,"beta",5);
|
||||
|
||||
%%%%% Clip to PAM range %%%%%%
|
||||
if 1
|
||||
min_ = min(symbol_seq.signal) * options.clipfactor ;
|
||||
max_ = max(symbol_seq.signal) * options.clipfactor ;
|
||||
X.signal = clip(X.signal,min_,max_);
|
||||
end
|
||||
|
||||
%%%%%Info about AWG input %%%%%%
|
||||
pwr_ = X.power; % in dbm into 50 ohm
|
||||
papr_ = papr(X.signal);
|
||||
vpk_ = max(abs(X.signal));
|
||||
vswing_ = max(X.signal)-min(X.signal);
|
||||
awg_string = ['Digital AWG Input: Pout: ',num2str(round(pwr_,2)),' dBm; PAPR: ',num2str(round(papr_,2)),'; Vpk: ',num2str(round(vpk_,2)),'; Vswing: ',num2str(round(vswing_,2)),''];
|
||||
% isp(awg_string);
|
||||
|
||||
%%%%% AWG %%%%%%
|
||||
el_sig = Awg.process(X);
|
||||
el_sig= el_sig.*0.7222;
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user