Skip to content

flex_rf.tidy3d.CircuitImpedanceModel

Type: class Base(s): MicrowaveBaseModel

Circuit model storing R/L/C components and port nodes; fits admittance on demand.

Stores the circuit description (components and port nodes) and fitting parameters. The model uses nodal analysis with linear R, L, and C branches only. Arbitrary topology is supported (any single connected graph of R/L/C branches), and a single one-port admittance is extracted between the chosen port nodes. Auxiliary branch-current equations and generalized augmented MNA (e.g. ideal sources, constraints, controlled sources) are not supported.

The circuit must form a single connected graph (all components share at least one node with the rest); this is validated at construction. Implements the same interface for LinearLumpedElement: _to_medium and _as_admittance_function compute the one-port admittance from the stored circuit and fit it to a pole-residue or rational form when needed.

Use from_spice to build from a SPICE netlist, or construct directly with components and optionally freq_range. When freq_range is omitted, it must be provided when the model is used (e.g. when used with TerminalComponentModeler, the modeler injects freq_range into the circuit model at build time).

DC / low-frequency limitation: All frequencies used for fitting or evaluation must be strictly positive. Inductors are modeled as 1/(jωL)1/(j\omega L), which is singular at DC; _get_effective_admittance and branch admittance construction reject f0f \le 0. For DC-safe or augmented formulations (e.g. inductor branches with auxiliary equations), a future augmented-MNA backend could be added; the current implementation is nodal-RLC only.

comps = (
LumpedCircuitComponent(element_type="R", node_plus="1", node_minus="0", value=50.0),
LumpedCircuitComponent(element_type="C", node_plus="1", node_minus="0", value=1e-12),
)
model = CircuitImpedanceModel(components=comps, freq_range=(1e9, 2e9), n_freqs=5)
components [tuple[LumpedCircuitComponent, ...]] = ...

R, L, and C LumpedCircuitComponent instances defining the one-port network.

port_node_plus [str] = '1'

Name of the port signal node (positive terminal).

port_node_minus [str] = '0'

Name of the port reference node (negative/reference terminal).

freq_range [FreqBound | None] = None

Frequency range in Hz for fitting the admittance. When set, must satisfy 0 < f_min < f_max (validated at construction; inductor admittance is singular at DC). n_freqs points are sampled from this range to fit the pole-residue model. If None, must be provided when the model is used (e.g. via _to_medium(scaling_factor, frequency_range=...) or by TerminalComponentModeler, which injects freq_range).

n_freqs [int] = 10

Number of sampling frequencies used in the pole-residue fit (minimum 5).

fit_tolerance [float] = 1e-05

Target weighted RMS error for the pole-residue fit.

min_num_poles [int] = 1

Minimum number of poles for the dispersion fitter.

max_num_poles [int] = 5

Maximum number of poles for the dispersion fitter.

fit_show_progress [bool] = False

Whether to show the fitter progress bar when fitting.

from_spice(spice_file: str | Path, frequency_range: FreqBound, port_node_plus: str | None = None, port_node_minus: str | None = None, n_freqs: int | None = None, min_num_poles: int = 1, max_num_poles: int = 5, tolerance_rms: float = 1e-05, show_progress: bool = False)

Build a CircuitImpedanceModel from a SPICE netlist file.

from_touchstone(touchstone_file: str, num_order: int = 2, denom_order: int = 2)

Build a CircuitImpedanceModel from a Touchstone file.