before new database

This commit is contained in:
Silas Oettinghaus
2026-07-13 19:59:57 +02:00
parent ef0a74cb7f
commit f421348e5b
15 changed files with 2682 additions and 487 deletions

View File

@@ -8,7 +8,8 @@
clear; clc;
scriptDir = fileparts(mfilename("fullpath"));
scriptDir = fileparts("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\Diss\MPI_revisit\algorithms\");
runWhFile = fullfile(scriptDir, "combined_by_run_id_results.mat");
configWhFile = fullfile(scriptDir, "combined_by_config_results.mat");
@@ -28,9 +29,9 @@ wh_config_combined.showInfo;
%% Plot settings
pathLengthToPlot = 1; % use 300 to see duplicate run_ids per config; set 1000 for the previous path
selectedPamLevels = 4;%wh_config_combined.parameter.pam_level.values;
selectedAlgorithms = algorithmStorageNames([1,5]);
pathLengthToPlot = 1000; % use 300 to see duplicate run_ids per config; set 1000 for the previous path
selectedPamLevels = 8; %wh_config_combined.parameter.pam_level.values;
selectedAlgorithms = algorithmStorageNames([1,2,3,5]);
useBoundedLines = true; % switch uncertainty bands on/off here
usePolyfit = true; % switch fitted dashed trend lines on/off here
@@ -141,6 +142,11 @@ for pamIdx = 1:numel(selectedPamLevels)
end
end
yline(2.2e-4, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
yline(3.8e-3, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
yline(2e-2, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
ylim([9e-5, 0.1]);
title(sprintf("PAM %.0f, path %.0f m", pamLevel, pathLengthToPlot));
xlabel("SIR (dB)");
ylabel("BER");

View File

@@ -27,7 +27,7 @@ db = DBHandler("dataBase", [dsp_options.dataBase],...
pamformats = [4,6,8];
baudrates = [112e9,96e9,72e9];
for i = 1:3
for i = 1
B = baudrates(i);
M = pamformats(i);
@@ -37,7 +37,7 @@ for i = 1:3
fp.where('Runs', 'symbolrate', 'EQUALS', B); % 72 96 112
fp.where('Runs', 'fiber_length', 'EQUALS', 0);
fp.where('Runs', 'interference_path_length', 'EQUALS', 1000);
fp.where('Runs', 'sir', 'LESS_EQUAL', 20);
% fp.where('Runs', 'sir', 'LESS_EQUAL', 20);
fp.where('Runs', 'db_mode', 'EQUALS', '"no_db"');
% fp.where('Runs', 'is_mpi', 'EQUALS', 1);
fp.where('Runs', 'pam_level', 'EQUALS', M);
@@ -45,13 +45,18 @@ for i = 1:3
[dataTable,~] = db.queryDB(fp, db.getTableFieldNames('Runs'));
[~, sortIdx] = sort(dataTable.sir, 'descend');
dataTable = dataTable(sortIdx, :);
% dataTable = dataTable(1,:);
run_ids = dataTable.run_id;
%% === Warehouse setup ===
dsp_options.userParameters = struct();
dsp_options.userParameters.block_update = 1;%[1,2,4,8,16,32,64,112,224,448,512,1024,2048,2048*2,2048*4];%%logspace(-3.8,-1,22);%[linspace(2,4096,22)];
% dsp_options.userParameters.block_update = linspace(1,224,22);
wh = DataStorage(dsp_options.userParameters);
@@ -68,7 +73,7 @@ for i = 1:3
%% === Run ===
% submitJobs returns the raw per-job results and the filled Warehouse. For a
% single run_id and remove_dc = [0, 1], results is a 2-by-1 cell array.
[results, wh] = submitJobs(run_ids, dsp_options, processingMode.serial, ...
[results, wh] = submitJobs(run_ids, dsp_options, processingMode.parallel, ...
"wh", wh, ...
"waitbar", true);
@@ -78,3 +83,56 @@ for i = 1:3
end
%% Analyze
storageNames = fieldnames(wh.sto);
x_base = dataTable.sir(:).';
% x_base = dsp_options.userParameters.block_update;
figure(2026); clf; hold on
for storage_idx = 1:numel(storageNames)
storageName = storageNames{storage_idx};
result = wh.sto.(storageName);
result = result(:).';
% Each stored entry is a package cell containing one or more occurrences.
ber_all = cell(1,numel(result));
for result_idx = 1:numel(result)
packageCell = result{result_idx};
if isempty(packageCell)
ber_all{result_idx} = NaN;
continue
end
ber_values = nan(1,numel(packageCell));
for package_idx = 1:numel(packageCell)
if isstruct(packageCell{package_idx}) && isfield(packageCell{package_idx},"metrics")
ber_values(package_idx) = packageCell{package_idx}.metrics.BER;
end
end
ber_all{result_idx} = ber_values;
end
maxPackages = max(cellfun(@numel,ber_all));
ber_mat = nan(maxPackages,numel(ber_all));
for k = 1:numel(ber_all)
ber_mat(1:numel(ber_all{k}),k) = ber_all{k};
end
ber = mean(ber_mat,1,"omitnan");
x = x_base;
if numel(x) ~= numel(ber)
x = 1:numel(ber);
end
h = plot(x,ber,"DisplayName",storageName);
for k = 1:numel(x)
scatter(repmat(x(k),maxPackages,1),ber_mat(:,k), ...
"MarkerEdgeColor",h.Color, ...
"HandleVisibility","off");
end
end
beautifyBERplot("logscale",true,"setcolors",false,"setmarkers",true);
legend("Location","best","Interpreter","none");

View File

@@ -1,7 +1,7 @@
% === DSP settings ===
dsp_options = struct();
dsp_options.mode = "run_id";
dsp_options.recipe = @mpi_recipe_dev;
dsp_options.recipe = @mpi_recipe;
dsp_options.append_to_db = false;
dsp_options.start_occurence = 1;
dsp_options.max_occurences = 15;

View File

@@ -27,13 +27,13 @@ db = DBHandler("dataBase", [dsp_options.dataBase],...
fp = QueryFilter();
fp.where('Runs','run_id','GREATER_EQUAL',3153);
fp.where('Runs', 'symbolrate', 'EQUALS', 72e9); % 72 96 112
fp.where('Runs', 'symbolrate', 'EQUALS', 112e9); % 72 96 112
fp.where('Runs', 'fiber_length', 'EQUALS', 0);
fp.where('Runs', 'interference_path_length', 'EQUALS', 1000);
% fp.where('Runs', 'sir', 'LESS_EQUAL', 50);
fp.where('Runs', 'db_mode', 'EQUALS', '"no_db"');
% fp.where('Runs', 'is_mpi', 'EQUALS', 1);
fp.where('Runs', 'pam_level', 'EQUALS', 8);
fp.where('Runs', 'pam_level', 'EQUALS', 4);
% fp.where('Runs', 'v_bias', 'EQUALS', 2.65);
[dataTable,~] = db.queryDB(fp, db.getTableFieldNames('Runs'));
@@ -47,7 +47,7 @@ dataTable = dataTable(sortIdx, :);
run_ids = dataTable.run_id;
%%
wh_ = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\Diss\MPI_revisit\parallelization_analysis\wh_block_update_pam8_combined.mat");
wh_ = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\Diss\MPI_revisit\parallelization_analysis\wh_block_update_pam4_combined.mat");
wh = wh_.wh;
% wh_ = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\Diss\MPI_revisit\parallelization_analysis\wh_block_update_pam4_short_blocks.mat");
@@ -59,6 +59,7 @@ wh = wh_.wh;
storageNames = fieldnames(wh.sto);
storageNames = storageNames([1,2,3,5]);
ber_by_storage = struct();
ber_mat_by_storage = struct();
@@ -73,7 +74,10 @@ else
curve_colors = lines(max(numel(storageNames),1));
end
fec_ber_threshold = 2e-2;%3.8e-3;
useBoundedLines = true;
usePolyfit = true;
polyfitOrderMax = 4;
fec_ber_threshold = 3.8e-3;%3.8e-3;
fit_coeff_by_storage = struct();
required_sir_fec_by_storage = struct();
for storage_idx = 1:numel(storageNames)
@@ -124,12 +128,19 @@ for block_idx = 1:numel(block_updates)
ber_mat(1:numel(ber_all{k}),k) = ber_all{k};
end
% Replace outliers in ber_mat with NaN (operate column-wise).
% Match the BER-over-SIR plot cleanup: remove high BER points and outliers per SIR.
for col = 1:size(ber_mat,2)
colData = ber_mat(:,col);
if all(isnan(colData)); continue; end
mask = isoutlier(colData);
ber_mat(mask,col) = NaN;
colData(~isfinite(colData) | colData >= 0.1) = NaN;
validColData = colData(isfinite(colData));
if isempty(validColData)
ber_mat(:,col) = NaN;
continue
end
outliers = isoutlier(validColData);
validColData(outliers) = NaN;
colData(isfinite(colData)) = validColData;
ber_mat(:,col) = colData;
end
ber = mean(ber_mat,1,"omitnan");
@@ -153,38 +164,50 @@ for block_idx = 1:numel(block_updates)
ber_by_storage.(storageName){block_idx} = ber;
ber_mat_by_storage.(storageName){block_idx} = ber_mat;
y_lower = max(ber - ber_min,0);
y_upper = max(ber_max - ber,0);
y_bounds = [y_lower(:), y_upper(:)];
[hl, hp] = boundedline(x(:),ber(:),y_bounds, ...
'alpha', 'transparency', 0.1, ...
'cmap', curve_color, ...
'nan', 'fill', ...
'orientation', 'vert');
set(hl, ...
'LineWidth',1.4, ...
'LineStyle','none', ...
'Marker','o', ...
'Markersize',5,...
'Color',curve_color, ...
'DisplayName',storageName);
set(hp, ...
'HandleVisibility','off', ...
'LineStyle','none');
for k = 1:numel(x)
scatter(repmat(x(k),maxPackages,1),ber_mat(:,k), ...
16, ...
30, ...
'Marker','.', ...
'MarkerEdgeColor',curve_color, ...
'MarkerFaceColor',curve_color, ...
'HandleVisibility','off');
end
fit_mask = isfinite(x) & isfinite(ber) & ber > 0;
if nnz(fit_mask) >= 2
fit_order = min(3,nnz(fit_mask)-1);
valid = isfinite(x) & isfinite(ber);
if ~any(valid)
continue
end
% if useBoundedLines && exist("boundedline","file")
% y_lower = max(ber - ber_min,0);
% y_upper = max(ber_max - ber,0);
% y_bounds = [y_lower(:), y_upper(:)];
%
% [hl, hp] = boundedline(x(valid).',ber(valid).',y_bounds(valid,:), ...
% 'alpha', 'transparency', 0.08, ...
% 'cmap', curve_color, ...
% 'nan', 'fill', ...
% 'orientation', 'vert');
% set(hl, ...
% 'LineStyle','none', ...
% 'Marker','none', ...
% 'HandleVisibility','off');
% set(hp, ...
% 'HandleVisibility','off', ...
% 'LineStyle','none');
% end
scatter(x(valid),ber(valid), ...
20, ...
'Marker','o', ...
'MarkerEdgeColor',curve_color, ...
'MarkerFaceColor',curve_color, ...
'LineWidth',1, ...
'DisplayName',storageName);
fit_mask = valid & ber > 0;
if usePolyfit && nnz(fit_mask) >= 2
fit_order = min(polyfitOrderMax,nnz(fit_mask)-1);
fit_coeff = polyfit(x(fit_mask),log10(ber(fit_mask)),fit_order);
x_fit = linspace(min(x(fit_mask)),max(x(fit_mask)),300);
y_fit = 10.^polyval(fit_coeff,x_fit);
@@ -210,9 +233,8 @@ for block_idx = 1:numel(block_updates)
required_sir_fec_by_storage.(storageName)(block_idx) = sir_req;
plot(x_fit,y_fit, ...
'LineWidth',1.2, ...
'LineWidth',1.1, ...
'LineStyle','--', ...
'Marker','none', ...
'Color',curve_color, ...
'HandleVisibility','off');
end
@@ -221,10 +243,17 @@ for block_idx = 1:numel(block_updates)
title(sprintf("BER over SIR, block update = %g",block_update));
xlabel("SIR (dB)");
ylabel("BER");
xlim([15 35]);
beautifyBERplot("logscale",true,"setcolors",false,"setmarkers",false);
legend("Location","best","Interpreter","none");
yline(2.2e-4, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
yline(3.8e-3, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
yline(2e-2, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
ylim([9e-5, 0.1]);
set(gca, "YScale", "log");
xlim([15,45]);
grid on;
box on;
legend("Location", "best", "Interpreter", "none");
end
%% Required SIR to reach FEC over parallelization