matlab: added support for cylindrical MSL port & fix for up-side-down oriented MSL port
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/1/head
parent
fedb8a91f2
commit
84668f7e3b
|
@ -122,6 +122,13 @@ else
|
||||||
direction = -1;
|
direction = -1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
% direction of propagation
|
||||||
|
if stop(idx_height)-start(idx_height) > 0
|
||||||
|
upsidedown = +1;
|
||||||
|
else
|
||||||
|
upsidedown = -1;
|
||||||
|
end
|
||||||
|
|
||||||
% create the metal/material for the MSL
|
% create the metal/material for the MSL
|
||||||
MSL_start = start;
|
MSL_start = start;
|
||||||
MSL_stop = stop;
|
MSL_stop = stop;
|
||||||
|
@ -177,7 +184,7 @@ i2_stop(idx_prop) = i2_start(idx_prop);
|
||||||
% create the probes
|
% create the probes
|
||||||
name = ['port_ut' num2str(portnr) 'A'];
|
name = ['port_ut' num2str(portnr) 'A'];
|
||||||
% weight = sign(stop(idx_height)-start(idx_height))
|
% weight = sign(stop(idx_height)-start(idx_height))
|
||||||
weight = -1;
|
weight = upsidedown;
|
||||||
CSX = AddProbe( CSX, name, 0, weight );
|
CSX = AddProbe( CSX, name, 0, weight );
|
||||||
CSX = AddBox( CSX, name, prio, v1_start, v1_stop );
|
CSX = AddBox( CSX, name, prio, v1_start, v1_stop );
|
||||||
name = ['port_ut' num2str(portnr) 'B'];
|
name = ['port_ut' num2str(portnr) 'B'];
|
||||||
|
@ -196,13 +203,18 @@ CSX = AddProbe( CSX, name, 1, weight );
|
||||||
CSX = AddBox( CSX, name, prio, i2_start, i2_stop );
|
CSX = AddBox( CSX, name, prio, i2_start, i2_stop );
|
||||||
|
|
||||||
% create port structure
|
% create port structure
|
||||||
|
port.LengthScale = 1;
|
||||||
|
if ((CSX.ATTRIBUTE.CoordSystem==1) && (idx_prop==2))
|
||||||
|
port.LengthScale = MSL_stop(idx_height);
|
||||||
|
end
|
||||||
port.nr = portnr;
|
port.nr = portnr;
|
||||||
port.drawingunit = CSX.RectilinearGrid.ATTRIBUTE.DeltaUnit;
|
port.drawingunit = CSX.RectilinearGrid.ATTRIBUTE.DeltaUnit;
|
||||||
port.v_delta = diff(meshlines);
|
port.v_delta = diff(meshlines)*port.LengthScale;
|
||||||
port.i_delta = diff( meshlines(1:end-1) + diff(meshlines)/2 );
|
port.i_delta = diff( meshlines(1:end-1) + diff(meshlines)/2 )*port.LengthScale;
|
||||||
port.direction = direction;
|
port.direction = direction;
|
||||||
port.excite = 0;
|
port.excite = 0;
|
||||||
port.measplanepos = abs(v2_start(idx_prop) - start(idx_prop));
|
port.measplanepos = abs(v2_start(idx_prop) - start(idx_prop))*port.LengthScale;
|
||||||
|
% port
|
||||||
|
|
||||||
% create excitation
|
% create excitation
|
||||||
% excitation of this port is enabled
|
% excitation of this port is enabled
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function [port] = calcPort( port, SimDir, f, varargin)
|
function [port] = calcPort( port, SimDir, f, varargin)
|
||||||
% [port] = calcPort( port, SimDir, f, [ref_ZL], [ref_shift])
|
% [port] = calcPort( port, SimDir, f, varargin)
|
||||||
%
|
%
|
||||||
% Calculate voltages and currents, the propagation constant beta
|
% Calculate voltages and currents, the propagation constant beta
|
||||||
% and the characteristic impedance ZL of the given port.
|
% and the characteristic impedance ZL of the given port.
|
||||||
|
@ -11,12 +11,13 @@ function [port] = calcPort( port, SimDir, f, varargin)
|
||||||
% f: frequency vector for DFT
|
% f: frequency vector for DFT
|
||||||
%
|
%
|
||||||
% variable input:
|
% variable input:
|
||||||
% 'RefImpedance': use a given reference impedance to calculate inc and
|
% 'RefImpedance': - use a given reference impedance to calculate inc and
|
||||||
% ref voltages and currents
|
% ref voltages and currents
|
||||||
% default is given port or calculated line impedance
|
% - default is given port or calculated line impedance
|
||||||
% 'RefPlaneShift': use a given reference plane shift from port beginning
|
% 'RefPlaneShift': - use a given reference plane shift from port beginning
|
||||||
% for a desired phase correction
|
% for a desired phase correction
|
||||||
% default is the measurement plane
|
% - default is the measurement plane
|
||||||
|
% - the plane shift has to be given in drawing units!
|
||||||
%
|
%
|
||||||
% output:
|
% output:
|
||||||
% port.f the given frequency fector
|
% port.f the given frequency fector
|
||||||
|
@ -90,9 +91,10 @@ ZL = sqrt(Et .* dEt ./ (Ht .* dHt));
|
||||||
|
|
||||||
% reference plane shift (lossless)
|
% reference plane shift (lossless)
|
||||||
if ~isnan(ref_shift)
|
if ~isnan(ref_shift)
|
||||||
% renormalize the shift to the measurement plane
|
ref_shift = ref_shift * port.LengthScale;
|
||||||
ref_shift = ref_shift - port.measplanepos * port.drawingunit;
|
% shift to the beginning of MSL
|
||||||
% ref_shift = ref_shift * port.drawingunit;
|
ref_shift = ref_shift - port.measplanepos;
|
||||||
|
ref_shift = ref_shift * port.drawingunit;
|
||||||
|
|
||||||
% store the shifted frequency domain waveforms
|
% store the shifted frequency domain waveforms
|
||||||
phase = real(beta)*ref_shift;
|
phase = real(beta)*ref_shift;
|
||||||
|
|
Loading…
Reference in New Issue