WIP - signal types

This commit is contained in:
Silas Oettinghaus
2023-05-15 16:14:37 +02:00
parent 0086346efd
commit f6b2f3eee9
5 changed files with 52 additions and 17 deletions

View File

@@ -32,7 +32,7 @@ classdef AWG
% Detailed explanation goes here
arguments
options.preset = [];
options.preset = [] ;
options.kover = 16;
options.repetitions = 1;
options.normalize = 1;
@@ -79,9 +79,18 @@ classdef AWG
end
function data_out = process_channel(obj,data_in)
function elec_out = process_channel(obj,data_in)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
arguments(Input)
obj
data_in Informationsignal
end
arguments(Output)
elec_out Electricalsignal
end
obj.signal_length = length(data_in);
if obj.normalize
@@ -96,24 +105,24 @@ classdef AWG
% 1. Quantize the signal
if obj.bit_resolution>0
data_out = obj.quantization(data_in) ;
elec_out = obj.quantization(data_in) ;
else
data_out = data_in;
elec_out = data_in;
end
% 2. Sample and hold + repeat (data_out: 1xsignal length)
data_out = repmat(data_out,obj.repetitions,obj.kover);
data_out = reshape(data_out',[],1);
elec_out = repmat(elec_out,obj.repetitions,obj.kover);
elec_out = reshape(elec_out',[],1);
% 3. Add skew
if obj.skew_active
data_out = obj.skew(data_out);
elec_out = obj.skew(elec_out);
end
% 4. Apply LPF on the signal
if obj.lpf_active
lpf = Filter('filtdegree',4,"f_cutoff",obj.f_cutoff,"fsamp",obj.kover*obj.fdac,"filterType",filtertypes.bessel_inp);
data_out = lpf.process(data_out);
elec_out = lpf.process(elec_out);
% obj.H_lpf = obj.buildFilter(1);
% data_out = obj.lpf(data_out) ;
end

View File

@@ -7,10 +7,10 @@ classdef Electricalsignal < Signal
end
methods
function obj = Electricalsignal(signal, fsym, fsimu)
function obj = Electricalsignal(signal)
%ELECTRICALSIGNAL Construct an instance of this class
% Detailed explanation goes here
obj = obj@Signal(signal, fsym, fsimu);
obj = obj@Signal(signal);
end

View File

@@ -0,0 +1,25 @@
classdef Informationsignal < Signal
%OPTICALSIGNAL Summary of this class goes here
% Detailed explanation goes here
properties
nase
lambda_nm
end
methods
function obj = Informationsignal(signal)
%OPTICALSIGNAL Construct an instance of this class
% Detailed explanation goes here
obj = obj@Signal(signal);
end
function outputArg = method1(obj,inputArg)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
outputArg = obj.Property1 + inputArg;
end
end
end

View File

@@ -9,14 +9,14 @@ classdef Signal
end
methods
function obj = Signal(signal, fsym)
function obj = Signal(signal)
%SIGNAL Construct an instance of this class
% Detailed explanation goes here
obj.signal = signal;
obj.fsym = fsym;
obj.fsym = 0;
obj.fsimu = fsym;
obj.fsimu = 0;
end

View File

@@ -24,14 +24,15 @@ for i = 1:log2(M)
[bitpattern(:,i),seed] = prbs(O,N,seed);
end
S = Signal(bitpattern,fsym);
Bits = Informationsignal(bitpattern);
pamData = pam_mapping(bitpattern,M,0);
Bits.signal = pam_mapping(Bits.signal,M,0);
Bits.signal = applyPulseShaping(Bits.signal,fsym,fdac);
shapedData = applyPulseShaping(pamData,fsym,fdac);
awg = AWG('preset','M8196A','fdac',fdac,'kover',kover,'lpf_active',1);
awgSignal = awg.process_channel(shapedData);
awgSignal = awg.process_channel(Bits);
fil = Filter('filtdegree',4,"f_cutoff",50e9,"fsamp",fdac,"filterType",filtertypes.bessel_bilin);
filtered = fil.process(awgSignal);