Update
This commit is contained in:
51
projects/MPI_April/auswertung_1.m
Normal file
51
projects/MPI_April/auswertung_1.m
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
|
||||
|
||||
vp = wh.parameter.vp.values(1);
|
||||
vb = wh.parameter.vb.values(1);
|
||||
rop = wh.parameter.rop.values;
|
||||
|
||||
|
||||
f=figure(1113);
|
||||
tiledlayout(2,4)
|
||||
for sir = [20,36]
|
||||
for lw = wh.parameter.laser_linewidth.values
|
||||
nexttile
|
||||
cols = linspecer(9);
|
||||
cnt = 1;
|
||||
for bias = wh.parameter.vb.values
|
||||
curber = [];
|
||||
curstd = [];
|
||||
rop_meas = [];
|
||||
txpow_meas = wh.getStoValue('mod_out_pow',sir,lw,1,vp,bias,rop(1));
|
||||
for pn_key = wh.parameter.pn_key.values
|
||||
curber(end+1,:) = wh.getStoValue('ber',sir,lw,pn_key,vp,bias,rop);
|
||||
rop_meas(end+1,:) = wh.getStoValue('rop_save',sir,lw,pn_key,vp,bias,rop);
|
||||
|
||||
curstd(end+1,:,:) = wh.getStoValue('level_std',sir,lw,pn_key,vp,bias,rop);
|
||||
plot(rop_meas(end,:)-txpow_meas, curber(end,:) ,'LineStyle',':','Color',cols(cnt,:),'LineWidth',0.1,'Marker','o','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:),'HandleVisibility','off','MarkerSize',1);
|
||||
hold on
|
||||
end
|
||||
[wrst,idx]=max(curber);
|
||||
for i = 1:numel(idx)
|
||||
rop_wrst(i)=rop_meas(idx(i),i);
|
||||
end
|
||||
plot( rop_wrst-txpow_meas, wrst ,'LineStyle',':','Color',cols(cnt,:),'LineWidth',1,'Marker','^','MarkerSize',5,'MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:),'HandleVisibility','off');
|
||||
plot(mean(rop_meas,1)-txpow_meas, mean(curber,1),'DisplayName',['Vbias: ',num2str(bias),' V'],'LineStyle','-','Color',cols(cnt,:),'LineWidth',1,'Marker','o','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(cnt,:));
|
||||
hold on
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
title(['SIR: ',num2str(sir),'; Lw: ',num2str(lw*1e-6),' MHz; Vpeakpeak: ',num2str(2*vp)])
|
||||
set(gca,'YScale','log');
|
||||
legend('Location','southwest')
|
||||
xlabel("measured ROP in dBm")
|
||||
ylabel("BER")
|
||||
yline(3.8e-3,'DisplayName','FEC');
|
||||
xlim([-5,3]);
|
||||
ylim([1e-4,3e-1]);
|
||||
drawnow
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,20 +4,16 @@ clear
|
||||
filename = '112G_2';
|
||||
load_sequence = 0;
|
||||
|
||||
M = 4;
|
||||
datarate = 112e9;
|
||||
M = 8;
|
||||
datarate = 448e9;
|
||||
|
||||
kover = 8;
|
||||
kover = 4;
|
||||
fsym = round(datarate*1e-9 / log2(M))*1e9;
|
||||
%fsym = 50e9;
|
||||
fdac = 256e9;
|
||||
fadc = 256e9;
|
||||
|
||||
laser_linewidth = 1e6;
|
||||
mpi_ = 50; %meter
|
||||
sir = 20; %decibel = attenuation of interference path
|
||||
|
||||
lowpass_cutoff = fsym/2 * 1;
|
||||
lowpass_cutoff = fsym/2 * 1.5;
|
||||
awg_bw = lowpass_cutoff;
|
||||
mod_bw = lowpass_cutoff;
|
||||
phd_bw = lowpass_cutoff;
|
||||
@@ -25,174 +21,218 @@ scp_bw = lowpass_cutoff;
|
||||
|
||||
mpi_path=50;
|
||||
|
||||
vp = [0.25];
|
||||
vb = [0.5:0.05:0.8];
|
||||
vb = 0.7;
|
||||
pn_key = [27];
|
||||
rop = -5;
|
||||
|
||||
LP_awg = Filter('filtdegree',2,"f_cutoff",awg_bw,"fs",fdac,"filterType","butterworth");
|
||||
LP_awg = Filter('filtdegree',2,"f_cutoff",awg_bw,"fs",fdac*kover,"filterType","butterworth");
|
||||
LP_laser = Filter('filtdegree',4,"f_cutoff",mod_bw,"fs",fdac*kover,"filterType",filtertypes.gaussian);
|
||||
LP_opt = Filter('filtdegree',4,"f_cutoff",fsym/log2(M).*1.5,"fs",fdac*kover,"filterType",filtertypes.gaussian);
|
||||
LP_phd = Filter('filtdegree',2,"f_cutoff",phd_bw,"fs",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
LP_scpe = Filter('filtdegree',2,"f_cutoff",scp_bw,"fs",fadc,"filterType","butterworth");
|
||||
|
||||
for pnk = 1:length(pn_key)
|
||||
for m = 1:length(vb)
|
||||
if load_sequence
|
||||
% 1) PRBS Generation
|
||||
O = 18; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
|
||||
load(['C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_April\',filename,'.mat'],'X');
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
spectrum_plot(X.signal',X.fs,'spectrum');
|
||||
else
|
||||
% 2 ) Build Inf. signal class
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
% 1) PRBS Generation
|
||||
O = 17; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
% 3) Digi modulation -> PAM-M signal
|
||||
digimod_out = PAMmapper(M,0).map(bits);
|
||||
digimod_out.fs = fsym;
|
||||
|
||||
X = Pulseformer("fsym",fsym,"fdac",fdac,"pulse","rrc","pulselength",16,"rrcalpha",0.1).process(digimod_out);
|
||||
|
||||
% 5) AWG (lowpass, quantization, sample and hold)
|
||||
X = AWG("fdac",fdac,"dac_min",-1,"dac_max",1,"H_lpf",LP_awg,"kover",kover,"bit_resolution",5,"lpf_active",1).process(X);
|
||||
|
||||
% 6) Lowpass behavior before laser
|
||||
X = LP_laser.process(X);
|
||||
|
||||
% 7) Normalize signal
|
||||
X = X.normalize("mode","oneone");
|
||||
|
||||
sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
laser_linewidth = [1e5 1e6 3e6 10e6];
|
||||
pn_key = [1:10];
|
||||
vp = [0.25,0.5,0.75,1];
|
||||
vb = [1:0.1:1.8];
|
||||
|
||||
rop = -9:3;
|
||||
% sir = 25;
|
||||
% laser_linewidth = 1e6;
|
||||
% pn_key = 1;
|
||||
% vp = 0.8;
|
||||
% vb = 1;
|
||||
|
||||
cnt = 1;
|
||||
for s = 1:length(sir)
|
||||
for l = 1:length(laser_linewidth)
|
||||
for pnk = 1:length(pn_key)
|
||||
for n = 1:length(vp)
|
||||
for m = 1:length(vb)
|
||||
|
||||
cnt = cnt+1;
|
||||
|
||||
% 1) Laser; Modulation -> OPTICAL DOMAIN
|
||||
u_pi = 2;
|
||||
vbias = -vb(m);
|
||||
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",X.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth(l),"randomkey",pn_key(pnk));
|
||||
E = X.*vp(1);
|
||||
|
||||
% E.signal = min(max(E.signal,-0.2),0.2);
|
||||
|
||||
[Opt,extmodlaser] = extmodlaser.process(E);
|
||||
|
||||
% figure(m)
|
||||
% hold on
|
||||
% scatter(E.signal(1:100000),(abs(Opt.signal(1:100000)).^2)*1e3,0.1,'.','DisplayName','Modulator TF')
|
||||
% xlabel('Input in V')
|
||||
% ylabel('abs(Output) in mW')
|
||||
|
||||
|
||||
% ER = 10*log10(max(abs(Opt.signal).^2)/min(abs(Opt.signal).^2));
|
||||
|
||||
Opt = LP_opt.process(Opt);
|
||||
|
||||
cspr(s,l,pnk,n,m) = Opt.cspr;
|
||||
mod_out_pow(s,l,pnk,n,m) = Opt.power;
|
||||
|
||||
% 2) ping pong fiber propagation
|
||||
Interference_sig = Fiber("fsimu",Opt.fs,"fiber_length",mpi_path*2/1000,"alpha",0,"D",0,"lambda0",1310,"gamma",0).process(Opt);
|
||||
|
||||
Interference_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",-sir(s)).process(Interference_sig);
|
||||
|
||||
% In the meantime: delay the main signal
|
||||
[Main_sig,dly] = Opt.delay("delay_meter",mpi_path*2);
|
||||
|
||||
% Add
|
||||
Combined_sig = Main_sig + Interference_sig;
|
||||
|
||||
% Cut (due to the delays there is a jump in the signals)
|
||||
if dly == 0;dly = 1;end
|
||||
Combined_sig.signal = Combined_sig.signal(ceil(dly):end);
|
||||
|
||||
% Fiber
|
||||
Combined_sig = Fiber("fsimu",Combined_sig.fs,"fiber_length",2,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.08).process(Combined_sig);
|
||||
|
||||
parfor i = 1:length(rop)
|
||||
|
||||
% Set ROP
|
||||
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",rop(i)).process(Combined_sig);
|
||||
rop_save(s,l,pnk,n,m,i) = Rx_sig.power;
|
||||
|
||||
% Square Law
|
||||
Rx_sig = Photodiode("fsimu",Rx_sig.fs,"dark_current",2e-08,"responsivity",1,"temperature",20).process(Rx_sig);
|
||||
|
||||
%Lowpass PhDiode
|
||||
Rx_sig = LP_phd.process(Rx_sig);
|
||||
|
||||
% Scope
|
||||
Rx_sig = Scope("fsimu",Rx_sig.fs,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"lpf_bw",scp_bw,"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).process(Rx_sig);
|
||||
|
||||
% Sample to 2x fsym
|
||||
Rx_sig = Rx_sig.resample("fs_in",fadc,"fs_out",2*fsym);
|
||||
|
||||
% Sync Rx signal with reference
|
||||
[Rx_sig,D,cuts] = Rx_sig.tsynch("reference",digimod_out,"fs_ref",fsym);
|
||||
|
||||
% % % simple EQ (optimum mudc: 0.05 -> 0.005)
|
||||
% EQ_sig = EQ_silas_plain("Ne",[20,8,8],"Nb",[2,0,0],"trainlength",4096,"mu_dc_dd",0.005,"mu_dc_train",0.05,...
|
||||
% "mu_ffe_train",0.005,"mu_combined_dd",[0.0004 0.0006 0.0003 0.005],"ddloops",3,'trainloops',3,'sps',2).process(Rx_sig,digimod_out);
|
||||
%
|
||||
% EQ_sig = EQ("K",2,"plottrain",0,"plotfinal",0,...
|
||||
% "training_length",4096,"training_loops",3,...
|
||||
% "Ne",[20,8,8],"Nb",[2,0,0],...
|
||||
% "DCmu",0.005,"DDmu",[0.0004 0.0006 0.0003 0.005],"DFEmu",0.005,"FFEmu",0.00,...
|
||||
% "dd_loops",3,"epsilon",[10 100 1000 ],"M",2,...
|
||||
% "thres",[0.005 0.004 0.0005 ],"l1act",0,"delay",0,"rho",0.0005,"ideal_dfe",0,"DB_aim",0).process(Rx_sig,digimod_out);
|
||||
|
||||
EQ_sig = EQ_silas("Ne",[20,2,0],"Nb",[2,0,0],"trainlength",4096,...
|
||||
"sps",2,...
|
||||
"mu_dc_dd",0.00,...
|
||||
"mu_dc_train",0.00,...
|
||||
"mu_ffe_train",0.00,...
|
||||
"mu_dfe_train",0.005,...
|
||||
"mu_ffe_dd",[0.0004 0.0006 0.0003],...
|
||||
"mu_dfe_dd",0.005,...
|
||||
"ddloops",3,...
|
||||
"trainloops",3,...
|
||||
"eq_parallelization_blocklength",1, ...
|
||||
"eq_updatelatency",1,...
|
||||
"eq_avg_blocklength",0).process(Rx_sig,digimod_out);
|
||||
|
||||
% Demap
|
||||
Rx_Bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
|
||||
Rx_symboldecision = PAMmapper(M,0).decide_pamlevel(EQ_sig,"symbol_levels",unique(digimod_out.signal));
|
||||
|
||||
levels = PAMmapper(M,0).separate_pamlevels(EQ_sig);
|
||||
%levels = PAMmapper(M,0).separate_pamlevels(Rx_sig.resample("fs_in",Rx_sig.fs,"fs_out",fsym));
|
||||
|
||||
level_avg(s,l,pnk,n,m,i,:) = mean(levels,'omitnan');
|
||||
level_std(s,l,pnk,n,m,i,:) = std(levels,'omitnan');
|
||||
|
||||
% BER
|
||||
[~,errors_bm,BER(s,l,pnk,n,m,i),errors] = calc_ber(Rx_Bits.signal,bitpattern,"skip_front",0,"skip_end",0,"returnErrorLocation",1);
|
||||
|
||||
formatted_ber = sprintf('%.1e', BER(s,l,pnk,n,m,i));
|
||||
disp(['SIR: ',num2str(sir(s)),'; Lw:',num2str(laser_linewidth(l)),'; Key:',num2str(pn_key(pnk)),'; Vpeak: ',num2str(vp(n)),'; Vbias',num2str(vbias),'; BER: ',formatted_ber,'; run: ',num2str(cnt),' / 12961']);
|
||||
|
||||
% plot_analysis_window;
|
||||
% drawnow;
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 2 ) Build Inf. signal class
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
% 3) Digi modulation -> PAM-M signal
|
||||
digimod_out = PAMmapper(M,0).map(bits);
|
||||
digimod_out.fs = fsym;
|
||||
|
||||
X = Pulseformer("fsym",fsym,"fdac",fdac,"pulse","rrc","pulselength",16,"rrcalpha",0.01).process(digimod_out);
|
||||
|
||||
% 5) AWG (lowpass, quantization, sample and hold)
|
||||
%X = M8196A().process(X);
|
||||
kover = 16;
|
||||
X = AWG("fdac",fdac,"dac_min",-1,"dac_max",1,"H_lpf",LP_awg,"kover",kover).process(X);
|
||||
|
||||
% 6) Lowpass behavior before laser
|
||||
X = LP_laser.process(X);
|
||||
|
||||
% 7) Normalize signal
|
||||
X = X.normalize("mode","oneone");
|
||||
|
||||
%save(['C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_April\',char(filename)],'X');
|
||||
end
|
||||
|
||||
% 1) Laser; Modulation -> OPTICAL DOMAIN
|
||||
u_pi = 2;
|
||||
vbias = -vb(m)*u_pi;
|
||||
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",X.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",pn_key(pnk));
|
||||
E = X.*vp(1);
|
||||
[Opt,extmodlaser] = extmodlaser.process(E);
|
||||
|
||||
% figure(m)
|
||||
% hold on
|
||||
% scatter(E.signal(1:100000),(abs(Opt.signal(1:100000)).^2)*1e3,0.1,'.','DisplayName','Modulator TF')
|
||||
% xlabel('Input in V')
|
||||
% ylabel('abs(Output) in mW')
|
||||
|
||||
Opt = LP_opt.process(Opt);
|
||||
|
||||
cspr(m) = Opt.cspr;
|
||||
|
||||
% 2) ping pong fiber propagation
|
||||
Interference_sig = Fiber("fsimu",Opt.fs,"fiber_length",mpi_path*2/1000,"alpha",0,"D",0,"lambda0",1310,"gamma",0).process(Opt);
|
||||
|
||||
Interference_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",-sir).process(Interference_sig);
|
||||
|
||||
% In the meantime: delay the main signal
|
||||
[Main_sig,n] = Opt.delay("delay_meter",mpi_path*2);
|
||||
|
||||
% Add
|
||||
Combined_sig = Main_sig + Interference_sig;
|
||||
|
||||
% Cut (due to the delays there is a jump in the signals)
|
||||
if n == 0;n = 1;end
|
||||
Combined_sig.signal = Combined_sig.signal(ceil(n):end);
|
||||
|
||||
% Fiber
|
||||
Combined_sig = Fiber("fsimu",Combined_sig.fs,"fiber_length",0,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.08).process(Combined_sig);
|
||||
|
||||
for i = 1:length(rop)
|
||||
|
||||
% Set ROP
|
||||
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",rop(i)).process(Combined_sig);
|
||||
rop_save(m,i) = Rx_sig.power;
|
||||
|
||||
% Square Law
|
||||
Rx_sig = Photodiode("fsimu",Rx_sig.fs,"dark_current",2e-08,"responsivity",1,"temperature",20).process(Rx_sig);
|
||||
|
||||
%Lowpass PhDiode
|
||||
Rx_sig = LP_phd.process(Rx_sig);
|
||||
|
||||
% Scope
|
||||
Rx_sig = Scope("fsimu",Rx_sig.fs,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"lpf_bw",scp_bw,"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).process(Rx_sig);
|
||||
|
||||
% Sample to 2x fsym
|
||||
Rx_sig = Rx_sig.resample("fs_in",fadc,"fs_out",2*fsym);
|
||||
|
||||
% Sync Rx signal with reference
|
||||
[Rx_sig,D,cuts] = Rx_sig.tsynch("reference",digimod_out,"fs_ref",fsym);
|
||||
|
||||
% % simple EQ (optimum mudc: 0.05 -> 0.005)
|
||||
EQ_sig = EQ_silas_plain("Ne",[20,8,8],"Nb",[2,0,0],"trainlength",4096,"mu_dc_dd",0.005,"mu_dc_train",0.05,...
|
||||
"mu_ffe_train",0.005,"mu_combined_dd",[0.0004 0.0006 0.0003 0.005],"ddloops",3,'trainloops',3,'sps',2).process(Rx_sig,digimod_out);
|
||||
|
||||
% Demap
|
||||
Rx_Bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
|
||||
Rx_symboldecision = PAMmapper(M,0).decide_pamlevel(EQ_sig,"symbol_levels",unique(digimod_out.signal));
|
||||
|
||||
levels = PAMmapper(M,0).separate_pamlevels(EQ_sig);
|
||||
level_avg(:,m,i) = mean(levels,'omitnan');
|
||||
level_std(:,m,i) = std(levels,'omitnan');
|
||||
|
||||
% BER
|
||||
[~,errors_bm,BER(m,i),errors] = calc_ber(Rx_Bits.signal,bitpattern,"skip_front",0,"skip_end",0,"returnErrorLocation",1);
|
||||
|
||||
formatted_ber = sprintf('%.1e', BER(m,i));
|
||||
disp(formatted_ber);
|
||||
|
||||
save('big_run_easy_EQ_one_nonlin');
|
||||
disp('saved_run2');
|
||||
end
|
||||
end
|
||||
end
|
||||
plot_analysis_window;
|
||||
save(['C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\MPI\Investigation_April_2024\','PAM_',num2str(M),'_mpi_',num2str(mpi_path),'_lw_',num2str(laser_linewidth)],"BER");
|
||||
|
||||
% BER plot
|
||||
figure(340)
|
||||
cols = linspecer(7);
|
||||
for m = 1:size(BER,1)
|
||||
hold on
|
||||
plot(rop,BER(m,:),'DisplayName',['Bias: ',num2str(vb(m)), ' V'],'LineStyle','-','Color',cols(m,:),'LineWidth',1,'Marker','o','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(m,:));
|
||||
|
||||
end
|
||||
set(gca,'YScale','log');
|
||||
legend
|
||||
xlabel("ROP in dBm")
|
||||
yline(3.8e-3,'DisplayName','FEC');
|
||||
|
||||
|
||||
figure(21)
|
||||
hold on
|
||||
plot(rop,mean(BER),'DisplayName',['Modulation: ',num2str(2*vp/extmodlaser.u_pi*100), ' $\%$'],'LineStyle','-','Color',cols(2,:),'LineWidth',1);
|
||||
set(gca,'YScale','log');
|
||||
legend
|
||||
ylabel("ROP in dBm")
|
||||
yline(3.8e-3,'DisplayName','FEC');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%check Rx and TX symbols
|
||||
figure(101)
|
||||
scatter(1:100,Rx_symboldecision.signal(1:100),10,'o');
|
||||
hold on
|
||||
scatter(1:100,digimod_out.signal(1:100),5,'x');
|
||||
% save(['C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\MPI\Investigation_April_2024\','PAM_',num2str(M),'_mpi_',num2str(mpi_path),'_lw_',num2str(laser_linewidth)],"BER");
|
||||
%
|
||||
% % BER plot
|
||||
% figure(340)
|
||||
% cols = linspecer(7);
|
||||
% for m = 1:size(BER,1)
|
||||
% hold on
|
||||
% plot(rop,BER(m,:),'DisplayName',['Bias: ',num2str(vb(m)), ' V'],'LineStyle','-','Color',cols(m,:),'LineWidth',1,'Marker','o','MarkerEdgeColor',[1 1 1],'MarkerFaceColor',cols(m,:));
|
||||
%
|
||||
% end
|
||||
% set(gca,'YScale','log');
|
||||
% legend
|
||||
% xlabel("ROP in dBm")
|
||||
% yline(3.8e-3,'DisplayName','FEC');
|
||||
%
|
||||
%
|
||||
% figure(21)
|
||||
% hold on
|
||||
% plot(rop,mean(BER),'DisplayName',['Modulation: ',num2str(2*vp/extmodlaser.u_pi*100), ' $\%$'],'LineStyle','-','Color',cols(2,:),'LineWidth',1);
|
||||
% set(gca,'YScale','log');
|
||||
% legend
|
||||
% ylabel("ROP in dBm")
|
||||
% yline(3.8e-3,'DisplayName','FEC');
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% %check Rx and TX symbols
|
||||
% figure(101)
|
||||
% scatter(1:100,Rx_symboldecision.signal(1:100),10,'o');
|
||||
% hold on
|
||||
% scatter(1:100,digimod_out.signal(1:100),5,'x');
|
||||
|
||||
9
projects/MPI_April/mzm_er.m
Normal file
9
projects/MPI_April/mzm_er.m
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
field=sqrt(10^(3/10-3)); %dbm to sqrt(mw)
|
||||
|
||||
vpi = 2;
|
||||
vbias = 1;
|
||||
vin = 0.1;
|
||||
|
||||
(field * cos(pi/2*(vin+vbias)/vpi)).^2
|
||||
@@ -16,9 +16,9 @@ ylim([-100,0]);
|
||||
%Phase Investigation
|
||||
subplot(3,2,3)
|
||||
hold on
|
||||
phase_int = extmodlaser.phase(n:end);
|
||||
phase_main = delayseq(extmodlaser.phase,n);
|
||||
phase_main = phase_main(n:end);
|
||||
phase_int = extmodlaser.phase(ceil(n):end);
|
||||
phase_main = delayseq(extmodlaser.phase,ceil(n));
|
||||
phase_main = phase_main(ceil(n):end);
|
||||
phase_diff = phase_int - phase_main;
|
||||
t = (1:length(phase_int))' ./ extmodlaser.fsimu ;
|
||||
plot(t*1e6,phase_int,'Color',colpairs(1,:),'DisplayName','Interferer Phase');
|
||||
@@ -53,7 +53,7 @@ for h = 1:size(levels,2)
|
||||
scatter(t*1e6,levels(:,h),1,'.');
|
||||
hold on
|
||||
end
|
||||
yline(PAMmapper(M,0).thresholds);
|
||||
%yline(PAMmapper(M,0).thresholds);
|
||||
title(['BER: ',sprintf('%.1e', BER(m,i))]);
|
||||
|
||||
%Histogram of EQzed Signal
|
||||
|
||||
61
projects/MPI_April/save_to_warehouse.m
Normal file
61
projects/MPI_April/save_to_warehouse.m
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
laser_linewidth = [1e5 1e6 3e6 10e6];
|
||||
pn_key = [1:10];
|
||||
vp = [0.25];
|
||||
vb = [1:0.1:1.8];
|
||||
rop = -9:3;
|
||||
|
||||
params = struct;
|
||||
params.sir = [20:2:36]; %decibel = attenuation of interference path
|
||||
params.laser_linewidth = [1e5 1e6 3e6 10e6];
|
||||
params.pn_key = [1:10];
|
||||
params.vp = [0.25,0.5,0.75,1];
|
||||
params.vb = [1:0.1:1.8];
|
||||
params.rop = -9:3;
|
||||
wh = DataStorage(params);
|
||||
wh.addStorage("ber");
|
||||
wh.addStorage("level_avg");
|
||||
wh.addStorage("level_std");
|
||||
wh.addStorage("rop_save");
|
||||
wh.addStorage("cspr");
|
||||
wh.addStorage("mod_out_pow");
|
||||
|
||||
cnt = 1;
|
||||
for s = 1:length(sir)
|
||||
for l = 1:length(laser_linewidth)
|
||||
for pnk = 1:length(pn_key)
|
||||
for n = 1
|
||||
for m = 1:length(vb)
|
||||
for i = 1:length(rop)
|
||||
cnt = cnt +1;
|
||||
|
||||
wh.addValueToStorage(BER(s,l,pnk,n,m,i),'ber',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(level_avg(s,l,pnk,n,m,i,:),'level_avg',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(level_std(s,l,pnk,n,m,i,:),'level_std',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(rop_save(s,l,pnk,n,m,i),'rop_save',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(cspr(s,l,pnk,n,m),'cspr',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
wh.addValueToStorage(mod_out_pow(s,l,pnk,n,m),'mod_out_pow',sir(s),laser_linewidth(l),pn_key(pnk),vp(n),vb(m),rop(i));
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 4) Hey! the warehouse is here and (hopefully) filled with data :-)
|
||||
|
||||
% Create a save dialog
|
||||
defaultDir = 'C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\MPI_April';
|
||||
defaultExt = '*.mat';
|
||||
[filename, pathname] = uiputfile(fullfile(defaultDir, defaultExt),'', 'wh.mat');
|
||||
|
||||
% Check if the user pressed Cancel
|
||||
if isequal(filename, 0) || isequal(pathname, 0)
|
||||
disp('Save operation canceled.');
|
||||
else
|
||||
% Save the variable to the selected file
|
||||
save(fullfile(pathname, filename), 'wh');
|
||||
disp(['Variable "wh" saved to: ', fullfile(pathname, filename)]);
|
||||
end
|
||||
Reference in New Issue
Block a user