Bald fertig für richtige Nutzung - Move_it vergleich fertig

Complete Checkup with Move_it: this framework is an almost perfect reproduction.
This commit is contained in:
Silas Oettinghaus
2023-06-08 15:33:57 +02:00
parent 2868887a15
commit 2aeacafe78
14 changed files with 198 additions and 122 deletions

View File

@@ -1,6 +1,6 @@
rng(2023);
rng(2020);
%% Set Simulation Variables
@@ -32,48 +32,50 @@ fsimu = kover * fdac ;
digimod = PAMmapper(M,0);
pulsef = Pulseformer("pulseform","rrc","fdac",fdac,"fsym",fsym,"pulselength",32,"rrcalpha",0.05);
pulseform = Pulseformer("pulseform","rrc","fdac",fdac,"fsym",fsym,"pulselength",32,"rrcalpha",0.05);
awg = AWG('preset','M8199B','fdac',fdac,'kover',kover,'lpf_active',1,'f_cutoff',56e9,'lpf_type',filtertypes.gaussian,'bit_resolution',5.5);
awg = AWG('fdac',fdac,'kover',kover,'lpf_active',1,'f_cutoff',56e9,'lpf_type',filtertypes.gaussian,'bit_resolution',5.5);
lp_laser = Filter('filtdegree',1,"f_cutoff",60e9,"fsamp",fdac,"filterType",filtertypes.bessel_inp);
lp_laser = Filter('filtdegree',1,"f_cutoff",50e9,"fsamp",fdac*kover,"filterType",filtertypes.bessel_inp);
u_pi = 4.6;
vbias = (0.5*u_pi)-u_pi;
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",15,"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");
extmodlaser = EML("mode",eml_mode.im_cosinus,"power",5,"fsimu",fsimu,"lambda",1550,"bias",vbias,"u_pi",u_pi,"linewidth",1e6);
fib = Fiber("fsimu",fdac*kover,"fiber_length",1,"alpha",0.2,"D",17,"lambda0",1550,"gamma",0);
optatten = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",0);
reflectionpoint = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",-20);
reflectionprop = Fiber("fsimu",fdac*kover,"fiber_length",1,"alpha",0.2,"D",17,"lambda0",1550,"gamma",0);
opticatten = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",0);
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);
lp_diode = Filter('filtdegree',1,"f_cutoff",50e9,"fsamp",fdac*kover,"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);
"adcresolution",6,"quantbuffer",0.1,'block_dc',1);
eq = EQ("K",2,"plottrain",0,"plotfinal",0,...
"training_length",4096,"training_loops",5,...
"Ne",[30,0,0],"Nb",[0,0,0],...
"DCmu",0.005,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.002,"FFEmu",0.00,...
"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.00,...
"dd_loops",2,"epsilon",[10 100 1000 ],"M",4,...
"thres",[0.005 0.004 0.0005 ],"l1act",0,"delay",0,"rho",0.0005,"ideal_dfe",0,"DB_aim",0);
"thres",[0.005 0.004 0.0005 ],"l1act",0,"delay",1,"rho",0.0005,"ideal_dfe",0,"DB_aim",0);
%% PROCESS
output_pow = 0
for lp1 = 1:length(output_pow)
fiblen = 0;
for lp1 = 1:length(fiblen)
% change parameters
optatten.amplification_db = output_pow(lp1);
fib.fiber_length = fiblen(lp1);
% PRBS Generation
@@ -93,25 +95,38 @@ for lp1 = 1:length(output_pow)
reference = mod_out;
% shape shape
mod_out = pulsef.process(mod_out);
test = applyPulseShaping(reference.signal,fsym,fdac);
X = pulseform.process(mod_out);
test = applyPulseShaping(reference.signal,fsym,fdac);
% AWG -> ELECTRICAL DOMAIN
X = awg.process(mod_out);
awg_out = awg.process(X);
X = lp_laser.process(awg_out);
X = lp_laser.process(X);
X = X.normalize;
X = X.normalize("mode","oneone");
X.signal = X.signal .* 1.3800;
% Laser; Modulation -> OPTICAL DOMAIN
X = extmodlaser.process(X);
%X.spectrum(fsimu,"displayname",'laser out','figurename','after laser');
%X = amp.process(X);
% Fiber Propagation
X = fib.process(X);
X = optatten.process(X);
%% Reflect with attenuation
R = reflectionpoint.process(X);
% Propagate
R = reflectionprop.process(R);
% Delay
R = R.delay("delay_meter",200);
% Add together
X = X+R;
%%
X = opticatten.process(X);
X = edfaamp.process(X);
% Photo Diode -> ELECTRICAL DOMAIN
@@ -124,8 +139,8 @@ for lp1 = 1:length(output_pow)
% Resample to Symbol Rate
X = X.resample("fs_out",2*fsym,"fs_in",fadc);
% INFORMATION SIGNAL
X = X.normalize;
% Normalize
X = X.normalize("mode","rms");
% Equalizer
eq_out = eq.process(X,reference);
@@ -135,7 +150,8 @@ for lp1 = 1:length(output_pow)
demap_out = digimod.demap(eq_out);
% BER
[bits,errors,BER] = calc_ber(demap_out.signal(:,1:end-1),bitpattern(1:end,:)',0);
[bits,errors,BER] = calc_ber(demap_out.signal(1:end-2,:),bitpattern(1:end,:),0);
disp(['BER: ', sprintf('%2E',BER), ' ERRORS: ' ,num2str(sum(errors))]);
bercurve(lp1) = BER;
@@ -145,33 +161,13 @@ end
%% Generate some Plots
if 0
if 1
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);
@@ -181,7 +177,7 @@ if 0
hold off
subplot(2,1,2)
hold on
stem(demap_out.signal(1,4150:4175),'DisplayName','Tx','Color',col(1,:),'LineStyle','-','LineWidth',5)
stem(demap_out.signal(4150:4175,1),'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
@@ -193,7 +189,7 @@ if 0
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');
scatter(1:4:X.length,X.signal(1:4:end),4,'.','MarkerEdgeColor',col(6,:),'DisplayName','Before EQ');
xlim([1, xax(end)]);
%ylim([-2 2]);
xlabel('Sampling Index')