function [results] = dsp_ief_file(varargin) mu_ffe1 = 0.0001; mu_ffe2 = 0.0008; mu_ffe3 = 0.001; mu_dc = 0.005; mu_dfe = 0.0004; vnle_order1 = 50; vnle_order2 = 3; vnle_order3 = 3; tcorrect = 0; %%% change specific parameter if given in varargin % Parse optional input arguments if ~isempty(varargin) var_s = varargin{1}; if isstruct(var_s) fields = fieldnames(var_s); for i = 1:numel(fields) if isnumeric(fields{i}) eval([fields{i}, ' = ', num2str( var_s.(fields{i}) ), ';']); fprintf("%s <-- %.2f \n", fields{i}, var_s.(fields{i})); else eval([fields{i}, ' = ', 'var_s.(fields{',num2str(i),'})' , ';']); end end else error('Optional variables should be passed as a struct.'); end end ssdPath = "D:\36_IMDD_Kiel\Data"; % code = "20250221T004802"; % code = "20250221T032043"; filename = findFileByCode(ssdPath, filecode{1}); % Extract parameters from the filename using an updated regex tokens = regexp(filename, 'Pmod_([-0-9p]+)dBm_P_PD_([-0-9p]+)dBm_.*?_(\d+)GBd_(\d+)PAM__\d+T\d+', 'tokens'); if isempty(tokens) error('Filename format not recognized.'); end tokens = tokens{1}; % Convert values config.P_laser = str2double(strrep(tokens{1}, 'p', '.')); config.P_pd = str2double(strrep(tokens{2}, 'p', '.')); config.fsym = str2double(tokens{3}) * 1e9; % Convert GBd to Hz config.M = str2double(tokens{4}); % Display results fprintf('Loaded file: %s\n', filename); fprintf('P_laser: %.3f dBm\n', config.P_laser); fprintf('P_pd: %.3f dBm\n', config.P_pd); fprintf('fsym: %.1f GBd\n', config.fsym*1e-9); fprintf('M: %d\n', config.M); %%% Load Data filepath = fullfile(filename); ief_ = h5info(filepath); config.fs_rx = h5readatt(filepath,'/','fs'); %sampling frequency at Rx config.fs_tx = h5readatt(filepath, '/','fs_Tx'); %sampling frequency at Tx config.fsym = h5readatt(filepath, '/','R'); %Baudrate config.M = h5readatt(filepath, '/','M'); % PAM- 'M' config.ROF = h5readatt(filepath, '/','ROF'); config.PulseShape =h5readatt(filepath, '/','PulseShape'); yOrg = h5readatt(filepath, ief_.Groups(4).Groups(1).Name, 'YOrg'); yInc = h5readatt(filepath, ief_.Groups(4).Groups(1).Name, 'YInc'); dataRx = double(h5read(filepath, '/Waveforms/Channel 2/Channel 2Data')); % rohdaten des CH4 bitsTx = h5read(filepath, '/Settings/dataTx'); %Binär bitsTx = reshape(bitsTx,log2(config.M),[])'; %%% Build Tx Signal (Bits, Pam Map, Symbols) Tx_bits = Informationsignal(bitsTx); Tx_symbols = PAMmapper(config.M,0,"eth_style",1).map(Tx_bits); Tx_symbols.fs = config.fsym; %%% Build Rx Signal (Rx, normalize,remove mean) dataRx = dataRx*yInc+yOrg; Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx); Rx_Sig = Rx_Sig.normalize("mode","rms"); % Rx_Sig.spectrum("fignum",3,"displayname",'Rx Signal','normalizeTo0dB',0); Rx_Sig = Filter('filtdegree',6,"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.delay(tcorrect,"mode","samples"); %%%%%% Sample to 2x fsym %%%%%% Rx_Sig_resamp = Rx_Sig.resample("fs_out",2*config.fsym); %%%%%% 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.eye(fsym,M,"fignum",4,"displayname",'eye diagram'); % timing syncroization ?? % filter Bw output = struct(); vnle_package = {}; vnle_pf_package = {}; dbtgt_package = {}; for s = 1:length(S) Rx_Sig_sync = S{s}; Rx_Sig_sync.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',0); mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3]; vnle_order=[vnle_order1,vnle_order2,vnle_order3]; eq_ = EQ("Ne",vnle_order,"Nb",[0,0,0],"training_length",4096*2,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1); %%%%% VNLE only (or DFE) %%%% if 0 [result] = vnle(eq_,config.M,Rx_Sig_sync,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1); vnle_package{s} = result; end %%%%% VNLE + PF + MLSE %%%% if 0 pf_ = Postfilter("ncoeff",1,"useBurg",1); mlse_ = MLSE_viterbi("duobinary_output",0,'M',config.M,'trellis_states',PAMmapper(config.M,0).levels); doub_mode = db_mode.no_db; [result] = vnle_postfilter_mlse(eq_,pf_,mlse_,config.M,Rx_Sig_sync,Tx_symbols,Tx_bits,"precode_mode",doub_mode,'showAnalysis',1,'eth_style_symbol_mapping',1); vnle_pf_package{s} = result; end %%%%% Duobinary Targeting %%%% if 1 mlse_db = MLSE_viterbi("DIR",[1,1],"duobinary_output",0,"M",config.M,"trellis_states",PAMmapper(config.M,0).levels); doub_mode = db_mode.db_emulate; [result] = duobinary_target(eq_, mlse_db, config.M, Rx_Sig_sync, Tx_symbols, Tx_bits, "precode_mode", doub_mode,'showAnalysis',1,'eth_style_symbol_mapping',1); dbtgt_package{s} = result; end end results.vnle_package = vnle_package; results.vnle_pf_package = vnle_pf_package; results.dbtgt_package = dbtgt_package; end