changes in pulsef
This commit is contained in:
@@ -241,10 +241,13 @@ classdef ChannelFreqResp < handle
|
||||
xlim([0.2 .5*max(obj.faxis)*1e-9]); grid on;
|
||||
|
||||
%%% plot for publication
|
||||
figure(1234);hold all;box on;title('Magnitude Freq. Response');
|
||||
%xlim([0.2 .5*max(obj.faxis)*1e-9]);
|
||||
%ylim([-40, 2]);
|
||||
Havg_smooth = smooth(Havg,50);
|
||||
figure(1234);
|
||||
hold all;
|
||||
box on;
|
||||
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;
|
||||
Havg = fftshift(Havg);
|
||||
%Havg = smooth(Havg);
|
||||
|
||||
@@ -50,7 +50,7 @@ classdef Pulseformer
|
||||
signalclass_in = signalclass_in.logbookentry(lbdesc);
|
||||
|
||||
% 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
|
||||
signalclass_out = signalclass_in;
|
||||
@@ -80,13 +80,13 @@ classdef Pulseformer
|
||||
if ~rem(obj.fdac,obj.fsym)
|
||||
%ist ein Vielfaches
|
||||
sps = obj.fdac / obj.fsym;
|
||||
up = sps;
|
||||
dn = 1;
|
||||
p = sps;
|
||||
q = 1;
|
||||
else
|
||||
%ist kein Vielfaches
|
||||
up = obj.fdac / gcd(obj.fdac, obj.fsym);
|
||||
dn = obj.fsym / gcd(obj.fdac, obj.fsym);
|
||||
sps= up;
|
||||
p = obj.fsym / gcd(obj.fdac, obj.fsym); %upsampling p->->->
|
||||
q = obj.fdac/ gcd(obj.fdac, obj.fsym); %downsampling <-q
|
||||
sps= q; %sps während dem pulse shaping
|
||||
end
|
||||
|
||||
if obj.pulse == pulseform.rc
|
||||
@@ -123,7 +123,7 @@ classdef Pulseformer
|
||||
data_out = circshift(data_out,[0 -(obj.pulselength*sps)]);
|
||||
|
||||
if rem(obj.fdac,obj.fsym)
|
||||
data_out = data_out(1:dn:end);
|
||||
data_out = data_out(1:q:end);
|
||||
end
|
||||
|
||||
end
|
||||
@@ -132,11 +132,11 @@ classdef Pulseformer
|
||||
|
||||
%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
|
||||
st = round(up/dn*racos_len/2); %we need to cut y_out
|
||||
en = round(st + (length(data_in)*up/dn));
|
||||
st = round(p/q*racos_len/2); %we need to cut y_out
|
||||
en = round(st + (length(data_in)*p/q));
|
||||
data_out = data_out_(st:en);
|
||||
|
||||
end
|
||||
@@ -146,7 +146,7 @@ classdef Pulseformer
|
||||
subplot(2,1,1)
|
||||
title("Convolution vs. Upfirdn and Cut")
|
||||
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')
|
||||
subplot(2,1,2)
|
||||
hold on
|
||||
@@ -161,7 +161,7 @@ classdef Pulseformer
|
||||
data_out = data_out';
|
||||
|
||||
%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');
|
||||
%disp('Check signal length after pulse shaping');
|
||||
end
|
||||
|
||||
@@ -93,6 +93,8 @@ function [eq_package] = vnle(eq_,M,rx_signal,tx_symbols,tx_bits,options)
|
||||
|
||||
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);
|
||||
|
||||
showLevelHistogram(eq_signal_sd,tx_symbols,"fignum",302);
|
||||
|
||||
9
Functions/Lab_helper/loadFreqResp.m
Normal file
9
Functions/Lab_helper/loadFreqResp.m
Normal 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();
|
||||
@@ -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);
|
||||
|
||||
@@ -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,6 +83,15 @@ function [results] = dsp_ief_file(varargin)
|
||||
Tx_symbols.fs = config.fsym;
|
||||
|
||||
%%% Build Rx Signal (Rx, normalize,remove mean)
|
||||
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);
|
||||
|
||||
else
|
||||
|
||||
dataRx = dataRx*yInc+yOrg;
|
||||
Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx);
|
||||
|
||||
@@ -90,20 +99,24 @@ function [results] = dsp_ief_file(varargin)
|
||||
|
||||
Rx_Sig = Rx_Sig.normalize("mode","rms");
|
||||
|
||||
Rx_Sig.spectrum("fignum",2,"displayname",'Rx Signal','normalizeTo0dB',1);
|
||||
|
||||
% Rx_Sig.spectrum("fignum",3,"displayname",'Rx Signal','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 = 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 filt','normalizeTo0dB',1);
|
||||
|
||||
% Rx_Sig.spectrum("fignum",3,"displayname",'Rx Signal filt','normalizeTo0dB',0);
|
||||
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_Sig = Rx_Sig.delay(tcorrect,"mode","samples");
|
||||
Rx_matched.spectrum("fignum",2,"displayname",'Rx Signal m','normalizeTo0dB',1);
|
||||
|
||||
%%%%%% Sample to 2x fsym %%%%%%
|
||||
Rx_Sig_resamp = Rx_Sig.resample("fs_out",8*config.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');
|
||||
|
||||
@@ -117,43 +130,41 @@ 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();
|
||||
vnle_package = {};
|
||||
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);
|
||||
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 = 8;
|
||||
sampsPerSym = 2;
|
||||
rcrFilt = comm.RaisedCosineReceiveFilter(...
|
||||
'Shape', 'Square root', ...
|
||||
'RolloffFactor', 1, ...
|
||||
'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;
|
||||
|
||||
|
||||
Rx_matched = Rx_matched.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 = 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);
|
||||
@@ -166,7 +177,11 @@ function [results] = dsp_ief_file(varargin)
|
||||
|
||||
Rx_syncd = Rx_syncd.resample("fs_out",2*config.fsym);
|
||||
|
||||
Rx_matched.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',1);
|
||||
Rx_matched.spectrum("fignum",3,"displayname",'After Matched Filter','normalizeTo0dB',1);
|
||||
|
||||
Rx_syncd.spectrum("fignum",3,"displayname",'Zero Crossing TR','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
|
||||
|
||||
Reference in New Issue
Block a user