WIP büro
This commit is contained in:
80
Classes/03_receive/Photodiode.m
Normal file
80
Classes/03_receive/Photodiode.m
Normal file
@@ -0,0 +1,80 @@
|
||||
classdef Photodiode
|
||||
%PGOTODIODE Summary of this class goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
properties
|
||||
fsimu
|
||||
responsivity
|
||||
dark_current
|
||||
temperature
|
||||
|
||||
end
|
||||
|
||||
methods
|
||||
function obj = Photodiode(options)
|
||||
%PHOTODIODE Construct an instance of this class
|
||||
% Detailed explanation goes here
|
||||
arguments
|
||||
options.fsimu
|
||||
options.responsivity = 1;
|
||||
options.dark_current = 0;
|
||||
options.temperature = 20;
|
||||
end
|
||||
|
||||
obj.fsimu = options.fsimu;
|
||||
obj.responsivity = options.responsivity;
|
||||
obj.dark_current = options.dark_current;
|
||||
obj.temperature = options.temperature;
|
||||
|
||||
end
|
||||
|
||||
function signalclass_out = process(obj,signalclass_in)
|
||||
|
||||
% actual processing of the signal (steps 1. - 3.)
|
||||
signalclass_in.signal = obj.process_(signalclass_in.signal);
|
||||
|
||||
% cast the inform. signal to electrical signal
|
||||
[signalclass_in, nase, lambda] = Electricalsignal(signalclass_in,"fs",obj.fsimu,"logbook",signalclass_in.logbook);
|
||||
|
||||
% append to logbook
|
||||
lbdesc = ['Photo Diode '];
|
||||
signalclass_in = signalclass_in.logbookentry(lbdesc);
|
||||
|
||||
% write to output
|
||||
signalclass_out = signalclass_in;
|
||||
|
||||
end
|
||||
|
||||
function yout = process_(obj,xin)
|
||||
%METHOD1 Summary of this method goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
k = Constant.Boltzmann;
|
||||
T = obj.temperature + 273.15 ; %celsius + 273 = kelvin
|
||||
R = 50; %resistance of phdiode (50ohm is typical value)
|
||||
|
||||
% Magnitude squared detection
|
||||
yout = sum( abs(xin) .^2*obj.responsivity, 2 ) ;
|
||||
|
||||
% Shot Noise
|
||||
shot_noise = sqrt(k * obj.fsimu .* yout) .* randn(size(yout,1),1);
|
||||
|
||||
yout = yout + shot_noise;
|
||||
|
||||
% Thermal Noise
|
||||
therm_current_psd = (2 * k * T / R ) ; %squared
|
||||
|
||||
Bw = obj.fsimu; %is this correct? shouldnt it be the bandwidth of the actual component? e.g. 70GHz?
|
||||
therm_noise_pow = therm_current_psd * 2 * Bw; %squared
|
||||
|
||||
therm_noise = sqrt(therm_noise_pow) .* randn(size(yout,1),1);
|
||||
|
||||
yout = yout + therm_noise;
|
||||
|
||||
% Dark Current
|
||||
yout = yout + obj.dark_current ;
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user