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

@@ -241,10 +241,13 @@ classdef ChannelFreqResp < handle
xlim([0.2 .5*max(obj.faxis)*1e-9]); grid on; xlim([0.2 .5*max(obj.faxis)*1e-9]); grid on;
%%% plot for publication %%% plot for publication
figure(1234);hold all;box on;title('Magnitude Freq. Response'); figure(1234);
%xlim([0.2 .5*max(obj.faxis)*1e-9]); hold all;
%ylim([-40, 2]); box on;
Havg_smooth = smooth(Havg,50); title('Magnitude Freq. Response');
xlim([0.2 .5*max(obj.faxis)*1e-9]);
ylim([-40, 2]);
% Havg_smooth = smooth(Havg,10);
symaxis = (obj.faxis-(obj.f_ref/2))/1e9; symaxis = (obj.faxis-(obj.f_ref/2))/1e9;
Havg = fftshift(Havg); Havg = fftshift(Havg);
%Havg = smooth(Havg); %Havg = smooth(Havg);

View File

@@ -50,7 +50,7 @@ classdef Pulseformer
signalclass_in = signalclass_in.logbookentry(lbdesc); signalclass_in = signalclass_in.logbookentry(lbdesc);
% write fs to signal % write fs to signal
signalclass_in.fs = obj.fdac .* (obj.fdac./obj.fsym); signalclass_in.fs = obj.fdac;%.* (obj.fdac./obj.fsym);
% write to output % write to output
signalclass_out = signalclass_in; signalclass_out = signalclass_in;
@@ -80,13 +80,13 @@ classdef Pulseformer
if ~rem(obj.fdac,obj.fsym) if ~rem(obj.fdac,obj.fsym)
%ist ein Vielfaches %ist ein Vielfaches
sps = obj.fdac / obj.fsym; sps = obj.fdac / obj.fsym;
up = sps; p = sps;
dn = 1; q = 1;
else else
%ist kein Vielfaches %ist kein Vielfaches
up = obj.fdac / gcd(obj.fdac, obj.fsym); p = obj.fsym / gcd(obj.fdac, obj.fsym); %upsampling p->->->
dn = obj.fsym / gcd(obj.fdac, obj.fsym); q = obj.fdac/ gcd(obj.fdac, obj.fsym); %downsampling <-q
sps= up; sps= q; %sps während dem pulse shaping
end end
if obj.pulse == pulseform.rc if obj.pulse == pulseform.rc
@@ -123,7 +123,7 @@ classdef Pulseformer
data_out = circshift(data_out,[0 -(obj.pulselength*sps)]); data_out = circshift(data_out,[0 -(obj.pulselength*sps)]);
if rem(obj.fdac,obj.fsym) if rem(obj.fdac,obj.fsym)
data_out = data_out(1:dn:end); data_out = data_out(1:q:end);
end end
end end
@@ -132,11 +132,11 @@ classdef Pulseformer
%Apply Filter using Matlab build in fctn. %Apply Filter using Matlab build in fctn.
data_out_ = upfirdn(data_in,h,up,dn); data_out_ = upfirdn(data_in,h,p,q);
%cut signal, which is longer due to fir filter %cut signal, which is longer due to fir filter
st = round(up/dn*racos_len/2); %we need to cut y_out st = round(p/q*racos_len/2); %we need to cut y_out
en = round(st + (length(data_in)*up/dn)); en = round(st + (length(data_in)*p/q));
data_out = data_out_(st:en); data_out = data_out_(st:en);
end end
@@ -146,7 +146,7 @@ classdef Pulseformer
subplot(2,1,1) subplot(2,1,1)
title("Convolution vs. Upfirdn and Cut") title("Convolution vs. Upfirdn and Cut")
hold on hold on
plot(data_out_(1:200),'DisplayName','Matlab upfirdn'); % plot(data_out_(1:200),'DisplayName','Matlab upfirdn');
plot(data_out(1:200),'DisplayName','By Hand cyclic convolution') plot(data_out(1:200),'DisplayName','By Hand cyclic convolution')
subplot(2,1,2) subplot(2,1,2)
hold on hold on
@@ -161,7 +161,7 @@ classdef Pulseformer
data_out = data_out'; data_out = data_out';
%Check output integrity %Check output integrity
if abs(round(up/dn * length(data_in)) - length(data_out)) > 4 if abs(round(p/q * length(data_in)) - length(data_out)) > 4
warning('Check signal length after pulse shaping'); warning('Check signal length after pulse shaping');
%disp('Check signal length after pulse shaping'); %disp('Check signal length after pulse shaping');
end end

View File

@@ -93,6 +93,8 @@ function [eq_package] = vnle(eq_,M,rx_signal,tx_symbols,tx_bits,options)
fprintf('VNLE BER: %.2e \n',ber); fprintf('VNLE BER: %.2e \n',ber);
showEQcoefficients(eq_.e,eq_.e2,eq_.e3,"displayname",'Coefficients');
showEQNoiseSNR(tx_symbols,eq_noise,"displayname",'SNR after VNLE','fignum',301); showEQNoiseSNR(tx_symbols,eq_noise,"displayname",'SNR after VNLE','fignum',301);
showLevelHistogram(eq_signal_sd,tx_symbols,"fignum",302); showLevelHistogram(eq_signal_sd,tx_symbols,"fignum",302);

