new minimal example
new project: FSO stuff
This commit is contained in:
@@ -108,9 +108,6 @@ classdef Electricalsignal < Signal
|
|||||||
obj.signal = obj.signal*scling;
|
obj.signal = obj.signal*scling;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,7 @@ classdef Opticalsignal < Signal
|
|||||||
s = mean( abs(obj.signal-mean(obj.signal)).^2 );
|
s = mean( abs(obj.signal-mean(obj.signal)).^2 );
|
||||||
cspr = 10*log10(c / s);
|
cspr = 10*log10(c / s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ classdef Signal
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
%% CONVERT TO Opticalsignal
|
%% CONVERT TO Opticalsignal
|
||||||
function o_sig = Opticalsignal(obj, options)
|
function o_sig = Opticalsignal(obj, options)
|
||||||
|
|
||||||
@@ -273,7 +272,6 @@ classdef Signal
|
|||||||
SignalCopy = [];
|
SignalCopy = [];
|
||||||
ModifierName = class(CallingModifier);
|
ModifierName = class(CallingModifier);
|
||||||
|
|
||||||
|
|
||||||
cell = {SignalType , TimeStamp , Length , SignalPower(1) , Nase, SignalCopy, ModifierName, ModifierCopy, Description};
|
cell = {SignalType , TimeStamp , Length , SignalPower(1) , Nase, SignalCopy, ModifierName, ModifierCopy, Description};
|
||||||
|
|
||||||
obj.logbook = [obj.logbook; cell];
|
obj.logbook = [obj.logbook; cell];
|
||||||
@@ -363,8 +361,7 @@ classdef Signal
|
|||||||
options.fft_length = 2^(nextpow2(length(obj.signal))-9);
|
options.fft_length = 2^(nextpow2(length(obj.signal))-9);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if options.normalizeToNyquist == 0
|
if options.normalizeToNyquist == 0
|
||||||
[p_lin,f_Hz] = pwelch(obj.signal, hanning(options.fft_length), ...
|
[p_lin,f_Hz] = pwelch(obj.signal, hanning(options.fft_length), ...
|
||||||
options.fft_length/2, options.fft_length, ...
|
options.fft_length/2, options.fft_length, ...
|
||||||
@@ -488,7 +485,6 @@ classdef Signal
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function move_it_spectrum(obj,options)
|
function move_it_spectrum(obj,options)
|
||||||
arguments
|
arguments
|
||||||
obj
|
obj
|
||||||
@@ -630,7 +626,6 @@ classdef Signal
|
|||||||
|
|
||||||
case power_notation.W
|
case power_notation.W
|
||||||
%pow = pow % Watt
|
%pow = pow % Watt
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -668,7 +663,7 @@ classdef Signal
|
|||||||
|
|
||||||
%% PAPR of signal
|
%% PAPR of signal
|
||||||
function papr_db = papr_db(obj)
|
function papr_db = papr_db(obj)
|
||||||
%PAPR The peak-to-average power ratio (PAPR) is the peak amplitude squared (giving the peak power)
|
% PAPR The peak-to-average power ratio (PAPR) is the peak amplitude squared (giving the peak power)
|
||||||
% divided by the RMS value squared (giving the average power).[1] It is the square of the crest factor.
|
% divided by the RMS value squared (giving the average power).[1] It is the square of the crest factor.
|
||||||
% papr = max(abs(timesignal))^2 / rms(timesignal)^2; ODER papr = peak2rms(sig)^2;
|
% papr = max(abs(timesignal))^2 / rms(timesignal)^2; ODER papr = peak2rms(sig)^2;
|
||||||
|
|
||||||
@@ -722,7 +717,7 @@ classdef Signal
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
%%
|
%%
|
||||||
function [obj,S,inverted,sequenceFound,sequenceStarts] = tsynch(obj,options)
|
function [obj,S,inverted,sequenceFound,sequenceStarts] = tsynch(obj,options)
|
||||||
% time sync and cut
|
% time sync and cut
|
||||||
arguments
|
arguments
|
||||||
@@ -732,14 +727,11 @@ classdef Signal
|
|||||||
options.debug_plots = 0;
|
options.debug_plots = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
S = {};
|
S = {};
|
||||||
inverted = -1;
|
inverted = -1;
|
||||||
sequenceFound = 0;
|
sequenceFound = 0;
|
||||||
sequenceStarts = [];
|
sequenceStarts = [];
|
||||||
|
|
||||||
|
|
||||||
%normalize the signal
|
%normalize the signal
|
||||||
a = obj.normalize("mode","oneone").signal;
|
a = obj.normalize("mode","oneone").signal;
|
||||||
|
|
||||||
@@ -777,8 +769,6 @@ classdef Signal
|
|||||||
findpeaks(abs(co./max(co)),'MinPeakDistance',length(b)/2,'MinPeakHeight',0.2,'NPeaks',maxpeaknum,'SortStr','descend')
|
findpeaks(abs(co./max(co)),'MinPeakDistance',length(b)/2,'MinPeakHeight',0.2,'NPeaks',maxpeaknum,'SortStr','descend')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
shifts = lags(pkpos);
|
shifts = lags(pkpos);
|
||||||
sequenceStarts = shifts;
|
sequenceStarts = shifts;
|
||||||
shifts = shifts(shifts>=0);
|
shifts = shifts(shifts>=0);
|
||||||
@@ -831,7 +821,6 @@ classdef Signal
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
function obj = filter(obj,a,b)
|
function obj = filter(obj,a,b)
|
||||||
|
|
||||||
@@ -921,6 +910,7 @@ classdef Signal
|
|||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
%%
|
%%
|
||||||
function eye(obj,fsym,M,options)
|
function eye(obj,fsym,M,options)
|
||||||
|
|
||||||
@@ -981,8 +971,8 @@ classdef Signal
|
|||||||
maxA = max(sig(100:end-100))*1.3;
|
maxA = max(sig(100:end-100))*1.3;
|
||||||
minA = min(sig(100:end-100))*1.3;
|
minA = min(sig(100:end-100))*1.3;
|
||||||
|
|
||||||
maxA = 0.12;
|
% maxA = 0.12;
|
||||||
minA = -0.08;
|
% minA = -0.08;
|
||||||
|
|
||||||
difference= maxA-minA;
|
difference= maxA-minA;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ if nargin == 4
|
|||||||
M_training = [];
|
M_training = [];
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
% if input is complex, separate into real and imaginary parts
|
% if input is complex, separate into real and imaginary parts
|
||||||
if any(imag(x(:))~=0) || any(imag(r(:))~=0)
|
if any(imag(x(:))~=0) || any(imag(r(:))~=0)
|
||||||
x = [real(x); imag(x)];
|
x = [real(x); imag(x)];
|
||||||
|
|||||||
12
projects/FSO_transmission/first_analysis.m
Normal file
12
projects/FSO_transmission/first_analysis.m
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
datas = load("C:\Users\Silas\Downloads\FSO_FP_QCL_60umUTC\FSO_FP_QCL_60umUTC\6G_PAM4\M=4_Rs=6e9_Fs=8e10_I=225mA_RoP=28.02mW_L=31m_PS=RRC_rolloff=0.6_Mode=Rise.mat");
|
||||||
|
|
||||||
|
fsym = 6e9;
|
||||||
|
fs = 80e9;
|
||||||
|
|
||||||
|
rawsignal = datas.tr.lastData(1).trace.ch3.RawData;
|
||||||
|
|
||||||
|
Scope_sig = Electricalsignal(rawsignal,"fs",fs);
|
||||||
|
|
||||||
|
Scope_sig.plot("displayname",'raw','fignum',100);
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
if 1
|
if 1
|
||||||
|
|
||||||
uloops = struct;
|
uloops = struct;
|
||||||
uloops.precomp = [1];
|
uloops.precomp = [1];
|
||||||
uloops.bitrate = [300].*1e9; %[300,330,360,390,420,450,480] [224,336,360,390,420,448] for MPI
|
uloops.bitrate = [300].*1e9; %[300,330,360,390,420,450,480] [224,336,360,390,420,448] for MPI
|
||||||
@@ -8,12 +9,12 @@ if 1
|
|||||||
uloops.laser_wavelength = [1293];
|
uloops.laser_wavelength = [1293];
|
||||||
uloops.M = [4];
|
uloops.M = [4];
|
||||||
uloops.link_length = [0:2:10]; % 1,2,3,5,6,8,10
|
uloops.link_length = [0:2:10]; % 1,2,3,5,6,8,10
|
||||||
uloops.alpha = [0.5,-0.5,0];
|
uloops.alpha = [0];
|
||||||
|
|
||||||
wh = DataStorage(uloops);
|
wh = DataStorage(uloops);
|
||||||
wh.addStorage("ber");
|
wh.addStorage("ber");
|
||||||
|
|
||||||
wh = submit_handle(@imdd_model,wh,"parallel",1);
|
wh = submit_handle(@imdd_model,wh,"parallel",0);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -34,6 +35,8 @@ beautifyBERplot()
|
|||||||
ylabel('BER');
|
ylabel('BER');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%
|
%
|
||||||
% wh_ana = wh_master;
|
% wh_ana = wh_master;
|
||||||
%
|
%
|
||||||
|
|||||||
@@ -92,9 +92,13 @@ if fsym_ ~= fsym
|
|||||||
% fprintf('Adapted symbolrate to %d GBd, to match provided bitrate of %d GBit/s using PAM %d \n',fsym.*1e-9,bitrate.*1e-9, M);
|
% fprintf('Adapted symbolrate to %d GBd, to match provided bitrate of %d GBit/s using PAM %d \n',fsym.*1e-9,bitrate.*1e-9, M);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
f_nyquist = fsym/2;
|
f_nyquist = fsym/2;
|
||||||
|
|
||||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"alpha",rcalpha);
|
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",16,"alpha",rcalpha);
|
||||||
|
|
||||||
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
|
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
|
||||||
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||||
|
|||||||
156
projects/IMDD_base_system/minimal_example.m
Normal file
156
projects/IMDD_base_system/minimal_example.m
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
% minimal example IM/DD
|
||||||
|
|
||||||
|
M = 4;
|
||||||
|
fsym = 180e9;
|
||||||
|
|
||||||
|
apply_pulsef = 1;
|
||||||
|
fdac = 256e9;
|
||||||
|
fadc = 256e9;
|
||||||
|
random_key = 1;
|
||||||
|
|
||||||
|
rcalpha = 0.05;
|
||||||
|
kover = 16;
|
||||||
|
|
||||||
|
duob_mode = db_mode.no_db;
|
||||||
|
|
||||||
|
vbias_rel = 0.5;
|
||||||
|
u_pi = 3;
|
||||||
|
vbias = -vbias_rel*u_pi;
|
||||||
|
|
||||||
|
laser_wavelength = 1293;
|
||||||
|
laser_linewidth = 0;
|
||||||
|
tx_bw_nyquist = 0.8;
|
||||||
|
|
||||||
|
% Channel
|
||||||
|
link_length = 1;
|
||||||
|
|
||||||
|
% RX
|
||||||
|
rop = -8;
|
||||||
|
rx_bw_nyquist = 0.8;
|
||||||
|
|
||||||
|
vnle_order1 = 50;
|
||||||
|
vnle_order2 = 7;
|
||||||
|
vnle_order3 = 7;
|
||||||
|
|
||||||
|
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||||
|
dfe_order = [0 0 0];
|
||||||
|
|
||||||
|
pf_ncoeffs = 1;
|
||||||
|
|
||||||
|
alpha = 0;
|
||||||
|
|
||||||
|
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_ffe3 mu_ffe3];
|
||||||
|
mu_dfe = 0.0004;
|
||||||
|
|
||||||
|
|
||||||
|
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",16,"alpha",rcalpha);
|
||||||
|
|
||||||
|
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
|
||||||
|
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||||
|
"fs_out",fdac,...
|
||||||
|
"applyclipping",0,"clipfactor",1.5,...
|
||||||
|
"applypulseform",apply_pulsef,"pulseformer",Pform,...
|
||||||
|
"randkey",random_key,...
|
||||||
|
'duobinary_mode',duob_mode,...
|
||||||
|
"mrds_code",0,"mrds_blocklength",512).process();
|
||||||
|
|
||||||
|
%%%%% 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);
|
||||||
|
El_sig.spectrum("displayname",'Digi Spectrum','fignum',100,'normalizeTo0dB',0);
|
||||||
|
% El_sig = El_sig.setPower(0,"dBm");
|
||||||
|
|
||||||
|
%%%%% Electrical Driver Amplifier %%%%%%
|
||||||
|
% El_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",3).process(El_sig);
|
||||||
|
El_sig = El_sig.normalize("mode","oneone");
|
||||||
|
scaling = 0.6*(u_pi/2-abs(vbias-u_pi/2));
|
||||||
|
El_sig = El_sig .* scaling;
|
||||||
|
|
||||||
|
%%%%% MODULATE E/O CONVERSION %%%%%%
|
||||||
|
[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,"alpha",alpha).process(El_sig);
|
||||||
|
|
||||||
|
Opt_sig.spectrum("displayname",'Opt Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||||
|
|
||||||
|
% Opt_sig.eye(fsym,M,"displayname",'eye adter modulator','fignum',2026);
|
||||||
|
|
||||||
|
Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig);
|
||||||
|
|
||||||
|
%%%%%% ROP %%%%%%
|
||||||
|
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt_sig);
|
||||||
|
|
||||||
|
%%%%%% PD Square Law %%%%%%
|
||||||
|
Rx_sig = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20,"nep",1.8e-11).process(Rx_sig);
|
||||||
|
|
||||||
|
%%%%%% Low-pass RX (PD, El. Connectors and Scope %%%%%%
|
||||||
|
rx_bwl = 80e9;
|
||||||
|
Rx_sig = Filter('filtdegree',4,"f_cutoff",rx_bwl,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(Rx_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(Rx_sig);
|
||||||
|
|
||||||
|
%%%%%% Sample to 2x fsym %%%%%%
|
||||||
|
Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
|
||||||
|
Scpe_sig.signal = Scpe_sig.signal(1:2*length(Symbols));
|
||||||
|
|
||||||
|
%%%%%% Sync Rx signal with reference %%%%%%
|
||||||
|
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",0);
|
||||||
|
Scpe_sig.spectrum("displayname",'Opt Spectrum','fignum',11,'normalizeTo0dB',1);
|
||||||
|
|
||||||
|
Scpe_sig = Filter('filtdegree',4,"f_cutoff",Symbols.fs.*0.5,"fs",Scpe_sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Scpe_sig);
|
||||||
|
|
||||||
|
Scpe_sig = Scpe_sig - mean(Scpe_sig.signal);
|
||||||
|
|
||||||
|
% -------------------- FFE --------------------
|
||||||
|
ffe_order = [50, 0, 0];
|
||||||
|
eq_ffe = EQ("Ne",ffe_order,"Nb",[0,0,0], ...
|
||||||
|
"training_length",len_tr,"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",0);
|
||||||
|
|
||||||
|
output.ffe_results = ffe(eq_ffe,M,Scpe_sig,Symbols,Tx_bits, ...
|
||||||
|
"precode_mode",duob_mode,'showAnalysis',0,"postFFE",[], ...
|
||||||
|
"eth_style_symbol_mapping",0);
|
||||||
|
|
||||||
|
output.ffe_results.metrics.print
|
||||||
|
|
||||||
|
% -------------------- VNLE + MLSE --------------------
|
||||||
|
pf_ncoeffs = 1;
|
||||||
|
ffe_order3 = [50, 5, 5];
|
||||||
|
eq_v = EQ("Ne",ffe_order3,"Nb",dfe_order, ...
|
||||||
|
"training_length",len_tr,"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);
|
||||||
|
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||||
|
|
||||||
|
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
||||||
|
|
||||||
|
[output.vnle_results, output.mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||||
|
"precode_mode", duob_mode, 'showAnalysis', 0, "postFFE", [], "eth_style_symbol_mapping", 0);
|
||||||
|
|
||||||
|
|
||||||
|
% -------------------- DB target --------------------
|
||||||
|
mlse_db_ = MLSE("DIR",[1,1],"duobinary_output",0,"M",M,'trellis_states',PAMmapper(M,0).levels);
|
||||||
|
ffe_order = [50, 5, 5];
|
||||||
|
eq_ = EQ("Ne",ffe_order,"Nb",dfe_order,"training_length",len_tr,"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);
|
||||||
|
output.dbt_results = duobinary_target(eq_,mlse_db_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||||
|
"precode_mode", duob_mode, 'showAnalysis', 0, "postFFE", []);
|
||||||
|
|
||||||
|
output.dbt_results.metrics.print("description",'Duobinary');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user