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

@@ -1,8 +1,5 @@
function output = mpi_recipe_dev(Scpe_sig_raw, Symbols, Tx_bits, options)
%mpi_recipe_dev Minimal example recipe for the DSP job framework.
% This recipe intentionally performs only light preprocessing and records
% summary values. It demonstrates the recipe interface without running a
% full equalizer chain.
%mpi_recipe_dev Minimal MPI equalizer comparison recipe.
arguments
Scpe_sig_raw
@@ -16,457 +13,205 @@ arguments
options.debug_plots (1,1) logical = false
end
%% Execution toggles
run_conventional_ffe = 1;
run_a2_tracked_levels = 1;
run_a2_residual = 1;
run_a1 = 1;
run_tracking_adaptive = 1;
plot_output_signals = 0;
%% Shared fixed EQ settings
eq_sps = 2;
eq_order = 50;
eq_adaption = "nlms";
eq_len_tr = 4096;
eq_epochs_tr = 5;
eq_mu_tr = 0.04;
eq_epochs_dd = 3;
eq_save_debug = false;
block_update = 1;
if isfield(options.userParameters,"block_update")
block_update = options.userParameters.block_update;
end
Scpe_sig = preprocessSignal(Scpe_sig_raw, Symbols, options.fsym, ...
"mode", "auto", ...
"debug_plots", options.debug_plots);
output = struct();
%% conventional FFE
eq_core_settings = { ...
"sps", 2, ...
"order", 50, ...
"decide", 0, ...
"adaption_technique", "nlms"};
%%
if plot_output_signals
showLevelScatter(Scpe_sig, Symbols, ...
"fsym", options.fsym, ...
"fignum", 400, ...
"normalize", true);
end
%% Conventional FFE
if run_conventional_ffe
eq_ffe = FFE_plain( ...
"sps", eq_sps, ...
"order", eq_order, ...
"decide", false, ...
"adaption_technique", eq_adaption, ...
"len_tr", eq_len_tr, ...
"epochs_tr", eq_epochs_tr, ...
"mu_tr", eq_mu_tr, ...
"dd_mode", true, ...
"epochs_dd", eq_epochs_dd, ...
"mu_dd", 0.0012, ...
"optmize_mus", false, ...
"plot_mu_optimization", options.debug_plots, ...
"save_debug", eq_save_debug);
eq_training_settings = { ...
"len_tr", 4096, ...
"epochs_tr", 5, ...
"mu_tr", 0.04};
eq_dd_settings = { ...
"dd_mode", 1, ...
"epochs_dd", 3, ...
"mu_dd", 0.012};
eq_a1_settings = { ...
"dc_smoothing_a1", 0, ...
"dc_avg_bufferlength_a1", 0, ...
"dc_avg_update_blocklength_a1", 1};
eq_a2_settings = { ...
"dc_smoothing_a2", 0, ...
"dc_level_avg_bufferlength_a2", 0, ...
"dc_level_update_blocklength_a2", 0, ...
"dc_level_weights_a2", [0.6 0.6 0.6 0.6]};
eq_dc_tracking_settings = { ...
"dc_tracking_mu", 0, ...
"dc_tracking_adaptive_enabled", 0, ...
"dc_tracking_persistence_gain", 0, ...
"dc_tracking_buffer_len", 1};
eq_ffe_update_settings = { ...
"ffe_update_buffer_len", 0};
eq_optimizer_settings = { ...
"optmize_mus", 0, ...
"plot_mu_optimization", options.debug_plots, ...
"optimize_dc_tracking_params", 0, ...
"optimize_a2_level_weights", 0, ...
"a2_level_weight_optimization_len", 2^15, ...
"a2_level_weight_optimization_max_evals", 30, ...
"a2_level_weight_max", 1};
eq_debug_settings = { ...
"save_debug", false};
eq_settings = [ ...
eq_core_settings, ...
eq_training_settings, ...
eq_dd_settings, ...
eq_a1_settings, ...
eq_a2_settings, ...
eq_dc_tracking_settings, ...
eq_ffe_update_settings, ...
eq_optimizer_settings, ...
eq_debug_settings];
eq_ffe = FFE(eq_settings{:});
% ffe_order_ffe = [50, 0, 0];
% mu_ffe = [0.0001, 0.0008, 0.001];
% mu_dfe = 0.0004;
% mu_ffe = [0, 0,0];
% mu_dfe = 0.0004;
% mu_dc = 0.005;
% eq_ffe = EQ("Ne",ffe_order_ffe,"Nb",[0,0,0],"training_length",4096,"training_loops",5,"dd_loops",5,"K",2,"DCmu",0.00,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",0);
if 1
[ffe_results,equalized_signal] = ffe(eq_ffe, options.M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", options.duob_mode, ...
'showAnalysis', options.debug_plots, ...
"postFFE", [], ...
"eth_style_symbol_mapping", 0);
ffe_results.metrics.print("description",sprintf('Immediate A2; SIR %d dB',options.dataTable.sir));
[ffe_results,equalized_signal] = runFfe(eq_ffe, "Conventional FFE", ...
Scpe_sig, Symbols, Tx_bits, options);
output.conventional_ffe = ffe_results;
if plot_output_signals
plotEqSignals(equalized_signal,Symbols,options,400,-1);
end
end
if 1
showLevelScatter(Scpe_sig_raw, Symbols, ...
"fsym", options.fsym, ...
"fignum", 400, ...
"normalize", true, ...
"debug_plots", false, ...
"showPlot", true, ...
"showStdAnnotations", true, ...
"yLimits", [-2.5 2.5], ...
"xLimits",[0 2.3],...
"scatterAlpha", 0.25, ...
"scatterSize", 1, ...
"avgLineMaxPoints", 500, ...
"avgLineSmoothWindow", 5);
%% A2 tracked-level decision
if run_a2_tracked_levels
eq_ffe = FFE_A2TrackedLevels( ...
"sps", eq_sps, ...
"order", eq_order, ...
"decide", true, ...
"adaption_technique", eq_adaption, ...
"len_tr", eq_len_tr, ...
"epochs_tr", eq_epochs_tr, ...
"mu_tr", eq_mu_tr, ...
"dd_mode", false, ...
"epochs_dd", eq_epochs_dd, ...
"mu_dd", 0.012, ...
"dc_smoothing_a2", 1, ...
"dc_level_avg_bufferlength_a2", 112, ...
"dc_level_update_blocklength_a2", block_update, ...
"dc_level_weights_a2", [1], ...
"save_debug", eq_save_debug);
[ffe_results,equalized_signal] = runFfe(eq_ffe, "A2 tracked levels", ...
Scpe_sig, Symbols, Tx_bits, options);
output.a2_adaptive_levels = ffe_results;
exportName = "before_eq";
exportDir = "C:/Users/Silas/Documents/6971e0b65b380ca6d71c837f/04_Experimental_Evaluation/tikz/mpi";
pngFile = fullfile(exportDir, exportName + "_img.png"); % absolute filesystem output
tikzFile = fullfile(exportDir, exportName + ".tikz"); % absolute filesystem output
pngTikzPath = "04_Experimental_Evaluation/tikz/mpi/" + exportName + "_img.png"; % path written into TikZ
figure(400);
exportLevelScatterTikz(gca, pngFile, tikzFile, pngTikzPath, ...
"resolutionDpi", 150, ...
"generatedBy", "mpi_recipe_dev.m");
if plot_output_signals
plotEqSignals(equalized_signal,Symbols,options,410,-1);
end
end
showLevelScatter(equalized_signal.*-1, Symbols, ...
"fsym", options.fsym, ...
"fignum", 401, ...
"normalize", true, ...
"debug_plots", false, ...
"showPlot", true, ...
"showStdAnnotations", true, ...
"yLimits", [-2.5 2.5], ...
"xLimits",[0 2.3],...
"scatterAlpha", 0.25, ...
"scatterSize", 1, ...
"avgLineMaxPoints", 500, ...
"avgLineSmoothWindow", 5);
%% A2 residual correction
if run_a2_residual
eq_ffe = FFE_A2Residual( ...
"sps", eq_sps, ...
"order", eq_order, ...
"decide", false, ...
"adaption_technique", eq_adaption, ...
"len_tr", eq_len_tr, ...
"epochs_tr", eq_epochs_tr, ...
"mu_tr", eq_mu_tr, ...
"dd_mode", true, ...
"epochs_dd", eq_epochs_dd, ...
"mu_dd", 0.012, ...
"dc_smoothing_a2", 1, ...
"dc_level_avg_bufferlength_a2", 112, ...
"dc_level_update_blocklength_a2", block_update, ...
"dc_level_weights_a2", [0.6], ...
"save_debug", eq_save_debug, "optmize_mus",0);
exportName = "after_ffe_eq";
pngFile = fullfile(exportDir, exportName + "_img.png"); % absolute filesystem output
tikzFile = fullfile(exportDir, exportName + ".tikz"); % absolute filesystem output
pngTikzPath = "04_Experimental_Evaluation/tikz/mpi/" + exportName + "_img.png"; % path written into TikZ
figure(401);
exportLevelScatterTikz(gca, pngFile, tikzFile, pngTikzPath, ...
"resolutionDpi", 150, ...
"generatedBy", "mpi_recipe_dev.m");
[ffe_results,equalized_signal] = runFfe(eq_ffe, "A2 residual", ...
Scpe_sig, Symbols, Tx_bits, options);
output.a2_residual = ffe_results;
if plot_output_signals
plotEqSignals(equalized_signal,Symbols,options,420,-1);
end
end
%% A1 moving-average input suppression
if run_a1
eq_ffe = FFE_A1( ...
"sps", eq_sps, ...
"order", eq_order, ...
"decide", false, ...
"adaption_technique", eq_adaption, ...
"len_tr", eq_len_tr, ...
"epochs_tr", eq_epochs_tr, ...
"mu_tr", eq_mu_tr, ...
"dd_mode", false, ...
"epochs_dd", eq_epochs_dd, ...
"mu_dd", 0.012, ...
"dc_smoothing_a1", 1, ...
"dc_avg_bufferlength_a1", 2048, ...
"dc_avg_update_blocklength_a1", block_update, ...
"save_debug", eq_save_debug);
[ffe_results,equalized_signal] = runFfe(eq_ffe, "A1", ...
Scpe_sig, Symbols, Tx_bits, options);
output.a1_ff_dc_avg = ffe_results;
if plot_output_signals
plotEqSignals(equalized_signal,Symbols,options,430,-1);
end
end
%% DC tracking, adaptive/persistence path
if run_tracking_adaptive
eq_ffe = FFE_DCTracking( ...
"sps", eq_sps, ...
"order", eq_order, ...
"decide", false, ...
"adaption_technique", eq_adaption, ...
"len_tr", eq_len_tr, ...
"epochs_tr", eq_epochs_tr, ...
"mu_tr", eq_mu_tr, ...
"dd_mode", true, ...
"epochs_dd", eq_epochs_dd, ...
"mu_dd", 0.012, ...
"dc_tracking_mu", 0.002, ...
"dc_tracking_adaptive_enabled", true, ...
"dc_tracking_persistence_gain", 0, ...
"dc_tracking_buffer_len", block_update, ...
"optmize_mus", false, ...
"plot_mu_optimization", options.debug_plots, ...
"save_debug", eq_save_debug);
[ffe_results,equalized_signal] = runFfe(eq_ffe, "DC tracking adaptive", ...
Scpe_sig, Symbols, Tx_bits, options);
output.dc_tracking = ffe_results;
if plot_output_signals
plotEqSignals(equalized_signal,Symbols,options,450,-1);
end
end
end
%% A2
eq_core_settings = { ...
"sps", 2, ...
"order", 50, ...
"decide", 0, ...
"adaption_technique", "nlms"};
eq_training_settings = { ...
"len_tr", 4096, ...
"epochs_tr", 5, ...
"mu_tr", 0.04};
eq_dd_settings = { ...
"dd_mode", 1, ...
"epochs_dd", 3, ...
"mu_dd", 0.012};
eq_a1_settings = { ...
"dc_smoothing_a1", 0, ...
"dc_avg_bufferlength_a1", 0, ...
"dc_avg_update_blocklength_a1", 1};
eq_a2_settings = { ...
"dc_smoothing_a2", 1, ...
"dc_level_avg_bufferlength_a2", 256, ...
"dc_level_update_blocklength_a2", options.userParameters.block_update, ...
"dc_level_weights_a2", [0.6]};
eq_dc_tracking_settings = { ...
"dc_tracking_mu", 0, ...
"dc_tracking_adaptive_enabled", 0, ...
"dc_tracking_persistence_gain", 0, ...
"dc_tracking_buffer_len", 0};
eq_ffe_update_settings = { ...
"ffe_update_buffer_len", 1};
eq_optimizer_settings = { ...
"optmize_mus", 0, ...
"plot_mu_optimization", options.debug_plots, ...
"optimize_dc_tracking_params", 0, ...
"optimize_a2_level_weights", 1, ...
"a2_level_weight_optimization_len", 2^15, ...
"a2_level_weight_optimization_max_evals", 30, ...
"a2_level_weight_max", 1};
eq_debug_settings = { ...
"save_debug", false};
eq_settings = [ ...
eq_core_settings, ...
eq_training_settings, ...
eq_dd_settings, ...
eq_a1_settings, ...
eq_a2_settings, ...
eq_dc_tracking_settings, ...
eq_ffe_update_settings, ...
eq_optimizer_settings, ...
eq_debug_settings];
eq_ffe = FFE(eq_settings{:});
if 0
function [ffe_results,equalized_signal] = runFfe(eq_ffe,description,Scpe_sig,Symbols,Tx_bits,options)
[ffe_results,equalized_signal] = ffe(eq_ffe, options.M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", options.duob_mode, ...
'showAnalysis', options.debug_plots, ...
"postFFE", [], ...
"eth_style_symbol_mapping", 0);
ffe_results.metrics.print("description",sprintf('Immediate A2; SIR %d dB',options.dataTable.sir));
output.a2_immediate_updates = ffe_results;
end
if options.debug_plots
showLevelScatter(Scpe_sig_raw, Symbols, ...
"fsym", options.fsym, ...
"fignum", 400, ...
"normalize", true);
[~, avg_for_lvl] = showLevelScatter(equalized_signal, Symbols, ...
"fsym", options.fsym, ...
"fignum", 401, ...
"normalize", true);
end
%% A1
eq_a1_settings = { ...
"dc_smoothing_a1", 1 ...
"dc_avg_bufferlength_a1", 2048, ...
"dc_avg_update_blocklength_a1", options.userParameters.block_update};
eq_a2_settings = { ...
"dc_smoothing_a2", 0, ...
"dc_level_avg_bufferlength_a2", 0, ...
"dc_level_update_blocklength_a2", 0, ...
"dc_level_weights_a2", [0.6 0.6 0.6 0.6]};
eq_optimizer_settings = { ...
"optmize_mus", 0, ...
"plot_mu_optimization", options.debug_plots, ...
"optimize_dc_tracking_params", 0, ...
"optimize_a2_level_weights", 0, ...
"a2_level_weight_optimization_len", 2^15, ...
"a2_level_weight_optimization_max_evals", 30, ...
"a2_level_weight_max", 1};
eq_debug_settings = { ...
"save_debug", false};
eq_settings = [ ...
eq_core_settings, ...
eq_training_settings, ...
eq_dd_settings, ...
eq_a1_settings, ...
eq_a2_settings, ...
eq_dc_tracking_settings, ...
eq_ffe_update_settings, ...
eq_optimizer_settings, ...
eq_debug_settings];
eq_ffe = FFE(eq_settings{:});
if 0
[ffe_results,equalized_signal] = ffe(eq_ffe, options.M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", options.duob_mode, ...
'showAnalysis', options.debug_plots, ...
"showAnalysis", options.debug_plots, ...
"postFFE", [], ...
"eth_style_symbol_mapping", 0);
ffe_results.metrics.print("description",sprintf('Immediate A1; SIR %d dB',options.dataTable.sir));
output.a1_immediate_updates = ffe_results;
showLevelScatter(Scpe_sig_raw, Symbols, ...
"fsym", options.fsym, ...
"fignum", 400, ...
"normalize", true);
[~, avg_for_lvl] = showLevelScatter(equalized_signal, Symbols, ...
"fsym", options.fsym, ...
"fignum", 401, ...
"normalize", true);
ffe_results.metrics.print("description",resultDescription(description,options));
end
%% Tracking fixed
eq_core_settings = { ...
"sps", 2, ...
"order", 50, ...
"decide", 0, ...
"adaption_technique", "nlms"};
eq_training_settings = { ...
"len_tr", 4096, ...
"epochs_tr", 5, ...
"mu_tr", 0.04};
eq_dd_settings = { ...
"dd_mode", 1, ...
"epochs_dd", 3, ...
"mu_dd", 0.012};
eq_a1_settings = { ...
"dc_smoothing_a1", 0, ...
"dc_avg_bufferlength_a1", 0, ...
"dc_avg_update_blocklength_a1", 1};
eq_a2_settings = { ...
"dc_smoothing_a2", 0, ...
"dc_level_avg_bufferlength_a2", 0, ...
"dc_level_update_blocklength_a2", 0, ...
"dc_level_weights_a2", [0.6 0.6 0.6 0.6]};
eq_dc_tracking_settings = { ...
"dc_tracking_mu", 0.002, ...
"dc_tracking_adaptive_enabled", 0, ...
"dc_tracking_persistence_gain", 0, ...
"dc_tracking_buffer_len", options.userParameters.block_update};
eq_ffe_update_settings = { ...
"ffe_update_buffer_len", 1};
eq_optimizer_settings = { ...
"optmize_mus", 0, ...
"plot_mu_optimization", options.debug_plots, ...
"optimize_dc_tracking_params", 1, ...
"optimize_a2_level_weights", 0, ...
"a2_level_weight_optimization_len", 2^15, ...
"a2_level_weight_optimization_max_evals", 30, ...
"a2_level_weight_max", 1};
eq_debug_settings = { ...
"save_debug", false};
eq_settings = [ ...
eq_core_settings, ...
eq_training_settings, ...
eq_dd_settings, ...
eq_a1_settings, ...
eq_a2_settings, ...
eq_dc_tracking_settings, ...
eq_ffe_update_settings, ...
eq_optimizer_settings, ...
eq_debug_settings];
eq_ffe = FFE(eq_settings{:});
if 1
[ffe_results,equalized_signal] = ffe(eq_ffe, options.M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", options.duob_mode, ...
'showAnalysis', options.debug_plots, ...
"postFFE", [], ...
"eth_style_symbol_mapping", 0);
ffe_results.metrics.print("description",sprintf('Immediate A2; SIR %d dB',options.dataTable.sir));
output.tracking_fixmu_immediate_updates = ffe_results;
function description = resultDescription(prefix,options)
sir = options.dataTable.sir;
if numel(sir) > 1
sir = sir(1);
end
description = sprintf('%s; SIR %g dB',prefix,sir);
end
%% Tracking Adaptive
function plotEqSignals(equalized_signal,Symbols,options,fignum,output_scale)
eq_core_settings = { ...
"sps", 2, ...
"order", 50, ...
"decide", 0, ...
"adaption_technique", "nlms"};
eq_training_settings = { ...
"len_tr", 4096, ...
"epochs_tr", 5, ...
"mu_tr", 0.04};
eq_dd_settings = { ...
"dd_mode", 1, ...
"epochs_dd", 3, ...
"mu_dd", 0.012};
eq_a1_settings = { ...
"dc_smoothing_a1", 0, ...
"dc_avg_bufferlength_a1", 0, ...
"dc_avg_update_blocklength_a1", 1};
eq_a2_settings = { ...
"dc_smoothing_a2", 0, ...
"dc_level_avg_bufferlength_a2", 0, ...
"dc_level_update_blocklength_a2", 0, ...
"dc_level_weights_a2", [0.6 0.6 0.6 0.6]};
eq_dc_tracking_settings = { ...
"dc_tracking_mu", 0.002, ...
"dc_tracking_adaptive_enabled", 1, ...
"dc_tracking_persistence_gain", 0, ...
"dc_tracking_buffer_len", options.userParameters.block_update};
eq_ffe_update_settings = { ...
"ffe_update_buffer_len", 1};
eq_optimizer_settings = { ...
"optmize_mus", 0, ...
"plot_mu_optimization", options.debug_plots, ...
"optimize_dc_tracking_params", 1, ...
"optimize_a2_level_weights", 0, ...
"a2_level_weight_optimization_len", 2^15, ...
"a2_level_weight_optimization_max_evals", 30, ...
"a2_level_weight_max", 1};
eq_debug_settings = { ...
"save_debug", false};
eq_settings = [ ...
eq_core_settings, ...
eq_training_settings, ...
eq_dd_settings, ...
eq_a1_settings, ...
eq_a2_settings, ...
eq_dc_tracking_settings, ...
eq_ffe_update_settings, ...
eq_optimizer_settings, ...
eq_debug_settings];
eq_ffe = FFE(eq_settings{:});
if 1
[ffe_results,equalized_signal] = ffe(eq_ffe, options.M, Scpe_sig, Symbols, Tx_bits, ...
"precode_mode", options.duob_mode, ...
'showAnalysis', options.debug_plots, ...
"postFFE", [], ...
"eth_style_symbol_mapping", 0);
ffe_results.metrics.print("description",sprintf('Immediate A2; SIR %d dB',options.dataTable.sir));
output.tracking_adaptive_immediate_updates = ffe_results;
showLevelScatter(Scpe_sig_raw, Symbols, ...
showLevelScatter(equalized_signal .* output_scale, Symbols, ...
"fsym", options.fsym, ...
"fignum", 400, ...
"fignum", fignum + 1, ...
"normalize", true);
[~, avg_for_lvl] = showLevelScatter(equalized_signal, Symbols, ...
"fsym", options.fsym, ...
"fignum", 401, ...
"normalize", true);
end
end