%%% Run parameters % TX M = 4; apply_pulsef = 1; fdac = 256e9; fadc = 256e9; random_key = 2; rcalpha = 0.05; kover = 8; vbias_rel = 0.5; u_pi = 3.2; vbias = -vbias_rel*u_pi; laser_wavelength = 1310; laser_linewidth = 1e6; % Channel link_length = 0; alpha = 0; doub_mode = db_mode.no_db; cols = linspecer(6); rop = [-6]; bwl = [0.5:0.1:1.5]; fsym = [208:16:256].*1e9; % nonlin_mod = [0.5:0.01:0.75]; nonlin_mod = ones(size(fsym)).*0.5; ffe_results = {}; mlse_results_lin= {}; for r = 1:length(fsym) Pform = Pulseformer("fsym",fsym(r),"fdac",4*fsym(r),"pulse","rc","pulselength",16,"alpha",rcalpha); db_precode = 0; db_encode = 0; duob_mode = db_mode.no_db; apply_pulsef = 1; [Digi_sig,Symbols,Tx_bits] = PAMsource(... "fsym",fsym(r),"M",M,"order",17,"useprbs",0,... "fs_out",fdac,... "applyclipping",0,"clipfactor",1.5,... "applypulseform",apply_pulsef,"pulseformer",Pform,... "randkey",random_key,... "db_precode",db_precode,"db_encode",db_encode,... "mrds_code",0,"mrds_blocklength",512,"duobinary_mode",duob_mode).process(); El_sig = M8199B("kover",kover).process(Digi_sig); %%%%% Electrical Driver Amplifier %%%%%% El_sig = El_sig.normalize("mode","oneone"); %%%%% MODULATE E/O CONVERSION %%%%% u_pi = 3.2; vbias = -u_pi*nonlin_mod(r); [Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",laser_wavelength,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",random_key+1).process(El_sig); %%%%%% Fiber %%%%%% Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig); %%%%%% ROP %%%%%% Opt_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt_sig); %%%%%% PD Square Law %%%%%% PD_sig = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20,"nep",1.8e-11,"randomkey",random_key).process(Opt_sig); %%%%%% Low-pass RX (PD, El. Connectors and Scope %%%%%% rx_bwl = 70e9; PD_sig = Filter('filtdegree',4,"f_cutoff",rx_bwl,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(PD_sig); % %%%%%% Low-pass Scope %%%%%% Lp_scpe = Filter('filtdegree',4,"f_cutoff",110e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true); %%%%%% Scope %%%%%% Scpe_sig = Scope("fsimu",fdac*kover,"fadc",fadc,... "delay",0,"fixed_delay",0,"filtertype",filtertypes.butterworth,... "samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,... "adcresolution",8,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',Lp_scpe).process(PD_sig); Scpe_sig_2sps = Scpe_sig.resample("fs_out",2*fsym(r)); % 2sps [~, Scpe_cell, ~, found_sync] = Scpe_sig_2sps.tsynch("reference", Symbols, "fs_ref", fsym(r), "debug_plots", 1); Rx_sig_2sps = Scpe_cell{1}; Rx_sig_2sps = Rx_sig_2sps.normalize("mode","rms"); % 1sps Scpe_sig_1sps = Scpe_sig.resample("fs_out",1*fsym(r)); [~, Scpe_cell_1sps, ~, found_sync] = Scpe_sig_1sps.tsynch("reference", Symbols, "fs_ref", fsym(r), "debug_plots", 1); Rx_sig_1sps = Scpe_cell_1sps{1}; Rx_sig_1sps = Rx_sig_1sps.normalize("mode","rms"); %% Implement DSP directly here: mu_lms = 0.0005; % tic % eq = FFE_MLSE("epochs_tr",5,"epochs_dd",5,"len_tr",2^13,"mu_dd",mu_lms,"mu_tr",mu_lms,"order",50,"sps",2,"traceback_depth",32,"L",1); % [Eq_signal,Vit_signal] = eq.process(Rx_sig_2sps,Symbols); % toc tic eq = ML_MLSE("epochs_tr",5,"epochs_dd",5,"len_tr",2^13,"mu_dd",mu_lms,"mu_tr",mu_lms,"order",50,"sps",2,"traceback_depth",32,"L",1); [Eq_signal,Vit_signal] = eq.process(Rx_sig_2sps,Symbols); toc Eq_bits = PAMmapper(M, 0, "eth_style", 0).demap(Eq_signal); [~, errors, ber, ~] = calc_ber(Eq_bits.signal, Tx_bits.signal, "skip_front", 0, "skip_end", 0, "returnErrorLocation", 1); fprintf('FFE: %.2e \n',ber); Vit_signal_ = Vit_signal; Vit_signal_.signal = circshift(Vit_signal.signal,0); Vit_bits = PAMmapper(M, 0, "eth_style", 0).demap(Vit_signal_); [~, errors, ber, errpos] = calc_ber(Vit_bits.signal, Tx_bits.signal, "skip_front", 0, "skip_end", 0, "returnErrorLocation", 1); fprintf('Viterbi: %.2e \n',ber); %% optimize smth. tr_len = 2.^[2:15]; tr_len = floor(tr_len); ber = zeros(size(tr_len)); for m = 1:numel(tr_len) mu_lms = 0.0005; eq = ML_MLSE("epochs_tr",5,"epochs_dd",5,"len_tr",2^13,"mu_dd",mu_lms,"mu_tr",mu_lms,"order",50,"sps",2,"traceback_depth",tr_len(m)); [Eq_signal,Vit_signal] = eq.process(Rx_sig_2sps,Symbols); % Eq_bits = PAMmapper(M, 0, "eth_style", 0).demap(Eq_signal); % [~, errors, ber(m), ~] = calc_ber(Eq_bits.signal, Tx_bits.signal, "skip_front", 0, "skip_end", 0, "returnErrorLocation", 1); Vit_bits = PAMmapper(M, 0, "eth_style", 0).demap(Vit_signal); [~, errors, ber(m), errpos] = calc_ber(Vit_bits.signal, Tx_bits.signal, "skip_front", 0, "skip_end", 0, "returnErrorLocation", 1); end figure(5); hold on title('1-SPS') plot(tr_len,ber,'DisplayName','BER'); xlabel('Traceback Length') beautifyBERplot legend ylim([1e-4, 1e-1]); set(gca,'YScale','log'); %% RUN Comparison len_tr = 4096*2; mu_ffe1 = 0.0001; mu_ffe2 = 0.0008; mu_ffe3 = 0.001; mu_dc = 0.005; % mu_dc = 0; mu_ffe = [mu_ffe1 mu_ffe2 mu_ffe3]; mu_dfe = 0.0004; pf_ncoeffs = 1; ffe_order = [50, 0, 0]; mu_lms = 0.0005; eq_ = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",2^13,"mu_dd",mu_lms,"mu_tr",mu_lms,"order",50,"sps",1,"dd_mode",1,"adaption_technique","lms"); % eq_ = EQ("Ne",ffe_order,"Nb",[0,0,0],"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",1,"DCmu",0.00,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1); pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1); mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels,'scale_mode',0,'trellis_exclusion',0,'trellis_state_mode',2,'debug',0); [ffe_results{r}, mlse_results_lin{r}] = vnle_postfilter_mlse(eq_, pf_, mlse_, M, Rx_sig_1sps, Symbols, Tx_bits, ... "precode_mode", duob_mode,... 'showAnalysis', 0, ... "postFFE", [],... "eth_style_symbol_mapping", 0); mlse_results_lin{r}.metrics.print; ffe_results{r}.metrics.print; end