Mainly AWG updates
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
%% Settings
|
||||
|
||||
clear
|
||||
for M=[4,6,8]
|
||||
for M=[4]
|
||||
|
||||
|
||||
filename = '112G_2';
|
||||
@@ -11,7 +11,7 @@ for M=[4,6,8]
|
||||
|
||||
kover = 8;
|
||||
fsym = round(datarate*1e-9 / log2(M))*1e9;
|
||||
fdac = 256e9;
|
||||
fdac = fsym;%256e9;
|
||||
fadc = 256e9;
|
||||
|
||||
lowpass_cutoff = fsym/2 * 1.1;
|
||||
@@ -20,21 +20,22 @@ for M=[4,6,8]
|
||||
phd_bw = lowpass_cutoff;
|
||||
scp_bw = lowpass_cutoff;
|
||||
|
||||
LP_awg = Filter('filtdegree',4,"f_cutoff",90e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
LP_awg = Filter('filtdegree',4,"f_cutoff",75e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
LP_modulator= Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
LP_opt = Filter('filtdegree',3,"f_cutoff",fsym/log2(M).*1.5,"fs",fdac*kover,"filterType",filtertypes.gaussian);
|
||||
LP_phd = Filter('filtdegree',2,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
LP_scpe = Filter('filtdegree',4,"f_cutoff",110e9,"fs",fadc,"filterType",filtertypes.butterworth);
|
||||
|
||||
|
||||
% 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=[];
|
||||
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
if M == 6
|
||||
bitpattern = reshape(bitpattern,[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
@@ -62,13 +63,13 @@ for M=[4,6,8]
|
||||
vp = [0.25,0.5,0.75,1];
|
||||
vb = [1:0.1:1.8];
|
||||
|
||||
rop = -5:5;
|
||||
rop = 0;
|
||||
sir = 28;
|
||||
laser_linewidth = 10e6;
|
||||
pn_key = 9;
|
||||
vp = 0.5;
|
||||
vb = 1;%[1:0.1:1.8];
|
||||
mpi_path=50;
|
||||
mpi_path = 50;
|
||||
|
||||
cnt = 1;
|
||||
|
||||
@@ -81,10 +82,59 @@ for M=[4,6,8]
|
||||
%digimod_out = digimod_out.normalize("mode","oneone");
|
||||
|
||||
% cnt = cnt+1;
|
||||
X = Pulseformer("fsym",fsym,"fdac",fdac,"pulse","rrc","pulselength",16,"rrcalpha",0.5).process(digimod_out);
|
||||
%X = Pulseformer("fsym",fsym,"fdac",fdac,"pulse","rrc","pulselength",16,"rrcalpha",0.05).process(digimod_out);
|
||||
X = digimod_out;
|
||||
|
||||
% % precomp
|
||||
[b,a] = butter(2,75e9/(fsym/2),"low");
|
||||
H=freqz(b,a,length(X),fsym,'whole');
|
||||
max_amp_db = 3;
|
||||
p = find(abs(H)<10^(-max_amp_db/20));
|
||||
H(p) = 10^(-max_amp_db/20);
|
||||
H_maxatt = H;
|
||||
H_maxatt = max(H,10^(-20/20));
|
||||
H_inv = 1./H_maxatt;
|
||||
|
||||
freq_vec = linspace(-X.fs/2,X.fs/2,length(X));
|
||||
|
||||
h = sin(pi*freq_vec/fdac)./(pi*freq_vec/fdac);
|
||||
|
||||
max_amp_db = 40;
|
||||
max_amp_lin = 10^(-max_amp_db/20);
|
||||
|
||||
p = find(h<max_amp_lin);
|
||||
|
||||
h(p)=10^(-max_amp_db/20);
|
||||
|
||||
h = 1./h;
|
||||
|
||||
figure(13);
|
||||
plot(freq_vec.*1e-9,20*log10(fftshift(H_inv)));
|
||||
hold on
|
||||
plot(freq_vec.*1e-9,20*log10((h)));
|
||||
|
||||
|
||||
|
||||
X.signal = ifft(fftshift(h).'.*fft(X.signal));
|
||||
% X.signal = ifft(H_inv.*fft(X.signal));
|
||||
|
||||
figure(12)
|
||||
spectrum_plot(X.signal,fsym);
|
||||
|
||||
% 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);
|
||||
X = AWG("fdac",fdac,"dac_min",-1,"dac_max",1,"lpf_active",0,"H_lpf",LP_awg,"kover",kover,"bit_resolution",16,"normalize2dac",1,"upsampling_method","samplehold").process(X);
|
||||
|
||||
spectrum_plot(X.signal,X.fs);
|
||||
|
||||
|
||||
burg_coeff = arburg(X.signal(10000:20000),100);
|
||||
|
||||
[h,w] = freqz(1,burg_coeff,length(X),"whole",fsym*kover);
|
||||
h = h/max(abs(h));
|
||||
hold on
|
||||
plot(w,20*log10(h),'DisplayName','Burg Coeff');
|
||||
|
||||
spectrum_plot(X.signal,X.fs);
|
||||
|
||||
% 6) Lowpass behavior before laser
|
||||
X = LP_modulator.process(X);
|
||||
@@ -100,11 +150,11 @@ for M=[4,6,8]
|
||||
|
||||
[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')
|
||||
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));
|
||||
|
||||
@@ -131,7 +181,7 @@ for M=[4,6,8]
|
||||
% 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)
|
||||
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);
|
||||
@@ -181,16 +231,8 @@ for M=[4,6,8]
|
||||
"eq_avg_blocklength",0).process(Scpe_sig,digimod_out);
|
||||
|
||||
% Demap
|
||||
% Rx_Bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
|
||||
Rx_Bits = PAMmapper(M,0).demap(EQ_sym);
|
||||
%
|
||||
% 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",100,"skip_end",150,"returnErrorLocation",1);
|
||||
@@ -198,13 +240,13 @@ for M=[4,6,8]
|
||||
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;
|
||||
plot_analysis_window;
|
||||
% drawnow;
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
save('pam4_level_comp');
|
||||
% save('pam4_level_comp');
|
||||
disp('saved_run2');
|
||||
end
|
||||
end
|
||||
|
||||
BIN
projects/MPI_April/results_ber.png
Normal file
BIN
projects/MPI_April/results_ber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -14,8 +14,6 @@ function simulate_tx_sig(filename)
|
||||
|
||||
lp_laser = Filter('filtdegree',2,"f_cutoff",50e9,"fsamp",fdac*kover,"filterType",filtertypes.butterworth);
|
||||
|
||||
|
||||
|
||||
%% PROCESS TX
|
||||
|
||||
% 1) PRBS Generation
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user