few changes in WDM stuff

cleaned up the base system... but its not yet a good minimal example...
This commit is contained in:
silas (home)
2026-01-07 08:30:14 +01:00
parent 0186eccced
commit 01a3881455
7 changed files with 841 additions and 753 deletions

View File

@@ -1,117 +1,133 @@
% basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
% db = DBHandler("pathToDB",[basePath,'silas_labor.db']);
if 1
uloops = struct;
uloops.precomp = [1];
uloops.db_precode = [0];
uloops.bitrate = [224].*1e9; %[300,330,360,390,420,450,480] [224,336,360,390,420,448] for MPI
uloops.bitrate = [300].*1e9; %[300,330,360,390,420,450,480] [224,336,360,390,420,448] for MPI
% uloops.laser_wavelength = [1293,1297.5,1302,1306.5,1310,1313.4,1318,1322.7,1327.4];
uloops.laser_wavelength = [1310];
uloops.laser_wavelength = [1293];
uloops.M = [4];
uloops.link_length = [1]; % 1,2,3,5,6,8,10
% uloops.interference_attenuation = [0,3,6,9,12,15,18,21,24,27,30,45];
uloops.link_length = [0:2:10]; % 1,2,3,5,6,8,10
uloops.alpha = [0.5,-0.5,0];
wh = DataStorage(uloops);
wh.addStorage("ber");
% wh = submit_simulations(wh,"parallel",0,"simulation_mode",0);
wh = submit_handle(@imdd_model,wh,"serial",0);
wh = submit_handle(@imdd_model,wh,"parallel",1);
end
wh_ana = wh_master;
cols = cbrewer2('Paired',8);
figure()
for precomp = [0,1]
wavelength=uloops.laser_wavelength;
for m = [6]
baudrate = wh_ana.parameter.bitrate.values;
%VNLE
precode = 1;
a = wh_ana.getStoValue('ber',precomp, precode, baudrate , wavelength, m, uloops.link_length);
ber_vnle_pc = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
%MLSE
ber_mlse_pc = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
%DB
ber_dbtgt_pc = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
precode = 0;
a = wh_ana.getStoValue('ber',precomp, precode, baudrate , wavelength, m, uloops.link_length);
ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
%MLSE
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
%DB
ber_dbtgt = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
if precomp
legndname1 = ['Pre-Emphasis'];
else
legndname1 = ['No Pre-Emphasis'];
end
baudrate = floor( uloops.bitrate.*1e-9 ./log2(m) ) .* 2.5 .* 1e9;
subplot(1,3,1)
hold on
title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
title(sprintf('PAM %d',m));
plot(baudrate.*1e-9,ber_vnle,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 0'],'Color',cols(1+precomp,:),'LineStyle','-','HandleVisibility','on');
plot(baudrate.*1e-9,ber_vnle_pc,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 1'],'Color',cols(1+precomp,:),'LineStyle','-.','HandleVisibility','on');
xticks(baudrate.*1e-9);
set(gca, 'YScale', 'log');
ylim([5e-5 0.4]);
xlim([min(baudrate(2).*1e-9), max(baudrate.*1e-9) ]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
xlabel('Bit Rate in Gbps');
ylabel('BER');
subplot(1,3,2)
hold on
% title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
title(sprintf('PAM %d',m));
plot(baudrate.*1e-9,ber_dbtgt,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 0'],'Color',cols(5+precomp,:),'LineStyle','-','HandleVisibility','on');
plot(baudrate.*1e-9,ber_dbtgt_pc,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 1'],'Color',cols(5+precomp,:),'LineStyle','-.','HandleVisibility','on');
xticks(baudrate.*1e-9);
set(gca, 'YScale', 'log');
ylim([5e-5 0.4]);
xlim([min(baudrate(2).*1e-9), max(baudrate.*1e-9) ]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
xlabel('Bit Rate in Gbps');
ylabel('BER');
subplot(1,3,3)
hold on
% title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
title(sprintf('PAM %d',m));
plot(baudrate.*1e-9,ber_mlse,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 0'],'Color',cols(3+precomp,:),'LineStyle','-','HandleVisibility','on');
plot(baudrate.*1e-9,ber_mlse_pc,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 1'],'Color',cols(3+precomp,:),'LineStyle','-.','HandleVisibility','on');
xticks(baudrate.*1e-9);
set(gca, 'YScale', 'log');
ylim([5e-5 0.4]);
xlim([min(baudrate(2).*1e-9), max(baudrate.*1e-9) ]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
xlabel('Bit Rate in Gbps');
ylabel('BER');
end
%%
figure
hold on
for alpha = uloops.alpha
a=wh.getStoValue('ber',1, [300].*1e9 , 1293, 4, uloops.link_length,alpha);
ffe = cellfun(@(x) x.ffe_results.metrics.BER, a);
plot(uloops.link_length,ffe,'DisplayName',sprintf('Alpha: %d',alpha),'LineStyle','-','HandleVisibility','on');
end
%
%
set(gca, 'YScale', 'log');
ylim([5e-5 0.4]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
ylabel('BER');
%
% wh_ana = wh_master;
%
% cols = cbrewer2('Paired',8);
%
% figure()
%
% for precomp = [0,1]
% wavelength=uloops.laser_wavelength;
% for m = [6]
%
% baudrate = wh_ana.parameter.bitrate.values;
%
%
% %VNLE
% precode = 1;
% a = wh_ana.getStoValue('ber',precomp, precode, baudrate , wavelength, m, uloops.link_length);
% ber_vnle_pc = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
% %MLSE
% ber_mlse_pc = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
% %DB
% ber_dbtgt_pc = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
%
% precode = 0;
% a = wh_ana.getStoValue('ber',precomp, precode, baudrate , wavelength, m, uloops.link_length);
% ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
% %MLSE
% ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
% %DB
% ber_dbtgt = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
%
% if precomp
% legndname1 = ['Pre-Emphasis'];
% else
% legndname1 = ['No Pre-Emphasis'];
% end
%
%
% baudrate = floor( uloops.bitrate.*1e-9 ./log2(m) ) .* 2.5 .* 1e9;
%
% subplot(1,3,1)
% hold on
% title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
% title(sprintf('PAM %d',m));
% plot(baudrate.*1e-9,ber_vnle,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 0'],'Color',cols(1+precomp,:),'LineStyle','-','HandleVisibility','on');
% plot(baudrate.*1e-9,ber_vnle_pc,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 1'],'Color',cols(1+precomp,:),'LineStyle','-.','HandleVisibility','on');
% xticks(baudrate.*1e-9);
% set(gca, 'YScale', 'log');
% ylim([5e-5 0.4]);
% xlim([min(baudrate(2).*1e-9), max(baudrate.*1e-9) ]);
% yline([3.8e-3, 2e-2],'HandleVisibility','off');
% legend
% beautifyBERplot()
% xlabel('Bit Rate in Gbps');
% ylabel('BER');
%
%
%
% subplot(1,3,2)
% hold on
% % title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
% title(sprintf('PAM %d',m));
% plot(baudrate.*1e-9,ber_dbtgt,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 0'],'Color',cols(5+precomp,:),'LineStyle','-','HandleVisibility','on');
% plot(baudrate.*1e-9,ber_dbtgt_pc,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 1'],'Color',cols(5+precomp,:),'LineStyle','-.','HandleVisibility','on');
% xticks(baudrate.*1e-9);
% set(gca, 'YScale', 'log');
% ylim([5e-5 0.4]);
% xlim([min(baudrate(2).*1e-9), max(baudrate.*1e-9) ]);
% yline([3.8e-3, 2e-2],'HandleVisibility','off');
% legend
% beautifyBERplot()
% xlabel('Bit Rate in Gbps');
% ylabel('BER');
%
%
% subplot(1,3,3)
% hold on
% % title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
% title(sprintf('PAM %d',m));
% plot(baudrate.*1e-9,ber_mlse,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 0'],'Color',cols(3+precomp,:),'LineStyle','-','HandleVisibility','on');
% plot(baudrate.*1e-9,ber_mlse_pc,'DisplayName',['Pre-Emphasis: ', num2str(precomp), '| Diff.-Code: 1'],'Color',cols(3+precomp,:),'LineStyle','-.','HandleVisibility','on');
% xticks(baudrate.*1e-9);
% set(gca, 'YScale', 'log');
% ylim([5e-5 0.4]);
% xlim([min(baudrate(2).*1e-9), max(baudrate.*1e-9) ]);
% yline([3.8e-3, 2e-2],'HandleVisibility','off');
% legend
% beautifyBERplot()
% xlabel('Bit Rate in Gbps');
% ylabel('BER');
% end
% end
% %
% %
% cols = linspecer(7);%cbrewer2('Set2',10);
%
%
@@ -163,163 +179,163 @@ end
% end
m = 6;
ir = [2,2.5,3];
cols = linspecer(6);
baudrate_gather = [];
for i = 1:3
m = uloops.M(i);
%%% GET VNLE VALS
precode = 0;
precomp = 1;
a = wh_master.getStoValue('ber',precomp, precode, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
ber_vnle(i,:) = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
%%% GET DB VALS
precode = 1;
precomp = 0;
a = wh_master.getStoValue('ber',precomp, precode, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
ber_db(i,:) = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
%%% GET MLSE VALS
precode = 0;
precomp = 0;
a = wh_master.getStoValue('ber',precomp, precode, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
ber_mlse(i,:) = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
inf_rate_pam(i,:) = cellfun(@(x) x.vnle_pf_package{1,1}.air, a);
inf_rate_pam(i,:) = inf_rate_pam(i,:)./log2(m);
bitrate = floor( uloops.bitrate.*1e-9 ./log2(m) ) .* ir(i) .* 1e9;
baudrate = floor( uloops.bitrate.*1e-9 ./log2(m) ) .* 1e9;
baudrate_gather = union(baudrate_gather,baudrate);
baudrate_ticks = 100:20:240;
bitrate_ticks = 300:30:480;
tp = TransmissionPerformance;
netRatesVNLE = tp.calculateNetRate(bitrate, 'NGMI', inf_rate_pam(i,:), 'BER', ber_vnle(i,:));
%%% NGMI
figure(12)
hold on
title(sprintf('Performance at 1310 nm'));
plot(baudrate.*1e-9,inf_rate_pam(i,:),'DisplayName',sprintf('NGMI; PAM %d',m),'Color',cols(i,:),'LineStyle','-');
xlabel('Baud rate in GBd');
ylabel('NGMI')
beautifyBERplot()
xticks(baudrate_ticks);
xlim([min(baudrate_ticks) max(baudrate_ticks)]);
%%% AIR
figure(14)
hold on
title(sprintf('Performance at 1310 nm'));
plot(baudrate.*1e-9,inf_rate_pam(i,:).*bitrate.*1e-9,'DisplayName',sprintf('AIR; PAM %d',m),'Color',cols(i,:),'LineStyle','-');
xlabel('Baud rate in GBd');
ylabel('AIR');
beautifyBERplot()
xticks(baudrate_ticks);
xlim([min(baudrate_ticks) max(baudrate_ticks)]);
%%% RATES
figure(16)
hold on
title(sprintf('Performance at 1310 nm'));
if i == 1
hv = 'on';
else
hv = 'off';
end
plot(baudrate*1e-9,netRatesVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('SD+HD FEC',m),'Color',cols(i,:),'LineStyle','-','HandleVisibility',hv,'Marker','o');
plot(baudrate.*1e-9,netRatesVNLE.HD.NetRate.*1e-9,'DisplayName',sprintf('HD FEC',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','diamond');
plot(baudrate.*1e-9,netRatesVNLE.KP4_hamming.NetRate*1e-9,'DisplayName',sprintf('KP4+Hamming',m),'Color',cols(i,:),'LineStyle','-.','HandleVisibility',hv,'Marker','square');
xticks(baudrate_ticks);
xlim([min(baudrate_ticks) max(baudrate_ticks)]);
xlabel('Baud rate in GBd');
ylabel('Net Bitrate in Gbps')
beautifyBERplot()
ylim([250 410])
%%% CODE OVERHEAD IN %
figure(18)
hold on
title(sprintf('Performance at 1310 nm'));
plot(baudrate*1e-9,100.*(1-netRatesVNLE.SDHD.CodeRate)./netRatesVNLE.SDHD.CodeRate,'DisplayName',sprintf('SD+HD FEC',m),'Color',cols(i,:),'LineStyle','-','HandleVisibility',hv,'Marker','o');
plot(baudrate.*1e-9,100.*(1-netRatesVNLE.HD.CodeRate)./netRatesVNLE.HD.CodeRate,'DisplayName',sprintf('HD FEC',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','diamond');
plot(baudrate.*1e-9,100.*(1-netRatesVNLE.KP4_hamming.CodeRate)./netRatesVNLE.KP4_hamming.CodeRate,'DisplayName',sprintf('KP4+Hamming',m),'Color',cols(i,:),'LineStyle','-.','HandleVisibility',hv,'Marker','square');
xticks(baudrate_ticks);
xlim([min(baudrate_ticks) max(baudrate_ticks)]);
xlabel('Baud rate in GBd');
ylabel('FEC Overhead in %')
beautifyBERplot()
%%% CLASSIC BER
figure(22)
subplot(1,4,i)
hold on
plot(baudrate*1e-9,ber_vnle(i,:),'DisplayName',sprintf('Tx precomp + VNLE',m),'Color',cols(i,:),'LineStyle','-','HandleVisibility','on','Marker','o');
plot(baudrate*1e-9,ber_mlse(i,:),'DisplayName',sprintf('VNLE + PF + MLSE',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility','on','Marker','square');
plot(baudrate*1e-9,ber_db(i,:),'DisplayName',sprintf('Diff. Code + DB tgt.',m),'Color',cols(i,:),'LineStyle','--','HandleVisibility','on','Marker','diamond');
yline(4.85e-3,'HandleVisibility','off');
yline(2e-2,'HandleVisibility','off');
xticks(baudrate*1e-9);
xlim([min(baudrate*1e-9) max(baudrate*1e-9)]);
ylim([1e-4 0.3]);
xlabel('Baudrate in GBd');
if i == 1
ylabel('BER')
end
beautifyBERplot()
set(gca, 'YScale', 'log');
legend
subplot(1,4,4)
hold on
if m == 4
plot(bitrate*1e-9,ber_db(i,:),'DisplayName',sprintf('Diff. Code + DB tgt.'),'Color',cols(i,:),'LineStyle','--','HandleVisibility','on','Marker','diamond');
elseif m == 6
plot(bitrate*1e-9,ber_vnle(i,:),'DisplayName',sprintf('VNLE + PF + MLSE'),'Color',cols(i,:),'LineStyle','-','HandleVisibility','on','Marker','o');
% plot(bitrate*1e-9,ber_mlse(i,:),'DisplayName',sprintf('MLSE',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','square');
elseif m ==8
plot(bitrate*1e-9,ber_vnle(i,:),'DisplayName',sprintf('Tx precomp + VNLE'),'Color',cols(i,:),'LineStyle','-','HandleVisibility','on','Marker','o');
% plot(bitrate*1e-9,ber_mlse(i,:),'DisplayName',sprintf('MLSE',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','square');
end
yline(4.85e-3,'HandleVisibility','off');
yline(2e-2,'HandleVisibility','off');
xticks(bitrate_ticks);
xlim([min(bitrate_ticks) max(bitrate_ticks)]);
ylim([1e-4 0.3]);
xlabel('Gross Bitrate in Gbps');
% ylabel('BER')
beautifyBERplot()
set(gca, 'YScale', 'log');
end
figure()
title(sprintf('%d km | 1310 nm | PAM %d | VNLE',uloops.link_length,uloops.M));
hold on
line([min(uloops.bitrate.*1e-9) max(uloops.bitrate.*1e-9)],[min(uloops.bitrate.*1e-9) max(uloops.bitrate.*1e-9)],'Color',[.7,.7,.7],'Marker','none','Handlevisibility','off');
plot(uloops.bitrate.*1e-9,cellfun(@min, inf_rate_vnle).*uloops.bitrate./log2(uloops.M).*1e-9,'DisplayName',sprintf('AIR'),'Color',cols(1,:),'LineStyle',':');
plot(uloops.bitrate.*1e-9,netRatesVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('SD+HD'),'Color',cols(2,:),'LineStyle',':');
plot(uloops.bitrate.*1e-9,netRatesVNLE.HD.NetRate.*1e-9,'DisplayName',sprintf('HD'),'Color',cols(3,:),'LineStyle',':');
plot(uloops.bitrate.*1e-9,netRatesVNLE.KP4_hamming.NetRate.*1e-9,'DisplayName',sprintf('KP4+Hamming'),'Color',cols(4,:),'LineStyle',':');
beautifyBERplot()
xlim([min(uloops.bitrate.*1e-9) max(uloops.bitrate.*1e-9)])
xlabel('Gross Bitrate in Gbps');
ylabel('Net Bitrate in Gbps');
legend
%
% m = 6;
% ir = [2,2.5,3];
% cols = linspecer(6);
% baudrate_gather = [];
% for i = 1:3
% m = uloops.M(i);
%
% %%% GET VNLE VALS
% precode = 0;
% precomp = 1;
% a = wh_master.getStoValue('ber',precomp, precode, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
% ber_vnle(i,:) = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
%
% %%% GET DB VALS
% precode = 1;
% precomp = 0;
% a = wh_master.getStoValue('ber',precomp, precode, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
% ber_db(i,:) = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
%
% %%% GET MLSE VALS
% precode = 0;
% precomp = 0;
% a = wh_master.getStoValue('ber',precomp, precode, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
% ber_mlse(i,:) = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
%
% inf_rate_pam(i,:) = cellfun(@(x) x.vnle_pf_package{1,1}.air, a);
% inf_rate_pam(i,:) = inf_rate_pam(i,:)./log2(m);
%
% bitrate = floor( uloops.bitrate.*1e-9 ./log2(m) ) .* ir(i) .* 1e9;
% baudrate = floor( uloops.bitrate.*1e-9 ./log2(m) ) .* 1e9;
% baudrate_gather = union(baudrate_gather,baudrate);
% baudrate_ticks = 100:20:240;
% bitrate_ticks = 300:30:480;
%
% tp = TransmissionPerformance;
% netRatesVNLE = tp.calculateNetRate(bitrate, 'NGMI', inf_rate_pam(i,:), 'BER', ber_vnle(i,:));
%
% %%% NGMI
% figure(12)
% hold on
% title(sprintf('Performance at 1310 nm'));
% plot(baudrate.*1e-9,inf_rate_pam(i,:),'DisplayName',sprintf('NGMI; PAM %d',m),'Color',cols(i,:),'LineStyle','-');
% xlabel('Baud rate in GBd');
% ylabel('NGMI')
% beautifyBERplot()
% xticks(baudrate_ticks);
% xlim([min(baudrate_ticks) max(baudrate_ticks)]);
%
%
% %%% AIR
% figure(14)
% hold on
% title(sprintf('Performance at 1310 nm'));
% plot(baudrate.*1e-9,inf_rate_pam(i,:).*bitrate.*1e-9,'DisplayName',sprintf('AIR; PAM %d',m),'Color',cols(i,:),'LineStyle','-');
% xlabel('Baud rate in GBd');
% ylabel('AIR');
% beautifyBERplot()
% xticks(baudrate_ticks);
% xlim([min(baudrate_ticks) max(baudrate_ticks)]);
%
% %%% RATES
% figure(16)
% hold on
% title(sprintf('Performance at 1310 nm'));
% if i == 1
% hv = 'on';
% else
% hv = 'off';
% end
% plot(baudrate*1e-9,netRatesVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('SD+HD FEC',m),'Color',cols(i,:),'LineStyle','-','HandleVisibility',hv,'Marker','o');
% plot(baudrate.*1e-9,netRatesVNLE.HD.NetRate.*1e-9,'DisplayName',sprintf('HD FEC',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','diamond');
% plot(baudrate.*1e-9,netRatesVNLE.KP4_hamming.NetRate*1e-9,'DisplayName',sprintf('KP4+Hamming',m),'Color',cols(i,:),'LineStyle','-.','HandleVisibility',hv,'Marker','square');
% xticks(baudrate_ticks);
% xlim([min(baudrate_ticks) max(baudrate_ticks)]);
% xlabel('Baud rate in GBd');
% ylabel('Net Bitrate in Gbps')
% beautifyBERplot()
% ylim([250 410])
%
% %%% CODE OVERHEAD IN %
% figure(18)
% hold on
% title(sprintf('Performance at 1310 nm'));
% plot(baudrate*1e-9,100.*(1-netRatesVNLE.SDHD.CodeRate)./netRatesVNLE.SDHD.CodeRate,'DisplayName',sprintf('SD+HD FEC',m),'Color',cols(i,:),'LineStyle','-','HandleVisibility',hv,'Marker','o');
% plot(baudrate.*1e-9,100.*(1-netRatesVNLE.HD.CodeRate)./netRatesVNLE.HD.CodeRate,'DisplayName',sprintf('HD FEC',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','diamond');
% plot(baudrate.*1e-9,100.*(1-netRatesVNLE.KP4_hamming.CodeRate)./netRatesVNLE.KP4_hamming.CodeRate,'DisplayName',sprintf('KP4+Hamming',m),'Color',cols(i,:),'LineStyle','-.','HandleVisibility',hv,'Marker','square');
% xticks(baudrate_ticks);
% xlim([min(baudrate_ticks) max(baudrate_ticks)]);
% xlabel('Baud rate in GBd');
% ylabel('FEC Overhead in %')
% beautifyBERplot()
%
% %%% CLASSIC BER
% figure(22)
% subplot(1,4,i)
% hold on
% plot(baudrate*1e-9,ber_vnle(i,:),'DisplayName',sprintf('Tx precomp + VNLE',m),'Color',cols(i,:),'LineStyle','-','HandleVisibility','on','Marker','o');
% plot(baudrate*1e-9,ber_mlse(i,:),'DisplayName',sprintf('VNLE + PF + MLSE',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility','on','Marker','square');
% plot(baudrate*1e-9,ber_db(i,:),'DisplayName',sprintf('Diff. Code + DB tgt.',m),'Color',cols(i,:),'LineStyle','--','HandleVisibility','on','Marker','diamond');
% yline(4.85e-3,'HandleVisibility','off');
% yline(2e-2,'HandleVisibility','off');
% xticks(baudrate*1e-9);
% xlim([min(baudrate*1e-9) max(baudrate*1e-9)]);
% ylim([1e-4 0.3]);
% xlabel('Baudrate in GBd');
% if i == 1
% ylabel('BER')
% end
% beautifyBERplot()
% set(gca, 'YScale', 'log');
% legend
% subplot(1,4,4)
% hold on
% if m == 4
%
% plot(bitrate*1e-9,ber_db(i,:),'DisplayName',sprintf('Diff. Code + DB tgt.'),'Color',cols(i,:),'LineStyle','--','HandleVisibility','on','Marker','diamond');
%
% elseif m == 6
%
% plot(bitrate*1e-9,ber_vnle(i,:),'DisplayName',sprintf('VNLE + PF + MLSE'),'Color',cols(i,:),'LineStyle','-','HandleVisibility','on','Marker','o');
% % plot(bitrate*1e-9,ber_mlse(i,:),'DisplayName',sprintf('MLSE',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','square');
%
% elseif m ==8
%
% plot(bitrate*1e-9,ber_vnle(i,:),'DisplayName',sprintf('Tx precomp + VNLE'),'Color',cols(i,:),'LineStyle','-','HandleVisibility','on','Marker','o');
% % plot(bitrate*1e-9,ber_mlse(i,:),'DisplayName',sprintf('MLSE',m),'Color',cols(i,:),'LineStyle',':','HandleVisibility',hv,'Marker','square');
%
% end
% yline(4.85e-3,'HandleVisibility','off');
% yline(2e-2,'HandleVisibility','off');
% xticks(bitrate_ticks);
% xlim([min(bitrate_ticks) max(bitrate_ticks)]);
% ylim([1e-4 0.3]);
% xlabel('Gross Bitrate in Gbps');
% % ylabel('BER')
% beautifyBERplot()
% set(gca, 'YScale', 'log');
%
%
% end
%
%
%
% figure()
% title(sprintf('%d km | 1310 nm | PAM %d | VNLE',uloops.link_length,uloops.M));
% hold on
% line([min(uloops.bitrate.*1e-9) max(uloops.bitrate.*1e-9)],[min(uloops.bitrate.*1e-9) max(uloops.bitrate.*1e-9)],'Color',[.7,.7,.7],'Marker','none','Handlevisibility','off');
% plot(uloops.bitrate.*1e-9,cellfun(@min, inf_rate_vnle).*uloops.bitrate./log2(uloops.M).*1e-9,'DisplayName',sprintf('AIR'),'Color',cols(1,:),'LineStyle',':');
% plot(uloops.bitrate.*1e-9,netRatesVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('SD+HD'),'Color',cols(2,:),'LineStyle',':');
% plot(uloops.bitrate.*1e-9,netRatesVNLE.HD.NetRate.*1e-9,'DisplayName',sprintf('HD'),'Color',cols(3,:),'LineStyle',':');
% plot(uloops.bitrate.*1e-9,netRatesVNLE.KP4_hamming.NetRate.*1e-9,'DisplayName',sprintf('KP4+Hamming'),'Color',cols(4,:),'LineStyle',':');
% beautifyBERplot()
% xlim([min(uloops.bitrate.*1e-9) max(uloops.bitrate.*1e-9)])
% xlabel('Gross Bitrate in Gbps');
% ylabel('Net Bitrate in Gbps');
% legend
% plot(uloops.bitrate.*1e-9,ber_vnle,'DisplayName',sprintf('NGMI MLSE; %d km',len),'Color',cols(1,:),'LineStyle','-');

View File

@@ -19,19 +19,13 @@ fdac = 256e9;
fadc = 256e9;
random_key = 1;
interference_attenuation = 0;
is_mpi = 1;
precomp = 0;
db_precode = 0;
db_encode = 0;
rcalpha = 0.05;
kover = 16;
vbias_rel = 0.5;
u_pi = 2.9;
u_pi = 3;
vbias = -vbias_rel*u_pi;
laser_wavelength = 1293;
laser_linewidth = 0;
tx_bw_nyquist = 0.8;
@@ -40,7 +34,7 @@ tx_bw_nyquist = 0.8;
link_length = 1;
% RX
rop = -5;
rop = -8;
rx_bw_nyquist = 0.8;
vnle_order1 = 50;
@@ -68,7 +62,7 @@ mu_dfe = 0.0004;
dfe_ = sum(dfe_order)>0;
doub_mode = db_mode.no_db;
duob_mode = db_mode.no_db;
%%% change specific parameter if given in varargin
% Parse optional input arguments
@@ -90,43 +84,6 @@ if ~isempty(varargin)
end
end
if doub_mode ~= db_mode.db_encoded
if precomp == 0 && db_precode == 1
doub_mode = db_mode.db_precoded;
db_precode = 1; % preceded data (in my measurement set, this corresponds to low precomp too!)
discard_precode = 0; %
emulate_precode = 0;
legendentry = 'low precomp; precoded';
disp('low precomp; precoded')
elseif precomp == 1 && db_precode == 1
doub_mode = db_mode.db_emulate;
db_precode = 0; % preceded data (in my measurement set, this corresponds to low precomp too!)
discard_precode = 0; %
emulate_precode = 1;
legendentry = 'high precomp; precoded';
disp('high precomp; precoded')
elseif precomp == 0 && db_precode == 0
doub_mode = db_mode.db_discard;
db_precode = 1; % preceded data (in my measurement set, this corresponds to low precomp too!)
discard_precode = 1; %
emulate_precode = 0;
legendentry = 'no precomp; not precoded';
disp('no precomp; not precoded')
elseif precomp == 1 && db_precode == 0
doub_mode = db_mode.no_db;
db_precode = 0; % preceded data (in my measurement set, this corresponds to low precomp too!)
discard_precode = 0; %
emulate_precode = 0;
legendentry = 'high precomp; not precoded';
disp('high precomp; not precoded')
end
else
end
fsym_ = floor( bitrate*1e-9./log2(M) ).*1e9;
@@ -137,28 +94,19 @@ end
f_nyquist = fsym/2;
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",16,"alpha",rcalpha);
rcalpha = 1;
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"alpha",rcalpha);
db_precode = 0;
db_encode = 0;
apply_pulsef = 1;
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
"fs_out",fdac,...
"applyclipping",0,"clipfactor",1.5,...
"applypulseform",apply_pulsef,"pulseformer",Pform,...
"randkey",random_key,...
"db_precode",db_precode,"db_encode",db_encode,...
'duobinary_mode',duob_mode,...
"mrds_code",0,"mrds_blocklength",512).process();
Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
%%%%% AWG
% El_sig = M8199A("kover",kover).process(Digi_sig);
El_sig = AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",1).process(Digi_sig);
@@ -172,13 +120,17 @@ El_sig = Filter('filtdegree',4,"f_cutoff",tx_bwl,"fs",fdac*kover,"filterType",fi
% El_sig.spectrum("displayname",'Digi Spectrum','fignum',100,'normalizeTo0dB',1);
%%%%% Electrical Driver Amplifier %%%%%%
El_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",3).process(El_sig);
% El_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",3).process(El_sig);
El_sig = El_sig.normalize("mode","oneone");
scaling = 0.6*(u_pi/2-abs(vbias-u_pi/2));
El_sig = El_sig .* scaling;
%%%%% MODULATE E/O CONVERSION %%%%%%
[Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",laser_wavelength,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",random_key+1).process(El_sig);
[Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",laser_wavelength,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",random_key+1,"alpha",alpha).process(El_sig);
Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig);
Opt_sig.spectrum("displayname",'Opt Spectrum','fignum',10,'normalizeTo0dB',1);
Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig);
%%%%%% ROP %%%%%%
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt_sig);
@@ -202,110 +154,75 @@ Scpe_sig = Scope("fsimu",fdac*kover,"fadc",fadc,...
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
"adcresolution",8,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',Lp_scpe).process(Rx_sig);
Scpe_cell{1} = Scpe_sig;
if db_precode
Symbols_precoded = Symbols;
end
output = struct();
vnle_pf_package = {};
vnle_dfe_package = {};
dbtgt_package = {};
%%%%%% Sample to 2x fsym %%%%%%
Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
Scpe_sig.signal = Scpe_sig.signal(1:2*length(Symbols));
%%%%%% Sync Rx signal with reference %%%%%%
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",1);
Scpe_sig = Filter('filtdegree',4,"f_cutoff",Symbols.fs.*0.5,"fs",Scpe_sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Scpe_sig);
Scpe_sig = Scpe_sig - mean(Scpe_sig.signal);
%%% EQUALIZING
proc_occ = min(1,length(Scpe_cell));
for occ = 1%:proc_occ
% -------------------- FFE --------------------
ffe_order = [50, 0, 0];
eq_ffe = EQ("Ne",ffe_order,"Nb",[0,0,0], ...
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
"FFEmu",0,"plotfinal",0,"ideal_dfe",0);
Scpe_sig = Scpe_cell{occ};
output.ffe_results = ffe(eq_ffe,M,Scpe_sig,Symbols,Tx_bits, ...
"precode_mode",duob_mode,'showAnalysis',0,"postFFE",[], ...
"eth_style_symbol_mapping",0);
%%%%%% Sample to 2x fsym %%%%%%
Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
output.ffe_results.metrics.print
%%%%%% Sync Rx signal with reference %%%%%%
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym);
% -------------------- DFE --------------------
eq_dfe = EQ("Ne",ffe_order,"Nb",[2,0,0], ...
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
"FFEmu",0,"plotfinal",0,"ideal_dfe",0);
Scpe_sig = Filter('filtdegree',4,"f_cutoff",Symbols.fs.*0.5,"fs",Scpe_sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Scpe_sig);
output.dfe_results = ffe(eq_dfe,M,Scpe_sig,Symbols,Tx_bits, ...
"precode_mode",duob_mode,'showAnalysis',0,"postFFE",[], ...
"eth_style_symbol_mapping",0);
Scpe_sig = Scpe_sig - mean(Scpe_sig.signal);
%
% Pform = Pulseformer("fsym",Scpe_sig.fs,"fdac",2*fsym,"pulse","rrc","pulselength",16,"alpha",rcalpha,"matched",0);
%
% Scpe_sig_matched = Pform.process(Scpe_sig);
%
% Scpe_sig.spectrum("normalizeTo0dB",0,"fignum",336,"displayname","scope ");
% Scpe_sig_matched.spectrum("normalizeTo0dB",0,"fignum",336,"displayname","matched");
%%% EQUALIZING
output.dfe_results.metrics.print("description",'DFE');
% eq_mlse = FFE_DCremoval("epochs_tr",5,"epochs_dd",5,"len_tr",len_tr,"mu_dd",mu_ffe(1),"mu_tr",0,"order",ffe_order(1),"sps",2,"decide",0,"dc_buffer_len",1,"mu_dc",0.05);
% eq_mlse = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",len_tr,"mu_dd",mu_ffe(1),"mu_tr",0,"order",ffe_order(1),"sps",2,"decide",0);
% eq_mlse = FFE_DCremoval("epochs_tr",5,"epochs_dd",5,"len_tr",len_tr,"mu_dd",mu_ffe(1),"mu_tr",0,"order",ffe_order(1),"sps",2,"decide",0,"dc_buffer_len",512,"mu_dc",0.05);
% -------------------- VNLE + MLSE --------------------
pf_ncoeffs = 1;
ffe_order3 = [50, 5, 5];
eq_v = EQ("Ne",ffe_order3,"Nb",dfe_order, ...
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
mu_ffe = [mu_ffe1 mu_ffe2 mu_ffe3];
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
% %%%%% VNLE + DFE %%%%
if 0
eq_vnle_dfe = EQ("Ne",vnle_order,"Nb",[0,0,0],"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",0);
eq_2 = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",2001,"sps",1,"decide",0);
[result] = vnle(eq_vnle_dfe,M,Scpe_sig,Symbols,Tx_bits,"precode_mode",doub_mode,"showAnalysis",1,"postFFE",[]);
vnle_dfe_package{occ} = result;
end
%%%%% VNLE + PF + MLSE %%%%
if 1
% len_tr = length(Symbols)-1000;
eq_vnle_ = EQ("Ne",vnle_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
% eq_vnle_ = VNLE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",vnle_order,"sps",2,"decide",0);
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
mlse_ = MLSE_viterbi("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
[result] = vnle_postfilter_mlse(eq_vnle_,pf_,mlse_,M,Scpe_sig,Symbols,Tx_bits,"precode_mode",doub_mode,'showAnalysis',1);
vnle_pf_package{occ} = result;
end
[output.vnle_results, output.mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", duob_mode, 'showAnalysis', 0, "postFFE", [], "eth_style_symbol_mapping", 0);
%%%%% Duobinary Targeting %%%%
if 1
% -------------------- DB target --------------------
mlse_db_ = MLSE("DIR",[1,1],"duobinary_output",0,"M",M,'trellis_states',PAMmapper(M,0).levels);
ffe_order = [50, 5, 5];
eq_ = EQ("Ne",ffe_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
output.dbt_results = duobinary_target(eq_,mlse_db_, M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", duob_mode, 'showAnalysis', 0, "postFFE", []);
mlse_db = MLSE_viterbi("DIR",[1,1],"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels);
eq_db = EQ("Ne",vnle_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
[result] = duobinary_target(eq_db, mlse_db, M, Scpe_sig, Symbols, Tx_bits, "precode_mode", doub_mode,'showAnalysis',0);
dbtgt_package{occ} = result;
output.dbt_results.metrics.print("description",'Duobinary');
end
%%%%%% %db signaling => db encoded %%%%%
if 0
mlse_db_enc = MLSE_viterbi("DIR",[1,1],"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels);
eq_db_enc = EQ("Ne",vnle_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
[result] = duobinary_signaling(eq_db_enc, mlse_db_enc,M, Scpe_sig ,Symbols, Tx_bits);
dbenc_package{occ} = result;
end
% autoArrangeFigures;
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ')
fprintf('\n')
end
output.vnle_dfe_package = vnle_dfe_package;
output.vnle_pf_package = vnle_pf_package;
output.dbtgt_package = dbtgt_package;
if ~isempty(curFolder)
cd(curFolder);
end
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ')
fprintf('\n')
end

View File

@@ -0,0 +1,69 @@
function wh = submit_handle(funcHandle, wh, options)
arguments
funcHandle
wh
options.parallel = 1;
end
%%% 2) SUBMIT SIMULATION
% Initialize job results
if options.parallel
curpool = gcp('nocreate');
if isempty(curpool)
parpool;
else
% stop all forgotten or unfetched jobs from queue
if ~isempty(curpool.FevalQueue.QueuedFutures) || ~isempty(curpool.FevalQueue.RunningFutures)
oldq = length(curpool.FevalQueue.QueuedFutures) + length(curpool.FevalQueue.RunningFutures);
curpool.FevalQueue.cancelAll
fprintf('Canceled %d unfetched jobs from old queue.', oldq);
end
end
results = parallel.FevalFuture.empty();
else
results = [];
end
fprintf('Requested %d loops\n', wh.getLastLinIndice);
for lin_idx = 1:wh.getLastLinIndice
optionalVars = struct();
if ~isempty(wh.getDimension)
% Build the optionalVars struct
[parametervalues, parameternames] = wh.getPhysIndicesByLinIndex(lin_idx);
for pidx = 1:numel(parameternames)
optionalVars.(parameternames{pidx}) = parametervalues{pidx};
end
end
%%% SIMULATION HERE
if options.parallel
numOutputs = 1;
results(lin_idx) = parfeval(funcHandle, numOutputs, optionalVars);
else
finalresults{lin_idx} = feval(funcHandle, optionalVars);
wh.addValueToStorageByLinIdx(finalresults{lin_idx}, 'ber', lin_idx);
end
end
if options.parallel
%%% 4) Setup waitbar
h = waitbar(0, 'Processing Simulations...');
updateWaitbar = @(~) waitbar(mean(arrayfun(@(f) strcmp(f.State, 'finished'), results)), h);
fprintf('Fetching results... \n');
updateWaitbarFutures = afterEach(results, updateWaitbar, 0);
afterAll(updateWaitbarFutures, @(~) delete(h), 0);
%%% 7) Fetch final results after all computations
fetchOutputs(results);
for ridx = 1:length(results)
wh.addValueToStorageByLinIdx(results(ridx).OutputArguments{1}, 'ber', ridx);
end
end
end