Merge branch 'main' of https://cau-git.rz.uni-kiel.de/nt/mitarbeiter/silas/imdd_simulation
This commit is contained in:
BIN
projects/.DS_Store
vendored
BIN
projects/.DS_Store
vendored
Binary file not shown.
@@ -0,0 +1,92 @@
|
||||
|
||||
% basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
% db = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
if 1
|
||||
|
||||
uloops = struct;
|
||||
uloops.precomp = [0,1];
|
||||
uloops.db_precode = [0,1];
|
||||
uloops.bitrate = [420].*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.M = [4];
|
||||
uloops.link_length = [1]; % 1,2,3,5,6,8,10
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
% wh = submit_simulations(wh,"parallel",0,"simulation_mode",0);
|
||||
wh = submit_handle(@dsp_mpi,wh,"parallel",1);
|
||||
|
||||
end
|
||||
|
||||
a = wh_mpi_112gbd.getStoValue('ber',uloops.precomp, uloops.db_precode, uloops.bitrate(1) , uloops.laser_wavelength, uloops.M, uloops.link_length);
|
||||
|
||||
%VNLE standalone
|
||||
try
|
||||
ber_vnle = cellfun(@(x) x.vnle_dfe_package{1,1}.ber_vnle, a);
|
||||
end
|
||||
%MLSE
|
||||
try
|
||||
ber_values_mlse = cellfun(@(s) cellfun(@(pkg) pkg.ber_mlse, s.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
|
||||
ber_values_mlse = cell2mat(ber_values_mlse{1});
|
||||
|
||||
end
|
||||
%DB
|
||||
try
|
||||
ber_values_db = cellfun(@(s) cellfun(@(pkg) pkg.ber, s.dbtgt_package, 'UniformOutput', false), a, 'UniformOutput', false);
|
||||
ber_values_db = cell2mat(ber_values_db{1});
|
||||
end
|
||||
|
||||
xax = [0
|
||||
3
|
||||
6
|
||||
9
|
||||
12
|
||||
15
|
||||
18
|
||||
21
|
||||
24
|
||||
27
|
||||
30
|
||||
45];
|
||||
cols = cbrewer2('Set1',8);
|
||||
|
||||
% Compute min, max, and mean for PAM 4 MLSE
|
||||
min_mlse = min(ber_values_mlse, [], 2);
|
||||
max_mlse = max(ber_values_mlse, [], 2);
|
||||
mean_mlse = mean(ber_values_mlse, 2);
|
||||
err_lower_mlse = mean_mlse - min_mlse;
|
||||
err_upper_mlse = max_mlse - mean_mlse;
|
||||
err_mlse = [err_lower_mlse, err_upper_mlse];
|
||||
|
||||
% Compute min, max, and mean for PAM 4 DB tgt.
|
||||
min_db = min(ber_values_db, [], 2);
|
||||
max_db = max(ber_values_db, [], 2);
|
||||
mean_db = mean(ber_values_db, 2);
|
||||
err_lower_db = mean_db - min_db;
|
||||
err_upper_db = max_db - mean_db;
|
||||
err_db = [err_lower_db, err_upper_db];
|
||||
|
||||
figure(1)
|
||||
hold on
|
||||
title('MPI');
|
||||
|
||||
% Plot the MLSE curve with bounded error using boundedline
|
||||
[hl_mlse, hp_mlse] = boundedline(xax, mean_mlse, err_mlse,'Color', cols(1,:));
|
||||
plot(xax,ber_values_mlse,'DisplayName','PAM 4 MLSE','Color',cols(1,:),'LineStyle','-','HandleVisibility','on','Marker','none','LineWidth',0.2);
|
||||
|
||||
% Plot the DB tgt. curve with bounded error using boundedline
|
||||
[hl_db, hp_db] = boundedline(xax, mean_db, err_db, 'Color', cols(2,:));
|
||||
plot(xax,ber_values_db,'DisplayName','PAM 4 MLSE','Color',cols(2,:),'LineStyle','-','HandleVisibility','on','Marker','none','LineWidth',0.2);
|
||||
|
||||
|
||||
% Format the plot
|
||||
xticks(xax);
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([5e-5 0.4]);
|
||||
xlim([min(xax) max(xax)]);
|
||||
yline([4.85e-3, 2e-2], 'HandleVisibility', 'off');
|
||||
legend
|
||||
% beautifyBERplot()
|
||||
xlabel('Interference Attenuation');
|
||||
ylabel('BER');
|
||||
333
projects/HighSpeedExperiment_2024/auswertung MPI/dsp_mpi.m
Normal file
333
projects/HighSpeedExperiment_2024/auswertung MPI/dsp_mpi.m
Normal file
@@ -0,0 +1,333 @@
|
||||
function [output] = dsp_mpi(varargin)
|
||||
|
||||
simulation_mode = 0;
|
||||
|
||||
%%% Change folder
|
||||
curFolder = pwd;
|
||||
funcFolder=fileparts(mfilename('fullpath'));
|
||||
if ~isempty(funcFolder)
|
||||
cd(funcFolder);
|
||||
end
|
||||
|
||||
%%% Run parameters
|
||||
% TX
|
||||
M = 4;
|
||||
fsym = 180e9;
|
||||
|
||||
apply_pulsef = 1;
|
||||
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;
|
||||
vbias = -vbias_rel*u_pi;
|
||||
laser_wavelength = 1293;
|
||||
laser_linewidth = 0;
|
||||
tx_bw_nyquist = 0.8;
|
||||
|
||||
% Channel
|
||||
link_length = 1;
|
||||
|
||||
% RX
|
||||
rop = -5;
|
||||
rx_bw_nyquist = 0.8;
|
||||
|
||||
vnle_order1 = 50;
|
||||
vnle_order2 = 5;
|
||||
vnle_order3 = 5;
|
||||
|
||||
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||
dfe_order = [0 0 0];
|
||||
|
||||
pf_ncoeffs = 1;
|
||||
|
||||
alpha = 0;
|
||||
|
||||
len_tr = 4096*2;
|
||||
|
||||
mu_ffe1 = 0.0001;
|
||||
mu_ffe2 = 0.0008;
|
||||
mu_ffe3 = 0.001;
|
||||
mu_dc = 0.005;
|
||||
mu_dc = 0;
|
||||
|
||||
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
|
||||
mu_dfe = 0.0004;
|
||||
|
||||
|
||||
dfe_ = sum(dfe_order)>0;
|
||||
|
||||
doub_mode = db_mode.no_db;
|
||||
|
||||
%%% change specific parameter if given in varargin
|
||||
% Parse optional input arguments
|
||||
if ~isempty(varargin)
|
||||
var_s = varargin{1};
|
||||
if isstruct(var_s)
|
||||
fields = fieldnames(var_s);
|
||||
for i = 1:numel(fields)
|
||||
if isnumeric(fields{i})
|
||||
eval([fields{i}, ' = ', num2str( var_s.(fields{i}) ), ';']);
|
||||
fprintf("%s <-- %.2f \n", fields{i}, var_s.(fields{i}));
|
||||
else
|
||||
eval([fields{i}, ' = ', 'var_s.(fields{',num2str(i),'})' , ';']);
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
error('Optional variables should be passed as a struct.');
|
||||
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;
|
||||
|
||||
if fsym_ ~= fsym
|
||||
fsym = fsym_;
|
||||
% fprintf('Adapted symbolrate to %d GBd, to match provided bitrate of %d GBit/s using PAM %d \n',fsym.*1e-9,bitrate.*1e-9, M);
|
||||
end
|
||||
f_nyquist = fsym/2;
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
useGui = 0;
|
||||
% db = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
filterParams = database.tables;
|
||||
% filterParams.Runs.run_id = 2958; % no db
|
||||
% filterParams.Runs.run_id = 2937; % no db
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', bitrate, ...
|
||||
'db_mode', db_precode+db_encode, ...
|
||||
'fiber_length', link_length, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', is_mpi, ...
|
||||
'pam_level', M, ...
|
||||
'precomp_amp', [], ...
|
||||
'rop_attenuation', 0, ...
|
||||
'symbolrate', [], ...
|
||||
'v_awg', [], ...
|
||||
'v_bias', [], ...
|
||||
'wavelength', laser_wavelength ...
|
||||
);
|
||||
|
||||
selectedFields = {'Runs.run_id','Runs.tx_bits_path', 'Runs.tx_symbols_path', 'Runs.rx_sync_path','Runs.rx_raw_path',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias',...
|
||||
'Configurations.interference_attenuation'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
[~, uniqueIdx] = unique(dataTable.run_id); % Get unique run_id indices
|
||||
dataTable = dataTable(uniqueIdx,:); % Extract unique configurations for each run_id
|
||||
fprintf('Found %d entries for requested Configuration. IDs are: %s \n \n',size(dataTable,1),jsonencode(dataTable.run_id(1:min(size(dataTable,1),100))));
|
||||
|
||||
|
||||
output = struct();
|
||||
vnle_pf_package = {};
|
||||
vnle_dfe_package = {};
|
||||
dbtgt_package = {};
|
||||
|
||||
disp(num2str(bitrate))
|
||||
|
||||
for iatt = 1:numel(dataTable.interference_attenuation)
|
||||
|
||||
current_run_id = dataTable.run_id(iatt);
|
||||
|
||||
Tx_bits = load([basePath, char(dataTable.tx_bits_path(iatt))]);
|
||||
Tx_bits = Tx_bits.Bits;
|
||||
Symbols_mapped = PAMmapper(M,0).map(Tx_bits);
|
||||
Symbols_mapped.fs = fsym;
|
||||
|
||||
Symbols = load([basePath, char(dataTable.tx_symbols_path(iatt))]);
|
||||
Symbols = Symbols.Symbols;
|
||||
|
||||
Scpe_load = load([basePath, char(dataTable.rx_sync_path(iatt))]);
|
||||
Scpe_cell = Scpe_load.S;
|
||||
[~,~,found]=Scpe_cell{2}.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",1);
|
||||
|
||||
if ~found
|
||||
Raw_signal = load([basePath, char(dataTable.rx_raw_path(1))]);
|
||||
Raw_signal = Raw_signal.Scpe_sig_raw;
|
||||
[~,Scpe_cell,found] =Raw_signal.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",1);
|
||||
end
|
||||
|
||||
if ~found
|
||||
if length(Symbols_mapped.signal) == sum(Symbols_mapped.signal == Symbols.signal)
|
||||
warning('Could not synchronize the received signal with the stored symbols!')
|
||||
else
|
||||
[~,Scpe_cell,found] =Raw_signal.tsynch("reference",Symbols_mapped,"fs_ref",fsym,"debug_plots",0);
|
||||
end
|
||||
if ~found
|
||||
warning('Could not synchronize the received signal with the stored symbols!')
|
||||
end
|
||||
end
|
||||
|
||||
fsym = Symbols.fs;
|
||||
|
||||
if db_precode
|
||||
Symbols_precoded = Symbols;
|
||||
end
|
||||
|
||||
|
||||
|
||||
proc_occ = min(15,length(Scpe_cell));
|
||||
for occ = 1:proc_occ
|
||||
|
||||
Scpe_sig = Scpe_cell{occ};
|
||||
|
||||
%%%%%% Sample to 2x fsym %%%%%%
|
||||
Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",0);
|
||||
|
||||
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
|
||||
|
||||
|
||||
% 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);
|
||||
|
||||
mu_ffe = [mu_ffe1 mu_ffe2 mu_ffe3];
|
||||
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||
|
||||
% %%%%% 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{iatt,occ} = result;
|
||||
|
||||
end
|
||||
|
||||
%%%%% VNLE + PF + MLSE %%%%
|
||||
if 1
|
||||
|
||||
try
|
||||
% 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);
|
||||
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_postfilter_mlse(eq_vnle_,pf_,mlse_,M,Scpe_sig,Symbols,Tx_bits,"precode_mode",doub_mode,'showAnalysis',0,"postFFE",[]);
|
||||
vnle_pf_package{iatt,occ} = result;
|
||||
|
||||
database.addProcessingResult(current_run_id,result.resultsMLSE, result.equalizerConfigMLSE);
|
||||
database.addProcessingResult(current_run_id,result.resultsVNLE, result.equalizerConfigVNLE);
|
||||
catch
|
||||
warning(['VNLE+MLSE fail: run id: ', num2str(current_run_id)],' occ:', num2str(occ), ' iatten: ',num2str(iatt))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
%%%%% Duobinary Targeting %%%%
|
||||
if 1
|
||||
|
||||
try
|
||||
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);
|
||||
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] = duobinary_target(eq_db, mlse_db, M, Scpe_sig, Symbols, Tx_bits, "precode_mode", doub_mode,'showAnalysis',0,"postFFE",[]);
|
||||
dbtgt_package{iatt,occ} = result;
|
||||
|
||||
database.addProcessingResult(current_run_id,result.resultsDBtgt, result.equalizerConfigDBtgt);
|
||||
|
||||
catch
|
||||
warning(['VNLE DB+MLSE fail: run id: ', num2str(current_run_id)],' occ:', num2str(occ), ' iatten: ',num2str(iatt))
|
||||
end
|
||||
|
||||
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{iatt,occ} = result;
|
||||
end
|
||||
|
||||
|
||||
% autoArrangeFigures;
|
||||
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ')
|
||||
fprintf('\n')
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
if ~isempty(curFolder)
|
||||
cd(curFolder);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
output.dataTable = dataTable;
|
||||
output.vnle_dfe_package = vnle_dfe_package;
|
||||
output.vnle_pf_package = vnle_pf_package;
|
||||
output.dbtgt_package = dbtgt_package;
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
% 1) Find RUN ID's
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', [], ...
|
||||
'fiber_length', [], ...
|
||||
'interference_attenuation',[], ...
|
||||
'is_mpi', 0, ...
|
||||
'pam_level', [], ...
|
||||
'rop_attenuation', 0 ...
|
||||
);
|
||||
|
||||
selectedFields = {'Runs.run_id',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength',...
|
||||
'Configurations.precomp_amp','Measurements.power_rop','Measurements.power_pd_in','Configurations.v_bias','Configurations.is_mpi',...
|
||||
'Configurations.interference_attenuation','Configurations.rop_attenuation'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
% only the rows without BER so far
|
||||
% dataTable = dataTable(dataTable.BER == 0,:);
|
||||
dataTable = dataTable((dataTable.fiber_length ~= 1),:);
|
||||
|
||||
% Ensure a parallel pool is running
|
||||
pool = gcp('nocreate');
|
||||
if isempty(pool)
|
||||
pool = parpool;
|
||||
% stop all forgotten or unfetched jobs from queue
|
||||
elseif ~isempty(pool.FevalQueue.QueuedFutures) || ~isempty(pool.FevalQueue.RunningFutures)
|
||||
oldq = length(pool.FevalQueue.QueuedFutures) + length(pool.FevalQueue.RunningFutures);
|
||||
pool.FevalQueue.cancelAll
|
||||
fprintf('Canceled %d unfetched jobs from old queue.', oldq);
|
||||
end
|
||||
|
||||
% Number of tasks to submit (one per run_id)
|
||||
nTasks = height(dataTable);
|
||||
futures = parallel.FevalFuture.empty();
|
||||
|
||||
% Submit each DSP run as a parallel task using parfeval
|
||||
for i = 1:nTasks
|
||||
% Extract the run_id (other parameters could be passed if needed)
|
||||
runID = dataTable.run_id(i);
|
||||
% Submit the function call to dsp_run_id (assuming it returns no output, hence 0 outputs)
|
||||
futures(i) = parfeval(pool, @dsp_run_id, 0, runID, "max_occurences", 15, "append_to_db", 1);
|
||||
end
|
||||
|
||||
% Set up a waitbar to monitor progress
|
||||
h = waitbar(0, 'Processing DSP runs...');
|
||||
while ~all(strcmp({futures.State}, 'finished'))
|
||||
finishedCount = sum(strcmp({futures.State}, 'finished'));
|
||||
waitbar(finishedCount / nTasks, h);
|
||||
pause(0.1);
|
||||
end
|
||||
delete(h);
|
||||
|
||||
fprintf('All DSP runs processed.\n');
|
||||
194
projects/HighSpeedExperiment_2024/auswertung MPI/dsp_run_id.m
Normal file
194
projects/HighSpeedExperiment_2024/auswertung MPI/dsp_run_id.m
Normal file
@@ -0,0 +1,194 @@
|
||||
function [output] = dsp_run_id(run_id,options)
|
||||
|
||||
arguments
|
||||
run_id
|
||||
options.append_to_db = 0;
|
||||
options.max_occurences = 4;
|
||||
options.parameters = struct();
|
||||
end
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct('run_id', run_id);
|
||||
|
||||
selectedFields = {'Runs.run_id','Runs.tx_bits_path', 'Runs.tx_symbols_path', 'Runs.rx_sync_path','Runs.rx_raw_path',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias',...
|
||||
'Configurations.interference_attenuation'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
[~, uniqueIdx] = unique(dataTable.run_id); % Get unique run_id indices
|
||||
dataTable = dataTable(uniqueIdx,:); % Extract unique configurations for each run_id
|
||||
|
||||
fsym = dataTable.symbolrate;
|
||||
M = double(dataTable.pam_level);
|
||||
duob_mode = db_mode(dataTable.db_mode);
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
len_tr = 4096*2;
|
||||
|
||||
vnle_order1 = 50;
|
||||
vnle_order2 = 5;
|
||||
vnle_order3 = 5;
|
||||
|
||||
dfe_order = [0 0 0];
|
||||
|
||||
pf_ncoeffs = 1;
|
||||
|
||||
mu_ffe1 = 0.0001;
|
||||
mu_ffe2 = 0.0008;
|
||||
mu_ffe3 = 0.001;
|
||||
mu_dfe = 0.0004;
|
||||
mu_dc = 0.00;
|
||||
|
||||
mu_ffe = [mu_ffe1 mu_ffe2 mu_ffe3];
|
||||
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||
|
||||
% Overwrite default parameters if given in options.parameters
|
||||
paramStruct = options.parameters;
|
||||
if ~isempty(paramStruct)
|
||||
paramNames = fieldnames(paramStruct);
|
||||
for i = 1:numel(paramNames)
|
||||
thisName = paramNames{i};
|
||||
thisValue = paramStruct.(thisName);
|
||||
eval([thisName ' = thisValue;']);
|
||||
end
|
||||
end
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
eq_ = 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);
|
||||
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
mlse_ = MLSE_viterbi("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
||||
mlse_db_ = MLSE_viterbi("DIR",[1,1],"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels);
|
||||
eq_post = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",2001,"sps",1,"decide",0);
|
||||
|
||||
output = struct();
|
||||
vnle_pf_package = {};
|
||||
vnle_dfe_package = {};
|
||||
dbtgt_package = {};
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
Tx_bits = load([basePath, char(dataTable.tx_bits_path)]);
|
||||
Tx_bits = Tx_bits.Bits;
|
||||
Symbols_mapped = PAMmapper(M,0).map(Tx_bits);
|
||||
Symbols_mapped.fs = dataTable.symbolrate;
|
||||
|
||||
Symbols = load([basePath, char(dataTable.tx_symbols_path)]);
|
||||
Symbols = Symbols.Symbols;
|
||||
|
||||
Scpe_load = load([basePath, char(dataTable.rx_sync_path)]);
|
||||
Scpe_cell = Scpe_load.S;
|
||||
[~,~,found]=Scpe_cell{2}.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",0);
|
||||
|
||||
if ~found
|
||||
Raw_signal = load([basePath, char(dataTable.rx_raw_path(1))]);
|
||||
Raw_signal = Raw_signal.Scpe_sig_raw;
|
||||
[~,Scpe_cell,found] =Raw_signal.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",0);
|
||||
end
|
||||
|
||||
if ~found
|
||||
if length(Symbols_mapped.signal) == sum(Symbols_mapped.signal == Symbols.signal)
|
||||
warning('Could not synchronize the received signal with the stored symbols!')
|
||||
else
|
||||
[~,Scpe_cell,found] =Raw_signal.tsynch("reference",Symbols_mapped,"fs_ref",dataTable.symbolrate,"debug_plots",0);
|
||||
end
|
||||
if ~found
|
||||
warning('Could not synchronize the received signal with the stored symbols!')
|
||||
end
|
||||
end
|
||||
|
||||
proc_occ = min(options.max_occurences,length(Scpe_cell));
|
||||
for occ = 1:proc_occ
|
||||
|
||||
Scpe_sig = Scpe_cell{occ};
|
||||
|
||||
%%%%%% Sample to 2x fsym %%%%%%
|
||||
Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",0);
|
||||
|
||||
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);
|
||||
|
||||
% Scpe_sig.plot("displayname",'Scope Signal','fignum',11);
|
||||
% Scpe_sig.spectrum("displayname",'Raw Signal','fignum',20);
|
||||
|
||||
if duob_mode ~= db_mode.db_encoded
|
||||
|
||||
% %%%%% 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_post = 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",duob_mode,"showAnalysis",1,"postFFE",[]);
|
||||
vnle_dfe_package{occ} = result;
|
||||
|
||||
end
|
||||
|
||||
%%%%% VNLE + PF + MLSE %%%%
|
||||
if 1
|
||||
|
||||
[result] = vnle_postfilter_mlse(eq_,pf_,mlse_,M,Scpe_sig,Symbols,Tx_bits,"precode_mode",duob_mode,'showAnalysis',0,"postFFE",[],"eth_style_symbol_mapping",0);
|
||||
vnle_pf_package{occ} = result;
|
||||
|
||||
if options.append_to_db
|
||||
database.addProcessingResult(run_id,result.resultsMLSE, result.equalizerConfigMLSE);
|
||||
database.addProcessingResult(run_id,result.resultsVNLE, result.equalizerConfigVNLE);
|
||||
end
|
||||
end
|
||||
|
||||
%%%%% Duobinary Targeting %%%%
|
||||
if 1
|
||||
[result] = duobinary_target(eq_, mlse_db_, M, Scpe_sig, Symbols, Tx_bits, "precode_mode", duob_mode,'showAnalysis',0,"postFFE",[]);
|
||||
dbtgt_package{occ} = result;
|
||||
|
||||
if options.append_to_db
|
||||
database.addProcessingResult(run_id, result.resultsDBtgt, result.equalizerConfigDBtgt);
|
||||
end
|
||||
end
|
||||
|
||||
fprintf("BER VNLE: %.2e | %.2e; BER MLSE: %.2e | %.2e; BER DB tgt: %.2e | %.2e \n",vnle_pf_package{occ}.resultsVNLE.BER,vnle_pf_package{occ}.resultsVNLE.BER_precoded ,vnle_pf_package{occ}.resultsMLSE.BER,vnle_pf_package{occ}.resultsMLSE.BER_precoded,dbtgt_package{occ}.resultsDBtgt.BER,dbtgt_package{occ}.resultsDBtgt.BER_precoded)
|
||||
% fprintf("BER VNLE: %.2e | %.2e; BER MLSE: %.2e | %.2e \n",vnle_pf_package{occ}.resultsVNLE.BER,vnle_pf_package{occ}.resultsVNLE.BER_precoded ,vnle_pf_package{occ}.resultsMLSE.BER,vnle_pf_package{occ}.resultsMLSE.BER_precoded);
|
||||
|
||||
|
||||
else
|
||||
|
||||
%%%%%% %db signaling => db encoded %%%%%
|
||||
if 1
|
||||
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;
|
||||
|
||||
if options.append_to_db
|
||||
database.addProcessingResult(run_id, result.resultsDBsignaling, result.equalizerConfigDBsignaling);
|
||||
end
|
||||
end
|
||||
|
||||
fprintf("BER DB: %.2e \n",dbenc_package{occ}.resultsDBsignaling.BER);
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
% autoArrangeFigures;
|
||||
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ')
|
||||
fprintf('\n')
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
output.dataTable = dataTable;
|
||||
output.vnle_dfe_package = vnle_dfe_package;
|
||||
output.vnle_pf_package = vnle_pf_package;
|
||||
output.dbtgt_package = dbtgt_package;
|
||||
|
||||
end
|
||||
@@ -0,0 +1,150 @@
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.no_db), ...
|
||||
'fiber_length', 1, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 1, ...
|
||||
'pam_level', 4, ...
|
||||
'rop_attenuation', 0, ...
|
||||
'wavelength', 1310 ...
|
||||
);
|
||||
|
||||
% filterParams.EqualizerParameters.diff_precode = int32(db_mode.no_db);
|
||||
filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
% filterParams.EqualizerParameters.DCmu = 0.005;
|
||||
|
||||
selectedFields = {'Configurations.run_id' 'Runs.rx_raw_path' 'Configurations.bitrate' 'Configurations.symbolrate' 'Configurations.pam_level' 'Configurations.db_mode' 'Configurations.rop_attenuation' 'Configurations.is_mpi' 'Configurations.interference_attenuation' 'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'Measurements.power_pd_in' 'Measurements.power_mpi_interference' 'Measurements.power_mpi_signal' 'Results.BER' 'Results.SNR' 'Results.GMI' 'Results.Alpha'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
fixedVars = {'run_id','eq_id','bitrate'};
|
||||
dataTableGrpd = groupIt(fixedVars,dataTable);
|
||||
|
||||
|
||||
% Create a new figure
|
||||
figure(3);
|
||||
hold on
|
||||
unique_rates = unique(dataTable.bitrate);
|
||||
cols = linspecer(8);
|
||||
for i = 1:numel(unique_rates)
|
||||
|
||||
% Plot BER vs. interference_attenuation
|
||||
% plot(dataTableGrpd.power_mpi_signal(dataTableGrpd.bitrate==unique_rates(i),:)-dataTableGrpd.power_mpi_interference(dataTableGrpd.bitrate==unique_rates(i),:), dataTableGrpd.BER(dataTableGrpd.bitrate==unique_rates(i),:), '-', 'LineWidth', 0.5,'Color',cols(i,:));
|
||||
|
||||
if filterParams.Configurations.is_mpi
|
||||
sir = dataTable.power_mpi_signal(dataTable.bitrate==unique_rates(i),:)-dataTable.power_mpi_interference(dataTable.bitrate==unique_rates(i),:);
|
||||
ber = dataTable.BER(dataTable.bitrate==unique_rates(i),:);
|
||||
sc=scatter(dataTable.power_mpi_signal(dataTable.bitrate==unique_rates(i),:)-dataTable.power_mpi_interference(dataTable.bitrate==unique_rates(i),:), dataTable.BER(dataTable.bitrate==unique_rates(i),:), 'LineWidth', 0.5,'Marker','.','MarkerEdgeColor',cols(i+1,:));
|
||||
pair_one = {'Run ID', dataTable.run_id(dataTable.bitrate==unique_rates(i),:)};
|
||||
pair_two = {'Rate', dataTable.bitrate(dataTable.bitrate==unique_rates(i),:)};
|
||||
addDatatips(sc, pair_one, pair_two);
|
||||
else
|
||||
sc=scatter(62*ones(size( dataTableGrpd.BER(dataTableGrpd.bitrate==unique_rates(i),:))), dataTableGrpd.BER(dataTableGrpd.bitrate==unique_rates(i),:), 'LineWidth', 0.5,'Marker','o','MarkerEdgeColor',cols(i,:),'MarkerFaceColor',cols(i,:));
|
||||
pair_one = {'Run ID', dataTableGrpd.run_id(dataTableGrpd.bitrate==unique_rates(i),:)};
|
||||
pair_two = {'Rate', dataTableGrpd.bitrate(dataTableGrpd.bitrate==unique_rates(i),:)};
|
||||
addDatatips(sc, pair_one, pair_two);
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
% Label the axes and add a title
|
||||
xlabel('SIR in dB');
|
||||
ylabel('BER');
|
||||
title('BER vs. Signal to Interference Ratio');
|
||||
yline(3.8e-3,'LineWidth',1,'LineStyle','--','HandleVisibility','off');
|
||||
% Enable grid for better readability
|
||||
grid on;
|
||||
|
||||
beautifyBERplot;
|
||||
ylim([1e-4 0.5]);
|
||||
|
||||
|
||||
|
||||
function resultTable = groupIt(fixedVars,dataTable)
|
||||
|
||||
% Group by run_id and eq_id (adjust grouping keys as needed)
|
||||
|
||||
[G, groupKeys] = findgroups(dataTable(:, fixedVars));
|
||||
|
||||
% Preallocate a cell array for aggregated data.
|
||||
varNames = dataTable.Properties.VariableNames;
|
||||
nVars = numel(varNames);
|
||||
aggData = cell(height(groupKeys), nVars);
|
||||
groupCount = zeros(height(groupKeys), 1); % To store the size of each group
|
||||
|
||||
% Loop over each group.
|
||||
for i = 1:height(groupKeys)
|
||||
idx = (G == i); % Logical index for group i
|
||||
groupCount(i) = sum(idx); % Count number of rows in this group
|
||||
% For each variable in the table:
|
||||
for j = 1:nVars
|
||||
colData = dataTable.(varNames{j});
|
||||
if isnumeric(colData)
|
||||
% For numeric data, compute the mean.
|
||||
aggData{i, j} = min(colData(idx));
|
||||
else
|
||||
% For non-numeric data, take the first entry.
|
||||
if iscell(colData)
|
||||
aggData{i, j} = colData{find(idx, 1)};
|
||||
else
|
||||
aggData{i, j} = colData(find(idx, 1));
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Convert the aggregated cell array into a table.
|
||||
resultTable = cell2table(aggData, 'VariableNames', varNames);
|
||||
|
||||
% Append the group count as a new column.
|
||||
resultTable.nRows = groupCount;
|
||||
|
||||
end
|
||||
|
||||
|
||||
function addDatatips(sc, varargin)
|
||||
% addDatatips Adds custom data tip rows to a scatter plot.
|
||||
%
|
||||
% addDatatips(sc, pair1, pair2, ...) adds one or more custom rows to the
|
||||
% data tip display of the scatter plot identified by sc.
|
||||
%
|
||||
% Each pair should be provided as a 1x2 cell array: {label, value}.
|
||||
% The value can be a scalar or a vector. If a vector is provided, its length
|
||||
% must match the number of scatter plot points.
|
||||
%
|
||||
% Example:
|
||||
% sc = scatter(x, y, 'LineWidth', 1.5, 'Marker', 'o');
|
||||
% pair_one = {'Attenuation', attenuationVector};
|
||||
% addDatatips(sc, pair_one);
|
||||
|
||||
numPoints = numel(sc.XData);
|
||||
|
||||
for k = 1:length(varargin)
|
||||
pair = varargin{k};
|
||||
|
||||
if ~iscell(pair) || numel(pair) ~= 2
|
||||
error('Each pair must be a 1x2 cell array: {label, value}.');
|
||||
end
|
||||
|
||||
label = pair{1};
|
||||
value = pair{2};
|
||||
|
||||
% If value is a vector, ensure its length is either 1 or equal to the number of scatter points.
|
||||
if isvector(value) && numel(value) ~= 1 && numel(value) ~= numPoints
|
||||
error('The vector for "%s" must be a scalar or have %d elements matching the scatter data points.', label, numPoints);
|
||||
end
|
||||
|
||||
% Create a new data tip row using the provided label and vector.
|
||||
newRow = dataTipTextRow(label, value);
|
||||
sc.DataTipTemplate.DataTipRows(end+1) = newRow;
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
% basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
% db = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
if 0
|
||||
|
||||
uloops = struct;
|
||||
uloops.precomp = [0];
|
||||
uloops.db_precode = [0];
|
||||
uloops.bitrate = [330,390,450].*1e9; %[300,330,360,390,420,450,480]
|
||||
uloops.laser_wavelength = [1310];
|
||||
uloops.M = [4];
|
||||
uloops.link_length = [2]; % 1,2,3,5,6,8,10
|
||||
%uloops.alpha = [0:0.1:1];
|
||||
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
wh = submit_simulations(wh,"parallel",1,"simulation_mode",0);
|
||||
|
||||
end
|
||||
|
||||
col = cbrewer2('spectral',6);%
|
||||
col=linspecer(5);
|
||||
|
||||
cnt = 1;
|
||||
for br = uloops.bitrate
|
||||
a = wh_burg.getStoValue('ber',uloops.precomp, uloops.db_precode, br , uloops.laser_wavelength, uloops.M, uloops.link_length);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
alpha = cellfun(@(x) x.vnle_pf_package{1,1}.pf.coefficients, a,'UniformOutput', false);
|
||||
figure(23)
|
||||
hold on
|
||||
scatter(alpha{1}(2),ber_mlse,100,'MarkerEdgeColor',col(cnt,:),'Marker','x','LineWidth',2,'HandleVisibility','off');
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
|
||||
|
||||
cnt = 1;
|
||||
alpha = [];
|
||||
|
||||
for br = uloops.bitrate
|
||||
|
||||
a = wh_alphas.getStoValue('ber',uloops.precomp, uloops.db_precode, br , uloops.laser_wavelength, uloops.M, uloops.link_length, [0:0.1:1]);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
|
||||
x_ax = [0:0.1:1];
|
||||
|
||||
figure(23)
|
||||
hold on
|
||||
% title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,uloops.M));
|
||||
plot(x_ax,ber_mlse,'DisplayName',sprintf(' %d GBps PAM 4',br.*1e-9),'LineStyle','-','HandleVisibility','on','Color',col(cnt,:));
|
||||
|
||||
xticks(x_ax);
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([1e-5 0.4]);
|
||||
xlim([min(x_ax), max(x_ax) ]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot();
|
||||
xlabel('Channel $\alpha$');
|
||||
ylabel('BER');
|
||||
|
||||
cnt = cnt+1;
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
% basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
% db = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
if 0
|
||||
|
||||
uloops = struct;
|
||||
uloops.precomp = [0];
|
||||
uloops.db_precode = [0];
|
||||
uloops.bitrate = [390].*1e9; %[300,330,360,390,420,450,480]
|
||||
uloops.laser_wavelength = [1310];
|
||||
uloops.M = [4];
|
||||
uloops.link_length = [2]; % 1,2,3,5,6,8,10
|
||||
uloops.vnle_order1 = [5,10:10:100];
|
||||
uloops.vnle_order2 = [0];
|
||||
uloops.vnle_order3 = [0];
|
||||
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
wh = submit_simulations(wh,"parallel",1,"simulation_mode",0);
|
||||
|
||||
end
|
||||
|
||||
|
||||
col = cbrewer2('spectral',6);%
|
||||
col=linspecer(5);
|
||||
cnt = 1;
|
||||
for n3 = uloops.vnle_order3
|
||||
|
||||
a = wh.getStoValue('ber',uloops.precomp, uloops.db_precode, uloops.bitrate , uloops.laser_wavelength, uloops.M, uloops.link_length,...
|
||||
uloops.vnle_order1,...
|
||||
uloops.vnle_order2,...
|
||||
n3);
|
||||
|
||||
ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
ber_db = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
log_bers = log10(ber_vnle + 1e-12);
|
||||
|
||||
figure(20)
|
||||
hold on
|
||||
title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,uloops.M));
|
||||
% plot(uloops.vnle_order1,ber_vnle,'DisplayName',sprintf('Tx precomp. + VNLE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt,:));
|
||||
plot(uloops.vnle_order1,ber_mlse,'DisplayName',sprintf('VNLE + Postfilter + ;MLSE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt,:));
|
||||
plot(uloops.vnle_order1,ber_db,'DisplayName',sprintf('DB tgt. VNLE + MLSE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt+2,:));
|
||||
xticks(uloops.vnle_order1([1:1:end]));
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([5e-5 0.4]);
|
||||
xlim([min(uloops.vnle_order1), max(uloops.vnle_order1) ]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot();
|
||||
xlabel('Number of 1st order coeff.');
|
||||
ylabel('BER');
|
||||
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
if 0
|
||||
uloops = struct;
|
||||
uloops.precomp = [0];
|
||||
uloops.db_precode = [0,1];
|
||||
uloops.bitrate = [420].*1e9; %[300,330,360,390,420,450,480]
|
||||
% uloops.laser_wavelength = [1293,1297.5,1302,1306.5,1310,1313.4,1318,1322.7,1327.4];
|
||||
uloops.laser_wavelength = [1293, 1302,1310,1318,1327.4];
|
||||
uloops.M = [4,6,8];
|
||||
uloops.link_length = [5]; % 1,2,3,5,6,8,10
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
wh = submit_simulations(wh,"parallel",1,"simulation_mode",0);
|
||||
end
|
||||
|
||||
col = cbrewer2('Set2',6);%
|
||||
col=linspecer(5);
|
||||
cnt = 1;
|
||||
|
||||
m = 8;
|
||||
|
||||
% a = wh.getStoValue('ber',1, 0, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
|
||||
% ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
|
||||
a = wh.getStoValue('ber',0, 0, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
|
||||
a = wh.getStoValue('ber',0, 1, uloops.bitrate , uloops.laser_wavelength, m, uloops.link_length);
|
||||
ber_db = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
|
||||
x_ax = uloops.laser_wavelength;
|
||||
|
||||
figure(21)
|
||||
hold on
|
||||
% title(sprintf('%d km | %d GBd | PAM %d',uloops.link_length,uloops.bitrate/log2(m).*1e-9,m));
|
||||
% plot(x_ax,ber_vnle,'DisplayName',sprintf('Tx precomp. + VNLE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt+1,:));
|
||||
plot(x_ax,ber_mlse,'DisplayName',sprintf('VNLE + Postfilter + MLSE'),'LineStyle','-','HandleVisibility','on','Color',colorsets.DeepRed.RGB);
|
||||
% plot(x_ax,ber_db,'DisplayName',sprintf('DB tgt. VNLE + MLSE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt,:));
|
||||
xticks(x_ax([1:1:end]));
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([5e-5 0.4]);
|
||||
xlim([min(x_ax)-3, max(x_ax)+3 ]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot();
|
||||
xlabel('Number of 1st order coeff.');
|
||||
ylabel('BER');
|
||||
|
||||
cnt = cnt+1;
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
% basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
% db = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
if 0
|
||||
|
||||
uloops = struct;
|
||||
uloops.precomp = [0];
|
||||
uloops.db_precode = [0];
|
||||
uloops.bitrate = [300,330,360,390,420,450,480].*1e9; %[300,330,360,390,420,450,480]
|
||||
uloops.laser_wavelength = [1310];
|
||||
uloops.M = [4];
|
||||
uloops.link_length = [2]; % 1,2,3,5,6,8,10
|
||||
uloops.vnle_order1 = [50];
|
||||
uloops.vnle_order2 = [7];
|
||||
uloops.vnle_order3 = [7];
|
||||
uloops.pf_ncoeffs = [1,2,3];
|
||||
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
wh = submit_simulations(wh,"parallel",1,"simulation_mode",0);
|
||||
|
||||
end
|
||||
|
||||
col = cbrewer2('spectral',6);%
|
||||
col=linspecer(5);
|
||||
cnt = 1;
|
||||
alpha = [];
|
||||
for n = uloops.pf_ncoeffs
|
||||
|
||||
a = wh.getStoValue('ber',uloops.precomp, uloops.db_precode, uloops.bitrate , uloops.laser_wavelength, uloops.M, uloops.link_length,...
|
||||
uloops.vnle_order1,...
|
||||
uloops.vnle_order2,...
|
||||
uloops.vnle_order3,...
|
||||
n);
|
||||
|
||||
ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
|
||||
% PF = cellfun(@(x) x.vnle_pf_package{1,1}.pf.coefficients, a,'UniformOutput',false);
|
||||
%
|
||||
% showTransferFunction(PF{3}.coefficients,"fignum",12,"color",clr.Set1.red,"DisplayName",['360 GBd']);
|
||||
%
|
||||
% showTransferFunction(PF{4}.coefficients,"fignum",12,"color",clr.Set1.blue,"DisplayName",['390 GBd']);
|
||||
%
|
||||
% showTransferFunction(PF{5}.coefficients,"fignum",12,'color',clr.Set1.green,"DisplayName",['420 GBd']);
|
||||
% ber_db = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
|
||||
x_ax = uloops.bitrate.*1e-9;
|
||||
|
||||
figure(23)
|
||||
hold on
|
||||
title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,uloops.M));
|
||||
if n==1
|
||||
plot(x_ax,ber_vnle,'DisplayName',sprintf('Tx precomp. + VNLE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt+4,:));
|
||||
end
|
||||
plot(x_ax,ber_mlse,'DisplayName',sprintf('VNLE + Postfilter + ;MLSE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt,:));
|
||||
% plot(x_ax,ber_db,'DisplayName',sprintf('DB tgt. VNLE + MLSE'),'LineStyle','-','HandleVisibility','on','Color',col(cnt+2,:));
|
||||
xticks(x_ax([1:1:end]));
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([1e-5 0.4]);
|
||||
xlim([min(x_ax(2:end)), max(x_ax) ]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot();
|
||||
xlabel('Gross Bitrate in Gbps');
|
||||
ylabel('BER');
|
||||
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
Binary file not shown.
186
projects/HighSpeedExperiment_2024/db_auswertung/rate_vs_ber.m
Normal file
186
projects/HighSpeedExperiment_2024/db_auswertung/rate_vs_ber.m
Normal file
@@ -0,0 +1,186 @@
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.db_encoded), ...
|
||||
'fiber_length', 10, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 0, ...
|
||||
'pam_level', 4, ...
|
||||
'rop_attenuation', 0, ...
|
||||
'wavelength', 1310 ...
|
||||
);
|
||||
|
||||
% filterParams.EqualizerParameters.diff_precode = int32(db_mode.db_encoded);
|
||||
% filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
filterParams.EqualizerParameters.DCmu = 0.00;
|
||||
|
||||
selectedFields = {'Configurations.run_id' 'Runs.rx_raw_path' 'Configurations.bitrate' 'Configurations.symbolrate' 'Configurations.pam_level'...
|
||||
'Configurations.db_mode' 'Configurations.rop_attenuation' 'Configurations.is_mpi' 'Configurations.interference_attenuation' ...
|
||||
'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'Measurements.power_pd_in' ...
|
||||
'Measurements.power_mpi_interference' 'Measurements.power_mpi_signal' 'Results.BER' 'Results.BER_precoded' 'Results.SNR' 'Results.GMI' 'Results.Alpha' 'Results.date_of_processing'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
fixedVars = {'eq_id','bitrate'};
|
||||
dataTableGrpd = groupIt(fixedVars,dataTable);
|
||||
|
||||
|
||||
plotRealizations = 0;
|
||||
|
||||
% Create a new figure
|
||||
figure();
|
||||
hold on
|
||||
unique_eq = unique(dataTable.eq_id);
|
||||
cols = linspecer(8);
|
||||
for i = 1:numel(unique_eq)
|
||||
|
||||
idx = find(dataTableGrpd.eq_id == unique_eq(i), 1, 'first');
|
||||
equalizer_ = equalizer_structure(dataTableGrpd.equalizer_structure(idx));
|
||||
|
||||
|
||||
loop_filt = dataTableGrpd.eq_id==unique_eq(i);
|
||||
|
||||
% Plot LINE: BER vs. interference_attenuation
|
||||
switch equalizer_
|
||||
case equalizer_structure.vnle
|
||||
bers = dataTableGrpd.BER(loop_filt,:);
|
||||
case equalizer_structure.vnle_pf_mlse
|
||||
bers = dataTableGrpd.BER(loop_filt,:);
|
||||
case equalizer_structure.vnle_db_mlse
|
||||
bers = dataTableGrpd.BER_precoded(loop_filt,:);
|
||||
case equalizer_structure.db_encoded
|
||||
bers = dataTableGrpd.BER(loop_filt,:);
|
||||
end
|
||||
|
||||
|
||||
name = sprintf('%s',equalizer_);
|
||||
|
||||
p = plot(dataTableGrpd.bitrate(loop_filt,:).*1e-9, bers, '-', 'LineWidth', 0.5,'Color',cols(i,:),'DisplayName',name);
|
||||
pair_one = {'Run ID', dataTableGrpd.run_id(loop_filt,:)};
|
||||
pair_two = {'Rate', dataTableGrpd.bitrate(loop_filt,:)};
|
||||
addDatatips(p, pair_one, pair_two);
|
||||
xticks(unique(dataTableGrpd.bitrate(loop_filt,:).*1e-9));
|
||||
|
||||
% Plot SCATTERS: BER vs. interference_attenuation
|
||||
|
||||
loop_filt = dataTable.eq_id==unique_eq(i);
|
||||
if plotRealizations
|
||||
switch equalizer_
|
||||
case equalizer_structure.vnle
|
||||
bers = dataTable.BER(loop_filt,:);
|
||||
case equalizer_structure.vnle_pf_mlse
|
||||
bers = dataTable.BER(loop_filt,:);
|
||||
case equalizer_structure.vnle_db_mlse
|
||||
bers = dataTable.BER_precoded(loop_filt,:);
|
||||
case equalizer_structure.db_encoded
|
||||
bers = dataTable.BER(loop_filt,:);
|
||||
end
|
||||
|
||||
sc = scatter(dataTable.bitrate(loop_filt,:).*1e-9, bers, 'LineWidth', 0.5,'Marker','*','MarkerEdgeColor',cols(i,:),'HandleVisibility','off');
|
||||
pair_one = {'Run ID', dataTable.run_id(loop_filt,:)};
|
||||
pair_two = {'Rate', dataTable.bitrate(loop_filt,:)};
|
||||
addDatatips(sc, pair_one, pair_two);
|
||||
xticks(unique(dataTable.bitrate(loop_filt,:).*1e-9));
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
% Label the axes and add a title
|
||||
xlabel('Bitrate in Gbps');
|
||||
ylabel('BER');
|
||||
title('Line Rate vs. BER');
|
||||
yline(3.8e-3,'LineWidth',1,'LineStyle','--','HandleVisibility','off');
|
||||
% Enable grid for better readability
|
||||
grid on;
|
||||
|
||||
beautifyBERplot;
|
||||
ylim([1e-4 0.5]);
|
||||
|
||||
|
||||
|
||||
function resultTable = groupIt(fixedVars,dataTable)
|
||||
|
||||
% Group by run_id and eq_id (adjust grouping keys as needed)
|
||||
|
||||
[G, groupKeys] = findgroups(dataTable(:, fixedVars));
|
||||
|
||||
% Preallocate a cell array for aggregated data.
|
||||
varNames = dataTable.Properties.VariableNames;
|
||||
nVars = numel(varNames);
|
||||
aggData = cell(height(groupKeys), nVars);
|
||||
groupCount = zeros(height(groupKeys), 1); % To store the size of each group
|
||||
|
||||
% Loop over each group.
|
||||
for i = 1:height(groupKeys)
|
||||
idx = (G == i); % Logical index for group i
|
||||
groupCount(i) = sum(idx); % Count number of rows in this group
|
||||
% For each variable in the table:
|
||||
for j = 1:nVars
|
||||
colData = dataTable.(varNames{j});
|
||||
if isnumeric(colData)
|
||||
% For numeric data, compute the mean.
|
||||
aggData{i, j} = min(colData(idx));
|
||||
else
|
||||
% For non-numeric data, take the first entry.
|
||||
if iscell(colData)
|
||||
aggData{i, j} = colData{find(idx, 1)};
|
||||
else
|
||||
aggData{i, j} = colData(find(idx, 1));
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Convert the aggregated cell array into a table.
|
||||
resultTable = cell2table(aggData, 'VariableNames', varNames);
|
||||
|
||||
% Append the group count as a new column.
|
||||
resultTable.nRows = groupCount;
|
||||
|
||||
end
|
||||
|
||||
|
||||
function addDatatips(sc, varargin)
|
||||
% addDatatips Adds custom data tip rows to a scatter plot.
|
||||
%
|
||||
% addDatatips(sc, pair1, pair2, ...) adds one or more custom rows to the
|
||||
% data tip display of the scatter plot identified by sc.
|
||||
%
|
||||
% Each pair should be provided as a 1x2 cell array: {label, value}.
|
||||
% The value can be a scalar or a vector. If a vector is provided, its length
|
||||
% must match the number of scatter plot points.
|
||||
%
|
||||
% Example:
|
||||
% sc = scatter(x, y, 'LineWidth', 1.5, 'Marker', 'o');
|
||||
% pair_one = {'Attenuation', attenuationVector};
|
||||
% addDatatips(sc, pair_one);
|
||||
|
||||
numPoints = numel(sc.XData);
|
||||
|
||||
for k = 1:length(varargin)
|
||||
pair = varargin{k};
|
||||
|
||||
if ~iscell(pair) || numel(pair) ~= 2
|
||||
error('Each pair must be a 1x2 cell array: {label, value}.');
|
||||
end
|
||||
|
||||
label = pair{1};
|
||||
value = pair{2};
|
||||
|
||||
% If value is a vector, ensure its length is either 1 or equal to the number of scatter points.
|
||||
if isvector(value) && numel(value) ~= 1 && numel(value) ~= numPoints
|
||||
error('The vector for "%s" must be a scalar or have %d elements matching the scatter data points.', label, numPoints);
|
||||
end
|
||||
|
||||
% Create a new data tip row using the provided label and vector.
|
||||
newRow = dataTipTextRow(label, value);
|
||||
sc.DataTipTemplate.DataTipRows(end+1) = newRow;
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,164 @@
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', 450e9, ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.no_db), ...
|
||||
'fiber_length', 10, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 0, ...
|
||||
'pam_level', 4, ...
|
||||
'rop_attenuation', 0, ...
|
||||
'wavelength', 1310 ...
|
||||
);
|
||||
|
||||
% filterParams.EqualizerParameters.diff_precode = int32(db_mode.db_encoded);
|
||||
% filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
filterParams.EqualizerParameters.DCmu = 0.00;
|
||||
|
||||
selectedFields = {'Configurations.run_id' 'Runs.rx_raw_path' 'Configurations.bitrate' 'Configurations.symbolrate' 'Configurations.pam_level'...
|
||||
'Configurations.db_mode' 'Configurations.rop_attenuation' 'Configurations.is_mpi' 'Configurations.interference_attenuation' ...
|
||||
'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'Measurements.power_pd_in' ...
|
||||
'Measurements.power_mpi_interference' 'Measurements.power_mpi_signal' 'Results.BER' 'Results.BER_precoded' 'Results.SNR' 'Results.GMI' 'Results.Alpha' 'Results.date_of_processing'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
fixedVars = {'eq_id','bitrate'};
|
||||
dataTableGrpd = groupIt(fixedVars,dataTable);
|
||||
|
||||
|
||||
plotRealizations = 1;
|
||||
|
||||
% Create a new figure
|
||||
figure();
|
||||
hold on
|
||||
unique_eq = unique(dataTable.eq_id);
|
||||
cols = linspecer(8);
|
||||
|
||||
for i = 1:numel(unique_eq)
|
||||
|
||||
idx = find(dataTableGrpd.eq_id == unique_eq(i), 1, 'first');
|
||||
equalizer_ = equalizer_structure(dataTableGrpd.equalizer_structure(idx));
|
||||
|
||||
% Plot SCATTERS: timestamp vs. interference_attenuation
|
||||
|
||||
loop_filt = dataTable.eq_id==unique_eq(i);
|
||||
if plotRealizations
|
||||
switch equalizer_
|
||||
case equalizer_structure.vnle
|
||||
bers = dataTable.BER(loop_filt,:);
|
||||
case equalizer_structure.vnle_pf_mlse
|
||||
bers = dataTable.BER(loop_filt,:);
|
||||
case equalizer_structure.vnle_db_mlse
|
||||
bers = dataTable.BER_precoded(loop_filt,:);
|
||||
case equalizer_structure.db_encoded
|
||||
bers = dataTable.BER(loop_filt,:);
|
||||
end
|
||||
date_of_proc = datetime(dataTable.date_of_processing(loop_filt,:));
|
||||
|
||||
sc = scatter(date_of_proc, bers, 'LineWidth', 0.5,'Marker','*','MarkerEdgeColor',cols(i,:),'HandleVisibility','off');
|
||||
pair_one = {'Run ID', dataTable.run_id(loop_filt,:)};
|
||||
pair_two = {'Rate', dataTable.bitrate(loop_filt,:)};
|
||||
addDatatips(sc, pair_one, pair_two);
|
||||
xticks(date_of_proc);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
% Label the axes and add a title
|
||||
xlabel('Time of Processing');
|
||||
ylabel('BER');
|
||||
title('Line Rate vs. BER');
|
||||
yline(3.8e-3,'LineWidth',1,'LineStyle','--','HandleVisibility','off');
|
||||
% Enable grid for better readability
|
||||
grid on;
|
||||
|
||||
beautifyBERplot;
|
||||
ylim([1e-4 0.5]);
|
||||
|
||||
|
||||
|
||||
function resultTable = groupIt(fixedVars,dataTable)
|
||||
|
||||
% Group by run_id and eq_id (adjust grouping keys as needed)
|
||||
|
||||
[G, groupKeys] = findgroups(dataTable(:, fixedVars));
|
||||
|
||||
% Preallocate a cell array for aggregated data.
|
||||
varNames = dataTable.Properties.VariableNames;
|
||||
nVars = numel(varNames);
|
||||
aggData = cell(height(groupKeys), nVars);
|
||||
groupCount = zeros(height(groupKeys), 1); % To store the size of each group
|
||||
|
||||
% Loop over each group.
|
||||
for i = 1:height(groupKeys)
|
||||
idx = (G == i); % Logical index for group i
|
||||
groupCount(i) = sum(idx); % Count number of rows in this group
|
||||
% For each variable in the table:
|
||||
for j = 1:nVars
|
||||
colData = dataTable.(varNames{j});
|
||||
if isnumeric(colData)
|
||||
% For numeric data, compute the mean.
|
||||
aggData{i, j} = min(colData(idx));
|
||||
else
|
||||
% For non-numeric data, take the first entry.
|
||||
if iscell(colData)
|
||||
aggData{i, j} = colData{find(idx, 1)};
|
||||
else
|
||||
aggData{i, j} = colData(find(idx, 1));
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Convert the aggregated cell array into a table.
|
||||
resultTable = cell2table(aggData, 'VariableNames', varNames);
|
||||
|
||||
% Append the group count as a new column.
|
||||
resultTable.nRows = groupCount;
|
||||
|
||||
end
|
||||
|
||||
|
||||
function addDatatips(sc, varargin)
|
||||
% addDatatips Adds custom data tip rows to a scatter plot.
|
||||
%
|
||||
% addDatatips(sc, pair1, pair2, ...) adds one or more custom rows to the
|
||||
% data tip display of the scatter plot identified by sc.
|
||||
%
|
||||
% Each pair should be provided as a 1x2 cell array: {label, value}.
|
||||
% The value can be a scalar or a vector. If a vector is provided, its length
|
||||
% must match the number of scatter plot points.
|
||||
%
|
||||
% Example:
|
||||
% sc = scatter(x, y, 'LineWidth', 1.5, 'Marker', 'o');
|
||||
% pair_one = {'Attenuation', attenuationVector};
|
||||
% addDatatips(sc, pair_one);
|
||||
|
||||
numPoints = numel(sc.XData);
|
||||
|
||||
for k = 1:length(varargin)
|
||||
pair = varargin{k};
|
||||
|
||||
if ~iscell(pair) || numel(pair) ~= 2
|
||||
error('Each pair must be a 1x2 cell array: {label, value}.');
|
||||
end
|
||||
|
||||
label = pair{1};
|
||||
value = pair{2};
|
||||
|
||||
% If value is a vector, ensure its length is either 1 or equal to the number of scatter points.
|
||||
if isvector(value) && numel(value) ~= 1 && numel(value) ~= numPoints
|
||||
error('The vector for "%s" must be a scalar or have %d elements matching the scatter data points.', label, numPoints);
|
||||
end
|
||||
|
||||
% Create a new data tip row using the provided label and vector.
|
||||
newRow = dataTipTextRow(label, value);
|
||||
sc.DataTipTemplate.DataTipRows(end+1) = newRow;
|
||||
end
|
||||
end
|
||||
@@ -5,141 +5,307 @@ if 1
|
||||
uloops = struct;
|
||||
uloops.precomp = [1];
|
||||
uloops.db_precode = [0];
|
||||
uloops.bitrate = [300,330,360,390,420,450,480].*1e9; %[300,330,360,390,420,450,480]
|
||||
% uloops.bitrate = 390e9;
|
||||
uloops.bitrate = [224].*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.M = [6];
|
||||
uloops.link_length = [2]; % 1,2,3,5,6,8,10
|
||||
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];
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
wh = submit_simulations(wh,"parallel",0,"simulation_mode",0);
|
||||
|
||||
% wh = submit_simulations(wh,"parallel",0,"simulation_mode",0);
|
||||
wh = submit_handle(@imdd_model,wh,"parallel",1);
|
||||
|
||||
end
|
||||
|
||||
wh_ana = wh;
|
||||
wh_ana = wh_master;
|
||||
|
||||
ber_mlse = {};
|
||||
ber_vnle = {};
|
||||
inf_rate_vnle ={};
|
||||
cols = cbrewer2('Paired',8);
|
||||
|
||||
ber_dbtgt ={};
|
||||
figure()
|
||||
|
||||
ber_dbenc ={};
|
||||
alpha = {};
|
||||
ber_dfe = {};
|
||||
ngmi = [];
|
||||
for precomp = [0,1]
|
||||
wavelength=uloops.laser_wavelength;
|
||||
for m = [6]
|
||||
|
||||
wavelength=uloops.laser_wavelength;
|
||||
for m = [4,6,8]
|
||||
%1302
|
||||
%VNLE
|
||||
precomp = 1;
|
||||
precode = 0;
|
||||
a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , wavelength, m, uloops.link_length);
|
||||
ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
|
||||
%MLSE
|
||||
% precomp = 0;
|
||||
% precode = 1;
|
||||
a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , wavelength, m, uloops.link_length);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
|
||||
%DB
|
||||
% precomp = 0;
|
||||
% precode = 1;
|
||||
a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , wavelength, m, uloops.link_length);
|
||||
ber_dbtgt = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
|
||||
figure(m+20)
|
||||
hold on
|
||||
title(sprintf('%d km | %d nm | PAM %d',uloops.link_length,wavelength,m));
|
||||
|
||||
plot(uloops.bitrate,ber_vnle,'DisplayName',sprintf('VNLE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
|
||||
|
||||
plot(uloops.bitrate,ber_dbtgt,'DisplayName',sprintf('DB tgt. + MLSE',uloops.link_length,uloops.M),'Color',cols(1,:),'LineStyle','-','HandleVisibility','on');
|
||||
|
||||
plot(uloops.bitrate,ber_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE',uloops.link_length,uloops.M),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
|
||||
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([5e-5 0.3]);
|
||||
% xlim([min(uloops.bitrate.*1e-9), max(uloops.bitrate.*1e-9) ]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot()
|
||||
xlabel('Bit Rate in Gbps');
|
||||
ylabel('BER');
|
||||
end
|
||||
baudrate = wh_ana.parameter.bitrate.values;
|
||||
|
||||
|
||||
cols = linspecer(7);%cbrewer2('Set2',10);
|
||||
%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);
|
||||
|
||||
for w = uloops.laser_wavelength
|
||||
|
||||
figure(w)
|
||||
figcnt = 0;
|
||||
|
||||
for precode = uloops.db_precode
|
||||
|
||||
for precomp = uloops.precomp
|
||||
|
||||
for m = uloops.M
|
||||
|
||||
a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , w, m, uloops.link_length);
|
||||
ber_dbtgt = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
|
||||
ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
|
||||
figcnt = figcnt+1;
|
||||
subplot(4,3,figcnt);
|
||||
hold on
|
||||
title(sprintf('precomp = %d | precode = %d | %d km | %d nm | PAM %d',precomp,precode,uloops.link_length,w,m));
|
||||
|
||||
plot(uloops.bitrate,ber_dbtgt,'DisplayName',sprintf('DB tgt. + MLSE',uloops.link_length,uloops.M),'Color',cols(1,:),'LineStyle','-','HandleVisibility','on');
|
||||
|
||||
plot(uloops.bitrate,ber_vnle,'DisplayName',sprintf('VNLE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
|
||||
|
||||
plot(uloops.bitrate,ber_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE',uloops.link_length,uloops.M),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
|
||||
|
||||
% plot(uloops.bitrate,cellfun(@min, ber_dfe),'DisplayName',sprintf('VNLE + DFE',uloops.link_length,uloops.M),'Color',cols(2,:),'LineStyle','--');
|
||||
|
||||
% plot(uloops.bitrate,cellfun(@min, ber_dbenc),'DisplayName',sprintf('DB Encoded',uloops.link_length,uloops.M),'Color',cols(5,:),'LineStyle','-');
|
||||
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([5e-5 0.5]);
|
||||
% xlim([min(uloops.bitrate.*1e-9), max(uloops.bitrate.*1e-9) ]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot()
|
||||
xlabel('Bit Rate in Gbps');
|
||||
ylabel('Channel Wavelength (nm)');
|
||||
|
||||
end
|
||||
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);
|
||||
%
|
||||
%
|
||||
% for w = uloops.laser_wavelength
|
||||
%
|
||||
% figure(w)
|
||||
% figcnt = 0;
|
||||
%
|
||||
% for precode = uloops.db_precode
|
||||
%
|
||||
% for precomp = uloops.precomp
|
||||
%
|
||||
% for m = uloops.M
|
||||
%
|
||||
% a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , w, m, uloops.link_length);
|
||||
% ber_dbtgt = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
%
|
||||
% ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
%
|
||||
% ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
%
|
||||
% figcnt = figcnt+1;
|
||||
% subplot(4,3,figcnt);
|
||||
% hold on
|
||||
% title(sprintf('precomp = %d | precode = %d | %d km | %d nm | PAM %d',precomp,precode,uloops.link_length,w,m));
|
||||
%
|
||||
% plot(uloops.bitrate,ber_dbtgt,'DisplayName',sprintf('DB tgt. + MLSE',uloops.link_length,uloops.M),'Color',cols(1,:),'LineStyle','-','HandleVisibility','on');
|
||||
%
|
||||
% plot(uloops.bitrate,ber_vnle,'DisplayName',sprintf('VNLE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
|
||||
%
|
||||
% plot(uloops.bitrate,ber_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE',uloops.link_length,uloops.M),'Color',cols(4,:),'LineStyle','-','HandleVisibility','on');
|
||||
%
|
||||
% % plot(uloops.bitrate,cellfun(@min, ber_dfe),'DisplayName',sprintf('VNLE + DFE',uloops.link_length,uloops.M),'Color',cols(2,:),'LineStyle','--');
|
||||
%
|
||||
% % plot(uloops.bitrate,cellfun(@min, ber_dbenc),'DisplayName',sprintf('DB Encoded',uloops.link_length,uloops.M),'Color',cols(5,:),'LineStyle','-');
|
||||
%
|
||||
% set(gca, 'YScale', 'log');
|
||||
% ylim([5e-5 0.5]);
|
||||
% % xlim([min(uloops.bitrate.*1e-9), max(uloops.bitrate.*1e-9) ]);
|
||||
% yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
% legend
|
||||
% beautifyBERplot()
|
||||
% xlabel('Bit Rate in Gbps');
|
||||
% ylabel('Channel Wavelength (nm)');
|
||||
%
|
||||
% end
|
||||
% end
|
||||
% end
|
||||
% end
|
||||
|
||||
tp = TransmissionPerformance;
|
||||
netRatesVNLE = tp.calculateNetRate(uloops.bitrate, 'NGMI', cellfun(@min, inf_rate_vnle)./log2(uloops.M), 'BER', cellfun(@min, ber_vnle));
|
||||
|
||||
pam8= [2.9515 2.9284 2.9203 2.9311 2.8473 2.7740 2.6253];
|
||||
pam6 = [2.5280 2.5452 2.5579 2.5549 2.5272 2.4243 2.2617];
|
||||
pam4 = [ 1.9982 1.9972 1.9690 1.7909 1.2493 0.8014 0.6385];
|
||||
|
||||
figure(6)
|
||||
hold on
|
||||
title(sprintf('Performance at 1310 for all lengths'));
|
||||
% plot(uloops.bitrate.*1e-9,cellfun(@min, inf_rate_vnle),'DisplayName',sprintf('NGMI VNLE; %d km',uloops.link_length),'Color',cols(3,:),'LineStyle',':');
|
||||
plot(uloops.bitrate.*1e-9,pam4/2,'DisplayName',sprintf('GMI VNLE; PAM 4'),'Color',cols(1,:),'LineStyle',':');
|
||||
plot(uloops.bitrate.*1e-9,pam6/log2(6),'DisplayName',sprintf('GMI VNLE; PAM 6'),'Color',cols(2,:),'LineStyle',':');
|
||||
plot(uloops.bitrate.*1e-9,pam8/3,'DisplayName',sprintf('GMI VNLE; PAM 8'),'Color',cols(3,:),'LineStyle',':');
|
||||
xlabel('Gross Bitrate in Gbps');
|
||||
ylabel('NGMI')
|
||||
beautifyBERplot()
|
||||
ylim([0,1]);
|
||||
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));
|
||||
@@ -160,7 +326,7 @@ legend
|
||||
% plot(uloops.bitrate.*1e-9,ber_dfe,'DisplayName',sprintf('NGMI MLSE; %d km',len),'Color',cols(1,:),'LineStyle','-');
|
||||
% plot(uloops.bitrate.*1e-9,ber_mlse,'DisplayName',sprintf('NGMI MLSE; %d km',len),'Color',cols(1,:),'LineStyle','-');
|
||||
% plot(uloops.bitrate.*1e-9,ber_db,'DisplayName',sprintf('NGMI VNLE; %d km',len),'Color',cols(2,:),'LineStyle','-');
|
||||
%
|
||||
%
|
||||
% set(gca, 'YScale', 'log');
|
||||
% ylim([1e-5, 0.1]);
|
||||
% yline([3.8e-3;1e-2],'LineWidth',1,'HandleVisibility','off');
|
||||
@@ -172,13 +338,13 @@ legend
|
||||
% for alpha = uloops.alpha
|
||||
% for precode = uloops.db_precode
|
||||
% for precomp = uloops.precomp
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% cols = linspecer(6);%cbrewer2('Set2',10);
|
||||
% cnt = 1;
|
||||
% a = wh.getStoValue('ber',alpha,uloops.vnle_order2,uloops.vnle_order3,precomp, precode, uloops.bitrate,uloops.M);
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% for i = 1:numel(a)
|
||||
% ber_db(i) = mean((a{i}.ber_db));
|
||||
% ber_vnle(i) = mean((a{i}.ber_vnle));
|
||||
@@ -186,98 +352,98 @@ legend
|
||||
% ber_mlse(i) = mean((a{i}.ber_mlse));
|
||||
% pf_taps(i) = a{i}.pf_taps{1}(2);
|
||||
% vnle_taps(i,:) = a{i}.eq_vnle{1}.e;
|
||||
%
|
||||
%
|
||||
% figure(222)
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% subplot(7,3,3*(i-1)+1)
|
||||
% ylim([-0.5 1]);
|
||||
% title(sprintf('%d GBps',uloops.bitrate(i).*1e-9));
|
||||
% hold on
|
||||
% stem(a{i}.eq_vnle{1}.e)
|
||||
%
|
||||
%
|
||||
% subplot(7,3,3*(i-1)+2)
|
||||
% ylim([-0.5 1]);
|
||||
% title(sprintf('%d GBps',uloops.bitrate(i).*1e-9));
|
||||
% hold on
|
||||
% stem(a{i}.eq_vnle{1}.e2)
|
||||
%
|
||||
%
|
||||
% subplot(7,3,3*(i-1)+3)
|
||||
% ylim([-0.5 1]);
|
||||
% title(sprintf('%d GBps',uloops.bitrate(i).*1e-9));
|
||||
% hold on
|
||||
% stem(a{i}.eq_vnle{1}.e3)
|
||||
%
|
||||
%
|
||||
% showEQNoisePSD(a{i}.noise_vnle{1},"fignum",220,"displayname",sprintf('%d 2nd order taps; %d GBps',vnle_order2,uloops.bitrate(i).*1e-9),"postfilter_taps",a{i}.pf_taps{1});
|
||||
%
|
||||
%
|
||||
% eq_sig = a{i}.signal_vnle{1};
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% end
|
||||
%
|
||||
%
|
||||
% figure()
|
||||
% hold on
|
||||
%
|
||||
%
|
||||
% if precomp
|
||||
% lsty = '-';
|
||||
% else
|
||||
% lsty = '-';
|
||||
% end
|
||||
%
|
||||
%
|
||||
% if precode
|
||||
% coloffset = 1;
|
||||
% else
|
||||
% coloffset=1;
|
||||
% end
|
||||
%
|
||||
%
|
||||
% % plot(uloops.bitrate,ber_mlse,'DisplayName',sprintf('Precomp: %d; Precode %d',precomp,precode),'Color',cols(cnt,:));
|
||||
% title(sprintf('Precomp: %d; Precode %d',precomp,precode));
|
||||
% plot(uloops.bitrate.*1e-9,ber_vnle,'DisplayName','VNLE','Color',cols(4,:),'LineStyle',lsty);
|
||||
% plot(uloops.bitrate.*1e-9,ber_vnle_dfe,'DisplayName','VNLE+DFE','Color',cols(2,:),'LineStyle',lsty);
|
||||
% plot(uloops.bitrate.*1e-9,ber_mlse,'DisplayName','VNLE+PF+MLSE','Color',cols(3,:),'LineStyle',lsty);
|
||||
% plot(uloops.bitrate.*1e-9,ber_db,'DisplayName','DB tgt.','Color',cols(1,:),'LineStyle',lsty);
|
||||
%
|
||||
%
|
||||
% cnt = cnt+1;
|
||||
% yline([3.8e-3;1e-2],'LineWidth',1,'HandleVisibility','off');
|
||||
% beautifyBERplot()
|
||||
% end
|
||||
% end
|
||||
% end
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% for vnle_order3 = uloops.vnle_order3([1,3,5,7,9,10])
|
||||
% cnt = 0;
|
||||
% for vnle_order2 = 3%= uloops.vnle_order2
|
||||
% for precode = uloops.db_precode
|
||||
% for precomp = uloops.precomp
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% cols = linspecer(10);%cbrewer2('Set2',10);
|
||||
% cnt = cnt+1;
|
||||
% a = wh.getStoValue('ber',vnle_order2,vnle_order3,precomp, precode, uloops.bitrate,uloops.M);
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% ber_db(cnt) = mean((a{1}.ber_db));
|
||||
% ber_vnle(cnt) = mean((a{1}.ber_vnle));
|
||||
% ber_vnle_dfe(cnt) = mean((a{1}.ber_vnle_dfe));
|
||||
% ber_mlse(cnt) = mean((a{1}.ber_mlse));
|
||||
% pf_taps(cnt) = a{1}.pf_taps{1}(2);
|
||||
%
|
||||
%
|
||||
% showEQNoisePSD(a{1}.noise_vnle{1},"fignum",220,"displayname",sprintf('%d 3rd order taps; %d GBps',vnle_order3,uloops.bitrate(i).*1e-9));
|
||||
%
|
||||
%
|
||||
% eq_sig = a{1}.signal_vnle{1};
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% end
|
||||
% end
|
||||
% end
|
||||
%
|
||||
%
|
||||
% figure(180)
|
||||
% hold on
|
||||
% scatter(uloops.vnle_order2,ber_mlse,'MarkerEdgeColor',cols(vnle_order3,:),'LineWidth',1,'DisplayName',sprintf('%d 3rd order taps',vnle_order3));
|
||||
% ylim([1e-3 0.5]);
|
||||
%
|
||||
%
|
||||
% end
|
||||
% title(sprintf('%d GBps',uloops.bitrate(i).*1e-9));
|
||||
% ylabel('BER');
|
||||
@@ -287,7 +453,7 @@ legend
|
||||
|
||||
% r = 1;
|
||||
% for rate = uloops.bitrate
|
||||
%
|
||||
%
|
||||
% i = 1;
|
||||
% for alpha = uloops.alpha
|
||||
% cols = linspecer(7);%cbrewer2('Set2',10);
|
||||
@@ -297,24 +463,24 @@ legend
|
||||
% pf_taps(i) = a{1}.pf_taps{1}(2);
|
||||
% i = i+1;
|
||||
% end
|
||||
%
|
||||
%
|
||||
% figure(150)
|
||||
% hold on
|
||||
% scatter(pf_taps(1),ber_mlse(1),200,'DisplayName','Burg','MarkerEdgeColor',cols(r,:),'Marker','x','LineWidth',2,'HandleVisibility','off');
|
||||
% plot(uloops.alpha(2:end),ber_mlse(2:end),'DisplayName',sprintf('%d GBps',rate.*1e-9),'Color',cols(r,:),'LineStyle','-');
|
||||
% r=r+1;
|
||||
%
|
||||
%
|
||||
% end
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% % title(sprintf('%d GBps',uloops.bitrate.*1e-9));
|
||||
% ylabel('BER');
|
||||
% xlabel('Alpha');
|
||||
% yline([3.8e-3;1e-2],'LineWidth',1,'HandleVisibility','off');
|
||||
% beautifyBERplot()
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% figure(2024)
|
||||
% hold on
|
||||
% for j = 1:numel(uloops.vnle_order3)
|
||||
@@ -323,23 +489,23 @@ legend
|
||||
% ber_mlse(i) = all2nd{i}.ber_mlse;
|
||||
% ber_vnle(i) = all2nd{i}.ber_vnle;
|
||||
% pf_taps(:,i) = all2nd{i}.pf_taps;
|
||||
%
|
||||
%
|
||||
% end
|
||||
% plot(uloops.vnle_order2,ber_mlse,'DisplayName',sprintf('%d 3rd order',uloops.vnle_order3(j)));
|
||||
% end
|
||||
%
|
||||
%
|
||||
% yline(3.8e-3,'LineWidth',2,'DisplayName','3.8e-3');
|
||||
% yline(2e-2,'LineWidth',2,'LineStyle','--','DisplayName','2e-2');
|
||||
% beautifyBERplot()
|
||||
% legend
|
||||
%
|
||||
%
|
||||
% figure(2025)
|
||||
% clf; % Clear figure so we start fresh
|
||||
%
|
||||
%
|
||||
% numJ = numel(uloops.vnle_order3);
|
||||
% numI = numel(uloops.vnle_order2);
|
||||
% ber_mlse_mat = zeros(numJ, numI);
|
||||
%
|
||||
%
|
||||
% % Gather data into a 2D matrix
|
||||
% for j = 1:numJ
|
||||
% all2nd = wh.getStoValue('ber', uloops.vnle_order3(j), uloops.vnle_order2, uloops.bitrate, uloops.M);
|
||||
@@ -347,21 +513,21 @@ legend
|
||||
% ber_mlse_mat(j,i) = all2nd{i}.ber_mlse;
|
||||
% end
|
||||
% end
|
||||
%
|
||||
%
|
||||
% % Create a 2D plot
|
||||
% % 'imagesc' displays the matrix as an image with a colorbar.
|
||||
% imagesc(uloops.vnle_order2, uloops.vnle_order3, ber_mlse_mat);
|
||||
% set(gca,'YDir','normal'); % Ensure that lower vnle_order3 is at the bottom
|
||||
% colorbar; % Add a colorbar to show BER scale
|
||||
%
|
||||
%
|
||||
% xlabel('VNLE Order 2');
|
||||
% ylabel('VNLE Order 3');
|
||||
% title('BER MLSE as a function of VNLE Orders');
|
||||
%
|
||||
%
|
||||
% % If you want to highlight certain BER levels, you can add contour lines:
|
||||
% hold on;
|
||||
% [C,h] = contour(uloops.vnle_order2, uloops.vnle_order3, ber_mlse_mat, [3.8e-3, 2e-2], 'LineWidth',2,'LineColor','k');
|
||||
% clabel(C,h,'Color','k','FontWeight','bold');
|
||||
%
|
||||
%
|
||||
% beautifyBERplot();
|
||||
% legend('BER contour lines');
|
||||
@@ -1,4 +1,6 @@
|
||||
function [output] = imdd_model(simulation_mode,varargin)
|
||||
function [output] = imdd_model(varargin)
|
||||
|
||||
simulation_mode = 0;
|
||||
|
||||
%%% Change folder
|
||||
curFolder = pwd;
|
||||
@@ -17,6 +19,9 @@ fdac = 256e9;
|
||||
fadc = 256e9;
|
||||
random_key = 1;
|
||||
|
||||
interference_attenuation = 0;
|
||||
is_mpi = 1;
|
||||
|
||||
precomp = 0;
|
||||
db_precode = 0;
|
||||
|
||||
@@ -35,7 +40,7 @@ tx_bw_nyquist = 0.8;
|
||||
link_length = 1;
|
||||
|
||||
% RX
|
||||
rop = -8;
|
||||
rop = -5;
|
||||
rx_bw_nyquist = 0.8;
|
||||
|
||||
vnle_order1 = 50;
|
||||
@@ -45,6 +50,7 @@ vnle_order3 = 7;
|
||||
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||
dfe_order = [0 0 0];
|
||||
|
||||
pf_ncoeffs = 1;
|
||||
|
||||
alpha = 0;
|
||||
|
||||
@@ -54,6 +60,7 @@ mu_ffe1 = 0.0001;
|
||||
mu_ffe2 = 0.0008;
|
||||
mu_ffe3 = 0.001;
|
||||
mu_dc = 0.005;
|
||||
% mu_dc = 0;
|
||||
|
||||
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
|
||||
mu_dfe = 0.0004;
|
||||
@@ -61,7 +68,7 @@ mu_dfe = 0.0004;
|
||||
|
||||
dfe_ = sum(dfe_order)>0;
|
||||
|
||||
doub_mode = db_mode.db_precoded;
|
||||
doub_mode = db_mode.no_db;
|
||||
|
||||
%%% change specific parameter if given in varargin
|
||||
% Parse optional input arguments
|
||||
@@ -132,10 +139,15 @@ f_nyquist = fsym/2;
|
||||
%%% run the simulation or measurement or ...
|
||||
if simulation_mode
|
||||
|
||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rcalpha);
|
||||
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",17,"useprbs",1,...
|
||||
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||
"fs_out",fdac,...
|
||||
"applyclipping",0,"clipfactor",1.5,...
|
||||
"applypulseform",apply_pulsef,"pulseformer",Pform,...
|
||||
@@ -143,7 +155,9 @@ if simulation_mode
|
||||
"db_precode",db_precode,"db_encode",db_encode,...
|
||||
"mrds_code",0,"mrds_blocklength",512).process();
|
||||
|
||||
% Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||
Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||
|
||||
|
||||
|
||||
%%%%% AWG
|
||||
% El_sig = M8199A("kover",kover).process(Digi_sig);
|
||||
@@ -207,7 +221,7 @@ else
|
||||
'fiber_length', link_length, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 0, ...
|
||||
'is_mpi', is_mpi, ...
|
||||
'pam_level', M, ...
|
||||
'precomp_amp', [], ...
|
||||
'rop_attenuation', 0, ...
|
||||
@@ -218,7 +232,8 @@ else
|
||||
);
|
||||
|
||||
selectedFields = {'Runs.run_id','Runs.tx_bits_path', 'Runs.tx_symbols_path', 'Runs.rx_sync_path','Runs.rx_raw_path',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias'};
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias',...
|
||||
'Configurations.interference_attenuation'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
[~, uniqueIdx] = unique(dataTable.run_id); % Get unique run_id indices
|
||||
@@ -236,13 +251,14 @@ else
|
||||
|
||||
|
||||
% Raw_signal = load([basePath, char(dataTable.rx_raw_path(1))]);
|
||||
% Raw_signal.Scpe_sig_raw.plot("displayname",'0db atten','fignum',10101)
|
||||
% Raw_signal = Raw_signal.Scpe_sig_raw;
|
||||
%
|
||||
% Raw_signal = Filter('filtdegree',4,"f_cutoff",Symbols.fs.*0.55,"fs",Raw_signal.fs,"filterType",filtertypes.gaussian,"active",true).process(Raw_signal);
|
||||
%
|
||||
Scpe_cell{1}.eye(fsym,M,"displayname",'eye','fignum',227);
|
||||
% Scpe_cell{1}.eye(fsym,M,"displayname",'eye','fignum',227);
|
||||
%
|
||||
% Raw_signal.spectrum("normalizeTo0dB",0,"fignum",336,"fft_length",2^12);
|
||||
% Raw_signal.spectrum("normalizeTo0dB",0,"fignum",11,"fft_length",2^12);
|
||||
% Raw_signal.move_it_spectrum("fignum",334);
|
||||
% Raw_signal.move_it_spectrum("fignum",334);
|
||||
|
||||
@@ -261,7 +277,7 @@ dbtgt_package = {};
|
||||
|
||||
|
||||
proc_occ = min(1,length(Scpe_cell));
|
||||
for occ = 1:proc_occ
|
||||
for occ = 1%:proc_occ
|
||||
|
||||
Scpe_sig = Scpe_cell{occ};
|
||||
|
||||
@@ -269,11 +285,18 @@ for occ = 1:proc_occ
|
||||
Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
% [Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym);
|
||||
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym);
|
||||
|
||||
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);
|
||||
%
|
||||
% 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
|
||||
|
||||
@@ -283,15 +306,17 @@ for occ = 1:proc_occ
|
||||
% 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);
|
||||
|
||||
mu_ffe = [mu_ffe1 mu_ffe2 mu_ffe3];
|
||||
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||
|
||||
% %%%%% VNLE + DFE %%%%
|
||||
if 1
|
||||
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",1,"ideal_dfe",0);
|
||||
|
||||
[result] = vnle(eq_vnle_dfe,M,Scpe_sig,Symbols,Tx_bits,"precode_mode",doub_mode,"showAnalysis",1);
|
||||
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
|
||||
@@ -299,7 +324,7 @@ for occ = 1:proc_occ
|
||||
% 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",1,"useBurg",1);
|
||||
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);
|
||||
@@ -314,7 +339,7 @@ for occ = 1:proc_occ
|
||||
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',1);
|
||||
[result] = duobinary_target(eq_db, mlse_db, M, Scpe_sig, Symbols, Tx_bits, "precode_mode", doub_mode,'showAnalysis',0);
|
||||
dbtgt_package{occ} = result;
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
precomp_path = "C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\standard_system";
|
||||
precomp_filename = "lab_mpi_setup_2";
|
||||
precomp_path = "C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\precomp";
|
||||
precomp_filename = "lab_high_speed";
|
||||
|
||||
freqresp = ChannelFreqResp("Nacq",1024,"Navg",64,"Ncp",63,'f_ref',92e9);
|
||||
freqresp.load('loadPath',precomp_path,'fileName',precomp_filename);
|
||||
|
||||
BIN
projects/Messung_Zürich/AIR_simp_new.fig
Normal file
BIN
projects/Messung_Zürich/AIR_simp_new.fig
Normal file
Binary file not shown.
BIN
projects/Messung_Zürich/BER_ief.fig
Normal file
BIN
projects/Messung_Zürich/BER_ief.fig
Normal file
Binary file not shown.
BIN
projects/Messung_Zürich/BER_simp_new.fig
Normal file
BIN
projects/Messung_Zürich/BER_simp_new.fig
Normal file
Binary file not shown.
BIN
projects/Messung_Zürich/NDR_simp_new.fig
Normal file
BIN
projects/Messung_Zürich/NDR_simp_new.fig
Normal file
Binary file not shown.
BIN
projects/Messung_Zürich/NGMI_ief.fig
Normal file
BIN
projects/Messung_Zürich/NGMI_ief.fig
Normal file
Binary file not shown.
BIN
projects/Messung_Zürich/NGMI_simp_new.fig
Normal file
BIN
projects/Messung_Zürich/NGMI_simp_new.fig
Normal file
Binary file not shown.
85
projects/Messung_Zürich/change_filenames.m
Normal file
85
projects/Messung_Zürich/change_filenames.m
Normal 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);
|
||||
366
projects/Messung_Zürich/dsp_all_files.m
Normal file
366
projects/Messung_Zürich/dsp_all_files.m
Normal file
@@ -0,0 +1,366 @@
|
||||
|
||||
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 = {'20250221T004926' '20250221T023534' '20250221T024256' '20250221T024629' '20250221T024929' '20250221T025305' '20250221T025505' '20250221T025856' '20250221T030122' '20250221T030311' '20250221T030513'};
|
||||
end
|
||||
|
||||
if 0
|
||||
uloops = struct;
|
||||
uloops.filecode = file_codes;
|
||||
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",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
|
||||
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
% netRateVNLE = TransmissionPerformance().calculateNetRate(log2(M)*baudrate,'NGMI',best_gmi_vnle./log2(M), 'BER',best_vnle);
|
||||
|
||||
vnle = 1;
|
||||
end
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
|
||||
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);
|
||||
|
||||
|
||||
cols = cbrewer2('Set1',8);
|
||||
hold on
|
||||
title(sprintf('Net Bitrate'));
|
||||
xax = baudrate.*1e-9;
|
||||
|
||||
if M == 2 || M == 4
|
||||
|
||||
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
|
||||
203
projects/Messung_Zürich/dsp_ief_file.m
Normal file
203
projects/Messung_Zürich/dsp_ief_file.m
Normal file
@@ -0,0 +1,203 @@
|
||||
|
||||
function [results] = dsp_ief_file(varargin)
|
||||
|
||||
mu_ffe1 = 0.0001;
|
||||
mu_ffe2 = 0.0008;
|
||||
mu_ffe3 = 0.001;
|
||||
mu_dc = 0.0003; %0.0003;
|
||||
|
||||
mu_dfe_training = 0.0004;
|
||||
vnle_order1 = 50;
|
||||
vnle_order2 = 3;
|
||||
vnle_order3 = 3;
|
||||
|
||||
dfe_mu = 0.0005;
|
||||
|
||||
|
||||
tcorrect = 0;
|
||||
%%% change specific parameter if given in varargin
|
||||
% Parse optional input arguments
|
||||
if ~isempty(varargin)
|
||||
var_s = varargin{1};
|
||||
if isstruct(var_s)
|
||||
fields = fieldnames(var_s);
|
||||
for i = 1:numel(fields)
|
||||
if isnumeric(fields{i})
|
||||
eval([fields{i}, ' = ', num2str( var_s.(fields{i}) ), ';']);
|
||||
fprintf("%s <-- %.2f \n", fields{i}, var_s.(fields{i}));
|
||||
else
|
||||
eval([fields{i}, ' = ', 'var_s.(fields{',num2str(i),'})' , ';']);
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
error('Optional variables should be passed as a struct.');
|
||||
end
|
||||
end
|
||||
|
||||
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');
|
||||
if isempty(tokens)
|
||||
error('Filename format not recognized.');
|
||||
end
|
||||
|
||||
tokens = tokens{1};
|
||||
|
||||
% Convert values
|
||||
config.P_laser = str2double(strrep(tokens{1}, 'p', '.'));
|
||||
config.P_pd = str2double(strrep(tokens{2}, 'p', '.'));
|
||||
config.fsym = str2double(tokens{3}) * 1e9; % Convert GBd to Hz
|
||||
config.M = str2double(tokens{4});
|
||||
|
||||
% Display results
|
||||
fprintf('Loaded file: %s\n', filename);
|
||||
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);
|
||||
|
||||
%%% Load Data
|
||||
filepath = fullfile(filename);
|
||||
ief_ = h5info(filepath);
|
||||
|
||||
config.fs_rx = h5readatt(filepath,'/','fs'); %sampling frequency at Rx
|
||||
config.fs_tx = h5readatt(filepath, '/','fs_Tx'); %sampling frequency at Tx
|
||||
config.fsym = h5readatt(filepath, '/','R'); %Baudrate
|
||||
config.M = h5readatt(filepath, '/','M'); % PAM- 'M'
|
||||
config.ROF = h5readatt(filepath, '/','ROF');
|
||||
config.PulseShape =h5readatt(filepath, '/','PulseShape');
|
||||
|
||||
yOrg = h5readatt(filepath, ief_.Groups(4).Groups(1).Name, 'YOrg');
|
||||
yInc = h5readatt(filepath, ief_.Groups(4).Groups(1).Name, 'YInc');
|
||||
|
||||
dataRx = double(h5read(filepath, '/Waveforms/Channel 2/Channel 2Data')); % rohdaten des CH4
|
||||
bitsTx = h5read(filepath, '/Settings/dataTx'); %Binär
|
||||
|
||||
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 = 1;
|
||||
if loadAfterTR
|
||||
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
|
||||
|
||||
dataRx = dataRx*yInc+yOrg;
|
||||
Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx);
|
||||
|
||||
Rx_Sig.signal = Rx_Sig.signal - mean(Rx_Sig.signal);
|
||||
|
||||
Rx_Sig = Rx_Sig.normalize("mode","rms");
|
||||
|
||||
%%%%%% Sample to 2x 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) %%%%%%
|
||||
|
||||
[~,S,isFlipped] = Rx_Sig_resamp.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
|
||||
|
||||
output = struct();
|
||||
vnle_package = {};
|
||||
vnle_pf_package = {};
|
||||
dbtgt_package = {};
|
||||
|
||||
for s = 1%:length(S)
|
||||
Rx_Sig_sync = S{s};
|
||||
Rx_Sig_sync = Rx_Sig_sync.normalize("mode","rms");
|
||||
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*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 0
|
||||
|
||||
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 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;
|
||||
|
||||
[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 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;
|
||||
|
||||
[result] = duobinary_target(eq_, mlse_db, config.M, Rx_Sig_sync, Tx_symbols, Tx_bits, "precode_mode", doub_mode,'showAnalysis',1,'eth_style_symbol_mapping',1);
|
||||
dbtgt_package{s} = result;
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
results.vnle_package = vnle_package;
|
||||
results.vnle_pf_package = vnle_pf_package;
|
||||
results.dbtgt_package = dbtgt_package;
|
||||
results.config = config;
|
||||
|
||||
|
||||
end
|
||||
40
projects/Messung_Zürich/findFileByCode.m
Normal file
40
projects/Messung_Zürich/findFileByCode.m
Normal file
@@ -0,0 +1,40 @@
|
||||
function fileName = findFileByCode(folderPath, code)
|
||||
% FINDFILEBYCODE Searches for a file in a folder structure by a given code.
|
||||
% fileName = findFileByCode(folderPath, code) searches recursively in
|
||||
% folderPath for a file containing 'code' in its name and returns the
|
||||
% full file name if found.
|
||||
%
|
||||
% Inputs:
|
||||
% folderPath - The root directory to search in
|
||||
% code - The unique code to search for in file names
|
||||
%
|
||||
% Output:
|
||||
% fileName - The full file name if found, empty if not found
|
||||
|
||||
% Initialize output
|
||||
fileName = '';
|
||||
|
||||
% Get list of all files and folders in the folderPath
|
||||
files = dir(folderPath);
|
||||
|
||||
% Iterate through the list
|
||||
for i = 1:length(files)
|
||||
% Skip '.' and '..'
|
||||
if files(i).isdir
|
||||
if ~startsWith(files(i).name, '.') % Avoid hidden folders
|
||||
% Recursive search in subdirectories
|
||||
subFolder = fullfile(folderPath, files(i).name);
|
||||
fileName = findFileByCode(subFolder, code);
|
||||
if ~isempty(fileName)
|
||||
return; % Stop searching if found
|
||||
end
|
||||
end
|
||||
else
|
||||
% Check if the file name contains the code
|
||||
if contains(files(i).name, code)
|
||||
fileName = fullfile(folderPath, files(i).name);
|
||||
return;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
19
projects/Messung_Zürich/minimal_pam4_mlse.m
Normal file
19
projects/Messung_Zürich/minimal_pam4_mlse.m
Normal 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)
|
||||
BIN
projects/Messung_Zürich/pam4.mat
Normal file
BIN
projects/Messung_Zürich/pam4.mat
Normal file
Binary file not shown.
BIN
projects/Messung_Zürich/pam4_eq.fig
Normal file
BIN
projects/Messung_Zürich/pam4_eq.fig
Normal file
Binary file not shown.
69
projects/Messung_Zürich/submit_handle.m
Normal file
69
projects/Messung_Zürich/submit_handle.m
Normal 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
|
||||
Reference in New Issue
Block a user