WIP büro
This commit is contained in:
110
Classes/01_transmit/Pulseformer.m
Normal file
110
Classes/01_transmit/Pulseformer.m
Normal file
@@ -0,0 +1,110 @@
|
||||
classdef Pulseformer
|
||||
%Pulseformer Summary of this class goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
properties(Access=public)
|
||||
fdac
|
||||
fsym
|
||||
pulseform
|
||||
pulselength
|
||||
rrcalpha
|
||||
end
|
||||
|
||||
methods (Access=public)
|
||||
function obj = Pulseformer(options)
|
||||
%NAME Construct an instance of this class
|
||||
% Detailed explanation goes here
|
||||
|
||||
arguments
|
||||
options.fdac double
|
||||
options.fsym double
|
||||
options.pulseform pulseform = pulseform.rrc
|
||||
options.pulselength double {mustBeInteger} = 32
|
||||
options.rrcalpha double = 0.05
|
||||
end
|
||||
|
||||
%
|
||||
fn = fieldnames(options);
|
||||
for n = 1:numel(fn)
|
||||
try
|
||||
obj.(fn{n}) = options.(fn{n});
|
||||
end
|
||||
end
|
||||
|
||||
% do more stuff
|
||||
|
||||
end
|
||||
|
||||
function signalclass_out = process(obj,signalclass_in)
|
||||
|
||||
% actual processing of the signal (steps 1. - 3.)
|
||||
signalclass_in.signal = obj.process_(signalclass_in.signal);
|
||||
|
||||
% append to logbook
|
||||
lbdesc = ['Applied Pulseshaping'];
|
||||
signalclass_in = signalclass_in.logbookentry(lbdesc);
|
||||
|
||||
% write to output
|
||||
signalclass_out = signalclass_in;
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
methods (Access=private)
|
||||
% Cant be seen from outside! So put all your functions here that can/
|
||||
% shall not be called from outside
|
||||
|
||||
function data_out = process_(obj,data_in)
|
||||
%METHOD1 Summary of this method goes here
|
||||
% Detailed explanation goes here
|
||||
arguments(Input)
|
||||
obj
|
||||
data_in double
|
||||
end
|
||||
|
||||
arguments(Output)
|
||||
data_out double
|
||||
end
|
||||
|
||||
if ~rem(obj.fdac,obj.fsym)
|
||||
%ist ein Vielfaches
|
||||
sps = obj.fdac / obj.fsym;
|
||||
up = sps;
|
||||
dn = 1;
|
||||
else
|
||||
%ist kein Vielfaches
|
||||
up = obj.fdac / gcd(obj.fdac, obj.fsym);
|
||||
dn = obj.fsym / gcd(obj.fdac, obj.fsym);
|
||||
sps= up;
|
||||
end
|
||||
|
||||
if obj.pulseform == pulseform.rrc
|
||||
%Bau das Filter (hier rrc)
|
||||
racos_len = obj.pulselength ;
|
||||
alpha = obj.rrcalpha;
|
||||
h = rcosdesign(alpha,racos_len,sps);
|
||||
end
|
||||
|
||||
%Apply Filter using Matlab build in fctn.
|
||||
data_out = upfirdn(data_in,h,up,dn);
|
||||
|
||||
%cut signal, which is longer due to fir filter
|
||||
st = round(up/dn*racos_len/2); %we need to cut y_out
|
||||
en = round(st + (length(data_in)*up/dn) -1);
|
||||
|
||||
data_out = data_out(st:en);
|
||||
|
||||
%Check output integrity
|
||||
if round(up/dn * length(data_in)) ~= length(data_out)
|
||||
warning('Check signal length after pulse shaping');
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
68
Classes/class_template.m
Normal file
68
Classes/class_template.m
Normal file
@@ -0,0 +1,68 @@
|
||||
classdef Name
|
||||
%NAME Summary of this class goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
properties(Access=public)
|
||||
|
||||
|
||||
end
|
||||
|
||||
methods (Access=public)
|
||||
function obj = Name(options)
|
||||
%NAME Construct an instance of this class
|
||||
% Detailed explanation goes here
|
||||
|
||||
arguments
|
||||
options.bla bool = true
|
||||
end
|
||||
|
||||
%
|
||||
fn = fieldnames(options);
|
||||
for n = 1:numel(fn)
|
||||
try
|
||||
obj.(fn{n}) = options.(fn{n});
|
||||
end
|
||||
end
|
||||
|
||||
% do more stuff
|
||||
|
||||
end
|
||||
|
||||
function signalclass_out = process(obj,signalclass_in)
|
||||
|
||||
% actual processing of the signal (steps 1. - 3.)
|
||||
signalclass_in.signal = obj.process_(signalclass_in.signal);
|
||||
|
||||
% append to logbook
|
||||
lbdesc = ['Logbookentry'];
|
||||
signalclass_in = signalclass_in.logbookentry(lbdesc);
|
||||
|
||||
% write to output
|
||||
signalclass_out = signalclass_in;
|
||||
|
||||
end
|
||||
|
||||
function data_out = process_(obj,data_in)
|
||||
%METHOD1 Summary of this method goes here
|
||||
% Detailed explanation goes here
|
||||
arguments(Input)
|
||||
obj
|
||||
data_in double
|
||||
end
|
||||
|
||||
arguments(Output)
|
||||
data_out double
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods (Access=private)
|
||||
% Cant be seen from outside! So put all your functions here that can/
|
||||
% shall not be called from outside
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
7
Datatypes/pulseform.m
Normal file
7
Datatypes/pulseform.m
Normal file
@@ -0,0 +1,7 @@
|
||||
classdef pulseform < int32
|
||||
|
||||
enumeration
|
||||
rrc (1)
|
||||
end
|
||||
|
||||
end
|
||||
BIN
Functions/.DS_Store
vendored
BIN
Functions/.DS_Store
vendored
Binary file not shown.
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"_schemaVersion": "1.0.0",
|
||||
"myFunc":
|
||||
{
|
||||
"inputs":
|
||||
[
|
||||
{"name":"in1", "kind":"required", "type":["numeric"], "purpose":"ID of item"},
|
||||
{"name":"in2", "kind":"required", "type":["numeric"], "purpose":"# Items"},
|
||||
{"name":"in3", "kind":"ordered", "type":["numeric"], "purpose":"Input Value"},
|
||||
{"name":"Name1", "kind":"namevalue", "type":["logical","scalar"],"purpose":"Option"},
|
||||
{"name":"Name2", "kind":"namevalue", "type":["char", "choices={'Default','Choice1','Choice2'}"]}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
% myFunc Example function
|
||||
% This function is called with any of these syntaxes:
|
||||
%
|
||||
% myFunc(in1, in2) accepts 2 required arguments.
|
||||
% myFunc(in1, in2, in3) also accepts an optional 3rd argument.
|
||||
% myFunc(___, NAME, VALUE) accepts one or more of the following name-value pair
|
||||
% arguments. This syntax can be used in any of the previous syntaxes.
|
||||
% * 'NAME1' with logical value
|
||||
% * 'NAME2' with 'Default', 'Choice1', or 'Choice2'
|
||||
function myFunc(reqA,reqB,varargin)
|
||||
% Initialize default values
|
||||
NV1 = true;
|
||||
NV2 = 'Default';
|
||||
posA = [];
|
||||
|
||||
if nargin > 3
|
||||
if rem(nargin,2)
|
||||
posA = varargin{1};
|
||||
V = varargin(2:end);
|
||||
else
|
||||
V = varargin;
|
||||
end
|
||||
for n = 1:2:size(V,2)
|
||||
switch V{n}
|
||||
case 'Name1'
|
||||
NV1 = V{n+1};
|
||||
case 'Name2'
|
||||
NV2 = V{n+1}
|
||||
otherwise
|
||||
error('Error.')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
|
||||
clear
|
||||
%% Set Simulation Variables
|
||||
|
||||
O = 18; %order of prbs
|
||||
@@ -31,6 +31,8 @@ fsimu = kover * fdac ;
|
||||
|
||||
digimod = PAMmapper(M,0);
|
||||
|
||||
pulsef = Pulseformer("pulseform","rrc","fdac",fdac,"fsym",fsym,"pulselength",32,"rrcalpha",0.05);
|
||||
|
||||
awg = AWG('preset','M8199B','fdac',fdac,'kover',kover,'lpf_active',1,'f_cutoff',56e9,'lpf_type',filtertypes.gaussian,'bit_resolution',5.5);
|
||||
|
||||
lp_laser = Filter('filtdegree',1,"f_cutoff",60e9,"fsamp",fdac,"filterType",filtertypes.bessel_inp);
|
||||
@@ -78,11 +80,12 @@ bits = Informationsignal(bitpattern);
|
||||
% Digi Mod
|
||||
mod_out = digimod.map(bits);
|
||||
|
||||
|
||||
% merken für EQ training
|
||||
reference = mod_out;
|
||||
|
||||
mod_out.signal = applyPulseShaping(mod_out.signal,fsym,fdac);
|
||||
|
||||
% shape shape
|
||||
mod_out = pulsef.process(mod_out);
|
||||
test = applyPulseShaping(reference.signal,fsym,fdac);
|
||||
|
||||
% AWG -> ELECTRICAL DOMAIN
|
||||
X = awg.process(mod_out);
|
||||
|
||||
Reference in New Issue
Block a user