kicad2ems.gfdtd.ports

openEMS's transmission-line and waveguide ports on gfdtd's CSX: MSLPort,
StripLinePort, CPWPort, CoaxialPort, WaveguidePort, RectWGPort, CircWGPort and
CurvePort, made as openEMS's ports.py makes them (the same metal, probes,
excitations and post-processing, so a script that uses them runs on gfdtd
unchanged and reads the same results). Ported from openEMS's Python interface
(ports.py, (C) 2015-2026 Thorsten Liebig and the openEMS contributors, GPL-3).
The lumped port is gfdtd.fdtd.LumpedPort.

    port = FDTD.AddMSLPort(1, metal, start, stop, 'x', 'z', excite=-1,
                           FeedShift=10, MeasPlaneShift=30)
    FDTD.Run(path); port.CalcPort(path, f, ref_impedance=50)
        # uf_inc, uf_ref, beta, Z_ref, ...

The transmission-line ports (MSL, stripline, CPW, coax) take the line's
impedance and propagation constant from three voltage and two current probes
along it; the waveguide ports match the field on the port plane to the mode
(probe types 10 and 11) and take the impedance from the mode's cutoff. Mode
purity (openEMS's extra probe column) is not written.
class kicad2ems.gfdtd.ports.CPWPort(CSX, port_nr, metal_prop, start, stop, prop_dir, exc_dir, gap_width, excite=0, **kw)[source]
A coplanar waveguide: the centre strip from start to stop (flat in the
plane's normal), exc_dir across the gaps, gap_width each; voltage probes
across both gaps. FeedShift, MeasPlaneShift, Feed_R.
class kicad2ems.gfdtd.ports.CircWGPort(CSX, port_nr, start, stop, exc_dir, radius, mode_name, pol_ang=0, excite=0, local_origin='center', **kw)[source]
A circular waveguide's TE_nm mode (Pozar), radius in metres, pol_ang the
polarisation (rad); Cartesian meshes only (the profile masked to rho <
radius).
class kicad2ems.gfdtd.ports.CoaxialPort(CSX, port_nr, pec_prop, mat_prop, start, stop, prop_dir, r_i, r_o, r_os, excite=0, **kw)[source]
A coaxial line along prop_dir from start to stop (its axis): inner radius
r_i, outer conductor r_o .. r_os (drawing units), pec_prop for the
conductors, mat_prop (or None) for the filling. FeedShift, MeasPlaneShift,
Feed_R (0, inf, or a resistance: a resistive annulus at the feed plane).
class kicad2ems.gfdtd.ports.CurvePort(CSX, port_nr, R, start, stop, excite=0, **kw)[source]
A lumped port on one mesh edge: R across the edge nearest the middle of
start -> stop, joined to start and stop by PEC curves when they are further
apart than one cell.
CalcPort(sim_path, freq, ref_impedance=None, ref_plane_shift=None, signal_type='pulse')[source]
Incident and reflected waves (uf_inc, uf_ref, if_*, ut_* / it_* for a
scalar reference) and the powers P_inc, P_ref, P_acc, as openEMS's
Port.CalcPort.
class kicad2ems.gfdtd.ports.MSLPort(CSX, port_nr, metal_prop, start, stop, prop_dir, exc_dir, excite=0, **kw)[source]
The microstrip port: the strip from start to stop (start's exc_dir
coordinate is the strip, stop's the ground), propagating along prop_dir.
FeedShift, MeasPlaneShift, Feed_R as openEMS's.
class kicad2ems.gfdtd.ports.Port(CSX, port_nr, start, stop, excite, **kw)[source]
The port base class: CSX, port number, start / stop box, excitation
amplitude; priority, PortNamePrefix and delay (s) as keywords.
CalcPort(sim_path, freq, ref_impedance=None, ref_plane_shift=None, signal_type='pulse')[source]
Incident and reflected waves (uf_inc, uf_ref, if_*, ut_* / it_* for a
scalar reference) and the powers P_inc, P_ref, P_acc, as openEMS's
Port.CalcPort.
SetEnabled(val)[source]
Enable or disable this port's excitation (a port made with excite=0
has none to enable).
class kicad2ems.gfdtd.ports.RectWGPort(CSX, port_nr, start, stop, exc_dir, a, b, mode_name, excite=0, local_origin='corner', **kw)[source]
A rectangular waveguide's TE_mn mode (Pozar): a, b in metres along the
first and second transverse axes, mode_name like 'TE10'.
class kicad2ems.gfdtd.ports.StripLinePort(CSX, port_nr, metal_prop, start, stop, prop_dir, exc_dir, height, excite=0, **kw)[source]
A stripline: the strip from start to stop (flat in the exc_dir axis),
height to each ground plane, voltage probes up and down from the strip.
FeedShift, MeasPlaneShift, Feed_R.
class kicad2ems.gfdtd.ports.WaveguidePort(CSX, port_nr, start, stop, exc_dir, E_WG_func, H_WG_func, kc, excite=0, excite_type=0, E_WG_file=None, H_WG_file=None, local_origin=None, **kw)[source]
Any waveguide mode: E_WG_func / H_WG_func (three expressions each) or
E_WG_file / H_WG_file (mode files), kc the mode's cutoff wavenumber (1/m),
exc_dir the propagation direction; excite_type 0 (E) or 2 (H); local_origin
'corner', 'center', a point or None.
CalcPort(sim_path, freq, ref_impedance=None, ref_plane_shift=None, signal_type='pulse', ZL=-1)[source]
beta and the wave impedance ZL from the cutoff (or ZL given), the
S-parameters on ZL unless ref_impedance is given.
kicad2ems.gfdtd.ports.dft_time2freq(t, val, freq, signal_type='pulse')[source]
openEMS's DFT_time2freq: the single-sided spectrum of val(t) at freq, 2
dt sum(val exp(-j w t)) for a pulse (2 / N sum for a periodic signal); in
blocks of 64 frequencies, (64, nt) at a time.