MPI Simulations and stuff
This commit is contained in:
99
projects/MPI_Juni/EQ_optimization/eq_optimization.m
Normal file
99
projects/MPI_Juni/EQ_optimization/eq_optimization.m
Normal file
@@ -0,0 +1,99 @@
|
||||
|
||||
clear
|
||||
Ref = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_Juni\EQ_optimization\ref_sig_with_mpi.mat",'Ref');
|
||||
Rx_sig = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_Juni\EQ_optimization\rx_sig_with_mpi.mat",'Rx_sig');
|
||||
Bits = load("C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_Juni\EQ_optimization\ref_bits_prms.mat","Bits");
|
||||
|
||||
M = 4;
|
||||
Ref = Ref.Ref;
|
||||
Rx_sig = Rx_sig.Rx_sig;
|
||||
Bits = Bits.Bits;
|
||||
|
||||
kover = 8;
|
||||
fdac = 256e9;
|
||||
fadc = 160e9;
|
||||
|
||||
Lp_phd = Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true);
|
||||
|
||||
Lp_scpe = Filter('filtdegree',4,"f_cutoff",63e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true);
|
||||
|
||||
Scp = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"filtertype",filtertypes.butterworth,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",16,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',Lp_scpe);
|
||||
|
||||
fadc = Scp.fadc;
|
||||
|
||||
% SETUP TX Model
|
||||
Pmap = PAMmapper(M,0);
|
||||
|
||||
% SETUP RX Model
|
||||
Phd = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20);
|
||||
|
||||
% Eq = EQ_silas_ofc("Ne",[50,2,2],"Nb",[2,0,0],"trainlength",4096,...
|
||||
% "sps",2,...
|
||||
% "mu_dc_dd",[0.5, 0.5, 0.5, 0.5],...
|
||||
% "mu_dc_train",0.0,...
|
||||
% "mu_ffe_train",0.00,...
|
||||
% "mu_dfe_train",0.005,...
|
||||
% "mu_ffe_dd",[0.0004 0.0004 0.0004],...
|
||||
% "mu_dfe_dd",0.005,...
|
||||
% "ddloops",3,...
|
||||
% "trainloops",4,...
|
||||
% "eq_parallelization_blocklength",0, ...
|
||||
% "eq_updatelatency",1,...
|
||||
% "eq_avg_blocklength",0);
|
||||
|
||||
|
||||
if 0
|
||||
Eq = EQ("Ne",[21,4,4],"Nb",[0,0,0],"training_length",4096,"training_loops",4,"dd_loops",4,"K",2,"DCmu",0,"DDmu",[0.0004 0.0005 0.0006 0.0003 ],"DFEmu",0.000,"FFEmu",0,"plotfinal",0,"ideal_dfe",0);
|
||||
|
||||
|
||||
% % RX Model
|
||||
Rx_bits = rx_model(Rx_sig,Ref,Phd,Lp_phd,Scp,Eq,Pmap);
|
||||
|
||||
% % BER
|
||||
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
disp(['BER: ',sprintf('%.1E',ber),' - - ROP: ',num2str(Rx_sig.power),'dBm - - PAM-',num2str(M),' - - ']);
|
||||
end
|
||||
|
||||
%%%%% Local Parameter %%%%%%%%
|
||||
fsym = Ref.fs;
|
||||
|
||||
%%%%%% Square Law %%%%%%
|
||||
Rx_sig = Phd.process(Rx_sig);
|
||||
|
||||
%%%%%% Lowpass PhDiode %%%%%%
|
||||
Rx_sig = Lp_phd.process(Rx_sig);
|
||||
% Rx_sig.spectrum("displayname","Received Signal after PhD","fignum",201);
|
||||
|
||||
%%%%%% Scope %%%%%%
|
||||
Scpe_sig = Scp.process(Rx_sig);
|
||||
% Scpe_sig.spectrum("displayname",'after scope','fignum',123);
|
||||
|
||||
%%%%%% Sample to 2x fsym %%%%%%
|
||||
Scpe_sig = Scpe_sig.resample("fs_in",Scp.fadc,"fs_out",2*fsym);
|
||||
% Scpe_sig.plot('fignum',12345,'displayname','bla')
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
[Scpe_sig,D,cuts] = Scpe_sig.tsynch("reference",Ref,"fs_ref",fsym);
|
||||
|
||||
|
||||
|
||||
Scpe_sig = Scpe_sig.normalize("mode","rms");
|
||||
|
||||
|
||||
Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",20,"sps",2,"decide",1);
|
||||
% Eq = FFE_DFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"ffe_mu_dd",1e-4,"dfe_mu_dd",5e-4,"ffe_mu_tr",0,"dfe_mu_tr",0,"ffe_order",21,"dfe_order",0,"sps",2,"decide",1);
|
||||
% Eq = VNLE("epochs_tr",7,"epochs_dd",7,"len_tr",4096,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",[21,5,5],"sps",2,"decide",1);
|
||||
|
||||
Eq_sig = Eq.process(Scpe_sig,Ref);
|
||||
|
||||
Rx_bits = Pmap.demap(Eq_sig);
|
||||
|
||||
% BER
|
||||
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
disp(['BER: ',sprintf('%.1E',ber),' - - ROP: ',num2str(Rx_sig.power),'dBm - - PAM-',num2str(M),' - - ']);
|
||||
|
||||
BIN
projects/MPI_Juni/EQ_optimization/ref_bits_prms.mat
Normal file
BIN
projects/MPI_Juni/EQ_optimization/ref_bits_prms.mat
Normal file
Binary file not shown.
BIN
projects/MPI_Juni/EQ_optimization/ref_sig_with_mpi.mat
Normal file
BIN
projects/MPI_Juni/EQ_optimization/ref_sig_with_mpi.mat
Normal file
Binary file not shown.
BIN
projects/MPI_Juni/EQ_optimization/rx_sig_with_mpi.mat
Normal file
BIN
projects/MPI_Juni/EQ_optimization/rx_sig_with_mpi.mat
Normal file
Binary file not shown.
46
projects/MPI_Juni/ber_curve.m
Normal file
46
projects/MPI_Juni/ber_curve.m
Normal file
@@ -0,0 +1,46 @@
|
||||
function ber_curve(wh,options)
|
||||
arguments
|
||||
wh
|
||||
options.DisplayName = '';
|
||||
end
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values;
|
||||
sir = wh.parameter.sir.values(1);
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values(1);
|
||||
vbias_rel = wh.parameter.vbias_rel.values(1);
|
||||
rop = wh.parameter.rop.values;
|
||||
clipfactor = wh.parameter.clipfactor.values;
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
|
||||
cols = linspecer(numel(datarate));
|
||||
|
||||
cnt = 0;
|
||||
for dr = datarate
|
||||
cnt = cnt+1;
|
||||
bers = wh.getStoValue('ber',M,dr,sir,laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
rops = wh.getStoValue('rop',M,dr,sir,laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
ers = unique(wh.getStoValue('er',M,dr,sir,laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha));
|
||||
|
||||
if 1 %isempty(options.DisplayName)
|
||||
dn = ['M: ',num2str(M),'; Rate: ',num2str(dr),'; Vbias rel: ',num2str(vbias_rel), '; ER: ', num2str(ers)];
|
||||
else
|
||||
dn = options.DisplayName;
|
||||
end
|
||||
|
||||
% Create the initial plot
|
||||
figure(43);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(rops,bers,"LineWidth",1,"LineStyle","--","Marker",".","MarkerSize",10,"DisplayName",string(dn),'Color',cols(cnt,:));
|
||||
|
||||
end
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Received Optical Power (dBm)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. Received Optical Power');
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
|
||||
end
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
projects/MPI_Juni/ber_vs_er/ber_vs_er_pam4_withMPI.mat
Normal file
BIN
projects/MPI_Juni/ber_vs_er/ber_vs_er_pam4_withMPI.mat
Normal file
Binary file not shown.
44
projects/MPI_Juni/ber_vs_er/tx_signal_curve.m
Normal file
44
projects/MPI_Juni/ber_vs_er/tx_signal_curve.m
Normal file
@@ -0,0 +1,44 @@
|
||||
function tx_signal_curve(wh,options)
|
||||
arguments
|
||||
wh
|
||||
options.DisplayName = '';
|
||||
end
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values(1);
|
||||
mpi_len = wh.parameter.mpi_pathlen.values(1);
|
||||
laser_linewidths = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
vbias_rel = wh.parameter.vbias_rel.values(1);
|
||||
rop = wh.parameter.rop.values(1);
|
||||
clipfactor = wh.parameter.clipfactor.values;
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
% Create the initial plot
|
||||
figure(4);
|
||||
cols = linspecer(6);
|
||||
cnt = 0;
|
||||
|
||||
|
||||
bers(:) = wh.getStoValue('ber',M,datarate,sirs,mpi_len,laser_linewidths,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
ers(:) = wh.getStoValue('er',M,datarate,sirs,mpi_len,laser_linewidths,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
|
||||
dn = ['M: ',num2str(M),'; Rate: ',num2str(datarate),'; SIR ',num2str(sirs), 'dB; lw: ',num2str(laser_linewidths.*1e-6),' MHz'];
|
||||
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
% scatter(clipfactor,bers,"LineWidth",1,"Marker",".","DisplayName",string(dn),"MarkerEdgeColor",cols(cnt,:),'HandleVisibility','off');
|
||||
yyaxis left
|
||||
plot(clipfactor,bers,"LineWidth",1,"Marker",".","DisplayName",'BER');
|
||||
yline(3.8e-3,'DisplayName','HD-FEC','HandleVisibility','off');
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
ylim([1e-5,4e-2])
|
||||
|
||||
yyaxis right
|
||||
plot(clipfactor,ers,"LineWidth",1,"Marker",".","DisplayName",'Extinction Ratio in dB');
|
||||
xlabel('Clip Factor');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title(['Bit Error Rate vs. Clip Factor: ',dn]);
|
||||
|
||||
legend
|
||||
end
|
||||
BIN
projects/MPI_Juni/clip_optimization/pam4_clipping.fig
Normal file
BIN
projects/MPI_Juni/clip_optimization/pam4_clipping.fig
Normal file
Binary file not shown.
BIN
projects/MPI_Juni/clip_optimization/pam6_clipping.fig
Normal file
BIN
projects/MPI_Juni/clip_optimization/pam6_clipping.fig
Normal file
Binary file not shown.
BIN
projects/MPI_Juni/clip_optimization/pam8_clipping.fig
Normal file
BIN
projects/MPI_Juni/clip_optimization/pam8_clipping.fig
Normal file
Binary file not shown.
BIN
projects/MPI_Juni/clip_optimization/pam_4_6_8.fig
Normal file
BIN
projects/MPI_Juni/clip_optimization/pam_4_6_8.fig
Normal file
Binary file not shown.
BIN
projects/MPI_Juni/dataset_2506.mat
Normal file
BIN
projects/MPI_Juni/dataset_2506.mat
Normal file
Binary file not shown.
40
projects/MPI_Juni/extrcurve.m
Normal file
40
projects/MPI_Juni/extrcurve.m
Normal file
@@ -0,0 +1,40 @@
|
||||
function ercurve(wh)
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values(1);
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values(1);
|
||||
vbias_rel = wh.parameter.vbias_rel.values;
|
||||
rop = wh.parameter.rop.values;
|
||||
clipfactor = wh.parameter.clipfactor.values;
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
|
||||
|
||||
for vbr = vbias_rel
|
||||
|
||||
bers = wh.getStoValue('ber',M,datarate,sir,laser_linewidth,pn_key,vbr,rop,clipfactor, rrcalpha);
|
||||
rops = wh.getStoValue('rop',M,datarate,sir,laser_linewidth,pn_key,vbr,rop,clipfactor, rrcalpha);
|
||||
ers = unique(wh.getStoValue('er',M,datarate,sir,laser_linewidth,pn_key,vbr,rop,clipfactor, rrcalpha));
|
||||
|
||||
if 1 %isempty(options.DisplayName)
|
||||
dn = ['M: ',num2str(M),'; Rate: ',num2str(datarate),'; Vbias rel: ',num2str(vbr), '; ER: ', num2str(ers)];
|
||||
else
|
||||
dn = options.DisplayName;
|
||||
end
|
||||
|
||||
% Create the initial plot
|
||||
figure(43);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(rops,bers,"LineWidth",1,"LineStyle","--","Marker",".","MarkerSize",10,"DisplayName",string(dn));
|
||||
|
||||
end
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Received Optical Power (dBm)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. Received Optical Power');
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
|
||||
end
|
||||
47
projects/MPI_Juni/linewidth_curve.m
Normal file
47
projects/MPI_Juni/linewidth_curve.m
Normal file
@@ -0,0 +1,47 @@
|
||||
function linewidth_curve(wh,options)
|
||||
arguments
|
||||
wh
|
||||
options.DisplayName = '';
|
||||
end
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values(6);
|
||||
mpi_len = wh.parameter.mpi_pathlen.values;
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values;
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
vbias_rel = wh.parameter.vbias_rel.values(1);
|
||||
rop = wh.parameter.rop.values(1);
|
||||
clipfactor = wh.parameter.clipfactor.values(1);
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
|
||||
cols = linspecer(numel(mpi_len));
|
||||
% Create the initial plot
|
||||
figure(44);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
for l = 1:numel(mpi_len)
|
||||
|
||||
cnt = 0;
|
||||
for i = 1:numel(laser_linewidth)
|
||||
|
||||
bers(:,i) = wh.getStoValue('ber',M,datarate,sir,mpi_len(l),laser_linewidth(i),pn_key,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
%ers(:,i) = unique(wh.getStoValue('er',M,datarate,sir,mpi_len,laser_linewidth(i),pn_key,vbias_rel,rop,clipfactor, rrcalpha));
|
||||
|
||||
dn = ['Interference Path Length: ',num2str(mpi_len(l)),'m; Rate: ',num2str(datarate)];
|
||||
|
||||
end
|
||||
|
||||
scatter(laser_linewidth.*1e-6,bers,"LineWidth",1,"Marker",".","DisplayName",string(dn),"MarkerEdgeColor",cols(l,:),'HandleVisibility','off');
|
||||
plot(laser_linewidth.*1e-6,mean(bers),"LineWidth",1,"Marker",".","DisplayName",string(dn),"MarkerEdgeColor",cols(l,:),"Color",cols(l,:));
|
||||
|
||||
end
|
||||
ylim([1e-4, 1e-2]);
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Laser Linewidth in MHz');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title(['Bit Error Rate vs. Interference Path Length @ SIR ',num2str(sir), 'dB']);
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
|
||||
end
|
||||
245
projects/MPI_Juni/main_simulation.m
Normal file
245
projects/MPI_Juni/main_simulation.m
Normal file
@@ -0,0 +1,245 @@
|
||||
|
||||
%% Parameter to simulate and save
|
||||
params = struct;
|
||||
|
||||
params.M = [4];
|
||||
params.datarate = [224];
|
||||
params.sir = [25]; %decibel = attenuation of interference path
|
||||
params.mpi_pathlen = [50];
|
||||
params.laser_linewidth = [1e6];
|
||||
params.pn_key = [15];
|
||||
params.vbias_rel = [0.5];
|
||||
params.rop = 0;
|
||||
|
||||
params.clipfactor = [1.3];
|
||||
params.rrcalpha = [0.1];
|
||||
|
||||
name = ['wh_',strrep(num2str(now),'.','')];
|
||||
|
||||
wh = DataStorage(params);
|
||||
|
||||
wh.addStorage("ber");
|
||||
wh.addStorage("rop");
|
||||
wh.addStorage("txpapr");
|
||||
wh.addStorage("er");
|
||||
|
||||
%% Init Params
|
||||
link_length = 10000; %meter
|
||||
|
||||
endcnt = prod(wh.dim);
|
||||
cnt=0;
|
||||
|
||||
disp(['Start Simulation of ',num2str(endcnt),' loops...'])
|
||||
tic
|
||||
for M = wh.parameter.M.values
|
||||
for datarate = wh.parameter.datarate.values
|
||||
for rrcalpha = wh.parameter.rrcalpha.values
|
||||
|
||||
%% SETUP HERE: %%
|
||||
kover = 8;
|
||||
Awg = M8199A("kover",kover);
|
||||
fdac = Awg.fdac;
|
||||
fsym = round(datarate / log2(M))*1e9;
|
||||
|
||||
Lp_awg = Filter('filtdegree',4,"f_cutoff",75e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true);
|
||||
Lp_mod = Filter('filtdegree',2,"f_cutoff",100e9,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true);
|
||||
Lp_opt = Filter('filtdegree',6,"f_cutoff",fsym.*0.7,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true);
|
||||
Lp_phd = Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.gaussian,"active",true);
|
||||
|
||||
fadc = 256e9;
|
||||
Lp_scpe = Filter('filtdegree',4,"f_cutoff",63e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true);
|
||||
|
||||
Scp = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"filtertype",filtertypes.butterworth,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",16,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',Lp_scpe);
|
||||
|
||||
fadc = Scp.fadc;
|
||||
|
||||
% figure(222)
|
||||
% Lp_awg.showHere;
|
||||
% Lp_mod.showHere;
|
||||
% Lp_opt.showHere;
|
||||
% Lp_phd.showHere;
|
||||
% Lp_scpe.showHere;
|
||||
|
||||
% SETUP TX Model
|
||||
Pmap = PAMmapper(M,0);
|
||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rrcalpha);
|
||||
|
||||
% SETUP RX Model
|
||||
Phd = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20);
|
||||
|
||||
% Eq = EQ_silas("Ne",[25,0,0],"Nb",[2,0,0],"trainlength",4096,...
|
||||
% "sps",2,...
|
||||
% "mu_dc_dd",0.1,...
|
||||
% "mu_dc_train",0.0,...
|
||||
% "mu_ffe_train",0.00,...
|
||||
% "mu_dfe_train",0.005,...
|
||||
% "mu_ffe_dd",[0.0004 0.0004 0.0004],...
|
||||
% "mu_dfe_dd",0.005,...
|
||||
% "ddloops",3,...
|
||||
% "trainloops",4,...
|
||||
% "eq_parallelization_blocklength",0, ...
|
||||
% "eq_updatelatency",0,...
|
||||
% "eq_avg_blocklength",1000);
|
||||
|
||||
% Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",0);
|
||||
|
||||
% Eq = FFE_DFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"ffe_mu_dd",1e-4,"dfe_mu_dd",5e-4,"ffe_mu_tr",0,"dfe_mu_tr",0,"ffe_order",25,"dfe_order",2,"sps",2,"decide",1);
|
||||
|
||||
% Eq = EQ_silas_sliding_window_dc_removal("Ne",[25,0,0],"Nb",[2,0,0],"trainlength",4096,...
|
||||
% "sps",2,...
|
||||
% "mu_dc_dd",0.05,...
|
||||
% "mu_dc_train",0.05,...
|
||||
% "mu_ffe_train",0,...
|
||||
% "mu_dfe_train",0.005,...
|
||||
% "mu_ffe_dd",[0.0004 0.0004 0.0004],...
|
||||
% "mu_dfe_dd",0.0004,...
|
||||
% "ddloops",4,...
|
||||
% "trainloops",4,...
|
||||
% "eq_blocklength",0,...
|
||||
% "eq_updatelatency",0);
|
||||
|
||||
% Eq = EQ("Ne",[25,3,3],"Nb",[0,0,0],"training_length",4096,"training_loops",4,"dd_loops",4,"K",2,"DCmu",0,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0,"plotfinal",1);
|
||||
|
||||
Eq = VNLE("epochs_tr",7,"epochs_dd",7,"len_tr",4096,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",[25,3,3],"sps",2,"decide",1);
|
||||
|
||||
for clipfactor = wh.parameter.clipfactor.values
|
||||
% TX model
|
||||
[El,Bits,Ref] = tx_model(fsym,Pmap,Pform,Awg,"clipfactor",clipfactor);
|
||||
|
||||
% Laser and Modulation
|
||||
El = Lp_mod.process(El);
|
||||
El = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",15).process(El);
|
||||
pwr_ = El.power; % in dbm into 50 ohm
|
||||
papr_ = papr(El.signal);
|
||||
vpk_ = max(abs(El.signal));
|
||||
vswing_ = max(El.signal)-min(El.signal);
|
||||
awg_string = ['AWG: Pout: ',num2str(round(pwr_,2)),' dBm (50 Ohm); PAPR: ',num2str(round(papr_,2)),'; Vpk: ',num2str(round(vpk_,2)),' V; Vswing: ',num2str(round(vswing_,2)),' V'];
|
||||
disp(awg_string);
|
||||
|
||||
for laser_linewidth = wh.parameter.laser_linewidth.values
|
||||
for pn_key = wh.parameter.pn_key.values
|
||||
for vbias_rel = wh.parameter.vbias_rel.values
|
||||
|
||||
u_pi = 2.9;
|
||||
vbias = -vbias_rel*u_pi;
|
||||
|
||||
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",pn_key);
|
||||
% El = El.normalize("mode","oneone").*u_pi.*0.4;
|
||||
[modulated,extmodlaser] = extmodlaser.process(El);
|
||||
|
||||
if 1
|
||||
figure(10)
|
||||
hold on
|
||||
scatter(El.signal(1:100000)+vbias,(abs(modulated.signal(1:100000)).^2)*1e3,0.1,'.','DisplayName','Modulator TF')
|
||||
ylim([0 4]);
|
||||
xlim([-u_pi/2, u_pi/2]+vbias);
|
||||
xlabel('Input in V')
|
||||
ylabel('abs(Output) in mW')
|
||||
% Define properties
|
||||
boxPosition = [0.15 0.86 0.2 0.05]; % Position for the first box [x y width height]
|
||||
boxColor = [0.9 0.9 0.9]; % Light grey background color
|
||||
boxEdgeColor = 'k'; % Black edge color
|
||||
boxLineStyle = '--'; % Dashed line style
|
||||
boxFontWeight = 'bold'; % Bold font
|
||||
|
||||
% Create first annotation box for Power
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String', ['V pi: ',num2str(u_pi),' V'], ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
% Adjust position for the second box (slightly to the right)
|
||||
boxPosition = [0.37 0.86 0.2 0.05]; % Adjusted position
|
||||
|
||||
% Create second annotation box for PAPR
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String', ['V bias: ',num2str(vbias),' V'], ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
modulated.eye(fsym,M);
|
||||
|
||||
modulated.spectrum("fignum",112,"displayname",'transmit spectrum');
|
||||
|
||||
modulated = Lp_opt.process(modulated);
|
||||
|
||||
end
|
||||
|
||||
er = modulated.extinctionratio(fsym,M);
|
||||
|
||||
if 1
|
||||
|
||||
m_ = wh.parameter.mpi_pathlen.length;
|
||||
j_ = wh.parameter.sir.length;
|
||||
i_ = wh.parameter.rop.length;
|
||||
ber=zeros(m_,j_,i_);
|
||||
patten=zeros(m_,j_,i_);
|
||||
|
||||
for m = 1:m_
|
||||
mpi_path = wh.parameter.mpi_pathlen.values(m);
|
||||
for j = 1:j_
|
||||
sir = wh.parameter.sir.values(j);
|
||||
|
||||
% MPI Channel
|
||||
Opt = channel_model_mpi(modulated,link_length,mpi_path,sir);
|
||||
|
||||
for i = 1:i_
|
||||
rop=wh.parameter.rop.values(i);
|
||||
|
||||
% Set ROP
|
||||
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt);
|
||||
patten(m,j,i) = Rx_sig.power;
|
||||
|
||||
% RX Model
|
||||
Rx_bits = rx_model(Rx_sig,Ref,Phd,Lp_phd,Scp,Eq,Pmap);
|
||||
|
||||
% BER
|
||||
[~,errors_bm,ber(m,j,i),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
cnt = cnt+1;
|
||||
disp(['BER: ',sprintf('%.1E',ber(m,j,i)),' - - ROP: ',num2str(Rx_sig.power),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for m = 1:m_
|
||||
mpi_path = wh.parameter.mpi_pathlen.values(m);
|
||||
for j = 1:j_
|
||||
sir = wh.parameter.sir.values(j);
|
||||
for i = 1:i_
|
||||
rop=wh.parameter.rop.values(i);
|
||||
wh.addValueToStorage(ber(m,j,i),'ber',M,datarate,sir,mpi_path,laser_linewidth,pn_key,vbias_rel,rop,clipfactor,rrcalpha);
|
||||
wh.addValueToStorage(patten(m,j,i),'rop',M,datarate,sir,mpi_path,laser_linewidth,pn_key,vbias_rel,rop,clipfactor,rrcalpha);
|
||||
wh.addValueToStorage(er,'er',M,datarate,sir,mpi_path,laser_linewidth,pn_key,vbias_rel,rop,clipfactor,rrcalpha);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
toc
|
||||
disp(['Simulated: ',num2str(cnt/endcnt*100),' %']);
|
||||
save(['C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_Juni\',name,'.mat'],"wh");
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
56
projects/MPI_Juni/mpilength_curve.m
Normal file
56
projects/MPI_Juni/mpilength_curve.m
Normal file
@@ -0,0 +1,56 @@
|
||||
function mpilength_curve(wh,options)
|
||||
arguments
|
||||
wh
|
||||
options.DisplayName = '';
|
||||
end
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(2);
|
||||
sirs = wh.parameter.sir.values(1);
|
||||
mpi_len = wh.parameter.mpi_pathlen.values;
|
||||
laser_linewidths = wh.parameter.laser_linewidth.values;
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
vbias_rel = wh.parameter.vbias_rel.values(1);
|
||||
rop = wh.parameter.rop.values(1);
|
||||
clipfactor = wh.parameter.clipfactor.values(1);
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
% Create the initial plot
|
||||
figure(4);
|
||||
cols = linspecer(6);
|
||||
cnt = 0;
|
||||
|
||||
for lw = 1:numel(laser_linewidths)
|
||||
laser_linewidth = laser_linewidths(lw);
|
||||
n=ceil(sqrt(wh.parameter.laser_linewidth.length));
|
||||
%subplot(n,n,sp);
|
||||
cnt=cnt+6;
|
||||
for sir = sirs
|
||||
|
||||
for i = 1:numel(mpi_len)
|
||||
|
||||
bers(:,i) = wh.getStoValue('ber',M,datarate,sir,mpi_len(i),laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
% ers(:,i) = unique(wh.getStoValue('er',M,datarate,sir,mpi_len(i),laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha));
|
||||
|
||||
dn = ['M: ',num2str(M),'; Rate: ',num2str(datarate),'; SIR ',num2str(sir), 'dB; lw: ',num2str(laser_linewidth.*1e-6),' MHz'];
|
||||
|
||||
end
|
||||
|
||||
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
scatter(mpi_len,bers,"LineWidth",1,"Marker",".","DisplayName",string(dn),"MarkerEdgeColor",cols(cnt,:),'HandleVisibility','off');
|
||||
plot(mpi_len,mean(bers),"LineWidth",1,"Marker",".","DisplayName",string(dn),"MarkerEdgeColor",cols(cnt,:),"Color",cols(cnt,:));
|
||||
|
||||
|
||||
end
|
||||
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('MPI Path in Meter');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title(['Bit Error Rate vs. Interference Path Length; Linewidth: ',num2str(laser_linewidth.*1e-6), ' MHz']);
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
ylim([1e-5,4e-2])
|
||||
|
||||
end
|
||||
legend
|
||||
end
|
||||
46
projects/MPI_Juni/sir_curve.m
Normal file
46
projects/MPI_Juni/sir_curve.m
Normal file
@@ -0,0 +1,46 @@
|
||||
function sir_curve(wh,options)
|
||||
arguments
|
||||
wh
|
||||
options.DisplayName = '';
|
||||
end
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sir = wh.parameter.sir.values;
|
||||
laser_linewidth = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
vbias_rel = wh.parameter.vbias_rel.values(1);
|
||||
rop = wh.parameter.rop.values(1);
|
||||
clipfactor = wh.parameter.clipfactor.values;
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
|
||||
cols = linspecer(numel(pn_key));
|
||||
|
||||
cnt = 0;
|
||||
for pnk = pn_key
|
||||
|
||||
cnt = cnt+1;
|
||||
bers = wh.getStoValue('ber',M,datarate,sir,laser_linewidth,pnk,vbias_rel,rop,clipfactor, rrcalpha);
|
||||
ers = unique(wh.getStoValue('er',M,datarate,sir,laser_linewidth,pnk,vbias_rel,rop,clipfactor, rrcalpha));
|
||||
|
||||
if 1 %isempty(options.DisplayName)
|
||||
dn = ['M: ',num2str(M),'; Rate: ',num2str(datarate),'; Vbias rel: ',num2str(vbias_rel), '; ER: ', num2str(ers)];
|
||||
else
|
||||
dn = options.DisplayName;
|
||||
end
|
||||
|
||||
% Create the initial plot
|
||||
figure(43);
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
plot(sir,bers',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",string(dn),'Color',cols(cnt,:));
|
||||
|
||||
end
|
||||
yline(3.8e-3,'DisplayName','HD-FEC');
|
||||
xlabel('Signal to Interference Ratio (dB)');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title('Bit Error Rate vs. SIR (MPI)');
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
legend
|
||||
|
||||
end
|
||||
53
projects/MPI_Juni/tx_signal_curve.m
Normal file
53
projects/MPI_Juni/tx_signal_curve.m
Normal file
@@ -0,0 +1,53 @@
|
||||
function tx_signal_curve(wh,options)
|
||||
arguments
|
||||
wh
|
||||
options.DisplayName = '';
|
||||
end
|
||||
|
||||
M = wh.parameter.M.values(1);
|
||||
datarate = wh.parameter.datarate.values(1);
|
||||
sirs = wh.parameter.sir.values(1);
|
||||
mpi_len = wh.parameter.mpi_pathlen.values(1);
|
||||
laser_linewidths = wh.parameter.laser_linewidth.values(1);
|
||||
pn_key = wh.parameter.pn_key.values;
|
||||
vbias_rel = wh.parameter.vbias_rel.values;
|
||||
rop = wh.parameter.rop.values(1);
|
||||
clipfactor = wh.parameter.clipfactor.values;
|
||||
rrcalpha = wh.parameter.rrcalpha.values(1);
|
||||
|
||||
% Create the initial plot
|
||||
figure(4);
|
||||
cols = linspecer(numel(vbias_rel));
|
||||
cnt = 0;
|
||||
|
||||
for vb = vbias_rel
|
||||
|
||||
cnt = cnt+1;
|
||||
bers(:) = wh.getStoValue('ber',M,datarate,sirs,mpi_len,laser_linewidths,pn_key,vb,rop,clipfactor, rrcalpha);
|
||||
ers(:) = wh.getStoValue('er',M,datarate,sirs,mpi_len,laser_linewidths,pn_key,vb,rop,clipfactor, rrcalpha);
|
||||
dn = ['M: ',num2str(M),'; Rate: ',num2str(datarate),'; SIR ',num2str(sirs), 'dB; lw: ',num2str(laser_linewidths.*1e-6),' MHz'];
|
||||
|
||||
hold on; % Retain the plot so new points can be added without complete redraw
|
||||
% scatter(clipfactor,bers,"LineWidth",1,"Marker",".","DisplayName",string(dn),"MarkerEdgeColor",cols(cnt,:),'HandleVisibility','off');
|
||||
plot(clipfactor,bers,"LineWidth",1,"Marker","x",'LineStyle','--',"DisplayName",['Vbias factor: ',num2str(vb)],"Color",cols(cnt,:));
|
||||
yline(3.8e-3,'DisplayName','HD-FEC','HandleVisibility','off');
|
||||
set(gca,'yscale','log');
|
||||
grid on;
|
||||
ylim([1e-5,5e-1])
|
||||
|
||||
xlabel('Clip Factor');
|
||||
ylabel('Bit Error Rate (BER)');
|
||||
title(['Bit Error Rate vs. Clip Factor: ',dn]);
|
||||
|
||||
legend
|
||||
end
|
||||
|
||||
|
||||
% figure(10101)
|
||||
% y = vbias_rel;
|
||||
% x = clipfactor;
|
||||
% [X,Y] = meshgrid(x,y);
|
||||
% Z = bers;
|
||||
% contourf(X,Y,Z,30,'LineStyle','none');
|
||||
|
||||
end
|
||||
BIN
projects/MPI_Juni/wh_first_run.mat
Normal file
BIN
projects/MPI_Juni/wh_first_run.mat
Normal file
Binary file not shown.
Reference in New Issue
Block a user