homeoffice push

This commit is contained in:
Silas
2024-04-29 11:30:35 +02:00
parent 7c1d9850d6
commit 54b70adda2
98 changed files with 48 additions and 62 deletions

View File

@@ -1,9 +1,9 @@
datarate = 112e9;
M = 6;
% datarate = 128e9;
M = 4;
laser_linewidth = 0;
kover = 32;
fsym = round(datarate*1e-9 / log2(M))*1e9;
fsym = 92e9;%round(datarate*1e-9 / log2(M))*1e9;
fdac = 256e9;
% 1) PRBS Generation
@@ -15,87 +15,73 @@ 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));
end
% 2 ) Build Inf. signal class
bits = Informationsignal(bitpattern);
alphas = flip([0.01,0.05,0.1,0.2,0.3,0.4]);
LP_awg = Filter('filtdegree',5,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
AWG_=AWG("fdac",fdac,"dac_min",-1,"dac_max",1,"H_lpf",LP_awg,"kover",kover,"bit_resolution",16,"lpf_active",1,"normalize2dac",1,"upsampling_method","samplehold");
% 3) Digi modulation -> PAM-M signal
% 2) 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",alphas(a)).process(digimod_out);
% 3) Pulseform Raised Cosine
X = Pulseformer("fsym",fsym,"fdac",fdac,"pulse","rrc","pulselength",16,"rrcalpha",0.2).process(digimod_out);
% plot_eye(X.signal,X.fs,fsym);
% 5) AWG (lowpass, quantization, sample and hold)
% Implememt Precompensation
% Implement Precoding
% 4) AWG (lowpass, quantization, sample and hold)
LP_awg = Filter('filtdegree',5,"f_cutoff",64e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
AWG_=AWG("fdac",fdac,"dac_min",-1,"dac_max",1,"H_lpf",LP_awg,"kover",kover,"bit_resolution",16,"lpf_active",1,"normalize2dac",1,"upsampling_method","samplehold");
X = AWG_.process(X);
f=figure(12);
f.Name = 'spectrum';
spectrum_plot(X.signal,X.fs,'spectrum');
figure(4)
LP_awg.showHere();
plot_eye(X.signal,X.fs,fsym);
disp(['El. power: ',num2str(X.power),' dBm (into 50 Ohm)']);
disp(['El. RMS voltage: ',num2str(sqrt(mean(X.signal.^2))),' V']);
disp(['max voltage: ',num2str(max(X.signal)),' V']);
rms_ = rms(X.signal);
max_ = max(X.signal);
min_ = min(X.signal);
figure(1);
hold on
plot(X.signal,'LineWidth',0.1);
yline([max_, min_],'LineWidth',2,'LineStyle','--');
yline([rms_, -rms_],'LineWidth',2,'LineStyle',':');
ylim([-3 3]);
title(['AWG output: ',num2str(X.power), 'dBm']);
f=figure(12);
f.Name = 'spectrum';
spectrum_plot(X.signal,X.fs,'spectrum');
% 6) Lowpass behavior before laser
% 5) Lowpass behavior before laser
LP_modulator= Filter('filtdegree',4,"f_cutoff",70e9,"fs",fdac*kover,"filterType",filtertypes.butterworth);
X = LP_modulator.process(X);
% 7) Normalize signal to 0dB rms
figure(1);subplot(1,2,1);plot(X.signal,'LineWidth',0.1);ylim([-3 3]);title(['AWG output: ',num2str(X.power), 'dBm into 50 Ohm']);
% 1) Laser; Modulation -> OPTICAL DOMAIN
u_pi = 2;
vbias = -1;
% 6) Laser; Modulation -> OPTICAL DOMAIN
u_pi = 4;
vbias = -1.8;
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",0,"fsimu",X.fs,"lambda",1290,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",5);
[Opt,extmodlaser] = extmodlaser.process(X);
E = X.normalize("mode","oneone");
figure(1);subplot(1,2,2);plot(E.signal,'LineWidth',0.1);ylim([-3 3]);title(['scaled to modulator; ',num2str(E.power), 'dBm']);
disp(['El. power: ',num2str(E.power),' dBm (into 50 Ohm)']);
if 1
f = figure(22);
tiledlayout(2,2);
nexttile
hold on
scatter(X.signal(1:100000),(abs(Opt.signal(1:100000)).^2)*1e3,0.1,'.','DisplayName','Modulator TF')
xlabel('Input in V')
ylabel('Output in mW')
[Opt,extmodlaser] = extmodlaser.process(E);
nexttile
hold on
plot(X.signal,'LineWidth',0.1);
yline([max_, min_],'LineWidth',2,'LineStyle','--');
yline([rms_, -rms_],'LineWidth',2,'LineStyle',':');
ylim([-3 3]);
title(['AWG output: ',num2str(X.power), 'dBm']);
nexttile
spectrum_plot(Opt.signal,Opt.fs);
rms_ = rms(X.signal);
max_ = max(X.signal);
min_ = min(X.signal);
end
f=figure(12);
f.Name = 'spectrum';
spectrum_plot(X.signal,X.fs,'spectrum');
plot_eye(E.signal,E.fs,fsym);
figure(111)
hold on
scatter(E.signal(1:100000),(abs(Opt.signal(1:100000)).^2)*1e3,0.1,'.','DisplayName','Modulator TF')
xlabel('Input in V')
ylabel('Output in mW')