2011-09-19 08:14:27 +00:00
|
|
|
function [port] = calcPort( port, SimDir, f, varargin)
|
2012-02-22 09:14:38 +00:00
|
|
|
% [port] = calcPort( port, SimDir, f, varargin)
|
2010-05-21 09:41:33 +00:00
|
|
|
%
|
2012-11-09 14:41:18 +00:00
|
|
|
% Calculate:
|
|
|
|
% - voltages and currents
|
|
|
|
% - the propagation constant and the characteristic impedance (if applicable)
|
|
|
|
%
|
|
|
|
% The port has to be created by e.g. AddMSLPort(), AddLumpedPort() or AddCurvePort
|
2010-05-21 09:41:33 +00:00
|
|
|
%
|
2010-10-04 08:16:05 +00:00
|
|
|
% input:
|
2011-09-19 08:14:27 +00:00
|
|
|
% port: return value of AddMSLPort()
|
2010-10-04 08:16:05 +00:00
|
|
|
% SimDir: directory, where the simulation files are
|
2011-09-19 08:14:27 +00:00
|
|
|
% f: frequency vector for DFT
|
|
|
|
%
|
|
|
|
% variable input:
|
2012-02-22 09:14:38 +00:00
|
|
|
% 'RefImpedance': - use a given reference impedance to calculate inc and
|
|
|
|
% ref voltages and currents
|
|
|
|
% - default is given port or calculated line impedance
|
2012-11-09 14:41:18 +00:00
|
|
|
% 'RefPlaneShift': for transmission lines only, See also calcTLPort for
|
|
|
|
% more details
|
2010-05-21 09:41:33 +00:00
|
|
|
%
|
2011-09-19 08:14:27 +00:00
|
|
|
% output:
|
|
|
|
% port.f the given frequency fector
|
|
|
|
% port.uf.tot/inc/ref total, incoming and reflected voltage
|
|
|
|
% port.if.tot/inc/ref total, incoming and reflected current
|
2013-03-22 12:52:27 +00:00
|
|
|
% port.ZL_ref used refernce impedance
|
2012-11-09 14:41:18 +00:00
|
|
|
%
|
|
|
|
% if port is a transmission line port:
|
2011-09-19 08:14:27 +00:00
|
|
|
% port.beta: propagation constant
|
|
|
|
% port.ZL: characteristic line impedance
|
2010-10-04 08:16:05 +00:00
|
|
|
%
|
2011-09-19 08:14:27 +00:00
|
|
|
% example:
|
2012-11-09 14:41:18 +00:00
|
|
|
% port = calcPort(port, Sim_Path, f, 'RefImpedance', 50);
|
2010-10-04 08:16:05 +00:00
|
|
|
%
|
|
|
|
% openEMS matlab interface
|
|
|
|
% -----------------------
|
2012-11-09 14:41:18 +00:00
|
|
|
% (C) 2012 Thorsten Liebig <thorsten.liebig@gmx.de>
|
|
|
|
%
|
|
|
|
% See also AddMSLPort, AddLumpedPort, AddCurvePort, calcTLPort, calcLumpedPort
|
2011-09-19 08:14:27 +00:00
|
|
|
|
2012-11-09 14:41:18 +00:00
|
|
|
if (iscell(port))
|
|
|
|
for n=1:numel(port)
|
|
|
|
port{n}=calcPort(port{n}, SimDir, f, varargin{:});
|
2011-09-19 08:14:27 +00:00
|
|
|
end
|
2012-11-09 14:41:18 +00:00
|
|
|
return;
|
2010-05-21 09:41:33 +00:00
|
|
|
end
|
|
|
|
|
2012-11-09 14:41:18 +00:00
|
|
|
if strcmpi(port.type,'MSL')
|
|
|
|
port = calcTLPort( port, SimDir, f, varargin{:});
|
|
|
|
return
|
2013-03-22 12:54:18 +00:00
|
|
|
elseif strcmpi(port.type,'WaveGuide')
|
|
|
|
port = calcWGPort( port, SimDir, f, varargin{:});
|
|
|
|
return
|
2012-11-09 14:41:18 +00:00
|
|
|
elseif (strcmpi(port.type,'Lumped') || strcmpi(port.type,'Curve'))
|
|
|
|
port = calcLumpedPort( port, SimDir, f, varargin{:});
|
|
|
|
return
|
2013-03-22 12:52:27 +00:00
|
|
|
else
|
|
|
|
error 'unknown port type'
|
2011-09-19 08:14:27 +00:00
|
|
|
end
|
|
|
|
|