Changes from mwork PC.

PDP 2025

MPI analysis

new focus on database and SQL
This commit is contained in:
Silas Oettinghaus
2025-03-21 08:11:40 +01:00
parent 402e491506
commit 74066d0669
36 changed files with 2234 additions and 620 deletions

View File

@@ -0,0 +1,85 @@
%% 1) Read all files in the TR folder
pathToTimingRecov = "C:\Users\Silas\Documents\MATLAB\Datensätze\IEF_Polariton_2025\36_IMDD_Kiel\Data\TR_ZIP";
trFiles = dir(fullfile(pathToTimingRecov, 'TR_SILAS_*.mat'));
%% Directory for measurement files (used to extract metadata)
pathToMeasurement = "C:\Users\Silas\Documents\MATLAB\Datensätze\IEF_Polariton_2025\36_IMDD_Kiel\Data\20250221";
%% Initialize lists for different PAM types
listPAM2 = {};
listPAM4 = {};
listPAM6 = {};
listPAM8 = {};
%% Loop over each TR file
for k = 1:length(trFiles)
% Get current TR file name
trFileName = trFiles(k).name;
% 2) Extract file code from TR file name.
% For a filename like "TR_SILAS_20250221T001800.mat" the code is "20250221T001800".
filecode = extractBetween(trFileName, 'TR_SILAS_', '.mat');
% Find corresponding measurement file by code (custom function)
measurementFilename = findFileByCode(pathToMeasurement, filecode{1});
% 3) Extract parameters from the measurement filename using regex.
% Expected measurement filename format (example):
% "Pmod_-10p000dBm_P_PD_-20p000dBm_..._32GBd_4PAM__1234T5678"
tokens = regexp(measurementFilename, ...
'Pmod_([-0-9p]+)dBm_P_PD_([-0-9p]+)dBm_.*?_(\d+)GBd_(\d+)PAM__\d+T\d+', ...
'tokens');
if isempty(tokens)
error('Filename format not recognized for measurement file: %s', measurementFilename);
end
tokens = tokens{1};
% Convert token strings to numbers
config.P_laser = str2double(strrep(tokens{1}, 'p', '.'));
config.P_pd = str2double(strrep(tokens{2}, 'p', '.'));
config.fsym = str2double(tokens{3}) * 1e9; % Convert from GBd to Hz
config.M = str2double(tokens{4});
% Display loaded metadata
fprintf('Loaded measurement file: %s\n', measurementFilename);
fprintf('P_laser: %.3f dBm\n', config.P_laser);
fprintf('P_pd: %.3f dBm\n', config.P_pd);
fprintf('fsym: %.1f GBd\n', config.fsym * 1e-9);
fprintf('M: %d\n', config.M);
% 4) Rename the TR file to include the metadata.
% New filename format: TR_SILAS_<code>_Pmod_<P_laser>dBm_P_PD_<P_pd>dBm_<fsym in GBd>GBd_<M>PAM.mat
newTRname = sprintf('TR_SILAS_%s_Pmod_%.3fdBm_P_PD_%.3fdBm_%dGBd_%dPAM', ...
filecode{1}, config.P_laser, config.P_pd, config.fsym/1e9, config.M);
newTRname = strrep(newTRname,'.','p');
newTRname = [newTRname, '.mat'];
movefile(fullfile(pathToTimingRecov, trFileName), fullfile(pathToTimingRecov, newTRname));
% Append the file code to the corresponding PAM list based on config.M
switch config.M
case 2
listPAM2{end+1} = filecode{1};
case 4
listPAM4{end+1} = filecode{1};
case 6
listPAM6{end+1} = filecode{1};
case 8
listPAM8{end+1} = filecode{1};
otherwise
warning('Unexpected PAM value %d in file %s', config.M, measurementFilename);
end
end
%% Display the lists of file codes for each PAM type
disp('List of file codes for PAM2:');
disp(listPAM2);
disp('List of file codes for PAM4:');
disp(listPAM4);
disp('List of file codes for PAM6:');
disp(listPAM6);
disp('List of file codes for PAM8:');
disp(listPAM8);

View File

