Terminated

class pmrf.models.composite.interconnected.terminated.Terminated(terminated_from: Model, terminated_into: Model, *, name: str | None = None, metadata: Any = None, method: Literal['s', 'a'] = 's')

Bases: Model

Represents one network terminated in another.

Mathematically collapses an active network by terminating a subset of its ports with a known load matrix.

Parameters:
  • terminated_from (Model) – The model being terminated.

  • terminated_into (Model) – The load model that terminated_from is terminated into.

  • method ({'s', 'a'}, default='s') – The underlying mathematical domain to use for the termination reduction.

expand()

Expands this model into its internal graph representation for circuit flattening.

Used by Circuit.flattened to unpack composite models into a single flat netlist for a global matrix solve.

pmrf.models.AbstractBuilder delegates this to its built model, as does a direct Model.build() override, so user classes rarely need it. It is mainly for built-in composites such as pmrf.models.Cascade and pmrf.models.Renumbered.

Returns:

If the model is a composite or routing container, it returns a tuple of: - port_mapping: A list of length nports mapping each external port index

of this model to an internal (Model, port_index) tuple.

  • internal_connections: A list of sub-nodes (connections) to add to the netlist. Each node is a list of (Model, port_index) tuples.

If the model is a fundamental leaf component, it returns None.

Return type:

tuple or None

Examples

A 2-port model holding an inductor and capacitor in series:

>>> def expand(self):
...     L, C = self.inductor, self.capacitor
...     port_mapping = [(L, 0), (C, 1)]
...     internal_connections = [[(L, 1), (C, 0)]]
...     return port_mapping, internal_connections
method: Literal['s', 'a'] = 's'

The termination reduction algorithm method.

property number_of_ports

Number of ports.

Return type:

int

terminated_from: Model

The “from” model.

terminated_into: Model

The “into” model.