more from home

This commit is contained in:
silas (home)
2025-03-10 11:49:59 +01:00
parent bc86fa8d98
commit ea8a43b2ae
6 changed files with 83 additions and 26 deletions

View File

@@ -698,18 +698,19 @@ classdef Signal
if numel(shifts) > 0
%Cut occurences of ref signal from signal (only positive shifts)
if all(sign(co(pkpos)))
isFlipped = 1;
end
for c = shifts(shifts>=0)
sig = obj.delay(-c,'mode','samples');
sig.signal = sig.signal(1:length(b));
sig.signal = sig.signal(1:length(b)).*-isFlipped;
S{end+1,1} = sig;
end
%
if all(sign(co(pkpos)))
isFlipped = 1;
end
%return/keep the sinal with the highest correlation (only within positive shifts)
[~,idx]=max(pks(shifts>=0));

View File

@@ -117,6 +117,7 @@ classdef PAMsource
else
s = RandStream('twister','Seed',obj.randkey);
for i = 1:log2(obj.M)
N = 2^(obj.order-1); %length of prbs
bitpattern(:,i) = randi(s,[0 1], N, 1);
end
end

View File

@@ -50,7 +50,7 @@ classdef Pulseformer
signalclass_in = signalclass_in.logbookentry(lbdesc);
% write fs to signal
signalclass_in.fs = obj.fdac;
signalclass_in.fs = obj.fdac .* (obj.fdac./obj.fsym);
% write to output
signalclass_out = signalclass_in;
@@ -98,14 +98,14 @@ classdef Pulseformer
%Bau das Filter (hier rc)
racos_len = obj.pulselength*2;
h = rcosdesign(obj.alpha,racos_len,sps,filtertype);
h = h./ max(h);
% h = h./ max(h);
if obj.matched
h = 1./h;
h = conj(fliplr(h));
end
manual_cyclic_convolution = 1;
upfirdn_convolution = 0;
manual_cyclic_convolution = 0;
upfirdn_convolution = 1;
if manual_cyclic_convolution
@@ -131,14 +131,13 @@ classdef Pulseformer
if upfirdn_convolution
%Apply Filter using Matlab build in fctn.
h = rcosdesign(obj.alpha,racos_len,sps,"normal");
h = h./ max(h);
data_out_ = upfirdn(data_in,h,up,dn);
%cut signal, which is longer due to fir filter
st = round(up/dn*racos_len/2)+1; %we need to cut y_out
st = round(up/dn*racos_len/2); %we need to cut y_out
en = round(st + (length(data_in)*up/dn));
data_out_ = data_out_(st:en);
data_out = data_out_(st:en);
end

View File

@@ -7,7 +7,7 @@ if 1
uloops.db_precode = [0];
uloops.bitrate = [330].*1e9; %[300,330,360,390,420,450,480]
uloops.laser_wavelength = [1310];
uloops.M = [6];
uloops.M = [4];
uloops.link_length = [2]; % 1,2,3,5,6,8,10
wh = DataStorage(uloops);
wh.addStorage("ber");

View File

@@ -139,7 +139,7 @@ if simulation_mode
db_encode = 0;
apply_pulsef = 1;
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
"fsym",fsym,"M",M,"order",18,"useprbs",1,...
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
"fs_out",fdac,...
"applyclipping",0,"clipfactor",1.5,...
"applypulseform",apply_pulsef,"pulseformer",Pform,...
@@ -149,6 +149,8 @@ if simulation_mode
Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
%%%%% AWG
% El_sig = M8199A("kover",kover).process(Digi_sig);
El_sig = AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",1).process(Digi_sig);

View File

@@ -73,7 +73,6 @@ function [results] = dsp_ief_file(varargin)
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),[])';
@@ -86,26 +85,39 @@ function [results] = dsp_ief_file(varargin)
%%% Build Rx Signal (Rx, normalize,remove mean)
dataRx = dataRx*yInc+yOrg;
Rx_Sig = Informationsignal(dataRx,"fs",config.fs_rx);
Rx_Sig.signal = Rx_Sig.signal - mean(Rx_Sig.signal);
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 = 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.delay(tcorrect,"mode","samples");
%%%%%% Sample to 2x fsym %%%%%%
Rx_Sig_resamp = Rx_Sig.resample("fs_out",2*config.fsym);
Rx_Sig_resamp = Rx_Sig.resample("fs_out",8*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 ??
% SYMSYNC = comm.SymbolSynchronizer("Modulation","PAM/PSK/QAM","SamplesPerSymbol",2);
%
% synd = SYMSYNC(Rx_Sig_sync.signal);
% Rx_Sig_sync.signal = synd;
%
% [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 = {};
@@ -114,18 +126,60 @@ function [results] = dsp_ief_file(varargin)
for s = 1:length(S)
Rx_Sig_sync = S{s};
Rx_Sig_sync.spectrum("fignum",3,"displayname",'No Matched Filter','normalizeTo0dB',0);
% 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);
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);
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;
% 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 = 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];
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);
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",1,"ideal_dfe",1);
%%%%% VNLE only (or DFE) %%%%
if 0
if 1
[result] = vnle(eq_,config.M,Rx_Sig_sync,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1);
[result] = vnle(eq_,config.M,Rx_matched,Tx_symbols,Tx_bits,"precode_mode",db_mode.no_db,"showAnalysis",1,'eth_style',1);
vnle_package{s} = result;
end
%%%%% VNLE + PF + MLSE %%%%
@@ -141,7 +195,7 @@ function [results] = dsp_ief_file(varargin)
end
%%%%% Duobinary Targeting %%%%
if 1
if 0
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;