CalcPort
From openEMS
calcPort is a post-simulation function to calculate frequency- and time-domain properties and data for ports.
The port has to be created by, for example, AddMSLPort()
, AddLumpedPort()
, AddRectWaveGuidePort()
, or AddCurvePort()
.
Contents |
Function Call for calcPort
[port] = calcPort( port, SimDir, f, varargin)
Input parameters
- port: return value of AddMSLPort()
- SimDir: directory, where the simulation files are
- f: frequency vector for calculation
varargin parameters
- RefImpedance: use a given reference impedance to calculate incident and reflected voltages and currents
- default is given port or calculated line impedance
- RefPlaneShift: for transmission lines only, See also calcTLPort for more details
- SwitchDirection: 0/1, switch assumed direction of propagation
- SignalType: 'pulse' (default) or 'periodic'
Output
The output structure port{i}
, where {i}
is the port number, has the following components:
Output signals/values in time domain (TD)
port{i}.ut.tot
- total voltage (time-domain)
port{i}.ut.time
- voltage time vector
port{i}.it.tot
- total current (time-domain)
port{i}.it.time
- current time vector
Output signals/values in frequency domain (TD)
port{i}.f
- frequency vector
port{i}.uf.tot/inc/ref
- total, incident and reflected voltage
port{i}.if.tot/inc/ref
- total, incident and reflected current
port{i}.ZL_ref
- reference impedance used
port{i}.P_inc
- incident power
port{i}.P_ref
- reflected power
port{i}.P_acc
- accepted power (incoming minus reflected, may be negative for passive ports)
Transmission line port properties
port{i}.beta
- propagation constant
port{i}.ZL
- characteristic line impedance
port{i}.ZL_ref
- reference characteristic line impedance used
Examples
Create two waveguide ports with port 1 active:
start=[mesh.x(1) mesh.y(1) mesh.z(11)]; stop =[mesh.x(end) mesh.y(end) mesh.z(12)]; %% change from mesh.z(15) [CSX, port{1}] = AddRectWaveGuidePort( CSX, 0, 1, start, stop, 'z', a*unit, b*unit, TE_mode, 1); start=[mesh.x(1) mesh.y(1) mesh.z(end-13)]; stop =[mesh.x(end) mesh.y(end) mesh.z(end-14)]; [CSX, port{2}] = AddRectWaveGuidePort( CSX, 0, 2, start, stop, 'z', a*unit, b*unit, TE_mode);
After the FDTD simulation is complete, perform the following calculations to get the s-parameters. The frequency-domain incident and reflected voltages are used.
freq = linspace(f_start,f_stop,201); port = calcPort(port, Sim_Path, freq); s11 = port{1}.uf.ref./ port{1}.uf.inc; s21 = port{2}.uf.ref./ port{1}.uf.inc;