Circuit

class pmrf.models.composite.interconnected.Circuit(connections: dataclasses.InitVar[list[list[tuple[pmrf.models.base.Model, int]]]] = None, *, z0: complex = 50 + 0j, name: str | None = None, metadata: Any = None, circuit: list[Model] = None, indexed_connections: list[list[tuple[int, int]]] = None, port_idxs: list[int] = None, domain: str = 's', method: str | None = None)

Bases: Model

Represents an arbitrary interconnection of multiple Model objects.

This container connects multiple models together based on a specified list of nodes. Each node connects one or more ports of the constituent models to form a composite network.

Parameters:

connections (list[list[tuple[Model, int]]]) – A list representing the nodes of the circuit. Each node is a list of tuples, where each tuple contains a Model instance and the integer index of the port to connect to that node.

Examples

Create a two-port PI-CLC network. External nodes are defined using Port, and common nodes using Ground.

>>> import pmrf as prf
>>> from pmrf.models import Capacitor, Inductor, Circuit, Port, Ground
>>>
>>> # Instantiate the elements, ports, and ground
>>> C1, C2 = Capacitor(C=2e-12), Capacitor(C=1.5e-12)
>>> L = Inductor(L=3e-9)
>>> p0, p1, ground = Port(), Port(), Ground()
>>>
>>> # Create the connections list
>>> connections = [
...     [(p0, 0), (C1, 1), (L, 1)],         # Node 0 -> Port 1
...     [(p1, 0), (C2, 1), (L, 0)],         # Node 1 -> Port 2
...     [(ground, 0), (C1, 0), (C2, 0)],    # Node 2 -> Ground
... ]
>>>
>>> # Create the circuit model
>>> pi_clc = Circuit(connections)
primary_matrix(freq: Frequency) Array

The primary matrix (e.g. s, a etc.) as a function of frequency.

The primary matrix represents the matrix returned by pmrf.Model.primary_property, which is either overridden by sub-classes, or is the first proprerty directly overriden out of pmrf.Model.s(), pmrf.Model.a(), pmrf.Model.y(), pmrf.Model.z() (in that order), unless :meth:pmrf.Model.build is overridden, in which case the primary matrix of the built model is returned.

This method can also be overriden itself in order to to dynamically implement one of the matrices as opposed to overriding it explicitly.

Return type:

jnp.ndarray

Raises:

NotImplementedError – If no primary property is overridden.

s_impl(freq: Frequency) Array
y_impl(freq: Frequency) Array

Evaluate the Y-parameters of the composite circuit.

circuit: list[Model] = None

The models in the circuit.

connections: dataclasses.InitVar[list[list[tuple[pmrf.models.base.Model, int]]]] = None

The connections.

domain: str = 's'

(experimental) The domain to perform the calculation in. Options are (‘s’, ‘y’), where ‘y’ is experimental.

indexed_connections: list[list[tuple[int, int]]] = None

The indices of the connections.

method: str | None = None

The algorithm to use for the call to connect_<domain>_arbitrary. If None, uses the default algorithm for the domain. Algorithms are available in pmrf.rf.

port_idxs: list[int] = None

The indices of the ports.

property primary_property

The primary property (e.g. "s", "a") as a string.

The primary property is the first overridden among PRIMARY_PROPERTIES, unless build is overridden, in which case the primary property of the built model is returned.

Return type:

str

Raises:

NotImplementedError – If no primary property is overridden.