IdealTransformer

class photonforge.IdealTransformer(*, turns_ratio, port_map=None)[source]

Ideal transformer with turns ratio n:1.

Constraint equations: \(V(p_1) - V(p_2) = n (V(s_1) - V(s_2))\), \(I_p = -n I_s\). Uses a pure constraint stamp with one auxiliary branch current. No impedance entries on the diagonal; no singularities at any frequency including DC.

Circuit diagram (4-terminal, floating):

        n:1
p1 ---.° || °,--- s1
       ) || (
       ) || (
       ) || (
p2 ---'  ||  '--- s2
Parameters:
  • turns_ratio (Annotated[float, exclusiveMinimum=0]) – Turns ratio \(n\) between primary and secondary.

  • port_map (dict[str, tuple[str, Annotated[complex, units='Ω']] | tuple[str, str, Annotated[complex, units='Ω']]] | None) – Port mappings from terminals (see LumpedModel).

Terminals: - p1: Primary positive terminal - p2: Primary negative terminal - s1: Secondary positive terminal - s2: Secondary negative terminal

Note

Use differential port mapping to extract 2-port S-parameters:

>>> port_map = {
...     "primary": ("p1", "p2", 50.0),
...     "secondary": ("s1", "s2", 50.0),
... }

Example

>>> # 2:1 step-down transformer
>>> xfmr = pf.IdealTransformer(turns_ratio=2.0)

Methods

autograd_smatrix(*, component, ...[, ...])

Compute an autograd-compatible S matrix for traced parameters.

estimate_cost(*args, **kwargs)

Estimate the cost for S matrix computation.

s_matrix(component, frequencies[, ...])

Compute the S matrix for a component using this lumped model.

setup_time_stepper

Not supported for lumped models.

start(component, frequencies, **kwargs)

Start the S-matrix computation for this lumped model.

start_mna(component, frequencies, **kwargs)

Start the MNA matrix computation for this lumped model.

transform([translation, rotation, scaling, ...])

Apply a transformation to this model.

update(*args, **kwargs)

Update this lumped model.

Attributes

parametric_function

Function used to update a parametric component.

parametric_kwargs

Keyword arguments used to update a parametric component.

port_map

Mapping from port names to (signal_terminal, impedance) or (signal_terminal, reference_terminal, impedance) tuples.

properties

Object properties.

random_variables

Random variables associated to this model's parameters.

time_stepper

Lumped models do not use time steppers.

start_mna(component, frequencies, **kwargs)[source]

Start the MNA matrix computation for this lumped model.

Important

This is an abstract method that must be implemented by derived classes.

Return an MNAMatrix containing the MNA stamp for this component, if the calculation can be performed synchronously.

Otherwise, it must return an object with attributes status and mna_matrix that will be pooled to check the calculation progress. The status attribute must return a dictionary with 'progress' (a number from 0 to 100 indicating the calculation progress) and 'message' (one of 'running', 'success', or 'error', indicating the current calculation status). The 'mna_matrix' attribute should return the computed MNAMatrix once the calculation is successful (or None otherwise).

Terminal naming convention: Terminal names starting with _ are reserved for auxiliary branch-current variables (e.g., _I for an inductor branch current, _I1 / _I2 for transmission line branch currents). User-defined terminal names for physical nodes should not start with _ to avoid collisions when elements are composed inside a future LumpedCircuitModel.

Parameters:
  • component (Component) – Component to perform the calculation.

  • frequencies (Sequence[float]) – Frequency values at which to calculate the matrix parameters (in Hz).

  • **kwargs (object) – Additional keyword arguments.

Returns:

Either an MNA matrix directly, or a runner with status and mna_matrix attributes.

Return type:

MNAMatrix | object