updates of framework

- focus on AWG output power and lowpass characteristics
This commit is contained in:
Silas Oettinghaus
2024-04-26 14:08:21 +02:00
parent 0600abfcbf
commit 7c1d9850d6
25 changed files with 864 additions and 279 deletions

View File

@@ -5,9 +5,10 @@ classdef AWG
properties(Access=public)
kover %oversampling factor e.g. 16
upsampling_method
repetitions %repeat the signal to generate a longer sequence?
fdac %needed
normalize %want to normalize at first? either 0 or 1
normalize2dac %want to normalize at first? either 0 or 1
bit_resolution %bit res. of quantizer (e.g. 5 bit)
dac_min
dac_max
@@ -32,8 +33,9 @@ classdef AWG
arguments
options.kover = 16;
options.upsampling_method upsampling_mode
options.repetitions = 1;
options.normalize = 1;
options.normalize2dac = 1;
options.fdac = 92e9;
options.bit_resolution = 5.5
options.dac_min = -0.5;
@@ -44,6 +46,7 @@ classdef AWG
options.lpf_type = 0;
options.f_cutoff = 32e9;
options.H_lpf Filter
end
fn = fieldnames(options);
@@ -59,9 +62,20 @@ classdef AWG
len_in = length(signalclass_in.signal);
if signalclass_in.fs ~= obj.fdac
signalclass_in = signalclass_in.resample("fs_in",signalclass_in.fs,"fs_out",obj.fdac);
end
% 1-3. actual processing of the signal (normalize->quantize->sample hold)
signalclass_in.signal = obj.process_(signalclass_in.signal);
% cast the inform. signal to electrical signal
signalclass_in = Electricalsignal(signalclass_in,"fs",obj.fdac*obj.kover,"logbook",signalclass_in.logbook);
% normalize to 0dBm before applying the lowpass
%signalclass_in = signalclass_in.normalize("mode","milliwatt");
signalclass_in = signalclass_in.setPower(12,"dBm");
% 4. Apply LPF on the signal
if obj.lpf_active
if isa(obj.H_lpf,'Filter')
@@ -74,10 +88,9 @@ classdef AWG
signalclass_in = lpf.process(signalclass_in);
end
end
% cast the inform. signal to electrical signal
signalclass_in = Electricalsignal(signalclass_in,"fs",obj.fdac*obj.kover,"logbook",signalclass_in.logbook);
% append to logbook
current_class = class(obj);
lbdesc = ['AWG ', current_class , '// k_over:',num2str(obj.kover),'. f_dac:',num2str(obj.fdac*1e-9),'GHz. Resolution:',num2str(obj.bit_resolution),' bits.'];
@@ -108,16 +121,17 @@ classdef AWG
obj.signal_length = length(data_in);
if obj.normalize
% 0a Normalize the signal to 1 Vpp and set the amplitude of the signal
if obj.normalize2dac
% 0a Normalize the signal to full scale DAC range
data_in = data_in - min(data_in);
data_in = data_in/(max(data_in)-min(data_in));
else
% 0b Cut the Signal at -1 and 1 and scale to amplitude
data_in(data_in > 1) = 1;
data_in(data_in < -1) = -1;
data_in = data_in * (obj.dac_max-obj.dac_min);
data_in = data_in + obj.dac_min;
end
% 1. Quantize the signal
% 1. Quantize the signal - Full Scale is between obj.dac_min
% and dac_max. If signal is smaller in between, you won't use
% the full bit-resolution.
if obj.bit_resolution>0
elec_out = obj.quantization(data_in) ;
else
@@ -125,8 +139,16 @@ classdef AWG
end
% 2. Sample and hold + repeat (data_out: 1xsignal length)
elec_out = repmat(elec_out,obj.repetitions,obj.kover);
elec_out = reshape(elec_out',[],1);
if obj.upsampling_method == 1
% just use matlab function
elec_out = resample(elec_out,obj.kover,1);
elseif obj.upsampling_method == 2
% sample and hold
elec_out = repmat(elec_out,obj.repetitions,obj.kover);
elec_out = reshape(elec_out',[],1);
else
error('chosen upsampling method not implemented?');
end
% 3. Add skew (not implemented so far)
if obj.skew_active
@@ -145,7 +167,7 @@ classdef AWG
if isreal(x_in)
% shift signal and clip to quantizer intervall
x_in = min(max(x_in-obj.dac_min,0),obj.dac_max-obj.dac_min);
x_in = min( max(x_in-obj.dac_min,0), obj.dac_max-obj.dac_min);
% quantize signal
x_in = round((steps-1)/(obj.dac_max-obj.dac_min)*x_in);

View File

@@ -24,6 +24,7 @@ classdef PAMmapper
if isa(signal_in,'Signal')
signal_in.signal = obj.map_(signal_in.signal);
signal_in = signal_in.normalize("mode","rms");
signal_in = signal_in.logbookentry();
out = signal_in;
else
@@ -57,7 +58,7 @@ classdef PAMmapper
pam_sig=2*pam_sig-3;
end
pam_sig = pam_sig .* 1/sqrt(5);
pam_sig = pam_sig/sqrt(5);
case 6
@@ -85,7 +86,7 @@ classdef PAMmapper
pam_sig=2*pam_sig-7;
end
pam_sig = pam_sig/sqrt(21);
case 16
% 16-ASK:
x1 = bitpattern(:,1);
@@ -126,6 +127,7 @@ classdef PAMmapper
elseif obj.unipolar==1
thres=[0.5,1.5,2.5];
end
thres = thres .* 1/sqrt(5);
case 6 %PAM 6
@@ -139,6 +141,8 @@ classdef PAMmapper
elseif obj.unipolar==1
thres=0.5:6.5;
end
thres=thres./sqrt(21);
case 16
% 16-ASK

View File

@@ -88,7 +88,7 @@ classdef Pulseformer
%Bau das Filter (hier rrc)
racos_len = obj.pulselength*2;
alpha = obj.rrcalpha;
h = rcosdesign(alpha,racos_len,sps);
h = rcosdesign(alpha,racos_len,sps,"normal");
h = h./ max(h);
end
@@ -118,8 +118,8 @@ classdef Pulseformer
% %Apply Filter using Matlab build in fctn.
h = rcosdesign(alpha,racos_len,sps);
h = h./ max(h);
% h = rcosdesign(alpha,racos_len,sps);
% h = h./ max(h);
%data_out_ = upfirdn(data_in,h,up,dn);
%
% %cut signal, which is longer due to fir filter
@@ -128,8 +128,8 @@ classdef Pulseformer
% data_out = data_out(st:en);
%scaling?! see pulsef module line 696
scale = max(max([abs(real(data_out)) abs(imag(data_out))])); %find max value from real and imag part
data_out = data_out./scale;
% scale = max(max([abs(real(data_out)) abs(imag(data_out))])); %find max value from real and imag part
% data_out = data_out./scale;
data_out = data_out';