CLEANUP - changes to folder structure

This commit is contained in:
Silas Oettinghaus
2026-03-25 10:57:48 +01:00
parent 0c5ad28f0a
commit 0ae846d3c3
351 changed files with 405 additions and 1294 deletions

View File

@@ -0,0 +1,111 @@
% Silas Amplifier characterization
laser = Exfo_laser("mainframe_channel",1,"safety_mode",0,"connection_id",'10','lab_interface','gpib');
laser.getLaserInfo();
laser.disableLaser;
laser.setWavelength(1310);
laser.enableLaser;
pdfa = Thor_PDFA();
%%
params.laserpower = [-30,-20,-10,0];
params.lambda = [1310]; %calcWavelengthPlan(16, 400e9 , 1310);
params.pump = [0:5:100];
wh = DataStorage(params);
wh.addStorage("spectrum_osa");
wh.addStorage("wavelength_osa");
wh.addStorage("psig_osa");
wh.addStorage("pase_osa");
wh.addStorage("osnr_osa");
wh.addStorage("amp_gain");
wh.addStorage("psig_total");
cols = linspecer(numel(params.laserpower));
ccnt = 0;
for p = params.laserpower
ccnt=ccnt+1;
laser.setWavelength(params.lambda(1));
usrcmd = sprintf('Laser to %d dBm',p);
waitUntilClick('Text',usrcmd);
for w = params.lambda
laser.setWavelength(w)
% pm.setWavelength([1550, w]);
span_nm = 5;
lambda_c_nm = w;
osa = OSA_Advantest( ...
'span_nm', 40, ...
'lambda_c_nm', w, ...
'resolution_nm', 0.1, ...
'sampling_points', 1001 );
osa.configure();
for pmp = params.pump
% pdfa.setPumpLevel(pmp);
usrcmd = sprintf('Amp to %d %',pmp);
waitUntilClick('Text',usrcmd);
% OSA
[lambda_nm, psd_dBm] = osa.measure();
osnr = osa.computeOSNR('bw_signal_nm',0.01,'ref_bw_nm',0.1,'debugplots',0,...
'carrier_frequency',w,'noise_guard_nm',1,'noise_window_nm',1);
osa.plot("FigureNumber",abs(p)+10,"Color",cols(ccnt,:));
xlabel('Wavelength [nm]');
ylabel('Opt. Spectrum [dBm]');
grid minor
% Powermeter
totalpower=10*log10(sum(10.^(psd_dBm./10)));
% [totalpower]=pm.readPower;
% totalpower=totalpower(2) + 20; %20dB attenuation with eigenlight to satisfy 3dB max of PMeter
wh.addValueToStorage(lambda_nm,'wavelength_osa',p,w,pmp);
wh.addValueToStorage(psd_dBm,'spectrum_osa',p,w,pmp);
wh.addValueToStorage(osnr.p_ase_db,'pase_osa',p,w,pmp);
wh.addValueToStorage(osnr.p_sig_db,'psig_osa',p,w,pmp);
wh.addValueToStorage(osnr,'osnr_osa',p,w,pmp);
wh.addValueToStorage(totalpower,'psig_total',p,w,pmp);
end
end
end
%% P out
figure(3);hold on
for p = [-30:10:0]
psig_osa = wh.getStoValue('psig_osa',p,params.lambda,params.pump);
pl=plot(params.pump,psig_osa,'DisplayName',sprintf('P_{signal}: %d dB ',p));
psig_total = wh.getStoValue('psig_total',p,params.lambda,params.pump);
plot(params.pump,psig_total,'DisplayName',sprintf('P_{total}: %d dB ',p),'LineStyle','--','Color',pl.Color);
pase = wh.getStoValue('pase_osa',p,params.lambda,params.pump);
plot(params.pump,pase,'DisplayName',sprintf('P_{ASE}: %d dB ',p),'LineStyle',':','Color',pl.Color);
end
legend
%% Gain
figure(4);hold on
for p = [-30:10:0]
% Die -2dB sind Korrekturfaktor aus dem Setup! Gilt für PDFA und SOA
psig_osa = wh.getStoValue('psig_osa',p,params.lambda,params.pump);
pl=plot(params.pump,psig_osa-(p-2),'DisplayName',sprintf('Gain: %d dB ',p));
psig_total = wh.getStoValue('psig_total',p,params.lambda,params.pump);
pl=plot(params.pump,psig_total-(p-2),'DisplayName',sprintf('Gain: %d dB ',p),'Color',pl.Color,'LineStyle','--');
end
legend

View File

