wdm update pt 3

This commit is contained in:
Silas Oettinghaus
2025-09-17 15:16:55 +02:00
parent e8afa72158
commit cbfdf4d222
2 changed files with 54 additions and 57 deletions

View File

@@ -3,58 +3,39 @@
% --- FIRST LINE: evaluate settings located beside this script --- % --- FIRST LINE: evaluate settings located beside this script ---
run(fullfile(fileparts(mfilename('fullpath')),'WDM_settings.m')); run(fullfile(fileparts(mfilename('fullpath')),'WDM_settings.m'));
% optional: size local parpool from Slurm allocation (minimal, no arrays)
cpus = str2double(getenv('SLURM_CPUS_PER_TASK'));
if ~isfinite(cpus) || cpus < 1, cpus = max(1, feature('numcores')); end
p = gcp('nocreate'); if isempty(p), parpool('local', cpus); end
M = 4; M = 4;
m = floor(log2(M)*10)/10; m = floor(log2(M)*10)/10;
fsym = 224e9; fsym = 224e9;
apply_pulsef = 1;
fdac = 2*fsym; fdac = 2*fsym;
fadc = 2*fsym; fadc = 2*fsym;
link_length = 0;
wavelengthplan = calcWavelengthPlan(16,400e9,1310);
wavelengthplan = [1295,1305,1315,1325];
random_key = 2; random_key = 2;
rcalpha = 0.05; % Laser / Modulator
kover = 8;
vbias_rel = 0.5; vbias_rel = 0.5;
u_pi = 3.2; u_pi = 3.2;
vbias = -vbias_rel*u_pi; vbias = -vbias_rel*u_pi;
laser_linewidth = 0e6; laser_linewidth = 0e6;
% EQ SETTINGS
% Channel
link_length = 2;
rop = -5;
vnle_order1 = 50; vnle_order1 = 50;
vnle_order2 = 0; vnle_order2 = 0;
vnle_order3 = 0; vnle_order3 = 0;
vnle_order=[vnle_order1,vnle_order2,vnle_order3]; vnle_order=[vnle_order1,vnle_order2,vnle_order3];
dfe_order = [0 0 0]; dfe_order = [0 0 0];
alpha = 0;
len_tr = 4096*2; len_tr = 4096*2;
mu_ffe1 = 0.0001; mu_ffe1 = 0.0001;
mu_ffe2 = 0.0008; mu_ffe2 = 0.0008;
mu_ffe3 = 0.001; mu_ffe3 = 0.001;
mu_dc = 0.005; mu_dc = 0.005;
% mu_dc = 0; % mu_dc = 0;
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3]; mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
mu_dfe = 0.0004; mu_dfe = 0.0004;
dfe_ = sum(dfe_order)>0;
doub_mode = db_mode.no_db;
cols = linspecer(6);
rcalpha = 0.05;
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",16,"alpha",rcalpha); Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",16,"alpha",rcalpha);
db_precode = 0; db_precode = 0;
@@ -63,20 +44,12 @@ duob_mode = db_mode.no_db;
apply_pulsef = 0; apply_pulsef = 0;
% AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",0).process(Digi_sig);
%%%%% Low-pass el. components %%%%%%
% tx_bwl = 100e9;
% El_sig = Filter('filtdegree',3,"f_cutoff",tx_bwl,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(El_sig);
wavelengthplan = calcWavelengthPlan(16,400e9,1310);
wavelengthplan = [1295,1305,1315,1325];
N = numel(wavelengthplan); N = numel(wavelengthplan);
f_plan = physconst('lightspeed')./(wavelengthplan.*1e-9); f_plan = physconst('lightspeed')./(wavelengthplan.*1e-9);
margin = 25e12; % some THz left and right margin = 25e12; % some THz left and right
f_span = (max(f_plan)+margin)-(min(f_plan)-margin); f_span = (max(f_plan)+margin)-(min(f_plan)-margin);
f_nyq = f_span/2; f_nyq = f_span/2;
kover = 8;
upsample_required = f_nyq./(fdac*kover/2); upsample_required = f_nyq./(fdac*kover/2);
upsample_pow = 2^nextpow2(upsample_required); upsample_pow = 2^nextpow2(upsample_required);
upsample_ceil = ceil(upsample_required); upsample_ceil = ceil(upsample_required);
@@ -88,9 +61,9 @@ signal_cell = {};
Symbols = {}; Symbols = {};
Tx_bits = {}; Tx_bits = {};
rop = linspace(-11,0,6); %12 workers when parallel rop = linspace(-11,0,8);
num_realiz = 10; num_realiz = 1;
gmi_vnle_bitwise = NaN(length(wavelengthplan),length(rop),num_realiz); gmi_vnle_bitwise = NaN(length(wavelengthplan),length(rop),num_realiz);
snr_vnle= NaN(length(wavelengthplan),length(rop),num_realiz); snr_vnle= NaN(length(wavelengthplan),length(rop),num_realiz);
ber_vnle= NaN(length(wavelengthplan),length(rop),num_realiz); ber_vnle= NaN(length(wavelengthplan),length(rop),num_realiz);
@@ -224,6 +197,21 @@ for realiz = 1:num_realiz
end end
figure();hold on;
cols = linspecer(N);
for l = 1:N
% plot(rop,mean(squeeze(ber_vnle(l,:,:)),2,'omitnan'),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)))
plot(rop,squeeze(ber_vnle(l,:,:)),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on')
end
yline([3.8e-3,2.2e-4],'HandleVisibility','off');
ylabel('BER');
xlabel('ROP')
title('BER vs. ROP');
set(gca, 'XScale', 'linear', ...
'YScale', 'log', ...
'TickLabelInterpreter', 'latex', ...
'FontSize', 11);
res = struct(); % placeholder res = struct(); % placeholder
res.gmi_vnle_bitwise = gmi_vnle_bitwise; % placeholder res.gmi_vnle_bitwise = gmi_vnle_bitwise; % placeholder
@@ -256,25 +244,10 @@ fname = sprintf('WDM_%s_%s_%s.mat', char(t), host, jobid);
save(fullfile(output_root, fname), 'res', '-v7.3'); save(fullfile(output_root, fname), 'res', '-v7.3');
fprintf('Saved results to: %s\n', fullfile(output_root, fname)); fprintf('Saved results to: %s\n', fullfile(output_root, fname));
% --- save as PNG ---
outname = fullfile(output_root, 'BER_vs_ROP.png'); % saves to current folder
print(gcf, outname, '-dpng', '-r300'); % 300 dpi
fprintf('Saved figure to %s\n', outname);
figure();hold on;
cols = linspecer(N);
for l = 1:N
% plot(rop,mean(squeeze(ber_vnle(l,:,:)),2,'omitnan'),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)))
plot(rop,squeeze(ber_vnle(l,:,:)),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on')
end
yline([3.8e-3,2.2e-4],'HandleVisibility','off');
ylabel('BER');
xlabel('ROP')
title('BER vs. ROP');
set(gca, 'XScale', 'linear', ...
'YScale', 'log', ...
'TickLabelInterpreter', 'latex', ...
'FontSize', 11);
function dispersion_vector = getDispersionVector(N, D, ref_zdw, randomize_ZDW, randomkey) function dispersion_vector = getDispersionVector(N, D, ref_zdw, randomize_ZDW, randomkey)

View File

@@ -6,5 +6,29 @@ else
addpath(genpath('/work_beegfs/sutef391/imdd_simulation')); addpath(genpath('/work_beegfs/sutef391/imdd_simulation'));
end end
% Define where results should be written (used by WDM_model.m) % Quiet the ambiguous CET warning (best is to set TZ in sbatch; see below)
output_root = '/work_beegfs/sutef391/results_WDM'; warning('off','MATLAB:datetime:AmbiguousTimeZone');
% How many workers?
cpus = str2double(getenv('SLURM_CPUS_PER_TASK'));
if ~isfinite(cpus) || cpus < 1, cpus = max(1, feature('numcores')); end
% Use a per-job, node-local JobStorageLocation to avoid stale locks on $HOME
% Prefer $TMPDIR if your cluster provides it, else tempdir().
tmpbase = getenv('TMPDIR');
if isempty(tmpbase), tmpbase = tempdir; end
jsl = fullfile(tmpbase, sprintf('matlab_jobstorage_%s_%s', ...
getenv('USER'), getenv('SLURM_JOB_ID')));
if ~exist(jsl,'dir'); mkdir(jsl); end
% Configure the local cluster explicitly and start the pool
c = parcluster('local');
c.NumWorkers = cpus;
c.JobStorageLocation = jsl;
p = gcp('nocreate');
if isempty(p) || p.NumWorkers ~= cpus
if ~isempty(p), delete(p); end
p = parpool(c, cpus); % avoids the queued state
end
fprintf('parpool up with %d workers; JobStorage=%s\n', p.NumWorkers, c.JobStorageLocation);