new par function

This commit is contained in:
silas (home)
2025-12-31 12:46:56 +01:00
parent 45c9fc2b14
commit 2354d7ac44
3 changed files with 590 additions and 151 deletions

View File

@@ -33,6 +33,7 @@ jsl = fullfile(tmpbase, sprintf('matlab_jobstorage_%s_%s', ...
getenv('USER'), getenv('SLURM_JOB_ID')));
if ~exist(jsl,'dir'); mkdir(jsl); end
if 0
% Configure the local cluster explicitly and start the pool
c = parcluster('local');
c.NumWorkers = cpus;
@@ -44,6 +45,7 @@ if isempty(p) || p.NumWorkers ~= cpus
p = parpool(c, cpus);
end
fprintf('parpool up with %d workers; JobStorage=%s\n', p.NumWorkers, c.JobStorageLocation);
end
%% result filename (timestamp + optional job id)
t = datetime('now','TimeZone','local','Format','yyyyMMdd_HHmmss');
@@ -106,7 +108,7 @@ Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",1
N = numel(s.wavelengthplan);
f_plan = physconst('lightspeed')./(s.wavelengthplan.*1e-9);
margin = 5e12; % some THz left and right
margin = 20e12; % some THz left and right
f_span = (max(f_plan)+margin)-(min(f_plan)-margin);
f_nyq = f_span/2;
@@ -128,7 +130,7 @@ s.rop = -12:0.75:-0.75;
% Evaluate BER at these intermediate distances (km), plus always include the final link_length if > 0.
segment_length = 1; % km (must match fiber loop below)
eval_dist_km = [2 4 6 8 10];
eval_dist_km = [2 10];
eval_dist_km = eval_dist_km(eval_dist_km <= link_length);
% Always include final distance (if > 0) and avoid duplicates
@@ -149,6 +151,7 @@ nEval = numel(eval_seg);
%% Preallocate outputs (add eval distance as 4th dimension)
output_ffe = cell(length(s.wavelengthplan), length(s.rop), s.num_realiz, nEval);
output_dfe = cell(length(s.wavelengthplan), length(s.rop), s.num_realiz, nEval);
output_vnle = cell(length(s.wavelengthplan), length(s.rop), s.num_realiz, nEval);
output_mlse = cell(length(s.wavelengthplan), length(s.rop), s.num_realiz, nEval);
output_dbt = cell(length(s.wavelengthplan), length(s.rop), s.num_realiz, nEval);
@@ -181,7 +184,7 @@ for realiz = 1:s.num_realiz
Tx_bits = cell(1,N);
%% ---------- TX per channel ----------
parfor l = 1:N
for l = 1:N
[Digi_sig,Symbols{l},Tx_bits{l}] = PAMsource( ...
"fsym",fsym,"M",s.M,"order",18,"useprbs",0, ...
@@ -235,6 +238,8 @@ for realiz = 1:s.num_realiz
for seg = 1:nSegments
fprintf('Realiz %d/%d: Segment %d/%d \n', realiz, s.num_realiz, seg, nSegments);
Opt_sig_wdm_fib = DP_Fiber("L",segment_length,"D",Dvec(seg),"Dpmd",s.pmd,"Ds",0.07, ...
"beat_len",10,"corr_len",100,"dz",1,"manakov",0, ...
"gamma",s.gamma,"lambda",zdw,"n_waveplates",10,"SS_dphimax",0.01, ...
@@ -247,10 +252,9 @@ for realiz = 1:s.num_realiz
Opt_sig_wdm_demux = Optical_Demultiplex("attenuation",0,"B",200e9,"filtype",1, ...
"fs_out",fdac*kover,"fs_in",fdac*kover*upsample_pow,"lambda_center",1310).process(Opt_sig_wdm_fib);
% NOTE: For correctness and to keep changes minimal, we keep the exact DSP chain.
for ri = 1:length(s.rop)
parfor l = 1:N
for l = 1:N
%%%%%% ROP %%%%%%
Opt_sig_wdm_rx = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power", ...
@@ -293,6 +297,19 @@ for realiz = 1:s.num_realiz
output_ffe{l,ri,realiz,eval_ptr} = ffe_results;
% -------------------- DFE --------------------
dfe_order = [50, 0, 0];
eq_dfe = EQ("Ne",dfe_order,"Nb",[2,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);
dfe_results = ffe(eq_dfe,s.M,Rx_sig,Symbols{l},Tx_bits{l}, ...
"precode_mode",duob_mode, ...
'showAnalysis',0, ...
"postFFE",[], ...
"eth_style_symbol_mapping",0);
output_dfe{l,ri,realiz,eval_ptr} = dfe_results;
% -------------------- VNLE + MLSE --------------------
pf_ncoeffs = 1;
ffe_order = [50, 5, 5];
@@ -348,6 +365,7 @@ for realiz = 1:s.num_realiz
res.settings = s;
res.eval_dist_km = eval_dist_km;
res.ffe = output_ffe;
res.dfe = output_dfe;
res.vnle = output_vnle;
res.mlse = output_mlse;
res.dbt = output_dbt;