@@ -1,113 +1,366 @@
% 202502211_km_fiber_Pmod_15dBm_P_PD_9p2494dBm_W03C34-0603E03_160GBd_8PAM__20250221T024256.h5
M = 8;
if M == 4
file_codes = {"20250221T032043",...
"20250221T032312",...
"20250221T032424",...
"20250221T032529",...
"20250221T032632",...
"20250221T032800",...
"20250221T032936",...
"20250221T033035",...
"20250221T033138",...
"20250221T033138",...
"20250221T033425",...
"20250221T033527",...
"20250221T033642",...
"20250221T033743",...
"20250221T033851",...
"20250221T034314",...
"20250221T034529",...
"20250221T034647",...
"20250221T034756",...
"20250221T034915",...
};
baudrate = [96,120,128,136,144,152,160,168,172,176,180,184,188,192,196,200,204,212,220,224];
pam4.result_vnle = result_vnle;
pam4.result_db = result_db;
M = 6;
if M == 2
file_codes = {'20250221T035221' '20250221T035354' '20250221T035824' '20250221T035931' '20250221T040035' '20250221T040132' '20250221T040226' '20250221T040523' '20250221T040646' '20250221T040723' '20250221T040843' '20250221T041011' '20250221T041101' '20250221T041244'};
elseif M == 4
file_codes = {'20250221T030844' '20250221T032043' '20250221T032312' '20250221T032424' '20250221T032529' '20250221T032632' '20250221T032800' '20250221T033035' '20250221T033138' '20250221T033246' '20250221T033425' '20250221T033527' '20250221T033642' '20250221T033743' '20250221T033851' '20250221T034314' '20250221T034529' '20250221T034647' '20250221T034756' '20250221T034915'};
elseif M == 6
file_codes = {'20250221T041445' '20250221T041512' '20250221T041539' '20250221T041607' '20250221T041633' '20250221T041702' '20250221T041729' '20250221T041758' '20250221T041825' '20250221T041854' '20250221T041922' '20250221T041951' '20250221T042019' '20250221T042048' '20250221T042117' '20250221T042147' '20250221T042215'};
elseif M ==8
file_codes = {"20250221T004651",... %96
"20250221T004926",...
"20250221T005844",...
"20250221T010032",...
"20250221T010150",...
"20250221T025505",...%144 ohne balun
"20250221T024629",...%152 ohne balun
"20250221T024315",...%160 ohne balun
"20250221T023534",...%168 ohne balun
"20250221T024929",...%172 ohne balun
"20250221T025305",...%176 ohne balun
};
file_codes = {"20250221T024256"};
baudrate = [96,112,120,128,136,144,152,160,168,172,176];
file_codes = {'20250221T004926' '20250221T023534' '20250221T024256' '20250221T024629' '20250221T024929' '20250221T025305' '20250221T025505' '20250221T025856' '20250221T030122' '20250221T030311' '20250221T030513'};
end
if 1
if 0
uloops = struct;
uloops.filecode = file_codes;
uloops.mu_dc = [0];
uloops.vnle_order1 = [50];
uloops.vnle_order2 = [5];
uloops.vnle_order3 = [5];
wh = DataStorage(uloops);
wh.addStorage("ber");
wh = submit_handle(@dsp_ief_file,wh,"parallel",0);
wh = submit_handle(@dsp_ief_file,wh,"parallel",1);
end
if 0
% Bring figure(5) to focus
fig = figure(2);
% Get handles to all line objects in the figure
lines = findobj(fig, 'Type', 'line');
% Preallocate cell arrays to store the data for each line
xData = cell(numel(lines),1);
yData = cell(numel(lines),1);
% Loop through each line and extract its data
for k = 1:numel(lines)
xData{k} = get(lines(k), 'XData');
yData{k} = get(lines(k), 'YData');
end
ief.M2.baudr_new = xData{4};
ief.M2.ngmi_new = yData{4};
ief.M4.baudr_new = xData{3};
ief.M4.ngmi_new = yData{3};
ief.M6.baudr_new = xData{2};
ief.M6.ngmi_new = yData{2};
ief.M8.baudr_new = xData{1};
ief.M8.ngmi_new = yData{1};
ief.M2.ber_new = yData{4};
ief.M4.ber_new = yData{3};
ief.M6.ber_new = yData{2};
ief.M8.ber_new = yData{1};
pam2_baudr = xData{4};
pam2_ber = yData{4};
pam2_ngmi = yData{4};
pam4_baudr = xData{3};
pam4_ber = yData{3};
pam4_ngmi = yData{3};
pam6_baudr = xData{2};
pam6_ber = yData{2};
pam6_ngmi = yData{2};
pam8_baudr = xData{1};
pam8_ber = yData{1};
pam8_ngmi = yData{1};
pam2_baudr_lowdsp = xData{4};
pam2_ber_lowdsp = yData{4};
pam2_ngmi_lowdsp = yData{4};
pam4_baudr_lowdsp = xData{3};
pam4_ber_lowdsp = yData{3};
pam4_ngmi_lowdsp = yData{3};
pam6_baudr_lowdsp = xData{2};
pam6_ber_lowdsp = yData{2};
pam6_ngmi_lowdsp = yData{2};
pam8_baudr_lowdsp = xData{1};
pam8_ber_lowdsp = yData{1};
pam8_ngmi_lowdsp = yData{1};
end
a = wh.getStoValue('ber',uloops.filecode, uloops.mu_ffe1);
close all
figure(1)
cnt = 1;
for M = [2,4,6,8]
% for i = 1:numel(uloops.vnle_order2)
% for j = 1:numel(uloops.vnle_order3)
wh = eval(sprintf('wh_pam%d',M));
a =wh.getStoValue('ber',wh.parameter.filecode.values, wh.parameter.vnle_order1.values, wh.parameter.vnle_order2.values,wh.parameter.vnle_order3.values);
% a =wh_mit_1001.getStoValue('ber',uloops.filecode, wh_mit_1001.parameter.vnle_order1.values, wh_mit_1001.parameter.vnle_order2.values,wh_mit_1001.parameter.vnle_order3.values);
baudrate = cell2mat(cellfun(@(a) a.config.fsym, a, 'UniformOutput', false));
[baudrate, idx] = sort(baudrate);
% get best results per baudrate
ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
% get best results per baudrate
vnle = 0;
try
ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_package, 'UniformOutput', false), a, 'UniformOutput', false);
ber_vnle_infrate = cellfun(@(a) cellfun(@(y) y.inf_rate_vnle, a.vnle_package, 'UniformOutput', false), a, 'UniformOutput', false);
% ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
% best_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
%
% ber_mlse_values = cellfun(@(a) cellfun(@(y) y.ber_mlse, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
% best_mlse = cellfun(@(x) min(cell2mat(x)), ber_mlse_values);
best_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
best_vnle = best_vnle(idx);
best_gmi_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_infrate);
best_gmi_vnle = best_gmi_vnle(idx);
%%% PLOT PARAMETER OPTIMIZATION
figure(2)
cols = cbrewer2('Set1',6);
hold on
title(sprintf('%d km | %d nm | PAM %d',1,1313.5,M));
xax = uloops.mu_ffe1;
plot(xax,best_vnle,'DisplayName',sprintf('VNLE 50,3,3'),'Color',cols(o,:),'LineStyle','-','HandleVisibility','on');
% netRateVNLE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'NGMI',best_gmi_vnle./log2(M), 'BER',best_vnle);
% plot(xax,best_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
vnle = 1;
end
% plot(xax,best_db,'DisplayName',sprintf('DB tgt. + MLSE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
mlse = 0;
try
ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_vnle_2 = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
best_vnle_2 = best_vnle_2(idx);
set(gca, 'YScale', 'log');
ylim([5e-5 0.3]);
xlim([min(xax), max(xax) ]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
xlabel('Adaption speed');
ylabel('BER');
gmi_vnle_values = cellfun(@(a) cellfun(@(y) y.gmi, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_gmi_vnle = cellfun(@(x) min(cell2mat(x)), gmi_vnle_values);
best_gmi_vnle = best_gmi_vnle(idx);
ber_mlse_values = cellfun(@(a) cellfun(@(y) y.ber_mlse, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_mlse = cellfun(@(x) min(cell2mat(x)), ber_mlse_values);
best_mlse = best_mlse(idx);
if M == 8
best_vnle_2(2) = [];
best_mlse(2) = [];
best_gmi_vnle(2) = [];
best_db(2) = [];
baudrate(2) = [];
elseif M == 4
end
mlse = 1;
end
db = 0;
try
ber_db_values = cellfun(@(a) cellfun(@(y) y.ber, a.dbtgt_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_db = cellfun(@(x) min(cell2mat(x)), ber_db_values);
best_db = best_db(idx);
if M == 4
best_db(end-1:end) = [];
baudrate(end-1:end) = [];
end
db = 1;
end
%% BER PLOT
% figure(1)
subplot(1,2,1)
cols = cbrewer2('Set1',6);
hold on
title(sprintf('BER'));
% title(sprintf('%d 1st order',uloops.vnle_order1(i)));
xax = baudrate.*1e-9;
if M == 4 || M == 2
plot(xax,best_db,'DisplayName',sprintf('PAM %d | DB+MLSE',M),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(ief.(sprintf('M%d', M)).baudr_new,ief.(sprintf('M%d', M)).ber_new,'DisplayName',sprintf('PAM %d |VNLE',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
elseif M == 6
plot(xax,best_vnle_2,'DisplayName',sprintf('PAM %d |VNLE',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
% plot(ief.(sprintf('M%d', M)).baudr_new,ief.(sprintf('M%d', M)).ber_new,'DisplayName',sprintf('PAM %d |VNLE',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
else
% plot(xax,best_vnle_2,'DisplayName',sprintf('PAM %d |VNLE',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(ief.(sprintf('M%d', M)).baudr_new,ief.(sprintf('M%d', M)).ber_new,'DisplayName',sprintf('PAM %d |VNLE',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
end
if 0
if vnle
plot(xax,best_vnle,'DisplayName',sprintf('VNLE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
end
if mlse
plot(xax,best_vnle_2,'DisplayName',sprintf('VNLE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
plot(xax,best_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
end
if db
plot(xax,best_db,'DisplayName',sprintf('DB tgt. + MLSE'),'Color',cols(1,:),'LineStyle','-','HandleVisibility','on');
end
plot(ief.(sprintf('M%d', M)).baudr,ief.(sprintf('M%d', M)).ber,'DisplayName',sprintf('VNLE [100,15,15] (ETH)'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
plot(ief.(sprintf('M%d', M)).baudr_lowdsp,ief.(sprintf('M%d', M)).ber_lowdsp,'DisplayName',sprintf('VNLE [100,15,15] (ETH)'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
end
set(gca, 'YScale', 'log');
ylim([1e-6 0.3]);
xlim([92, 260 ]);
xticks([0:16:280]);
yline([4.85e-3, 2e-2],'HandleVisibility','off');
% legend
% beautifyBERplot()
xlabel('baudrate in GBd');
ylabel('BER');
set(findall(gca, '-property', 'Interpreter'), 'Interpreter', 'latex');
set(gcf, 'Color', 'w');
set(gca, 'Box', 'on', 'LineWidth', 0.8); % Thicker border
grid on;
set(gca, 'FontSize', 10, 'FontName', 'Times New Roman');
%
%% NGMI PLOT
% figure(2)
% cols = cbrewer2('Set1',6);
% hold on
% title(sprintf('%d km ; %.1f nm ; PAM %d',1,1313,M));
% xax = baudrate.*1e-9;
%
% plot(xax,best_gmi_vnle./log2(M),'DisplayName',sprintf('NGMI VNLE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
%
% plot(ief.(sprintf('M%d', M)).baudr,ief.(sprintf('M%d', M)).ngmi,'DisplayName',sprintf('VNLE [100,15,15] (ETH)'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
% plot(ief.(sprintf('M%d', M)).baudr_lowdsp,ief.(sprintf('M%d', M)).ngmi_lowdsp,'DisplayName',sprintf('VNLE [100,15,15] (ETH)'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
%
% set(gca, 'YScale', 'log');
% ylim([0.7 1]);
% xlim([min(xax), max(xax) ]);
% xticks(xax);
% yline([0.8],'HandleVisibility','off');
% legend
% beautifyBERplot()
% xlabel('Baudrate in GBd');
% ylabel('NGMI');
%% AIR Plot
% subplot(1,3,2)
%
% netRateMLSE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'BER',best_mlse);
% netRateVNLE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'NGMI',best_gmi_vnle./log2(M), 'BER',best_vnle_2);
% netRateDB = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'BER',best_db);
%
% netRateIEF = TransmissionPerformance().calculateNetRate(log2(M)*ief.(sprintf('M%d', M)).baudr,'BER',ief.(sprintf('M%d', M)).ber,'NGMI',ief.(sprintf('M%d', M)).ngmi);
% netRateIEF_lowdsp = TransmissionPerformance().calculateNetRate(log2(M)*ief.(sprintf('M%d', M)).baudr_lowdsp,'BER',ief.(sprintf('M%d', M)).ber_lowdsp,'NGMI',ief.(sprintf('M%d', M)).ngmi_lowdsp);
%
% cols = cbrewer2('Set1',8);
% hold on
% title(sprintf('AIR'));
% xax = baudrate.*1e-9;
%
% if M == 2 || M == 4
%
% % plot(xax,netRateMLSE.HD.NetRate.*1e-9,'DisplayName',sprintf('MLSE - HD'),'Color',cols(1,:),'LineStyle',':','HandleVisibility','on');
% % plot(xax,netRateVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('VNLE SD+HD'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
% plot(xax,netRateDB.HD.NetRate.*1e-9,'DisplayName',sprintf('PAM %d | DB+MLSE HD',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on');
% plot(xax,netRateDB.O_FEC.NetRate.*1e-9,'DisplayName',sprintf('PAM %d | DB+MLSE O-FEC',M),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on');
% % plot(xax,netRateDB.KP4_hamming.NetRate.*1e-9,'DisplayName',sprintf('PAM %d | DB+MLSE KP4-FEC',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on');
%
% else
%
% % plot(xax,netRateMLSE.HD.NetRate.*1e-9,'DisplayName',sprintf('MLSE - HD'),'Color',cols(1,:),'LineStyle',':','HandleVisibility','on');
% % plot(xax,netRateVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('VNLE SD+HD'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
% % plot(ief.(sprintf('M%d', M)).baudr,netRateIEF.HD.NetRate,'DisplayName',sprintf('PAM %d | HD IEF',M),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on');
% plot(ief.(sprintf('M%d', M)).baudr,netRateIEF.SDHD.NetRate,'DisplayName',sprintf('PAM %d | SD+HD IEF',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on');
%
% end
% set(gca, 'YScale', 'log');
% ylim([92 450]);
% xlim([min(xax), max(xax) ]);
% xlim([92, 260 ]);
% xticks([0:16:280]);
% yline([0.8],'HandleVisibility','off');
% legend
% beautifyBERplot()
% xlabel('Baudrate in GBd');
% ylabel('Net Rate in Gbps');
%
%
%% NDR PLOT
%%% PLOT COMPLETE BAUDRATE
figure(20)
cols = cbrewer2('Set1',6);
hold on
title(sprintf('%d km | %d nm | PAM %d',1,1313.5,M));
subplot(1,2,2)
netRateIEF = TransmissionPerformance().calculateNetRate(log2(M)*ief.(sprintf('M%d', M)).baudr,'BER',ief.(sprintf('M%d', M)).ber,'NGMI',ief.(sprintf('M%d', M)).ngmi);
netRateIEF_lowdsp = TransmissionPerformance().calculateNetRate(log2(M)*ief.(sprintf('M%d', M)).baudr_lowdsp,'BER',ief.(sprintf('M%d', M)).ber_lowdsp,'NGMI',ief.(sprintf('M%d', M)).ngmi_lowdsp);
netRateIEF_new = TransmissionPerformance().calculateNetRate(log2(M)*ief.(sprintf('M%d', M)).baudr_new,'BER',ief.(sprintf('M%d', M)).ber_new,'NGMI',ief.(sprintf('M%d', M)).ngmi_new);
plot(baudrate,best_vnle,'DisplayName',sprintf('VNLE'),'Color',cols(1,:),'LineStyle','-','HandleVisibility','on');
plot(baudrate,best_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
cols = cbrewer2('Set1',8);
hold on
title(sprintf('Net Bitrate'));
xax = baudrate.*1e-9;
plot(baudrate,best_db,'DisplayName',sprintf('DB tgt. + MLSE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
if M == 2 || M == 4
set(gca, 'YScale', 'log');
ylim([5e-5 0.3]);
xlim([min(baudrate), max(baudrate) ]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
xlabel('Bit Rate in Gbps');
ylabel('BER');
log2M = log2(M);
netRateDB = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'BER',best_db);
% plot(xax,netRateMLSE.HD.NetRate.*1e-9,'DisplayName',sprintf('MLSE - HD'),'Color',cols(1,:),'LineStyle',':','HandleVisibility','on');
% plot(xax,netRateVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('VNLE SD+HD'),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
plot(xax,netRateDB.HD.NetRate.*1e-9,'DisplayName',sprintf('PAM %d | DB+MLSE HD',M),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(xax,netRateDB.O_FEC.NetRate.*1e-9,'DisplayName',sprintf('PAM %d | DB+MLSE O-FEC',M),'Color',cols(M/2,:),'LineStyle','-.','HandleVisibility','on','Marker','x','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
% plot(xax,netRateDB.KP4_hamming.NetRate.*1e-9,'DisplayName',sprintf('PAM %d | DB+MLSE KP4-FEC',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','*','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(ief.(sprintf('M%d', M)).baudr_new,netRateIEF_new.SDHD.NetRate,'DisplayName',sprintf('PAM %d | SD+HD',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(ief.(sprintf('M%d', M)).baudr_new,ief.(sprintf('M%d', M)).ngmi_new.*ief.(sprintf('M%d', M)).baudr_new.*log2M ,'DisplayName',sprintf('PAM %d | AIR',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
elseif M == 6
log2M = 2.5;
netRateMLSE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'BER',best_mlse);
netRateVNLE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'NGMI',best_gmi_vnle./log2(M), 'BER',best_vnle_2);
plot(xax,netRateVNLE.HD.NetRate.*1e-9,'DisplayName',sprintf('MLSE - HD'),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(xax,netRateVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('VNLE SD+HD'),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
% plot(ief.(sprintf('M%d', M)).baudr_new,netRateIEF_new.HD.NetRate,'DisplayName',sprintf('PAM %d | HD IEF',M),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
% plot(ief.(sprintf('M%d', M)).baudr_new,netRateIEF_new.SDHD.NetRate,'DisplayName',sprintf('PAM %d | SD+HD IEF',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
else
log2M = log2(M);
netRateMLSE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'BER',best_mlse);
netRateVNLE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'NGMI',best_gmi_vnle./log2(M), 'BER',best_vnle_2);
% plot(xax,netRateVNLE.HD.NetRate.*1e-9,'DisplayName',sprintf('MLSE - HD'),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
% plot(xax,netRateVNLE.SDHD.NetRate.*1e-9,'DisplayName',sprintf('VNLE SD+HD'),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(ief.(sprintf('M%d', M)).baudr_new,netRateIEF_new.HD.NetRate,'DisplayName',sprintf('PAM %d | HD IEF',M),'Color',cols(M/2,:),'LineStyle',':','HandleVisibility','on','Marker','square','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
plot(ief.(sprintf('M%d', M)).baudr_new,netRateIEF_new.SDHD.NetRate,'DisplayName',sprintf('PAM %d | SD+HD IEF',M),'Color',cols(M/2,:),'LineStyle','-','HandleVisibility','on','Marker','o','MarkerFaceColor',[1,1,1],'MarkerEdgeColor',cols(M/2,:),'MarkerSize',4,'LineWidth',1.4);
end
set(gca, 'YScale', 'log');
ylim([150 450]);
xlim([min(xax), max(xax) ]);
xlim([92, 270 ]);
xticks([0:16:280]);
yline([0.8],'HandleVisibility','off');
% legend
xlabel('Baudrate in GBd');
ylabel('Net Rate in Gbps');
set(findall(gca, '-property', 'Interpreter'), 'Interpreter', 'latex');
set(gcf, 'Color', 'w');
set(gca, 'Box', 'on', 'LineWidth', 0.8); % Thicker border
grid on;
set(gca, 'FontSize', 10, 'FontName', 'Times New Roman');
end

View File

@@ -4,12 +4,14 @@ function [results] = dsp_ief_file(varargin)
mu_ffe1 = 0.0001;
mu_ffe2 = 0.0008;
mu_ffe3 = 0.001;
mu_dc = 0.00;
mu_dc = 0.0003; %0.0003;
mu_dfe = 0.0004;
vnle_order1 = 100;
mu_dfe_training = 0.0004;
vnle_order1 = 50;
vnle_order2 = 3;
vnle_order3 = 3;
dfe_mu = 0.0005;
tcorrect = 0;
@@ -33,10 +35,11 @@ function [results] = dsp_ief_file(varargin)
end
end
ssdPath = "D:\36_IMDD_Kiel\Data";
% code = "20250221T004802";
% code = "20250221T032043";
filename = findFileByCode(ssdPath, filecode{1});
pathToMeasurement = "C:\Users\Silas\Documents\MATLAB\Datensätze\IEF_Polariton_2025\36_IMDD_Kiel\Data\20250221";
filename = findFileByCode(pathToMeasurement, filecode{1});
pathToTimingRecov = "C:\Users\Silas\Documents\MATLAB\Datensätze\IEF_Polariton_2025\36_IMDD_Kiel\Data\TR_ZIP";
filename_2 = findFileByCode(pathToTimingRecov, filecode{1});
% Extract parameters from the filename using an updated regex
tokens = regexp(filename, 'Pmod_([-0-9p]+)dBm_P_PD_([-0-9p]+)dBm_.*?_(\d+)GBd_(\d+)PAM__\d+T\d+', 'tokens');
@@ -75,20 +78,45 @@ function [results] = dsp_ief_file(varargin)
dataRx = double(h5read(filepath, '/Waveforms/Channel 2/Channel 2Data')); % rohdaten des CH4
bitsTx = h5read(filepath, '/Settings/dataTx'); %Binär
bitsTx = reshape(bitsTx,log2(config.M),[])';
if config.M ~= 6
bitsTx = reshape(bitsTx,log2(config.M),[])';
else
%bitsTx = reshape(bitsTx,5,[])';
end
%%% Build Tx Signal (Bits, Pam Map, Symbols)
Tx_bits = Informationsignal(bitsTx);
Tx_symbols = PAMmapper(config.M,0,"eth_style",1).map(Tx_bits);
Tx_symbols.fs = config.fsym;
if 0
Rx_bits = PAMmapper(config.M,0,"eth_style",1).demap(Tx_symbols);
[~,~,ber_bw,~] = calc_ber(Rx_bits.signal,Tx_bits.signal(1:length(Rx_bits.signal)),"skip_front",100,"skip_end",150,"returnErrorLocation",1);
end
%%% Build Rx Signal (Rx, normalize,remove mean)
loadAfterTR = 0;
loadAfterTR = 1;
if loadAfterTR
rx_sig = load("testSilas.mat","signal_TR3");
rx_sig=rx_sig.signal_TR3;
Rx_Sig_resamp = Informationsignal(rx_sig,"fs",config.fsym*2);
if 1
rx_sig = load(filename_2);
rx_sig=rx_sig.signal_TR;
if config.M == 6
rx_sig_pam6 = zeros(length(rx_sig)*2,1);
rx_sig_pam6(1:2:end) = real(rx_sig);
rx_sig_pam6(2:2:end) = imag(rx_sig);
rx_sig = rx_sig_pam6;
Rx_Sig_resamp = Informationsignal(rx_sig,"fs",config.fsym);
% Tx_symbols.signal = Tx_symbols.signal(1:end/2);
else
Rx_Sig_resamp = Informationsignal(rx_sig,"fs",config.fsym*2);
end
else
rx_sig = load(string(['testSilas_',char(filecode{1}),'.mat']),"signal_TR3");
rx_sig=rx_sig.signal_TR3;
Rx_Sig_resamp = Informationsignal(rx_sig,"fs",config.fsym*2);
end
else
@@ -98,39 +126,17 @@ function [results] = dsp_ief_file(varargin)
Rx_Sig.signal = Rx_Sig.signal - mean(Rx_Sig.signal);
Rx_Sig = Rx_Sig.normalize("mode","rms");
Rx_Sig.spectrum("fignum",2,"displayname",'Rx Signal','normalizeTo0dB',1);
Rx_Sig = Filter('filtdegree',4,"f_cutoff",Tx_symbols.fs.*0.9,"fs",Rx_Sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Rx_Sig);
Rx_Sig.spectrum("fignum",2,"displayname",'Rx Signal filt','normalizeTo0dB',1);
mf = Pulseformer("alpha",config.ROF,"fsym",config.fsym,"fdac",Rx_Sig.fs,"matched",1,"pulse","rrc","pulselength",32);
Rx_matched = mf.process(Rx_Sig);
Rx_matched.spectrum("fignum",2,"displayname",'Rx Signal m','normalizeTo0dB',1);
%%%%%% Sample to 2x fsym %%%%%%
Rx_Sig_resamp = Rx_Sig.resample("fs_out",2*config.fsym);
Rx_Sig_resamp = Rx_Sig.resample("fs_out",config.fsym);
end
%%%%%% Sync Rx signal with reference (S is a cell array with all occurences) %%%%%%
[Rx_Sig_sync,S,isFlipped] = Rx_Sig_resamp.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
% Rx_Sig_sync.eye(fsym,M,"fignum",4,"displayname",'eye diagram');
% timing syncroization ??
[~,S,isFlipped] = Rx_Sig_resamp.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
% SYMSYNC = comm.SymbolSynchronizer("Modulation","PAM/PSK/QAM","SamplesPerSymbol",2);
%
% synd = SYMSYNC(Rx_Sig_sync.signal);
% Rx_Sig_sync.signal = synd;
%
% [Rx_Sig_sync,S,isFlipped] = Rx_Sig_sync.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
%
% filter Bw
output = struct();
vnle_package = {};
vnle_pf_package = {};
@@ -139,78 +145,44 @@ function [results] = dsp_ief_file(varargin)
for s = 1%:length(S)
Rx_Sig_sync = S{s};
Rx_Sig_sync = Rx_Sig_sync.normalize("mode","rms");
if 1
Tx_symbols.spectrum("fignum",3,"displayname",'Tx Symbols','normalizeTo0dB',1);
Rx_Sig_sync.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
Nsym = 64;
sampsPerSym = 2;
rcrFilt = comm.RaisedCosineReceiveFilter(...
'Shape', 'Square root', ...
'RolloffFactor', config.ROF, ...
'FilterSpanInSymbols', Nsym, ...
'InputSamplesPerSymbol', sampsPerSym, ...
'DecimationFactor', 1);
yr = rcrFilt([Rx_Sig_sync.signal;zeros(Nsym*sampsPerSym/2, 1)]);
fltDelay = Nsym / (2*config.fsym);
yr = yr(fltDelay*Rx_Sig_sync.fs+1:end);
Rx_matched = Rx_Sig_sync;
Rx_matched.signal = yr;
% Rx_matched = Rx_matched.resample("fs_out",2*config.fsym);
% length(Rx_matched);
% symbolSync = comm.SymbolSynchronizer("Modulation","PAM/PSK/QAM","SamplesPerSymbol",2,"TimingErrorDetector","Mueller-Muller (decision-directed)");
% Rx_syncd = Rx_matched;
% [Rx_syncd.signal,tError] = symbolSync(Rx_syncd.signal);
% Rx_syncd.fs = config.fsym;
% length(Rx_syncd);
% figure();hold on;
% stem(Tx_symbols.normalize("mode","oneone").signal);
% stem(Rx_syncd.normalize("mode","oneone").signal);
%
% figure();hold on;
% plot(Rx_Sig_sync.normalize("mode","oneone").signal);
% plot(Rx_matched.normalize("mode","oneone").signal);
Rx_syncd = Rx_syncd.resample("fs_out",2*config.fsym);
Rx_matched.spectrum("fignum",3,"displayname",'After Matched Filter','normalizeTo0dB',1);
Rx_syncd.spectrum("fignum",3,"displayname",'Zero Crossing TR','normalizeTo0dB',1);
end
Rx_Sig_sync = Rx_Sig_sync.resample("fs_out",2*config.fsym);
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
eq_ = EQ("Ne",vnle_order,"Nb",[0,0,0],"training_length",4096*2,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",1,"ideal_dfe",1);
eq_ = EQ("Ne",vnle_order,"Nb",[0,0,0],"training_length",4096*4,"training_loops",4,"dd_loops",3,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe_training],"DFEmu",dfe_mu,"FFEmu",0,"plotfinal",0,"ideal_dfe",0,"plottrain",0);
%%%%% VNLE only (or DFE) %%%%
if 1
if 0
[result] = vnle(eq_,config.M,Rx_syncd,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1);
eq_post = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",1001,"sps",1,"decide",0);
[result] = vnle(eq_,config.M,Rx_Sig_sync,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1,'postFFE',eq_post);
netRate = TransmissionPerformance().calculateNetRate(log2(config.M)*config.fsym,'NGMI',result.inf_rate_vnle, 'BER',result.ber_vnle);
vnle_package{s} = result;
end
%%%%% VNLE + PF + MLSE %%%%
if 0
if 1
eq_post = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",1001,"sps",1,"decide",0);
pf_ = Postfilter("ncoeff",1,"useBurg",1);
mlse_ = MLSE("duobinary_output",0,'M',config.M,'trellis_states',PAMmapper(config.M,0).levels);
mlse_ = MLSE_viterbi("duobinary_output",0,'M',config.M,'trellis_states',PAMmapper(config.M,0).levels);
doub_mode = db_mode.no_db;
doub_mode = db_mode.no_db;
[result] = vnle_postfilter_mlse(eq_,pf_,mlse_,config.M,Rx_Sig_sync,Tx_symbols,Tx_bits,"precode_mode",doub_mode,'showAnalysis',1,'eth_style_symbol_mapping',1);
[result] = vnle_postfilter_mlse(eq_,pf_,mlse_,config.M,Rx_Sig_sync,Tx_symbols,Tx_bits,"precode_mode",doub_mode,'showAnalysis',1,'eth_style_symbol_mapping',1,'postFFE',eq_post);
netRate = TransmissionPerformance().calculateNetRate(log2(config.M)*config.fsym,'NGMI',result.gmi./log2(config.M), 'BER',result.ber_mlse);
fprintf('VNLE SD: %.1f GBd \n',netRate.SDHD.NetRate.*1e-9);
fprintf('MLSE HD: %.1f GBd \n',netRate.HD.NetRate.*1e-9);
vnle_pf_package{s} = result;
end
%%%%% Duobinary Targeting %%%%
if 0
if 1
mlse_db = MLSE_viterbi("DIR",[1,1],"duobinary_output",0,"M",config.M,"trellis_states",PAMmapper(config.M,0).levels);
doub_mode = db_mode.db_emulate;
@@ -225,6 +197,7 @@ function [results] = dsp_ief_file(varargin)
results.vnle_package = vnle_package;
results.vnle_pf_package = vnle_pf_package;
results.dbtgt_package = dbtgt_package;
results.config = config;
end

View File

@@ -0,0 +1,19 @@
mlse_sig_sd=load("imdd_simulation\projects\Messung_Zürich\mlse_sig_sd.mat","mlse_sig_sd");
mlse_sig_sd = mlse_sig_sd.mlse_sig_sd;
tx_symbols=load("imdd_simulation\projects\Messung_Zürich\tx_symbols.mat","tx_symbols");
tx_symbols = tx_symbols.tx_symbols;
mlse_ = MLSE_viterbi("duobinary_output",0,'M',4,'trellis_states',PAMmapper(4,0).levels);
mlse_.DIR = [1.0000 0.5452];
mlse_sig_sd = mlse_.process(mlse_sig_sd);
%
% mlse_ = MLSE_viterbi("duobinary_output",0,'M',4,'trellis_states',PAMmapper(4,0).levels);
% mlse_.DIR = [1.0000 0.5452];
% mlse_sig_sd = mlse_.process(mlse_sig_sd,tx_symbols);
h = [1.0000 0.5452];
chatgpt_answer(mlse_sig_sd.signal,tx_symbols.signal,h)