View File

@@ -0,0 +1,9 @@
precomp_path = "D:\kiel_dsp\imdd_simulation\projects\HighSpeed_ETH";
precomp_filename = "lab_high_speed_nachtschichtmzm";
% precomp_filename = "lab_high_speed";
% precomp_filename = "lab_high_speed";
freqresp = ChannelFreqResp("Nacq",1024,"Navg",64,"Ncp",63,'f_ref',92e9);
freqresp.load('loadPath',precomp_path,'fileName',precomp_filename);
freqresp.plot();

View File

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

View File

@@ -4,10 +4,10 @@ function [results] = dsp_ief_file(varargin)
mu_ffe1 = 0.0001; mu_ffe1 = 0.0001;
mu_ffe2 = 0.0008; mu_ffe2 = 0.0008;
mu_ffe3 = 0.001; mu_ffe3 = 0.001;
mu_dc = 0.005; mu_dc = 0.00;
mu_dfe = 0.0004; mu_dfe = 0.0004;
vnle_order1 = 50; vnle_order1 = 100;
vnle_order2 = 3; vnle_order2 = 3;
vnle_order3 = 3; vnle_order3 = 3;
@@ -83,27 +83,40 @@ function [results] = dsp_ief_file(varargin)
Tx_symbols.fs = config.fsym; Tx_symbols.fs = config.fsym;
%%% Build Rx Signal (Rx, normalize,remove mean) %%% Build Rx Signal (Rx, normalize,remove mean)
dataRx = dataRx*yInc+yOrg; loadAfterTR = 0;
Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx); 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 = Rx_Sig.normalize("mode","rms");
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",2,"displayname",'Rx Signal','normalizeTo0dB',1);
% Rx_Sig.spectrum("fignum",3,"displayname",'Rx Signal filt','normalizeTo0dB',0); 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"); Rx_Sig.spectrum("fignum",2,"displayname",'Rx Signal filt','normalizeTo0dB',1);
%%%%%% Sample to 2x fsym %%%%%% mf = Pulseformer("alpha",config.ROF,"fsym",config.fsym,"fdac",Rx_Sig.fs,"matched",1,"pulse","rrc","pulselength",32);
Rx_Sig_resamp = Rx_Sig.resample("fs_out",8*config.fsym); 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) %%%%%% %%%%%% 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'); % 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); % [Rx_Sig_sync,S,isFlipped] = Rx_Sig_sync.tsynch("reference",Tx_symbols,"fs_ref",config.fsym,"debug_plots",1);
% %
% filter Bw % filter Bw
output = struct(); output = struct();
@@ -124,49 +136,52 @@ function [results] = dsp_ief_file(varargin)
vnle_pf_package = {}; vnle_pf_package = {};
dbtgt_package = {}; dbtgt_package = {};
for s = 1:length(S) for s = 1%:length(S)
Rx_Sig_sync = S{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); if 1
% Tx_symbols.spectrum("fignum",3,"displayname",'Tx Symbols','normalizeTo0dB',1);
Tx_symbols.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1); Rx_Sig_sync.spectrum("fignum",3,"displayname",'No Matched Filter','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; % Rx_matched = Rx_matched.resample("fs_out",2*config.fsym);
sampsPerSym = 8; % length(Rx_matched);
rcrFilt = comm.RaisedCosineReceiveFilter(... % symbolSync = comm.SymbolSynchronizer("Modulation","PAM/PSK/QAM","SamplesPerSymbol",2,"TimingErrorDetector","Mueller-Muller (decision-directed)");
'Shape', 'Square root', ... % Rx_syncd = Rx_matched;
'RolloffFactor', 1, ... % [Rx_syncd.signal,tError] = symbolSync(Rx_syncd.signal);
'FilterSpanInSymbols', Nsym, ... % Rx_syncd.fs = config.fsym;
'InputSamplesPerSymbol', sampsPerSym, ... % length(Rx_syncd);
'DecimationFactor', 1);
% figure();hold on;
yr = rcrFilt([Rx_Sig_sync.signal;zeros(Nsym*sampsPerSym/2, 1)]); % stem(Tx_symbols.normalize("mode","oneone").signal);
fltDelay = Nsym / (2*config.fsym); % stem(Rx_syncd.normalize("mode","oneone").signal);
yr = yr(fltDelay*Rx_Sig_sync.fs+1:end); %
Rx_matched = Rx_Sig_sync; % figure();hold on;
Rx_matched.signal = yr; % 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_matched.spectrum("fignum",3,"displayname",'After Matched Filter','normalizeTo0dB',1);
Rx_syncd = Rx_matched;
Rx_syncd.signal = real(symbolSync(Rx_syncd.signal));
Rx_syncd.fs = config.fsym;
% figure();hold on; Rx_syncd.spectrum("fignum",3,"displayname",'Zero Crossing TR','normalizeTo0dB',1);
% 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);
end
Rx_syncd = Rx_syncd.resample("fs_out",2*config.fsym);
Rx_matched.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3]; mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
vnle_order=[vnle_order1,vnle_order2,vnle_order3]; vnle_order=[vnle_order1,vnle_order2,vnle_order3];
@@ -177,7 +192,7 @@ function [results] = dsp_ief_file(varargin)
if 1 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; vnle_package{s} = result;
end end