@@ -0,0 +1,88 @@
wh_aeon = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\Lab_analysis\aeon_soa_measurement_lambda_plaser_pump.mat");
wh_aeon = wh_aeon.wh;
wh_thor = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\Lab_analysis\thorlabs_pdfa_measurement_lambda_plaser_pump.mat");
wh_thor = wh_thor.wh;
% Silas' custom "warehouse" datatype
wh_aeon.showInfo;
wh_thor.showInfo;
%% PLOT OSA SPECTRA
figure();hold on
cols = linspecer(4);
cols = cbrewer2('Paired',8);
subplot(1,2,1);hold on;
wh = wh_thor;
ccnt = 1;
pumps = wh.parameter.pump.values;
plasers = wh.parameter.laserpower.values;
scnt = 1;
for p = 1:numel(plasers)
for pmp = 1:numel(pumps)
subplot(numel(plasers),numel(pumps),scnt);hold on;
title(sprintf('Laser: %d dBm; Pump: %d %',plasers(p),pumps(pmp)),"Interpreter","tex")
for lambda = wh.parameter.lambda.values
spectrum_osa = wh_thor.getStoValue('spectrum_osa',plasers(p),lambda,pumps(pmp));
wavelength_osa = wh_thor.getStoValue('wavelength_osa',plasers(p),lambda,pumps(pmp));
plot(wavelength_osa,spectrum_osa,'DisplayName',sprintf('P_{in}: %d dB ',plasers(p)),'Color',cols(ccnt,:));
spectrum_osa = wh_aeon.getStoValue('spectrum_osa',plasers(p),lambda,pumps(pmp));
wavelength_osa = wh_aeon.getStoValue('wavelength_osa',plasers(p),lambda,pumps(pmp));
plot(wavelength_osa,spectrum_osa,'DisplayName',sprintf('P_{in}: %d dB ',plasers(p)),'Color',cols(ccnt+1,:));
ylim([-60, 20]);
beautifyBERplot("logscale",false,"setmarkers",0,"setcolors",0);
end
scnt = scnt +1;
end
ccnt = ccnt+2;
end
xlabel('Wavelength [nm]');
ylabel('OSNR [dB]')
%%
figure();hold on
cols = linspecer(4);
subplot(1,2,1);hold on;
wh = wh_thor;
ccnt = 1;
pumps = wh.parameter.pump.values;
plasers = wh.parameter.laserpower.values;
scnt = 1;
for p = 1:numel(plasers)
for pmp = 1:numel(pumps)
subplot(numel(plasers),numel(pumps),scnt);hold on;
ase_noise = wh_thor.getStoValue('pase_osa',plasers(p),wh.parameter.lambda.values,pumps(pmp));
signal = wh_thor.getStoValue('psig_osa',plasers(p),wh.parameter.lambda.values,pumps(pmp));
plot(wh.parameter.lambda.values,ase_noise,'DisplayName',sprintf('P_{in}: %d dB ',plasers(p)),'Color',cols(ccnt,:));
ase_noise = wh_aeon.getStoValue('pase_osa',plasers(p),wh.parameter.lambda.values,pumps(pmp));
signal = wh_aeon.getStoValue('psig_osa',plasers(p),wh.parameter.lambda.values,pumps(pmp));
plot(wh.parameter.lambda.values,ase_noise,'DisplayName',sprintf('P_{in}: %d dB ',plasers(p)),'Color',cols(ccnt,:),'LineStyle','-');
ylim([-60, 20]);
beautifyBERplot("logscale",false,"setmarkers",0,"setcolors",0);
scnt = scnt +1;
end
ccnt = ccnt+1;
end
xlabel('Wavelength [nm]');
ylabel('OSNR [dB]')

View File

@@ -0,0 +1,59 @@
%% Parameter to simulate and save
params = struct;
params.M = [4];
params.datarate = [300];
params.rop = [0];
precomp_mode = 2; %0=do nothing ; 1= measure; 2=precomp active
if ismac
precomp_path = "/Users/silasoettinghaus/Documents/MATLAB/imdd_simulation/projects/standard_system";
else
precomp_path = "C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\standard_system\";
end
precomp_fn = "400G_simulative_setup";
usemrds = 0;
name = ['wh_',strrep(num2str(now),'.','')];
wh = DataStorage(params);
wh.addStorage("ber_ffe");
%% Init Params
link_length = 0; %meter
pn_key = 2;
laser_linewidth = 0;
endcnt = prod(wh.dim);
cnt=0;
disp(['Start Simulation of ',num2str(endcnt),' loops...'])
tic
% SETUP HERE: %%
fsym = 92e9;
Symbols = Informationsignal(digi_mod_out',"fs",92e9);
Scpe_sig = Electricalsignal(awg2scope_keysight_out.no1',"fs",160e9);
Scpe_sig = Scpe_sig.resample("fs_in",160e9,"fs_out",2*92e9);
Bits = Informationsignal(prms_out',"fs",92e9);
%%%%%% Sync Rx signal with reference %%%%%%
[Scpe_sig,S] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym);
%%%%% EQUALIZE %%%%%%
% Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",1);
Eq = VNLE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",[50,7,7],"sps",2,"decide",1);
[EQ_sig] = Eq.process(Scpe_sig,Symbols);
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
[~,errors_bm,ber_ffe,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
disp(['BER: ',sprintf('%.1E',ber_ffe),' - - - ',num2str(fsym*1e-9),' GBd']);