WIP Büro
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
clear all
|
||||
|
||||
|
||||
%% Set Simulation Variables
|
||||
|
||||
O = 18; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
@@ -9,7 +11,8 @@ M = 4; %PAM-M
|
||||
bitpattern = zeros(N,log2(M));
|
||||
|
||||
% Symbol Rate
|
||||
fsym = 80e9;
|
||||
fsym = 112e9;
|
||||
|
||||
% DAC Rate
|
||||
fdac = 120e9;
|
||||
|
||||
@@ -22,144 +25,157 @@ fadc = 256e9;
|
||||
% Simulation frequency in "analog domain"
|
||||
fsimu = kover * fdac ;
|
||||
|
||||
|
||||
|
||||
%% CONSTRUCT ALL CLASSES
|
||||
|
||||
pam_mapper = PAMmapper(M,0);
|
||||
digimod = PAMmapper(M,0);
|
||||
|
||||
awg = AWG('preset','M8199B','fdac',fdac,'kover',kover,'lpf_active',1,'f_cutoff',80e9,'lpf_type',filtertypes.gaussian);
|
||||
awg = AWG('preset','M8199B','fdac',fdac,'kover',kover,'lpf_active',1,'f_cutoff',56e9,'lpf_type',filtertypes.gaussian,'bit_resolution',5.5);
|
||||
|
||||
fil_50 = Filter('filtdegree',1,"f_cutoff",50e9,"fsamp",fdac,"filterType",filtertypes.bessel_inp);
|
||||
lp_laser = Filter('filtdegree',1,"f_cutoff",60e9,"fsamp",fdac,"filterType",filtertypes.bessel_inp);
|
||||
|
||||
|
||||
u_pi = 3.5;
|
||||
u_pi = 4.6;
|
||||
vbias = (0.5*u_pi)-u_pi;
|
||||
extmodlaser = EML("mode",emlmodes.im_cosinus,"power",5,"fsimu",fsimu,"lambda",1550,"bias",vbias,"u_pi",u_pi,"linewidth",10000);
|
||||
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",5,"fsimu",fsimu,"lambda",1550,"bias",vbias,"u_pi",u_pi,"linewidth",10000);
|
||||
|
||||
amp = Amplifier("amp_mode","ideal_no_noise","amplification_db",0,"gain_mode","output_power");
|
||||
amp = Amplifier("amp_mode","ideal_no_noise","amplification_db",0,"gain_mode","output_power");
|
||||
|
||||
fib = Fiber("fsimu",fdac*kover,"fiber_length",0,"alpha",0.2,"D",17,"lambda0",1550);
|
||||
fib = Fiber("fsimu",fdac*kover,"fiber_length",0,"alpha",0.2,"D",17,"lambda0",1550,"gamma",0);
|
||||
|
||||
phdiode = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20);
|
||||
optatten = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",5);
|
||||
|
||||
fil_diode = Filter('filtdegree',1,"f_cutoff",120e9,"fsamp",fdac,"filterType",filtertypes.bessel_inp);
|
||||
edfaamp = Amplifier("amp_mode","edfa_increase_nase","gain_mode","output_power","amplification_db",0,"nase_mode","generate_ase","noifig",5);
|
||||
|
||||
phdiode = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20);
|
||||
|
||||
lp_diode = Filter('filtdegree',1,"f_cutoff",80e9,"fsamp",fdac,"filterType",filtertypes.bessel_inp);
|
||||
|
||||
scp = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"lpf_bw",113e9,"filtertype",filtertypes.butterworth,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",6,"quantbuffer",0.1);
|
||||
|
||||
eq = EQ("K",2,"plottrain",0,"plotfinal",1,...
|
||||
"training_length",4096,"training_loops",5,...
|
||||
"Ne",[50,0,0],"Nb",[0,0,0],...
|
||||
"DCmu",0.005,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0.000,...
|
||||
"dd_loops",2,"epsilon",[10 100 1000 ],"M",4,...
|
||||
"thres",[0.005 0.004 0.0005 ],"l1act",0,"delay",1,"rho",0.0005,"ideal_dfe",0,"DB_aim",0);
|
||||
|
||||
scp = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"lpf_bw",113e9,"filtertype",filtertypes.butterworth,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",6,"quantbuffer",0.1);
|
||||
|
||||
eq = EQ("K",2,"plottrain",0,"plotfinal",1,...
|
||||
"training_length",4096,"training_loops",5,...
|
||||
"Ne",[50,0,0],"Nb",[0,0,0],...
|
||||
"DCmu",0.005,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0.000,...
|
||||
"dd_loops",2,"epsilon",[10 100 1000 ],"M",4,...
|
||||
"thres",[0.005 0.004 0.0005 ],"l1act",0,"delay",2,"rho",0.0005,"ideal_dfe",0,"DB_aim",0);
|
||||
|
||||
%% PROCESS
|
||||
% INFORMATION SIGNAL
|
||||
|
||||
% PRBS Generation
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
bits = Informationsignal(bitpattern);
|
||||
% Build Inf. signal class
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
mod_out = pam_mapper.map(bits);
|
||||
% Digi Mod
|
||||
mod_out = digimod.map(bits);
|
||||
|
||||
reference = mod_out;
|
||||
|
||||
reference = mod_out;
|
||||
|
||||
mod_out.signal = applyPulseShaping(mod_out.signal,fsym,fdac);
|
||||
|
||||
% ELECTRICAL DOMAIN
|
||||
X = awg.process(mod_out);
|
||||
X = fil_50.process(X);
|
||||
X = X.normalize;
|
||||
|
||||
% OPTICAL DOMAIN
|
||||
X = extmodlaser.process(X);
|
||||
% AWG -> ELECTRICAL DOMAIN
|
||||
X = awg.process(mod_out);
|
||||
|
||||
X = amp.process(X);
|
||||
X = lp_laser.process(X);
|
||||
|
||||
X = fib.process(X);
|
||||
X = X.normalize;
|
||||
|
||||
X = phdiode.process(X);
|
||||
% Laser; Modulation -> OPTICAL DOMAIN
|
||||
X = extmodlaser.process(X);
|
||||
X.spectrum(fsimu,"displayname",'laser out','figurename','after laser');
|
||||
|
||||
X = fil_diode.process(X);
|
||||
%X = amp.process(X);
|
||||
|
||||
% ELECTRICAL DOMAIN
|
||||
X = scp.process(X);
|
||||
% Fiber Propagation
|
||||
X = fib.process(X);
|
||||
X = optatten.process(X);
|
||||
X = edfaamp.process(X);
|
||||
|
||||
X = X.resample("fs_out",2*fsym,"fs_in",fadc);
|
||||
% Photo Diode -> ELECTRICAL DOMAIN
|
||||
X = phdiode.process(X);
|
||||
X = lp_diode.process(X);
|
||||
X.spectrum(fsimu,"displayname",'diode out','figurename','after diode');
|
||||
% Oscilloscope (Sampling to f_adc; Quantization; Bandwidth Limitation)
|
||||
X = scp.process(X);
|
||||
|
||||
% Resample to Symbol Rate
|
||||
X = X.resample("fs_out",2*fsym,"fs_in",fadc);
|
||||
|
||||
% INFORMATION SIGNAL
|
||||
X = X.normalize;
|
||||
eq_out = eq.process(X,reference);
|
||||
rx_series = eq_out.signal;
|
||||
X = X.normalize;
|
||||
|
||||
demap_out = pam_mapper.demap(eq_out);
|
||||
% Equalizer
|
||||
eq_out = eq.process(X,reference);
|
||||
rx_series = eq_out.signal;
|
||||
|
||||
[bits,errors,BER] = calc_ber(demap_out.signal(:,10000:end-20),bitpattern(10000:end-19,:)',0);
|
||||
|
||||
|
||||
%%
|
||||
figure(22)
|
||||
clf
|
||||
subplot(3,1,1)
|
||||
hold on
|
||||
plot(reference.signal(10000:end-20));
|
||||
plot(rx_series(10000:end-20));
|
||||
hold off
|
||||
subplot(3,1,2)
|
||||
hold on
|
||||
plot(reference.signal(4150:4175));
|
||||
plot(rx_series(4150:4175));
|
||||
hold off
|
||||
subplot(3,1,3)
|
||||
hold on
|
||||
stem(demap_out.signal(1,4150:4175))
|
||||
stem(bitpattern(4150:4175,1)')
|
||||
hold off
|
||||
legend
|
||||
|
||||
xax = 1:eq_out.length;
|
||||
col = cbrewer2('Set1',4);
|
||||
|
||||
figure(12)
|
||||
sgtitle('Laser Linewidth = 10 MHz; SIR = 24 dB ; $N_{1,2}$ = 100')
|
||||
subplot(1,4,1:2)
|
||||
scatter(1:X.length,X.signal,4,'.','MarkerEdgeColor',col(2,:),'DisplayName','A1');
|
||||
xlim([1, xax(end)]);
|
||||
%ylim([-2 2]);
|
||||
xlabel('Sampling Index')
|
||||
ylabel('Amplitude')
|
||||
legend
|
||||
|
||||
subplot(1,4,3:4)
|
||||
scatter(xax,eq_out.signal,4,'.','MarkerEdgeColor',col(1,:),'DisplayName','No MPI Mitigation');
|
||||
xlim([1, xax(end)]);
|
||||
%ylim([-2 2]);
|
||||
xlabel('Sampling Index')
|
||||
ylabel('Amplitude')
|
||||
legend
|
||||
|
||||
a = fftshift(xcorr(X.signal(1,:),circshift(bitpattern(:,1)',0)));
|
||||
% Digi Demod
|
||||
demap_out = digimod.demap(eq_out);
|
||||
|
||||
% BER
|
||||
if (length(X.signal) ~= length(bitpattern'))
|
||||
warning("TX and RX bitstreams have different length...")
|
||||
end
|
||||
|
||||
|
||||
|
||||
disp(demap_out.logbook);
|
||||
[bits,errors,BER] = calc_ber(demap_out.signal(:,1:end-1),bitpattern(1:end,:)',0);
|
||||
disp(['BER: ', sprintf('%2E',BER)]);
|
||||
|
||||
% disp(demap_out.logbook);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%% Generate some Plots
|
||||
if 0
|
||||
col = cbrewer2('Paired',8);
|
||||
|
||||
figure(22)
|
||||
clf
|
||||
% subplot(3,1,1)
|
||||
% hold on
|
||||
% plot(reference.signal(10000:end-20),'DisplayName','Tx','Color',col(1,:),'LineWidth',3);
|
||||
% plot(rx_series(10000:end-20),'DisplayName','Rx','Color',col(6,:));
|
||||
% title('Modulated Sequence Tx - Rx');
|
||||
% legend
|
||||
% hold off
|
||||
subplot(2,1,1)
|
||||
hold on
|
||||
plot(reference.signal(4150:4175),'DisplayName','Tx','Color',col(1,:),'LineWidth',3);
|
||||
plot(rx_series(4150:4175),'DisplayName','Rx after EQ','Color',col(6,:),'LineWidth',1);
|
||||
title('Modulated Sequence Zoom');
|
||||
legend
|
||||
hold off
|
||||
subplot(2,1,2)
|
||||
hold on
|
||||
stem(demap_out.signal(1,4150:4175),'DisplayName','Tx','Color',col(1,:),'LineStyle','-','LineWidth',5)
|
||||
stem(bitpattern(4150:4175,1)','DisplayName','Rx','Color',col(6,:),'LineStyle','--','LineWidth',2)
|
||||
title('Bitpattern Tx - Rx');
|
||||
legend
|
||||
hold off
|
||||
|
||||
|
||||
xax = 1:eq_out.length;
|
||||
|
||||
figure(12)
|
||||
sgtitle('')
|
||||
subplot(1,4,1:2)
|
||||
scatter(1:4:X.length,X.signal(1:4:end),4,'.','MarkerEdgeColor',col(5,:),'DisplayName','Before EQ');
|
||||
xlim([1, xax(end)]);
|
||||
%ylim([-2 2]);
|
||||
xlabel('Sampling Index')
|
||||
ylabel('Amplitude')
|
||||
legend
|
||||
|
||||
subplot(1,4,3:4)
|
||||
scatter(xax,eq_out.signal,4,'.','MarkerEdgeColor',col(6,:),'DisplayName','After EQ');
|
||||
xlim([1, xax(end)]);
|
||||
%ylim([-2 2]);
|
||||
xlabel('Sampling Index')
|
||||
ylabel('Amplitude')
|
||||
legend
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user