121 lines
4.0 KiB
Matlab
121 lines
4.0 KiB
Matlab
|
|
clear;
|
|
col = linspecer(6);
|
|
|
|
if ismac
|
|
foldername = '/Users/silasoettinghaus/Documents/MATLAB/Labor_Datensatz_PAM4_MPI/pam4_10km_1km';
|
|
else
|
|
foldername = 'C:\Users\Silas\Documents\MATLAB\Labor_Datensatz_PAM4_MPI\pam4_10km_1km';
|
|
end
|
|
|
|
allfiles = dir(foldername);
|
|
|
|
mudc_loop = [0.05 0.01 0.005];
|
|
|
|
parfsym = zeros(length(mudc_loop),length(allfiles));
|
|
parsir = zeros(length(mudc_loop),length(allfiles));
|
|
ber_wo_reduction = zeros(length(mudc_loop),length(allfiles));
|
|
ber_w_dcremoval = zeros(length(mudc_loop),length(allfiles));
|
|
mudc = zeros(length(mudc_loop),length(allfiles));
|
|
|
|
|
|
for j = 1:length(mudc_loop)
|
|
mudc_current = mudc_loop(j);
|
|
parfor i = 1:length(allfiles)
|
|
|
|
if allfiles(i).bytes ~= 0
|
|
current_filename = allfiles(i).name;
|
|
else
|
|
continue
|
|
end
|
|
|
|
% load dataset
|
|
simdata = load([foldername,filesep, current_filename]);
|
|
% get common variables of simulation loop
|
|
|
|
%even if redundant, save stuff to results struct
|
|
parsir(j,i) = simdata.saveStructTemp.awg2scope_keysight_state.eigenlight_mpi - 3.3 + 7.2;
|
|
parfsym(j,i) = simdata.saveStructTemp.common.f_sym;
|
|
|
|
fdac = simdata.saveStructTemp.common.f_DAC;
|
|
fadc = simdata.saveStructTemp.common.f_ADC;
|
|
fsym = simdata.saveStructTemp.common.f_sym;
|
|
|
|
% 0) build RX Signal
|
|
|
|
y_rx = Electricalsignal(simdata.saveStructTemp.dp_tsynch_out');
|
|
|
|
y_rx.fs = 2.*fsym;
|
|
|
|
% 0) build tx reference Signal for eq training
|
|
y_digimod = Electricalsignal(simdata.saveStructTemp.digi_mod_out');
|
|
y_digimod.fs = fsym;
|
|
|
|
|
|
% 1) normlaize
|
|
y_rx = y_rx.normalize("mode","rms");
|
|
|
|
eq = EQ_silas("Ne",[50,9,9],"Nb",[2,0,0],"trainlength",4096,...
|
|
"sps",2,...
|
|
"mu_dc_dd",mudc_current,...
|
|
"mu_dc_train",mudc_current,...
|
|
"mu_ffe_train",0,...
|
|
"mu_dfe_train",0.005,...
|
|
"mu_ffe_dd",[0.0004 0.0004 0.0004],...
|
|
"mu_dfe_dd",0.005,...
|
|
"ddloops",4,...
|
|
"trainloops",4,...
|
|
"eq_blocklength",10);
|
|
|
|
[Eq_out] = eq.process(y_rx,y_digimod);
|
|
|
|
|
|
% 2.2) MPI reduction blocks
|
|
|
|
% 3) digital demodulation
|
|
digimod = PAMmapper(2^simdata.saveStructTemp.common.M,0);
|
|
|
|
d_hat = digimod.demap(Eq_out);
|
|
|
|
d_ = digimod.demap(Electricalsignal(simdata.saveStructTemp.digi_mod_out'));
|
|
d = simdata.saveStructTemp.prms_out;
|
|
|
|
% 4) BER calculation
|
|
[totalbits,errors_bm,ber_dhat,loc] = calc_ber(d_hat.signal(1:end,:) ,d(1:end,:)',"skip",0,"returnErrorLocation",1);
|
|
|
|
ber_nodctap = mean(simdata.saveStructTemp.prms_compare_state.BER );
|
|
|
|
disp(['fsym: ',num2str(parfsym(j,i).*1e-9),'GBd, SIR: ',num2str(parsir(j,i)),' ->> BER_new: ',sprintf('%2E',ber_dhat),' BER_old: ',sprintf('%2E',ber_nodctap)]);
|
|
|
|
% 5) save to struct
|
|
|
|
ber_wo_reduction(j,i) = ber_nodctap;
|
|
ber_w_dcremoval(j,i) = ber_dhat;
|
|
mudc(j,i) = eq.mu_dc_dd;
|
|
|
|
end
|
|
end
|
|
|
|
rate = [92e9, 56e9];
|
|
figure(99)
|
|
|
|
for j = 1:length(mudc_loop)
|
|
for r = 1:length(rate)
|
|
a = [parsir(j,parfsym(j,:)==rate(r));ber_wo_reduction(j,parfsym(j,:)==rate(r))];
|
|
a=sort(a,2);
|
|
plot(a(1,:),a(2,:),'DisplayName',[num2str(rate(r).*1e-9),' GBd; PAM4; w/o reduction'],'LineWidth',2,'Marker','o','MarkerSize',3);
|
|
%scatter(parsir(parfsym==rate(r)),ber_wo_reduction(parfsym==rate(r)),'DisplayName',[num2str(rate(r).*1e-9),' GBd; PAM4; w/o reduction'],'LineWidth',2,'Marker','o')
|
|
hold on
|
|
b = [parsir(j,parfsym(j,:)==rate(r));ber_w_dcremoval(j,parfsym(j,:)==rate(r))];
|
|
b=sort(b,2);
|
|
plot(b(1,:),b(2,:),'DisplayName',[num2str(rate(r).*1e-9),' GBd; PAM4; adaptive DC removal'],'LineWidth',2,'Marker','+','MarkerSize',3);
|
|
%scatter(parsir(parfsym==rate(r)),ber_w_dcremoval(parfsym==rate(r)),'DisplayName',[num2str(rate(r).*1e-9),' GBd; PAM4; adaptive DC removal'],'LineWidth',2,'Marker','+');
|
|
end
|
|
end
|
|
set(gca, 'YScale', 'log');
|
|
yline(3.8e-3,'LineWidth',1.5);
|
|
|
|
|
|
|
|
|