changes in pulsef

This commit is contained in:
silas (home)
2025-03-11 07:17:26 +01:00
parent ea8a43b2ae
commit 0abb5d3d69
6 changed files with 114 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
% 202502211_km_fiber_Pmod_15dBm_P_PD_9p2494dBm_W03C34-0603E03_160GBd_8PAM__20250221T024256.h5
M = 8;
if M == 4
@@ -40,7 +40,7 @@ elseif M ==8
"20250221T024929",...%172 ohne balun
"20250221T025305",...%176 ohne balun
};
file_codes = {"20250221T004651"};
file_codes = {"20250221T024256"};
baudrate = [96,112,120,128,136,144,152,160,168,172,176];
end
@@ -48,34 +48,35 @@ if 1
uloops = struct;
uloops.filecode = file_codes;
uloops.tcorrect = [0];
uloops.mu_dc = [0];
wh = DataStorage(uloops);
wh.addStorage("ber");
wh = submit_handle(@dsp_ief_file,wh,"parallel",0);
end
a = wh.getStoValue('ber',uloops.filecode, uloops.tcorrect);
a = wh.getStoValue('ber',uloops.filecode, uloops.mu_ffe1);
% get best results per baudrate
% ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_package, 'UniformOutput', false), a, 'UniformOutput', false);
% best_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
ber_mlse_values = cellfun(@(a) cellfun(@(y) y.ber_mlse, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
best_mlse = cellfun(@(x) min(cell2mat(x)), ber_mlse_values);
% ber_vnle_values = cellfun(@(a) cellfun(@(y) y.ber_vnle, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
% best_vnle = cellfun(@(x) min(cell2mat(x)), ber_vnle_values);
%
% ber_mlse_values = cellfun(@(a) cellfun(@(y) y.ber_mlse, a.vnle_pf_package, 'UniformOutput', false), a, 'UniformOutput', false);
% best_mlse = cellfun(@(x) min(cell2mat(x)), ber_mlse_values);
%%% PLOT PARAMETER OPTIMIZATION
figure()
figure(2)
cols = cbrewer2('Set1',6);
hold on
title(sprintf('%d km | %d nm | PAM %d',1,1313.5,M));
xax = uloops.tcorrect;
plot(xax,best_vnle,'DisplayName',sprintf('VNLE'),'Color',cols(1,:),'LineStyle','-','HandleVisibility','on');
xax = uloops.mu_ffe1;
plot(xax,best_vnle,'DisplayName',sprintf('VNLE 50,3,3'),'Color',cols(o,:),'LineStyle','-','HandleVisibility','on');
plot(xax,best_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
% plot(xax,best_mlse,'DisplayName',sprintf('VNLE + 1 tap post-filter + MLSE'),'Color',cols(2,:),'LineStyle','-','HandleVisibility','on');
% plot(xax,best_db,'DisplayName',sprintf('DB tgt. + MLSE'),'Color',cols(3,:),'LineStyle','-','HandleVisibility','on');
@@ -85,12 +86,11 @@ xlim([min(xax), max(xax) ]);
yline([3.8e-3, 2e-2],'HandleVisibility','off');
legend
beautifyBERplot()
xlabel('Number 1st order taps');
xlabel('Adaption speed');
ylabel('BER');
%%% PLOT COMPLETE BAUDRATE
figure(20)
cols = cbrewer2('Set1',6);

View File

@@ -4,10 +4,10 @@ function [results] = dsp_ief_file(varargin)
mu_ffe1 = 0.0001;
mu_ffe2 = 0.0008;
mu_ffe3 = 0.001;
mu_dc = 0.005;
mu_dc = 0.00;
mu_dfe = 0.0004;
vnle_order1 = 50;
vnle_order1 = 100;
vnle_order2 = 3;
vnle_order3 = 3;
@@ -83,27 +83,40 @@ function [results] = dsp_ief_file(varargin)
Tx_symbols.fs = config.fsym;
%%% Build Rx Signal (Rx, normalize,remove mean)
dataRx = dataRx*yInc+yOrg;
Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx);
loadAfterTR = 0;
if loadAfterTR
rx_sig = load("testSilas.mat","signal_TR3");
rx_sig=rx_sig.signal_TR3;
Rx_Sig_resamp = Informationsignal(rx_sig,"fs",config.fsym*2);
Rx_Sig.signal = Rx_Sig.signal - mean(Rx_Sig.signal);
else
Rx_Sig = Rx_Sig.normalize("mode","rms");
dataRx = dataRx*yInc+yOrg;
Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx);
Rx_Sig.signal = Rx_Sig.signal - mean(Rx_Sig.signal);
% Rx_Sig.spectrum("fignum",3,"displayname",'Rx Signal','normalizeTo0dB',0);
Rx_Sig = Filter('filtdegree',0,"f_cutoff",Tx_symbols.fs.*0.9,"fs",Rx_Sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Rx_Sig);
% Rx_Sig.spectrum("fignum",3,"displayname",'Rx Signal filt','normalizeTo0dB',0);
Rx_Sig = Rx_Sig.normalize("mode","rms");
Rx_Sig.spectrum("fignum",2,"displayname",'Rx Signal','normalizeTo0dB',1);
Rx_Sig = Filter('filtdegree',4,"f_cutoff",Tx_symbols.fs.*0.9,"fs",Rx_Sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Rx_Sig);
Rx_Sig = Rx_Sig.delay(tcorrect,"mode","samples");
%%%%%% Sample to 2x fsym %%%%%%
Rx_Sig_resamp = Rx_Sig.resample("fs_out",8*config.fsym);
Rx_Sig.spectrum("fignum",2,"displayname",'Rx Signal filt','normalizeTo0dB',1);
mf = Pulseformer("alpha",config.ROF,"fsym",config.fsym,"fdac",Rx_Sig.fs,"matched",1,"pulse","rrc","pulselength",32);
Rx_matched = mf.process(Rx_Sig);
Rx_matched.spectrum("fignum",2,"displayname",'Rx Signal m','normalizeTo0dB',1);
%%%%%% Sample to 2x fsym %%%%%%
Rx_Sig_resamp = Rx_Sig.resample("fs_out",2*config.fsym);
end
%%%%%% Sync Rx signal with reference (S is a cell array with all occurences) %%%%%%
[Rx_Sig_sync,S,isFlipped] = Rx_Sig_resamp.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",0);
[Rx_Sig_sync,S,isFlipped] = Rx_Sig_resamp.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
% Rx_Sig_sync.eye(fsym,M,"fignum",4,"displayname",'eye diagram');
@@ -116,7 +129,6 @@ function [results] = dsp_ief_file(varargin)
%
% [Rx_Sig_sync,S,isFlipped] = Rx_Sig_sync.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
%
% filter Bw
output = struct();
@@ -124,49 +136,52 @@ function [results] = dsp_ief_file(varargin)
vnle_pf_package = {};
dbtgt_package = {};
for s = 1:length(S)
for s = 1%:length(S)
Rx_Sig_sync = S{s};
Rx_Sig_sync = Rx_Sig_sync.normalize("mode","rms");
% figure();hold on;plot(Tx_symbols.resample("fs_out",2*config.fsym).normalize("mode","oneone").signal);plot(Rx_Sig_sync.normalize("mode","oneone").signal);
%
Tx_symbols.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
Rx_Sig_sync.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
if 1
Tx_symbols.spectrum("fignum",3,"displayname",'Tx Symbols','normalizeTo0dB',1);
Rx_Sig_sync.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
Nsym = 64;
sampsPerSym = 2;
rcrFilt = comm.RaisedCosineReceiveFilter(...
'Shape', 'Square root', ...
'RolloffFactor', config.ROF, ...
'FilterSpanInSymbols', Nsym, ...
'InputSamplesPerSymbol', sampsPerSym, ...
'DecimationFactor', 1);
yr = rcrFilt([Rx_Sig_sync.signal;zeros(Nsym*sampsPerSym/2, 1)]);
fltDelay = Nsym / (2*config.fsym);
yr = yr(fltDelay*Rx_Sig_sync.fs+1:end);
Rx_matched = Rx_Sig_sync;
Rx_matched.signal = yr;
Nsym = 64;
sampsPerSym = 8;
rcrFilt = comm.RaisedCosineReceiveFilter(...
'Shape', 'Square root', ...
'RolloffFactor', 1, ...
'FilterSpanInSymbols', Nsym, ...
'InputSamplesPerSymbol', sampsPerSym, ...
'DecimationFactor', 1);
yr = rcrFilt([Rx_Sig_sync.signal;zeros(Nsym*sampsPerSym/2, 1)]);
fltDelay = Nsym / (2*config.fsym);
yr = yr(fltDelay*Rx_Sig_sync.fs+1:end);
Rx_matched = Rx_Sig_sync;
Rx_matched.signal = yr;
% Rx_matched = Rx_matched.resample("fs_out",2*config.fsym);
% length(Rx_matched);
% symbolSync = comm.SymbolSynchronizer("Modulation","PAM/PSK/QAM","SamplesPerSymbol",2,"TimingErrorDetector","Mueller-Muller (decision-directed)");
% Rx_syncd = Rx_matched;
% [Rx_syncd.signal,tError] = symbolSync(Rx_syncd.signal);
% Rx_syncd.fs = config.fsym;
% length(Rx_syncd);
% figure();hold on;
% stem(Tx_symbols.normalize("mode","oneone").signal);
% stem(Rx_syncd.normalize("mode","oneone").signal);
%
% figure();hold on;
% plot(Rx_Sig_sync.normalize("mode","oneone").signal);
% plot(Rx_matched.normalize("mode","oneone").signal);
Rx_matched = Rx_matched.resample("fs_out",2*config.fsym);
Rx_syncd = Rx_syncd.resample("fs_out",2*config.fsym);
symbolSync = comm.SymbolSynchronizer("Modulation","PAM/PSK/QAM","SamplesPerSymbol",2);
Rx_syncd = Rx_matched;
Rx_syncd.signal = real(symbolSync(Rx_syncd.signal));
Rx_syncd.fs = config.fsym;
Rx_matched.spectrum("fignum",3,"displayname",'After Matched Filter','normalizeTo0dB',1);
% figure();hold on;
% stem(Tx_symbols.normalize("mode","oneone").signal);
% stem(Rx_syncd.normalize("mode","oneone").signal);
%
% figure();hold on;
% plot(Rx_Sig_sync.normalize("mode","oneone").signal);
% plot(Rx_matched.normalize("mode","oneone").signal);
Rx_syncd.spectrum("fignum",3,"displayname",'Zero Crossing TR','normalizeTo0dB',1);
Rx_syncd = Rx_syncd.resample("fs_out",2*config.fsym);
Rx_matched.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
end
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
@@ -177,7 +192,7 @@ function [results] = dsp_ief_file(varargin)
if 1
[result] = vnle(eq_,config.M,Rx_matched,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1);
[result] = vnle(eq_,config.M,Rx_syncd,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1);
vnle_package{s} = result;
end