twpasolver.models.oneport module#

One-port network components, described by their impedance versus frequency.

pydantic model twpasolver.models.oneport.OnePortModel[source]#

Bases: TwoPortModel, ABC

Base class for components entirely described by a 1D impedance array.

Show JSON schema
{
   "title": "OnePortModel",
   "description": "Base class for components entirely described by a 1D impedance array.",
   "type": "object",
   "properties": {
      "Z0_ref": {
         "default": 50.0,
         "description": "Reference line impedance of the two-port component.",
         "title": "Z0 Ref",
         "type": "number"
      },
      "N": {
         "default": 1,
         "description": "Number of repetitions of the model in the computed abcd matrix.",
         "minimum": 0,
         "title": "N",
         "type": "integer"
      },
      "twoport_parallel": {
         "default": false,
         "description": "Insert component in parallel when transforming to twoport representation.",
         "title": "Twoport Parallel",
         "type": "boolean"
      }
   }
}

Fields:
field twoport_parallel: bool = False#

Insert component in parallel when transforming to twoport representation.

abstract Z(freqs: ndarray) → ndarray[source]#

Impedance of the component in Ohm.

Parameters:

freqs (np.ndarray) – Frequencies in Hz.

Y(freqs: ndarray) → ndarray[source]#

Admittance of the component, 1 / Z.

single_abcd(freqs: ndarray) → ABCDArray[source]#

ABCD matrices of the series impedance (shunt admittance if twoport_parallel).

pydantic model twpasolver.models.oneport.OnePortArray[source]#

Bases: OnePortModel, ModelArray

Container for direct compositions of OnePortModels.

Show JSON schema
{
   "title": "OnePortArray",
   "description": "Container for direct compositions of OnePortModels.",
   "type": "object",
   "properties": {
      "Z0_ref": {
         "default": 50.0,
         "description": "Reference line impedance of the two-port component.",
         "title": "Z0 Ref",
         "type": "number"
      },
      "N": {
         "default": 1,
         "description": "Number of repetitions of the model in the computed abcd matrix.",
         "minimum": 0,
         "title": "N",
         "type": "integer"
      },
      "cells": {
         "description": "List of TwoPortModels representing the basic cells. Nested lists are allowed.",
         "items": {},
         "title": "Cells",
         "type": "array"
      },
      "twoport_parallel": {
         "default": false,
         "description": "Insert component in parallel when transforming to twoport representation.",
         "title": "Twoport Parallel",
         "type": "boolean"
      },
      "name": {
         "const": "OnePortArray",
         "default": "OnePortArray",
         "title": "Name",
         "type": "string"
      },
      "parallel": {
         "default": false,
         "description": "Connect internal OnePortModels in parallel.",
         "title": "Parallel",
         "type": "boolean"
      }
   }
}

Fields:
Validators:

field name: Literal['OnePortArray'] = 'OnePortArray'#
field parallel: bool = False#

Connect internal OnePortModels in parallel.

cell_base#

alias of OnePortModel

Z(freqs: ndarray) → ndarray[source]#

Impedance of the cells in series, or in parallel if parallel.

pydantic model twpasolver.models.oneport.Resistance[source]#

Bases: OnePortModel

Model of a resistor.

Show JSON schema
{
   "title": "Resistance",
   "description": "Model of a resistor.",
   "type": "object",
   "properties": {
      "Z0_ref": {
         "default": 50.0,
         "description": "Reference line impedance of the two-port component.",
         "title": "Z0 Ref",
         "type": "number"
      },
      "N": {
         "default": 1,
         "description": "Number of repetitions of the model in the computed abcd matrix.",
         "minimum": 0,
         "title": "N",
         "type": "integer"
      },
      "twoport_parallel": {
         "default": false,
         "description": "Insert component in parallel when transforming to twoport representation.",
         "title": "Twoport Parallel",
         "type": "boolean"
      },
      "name": {
         "const": "Resistance",
         "default": "Resistance",
         "title": "Name",
         "type": "string"
      },
      "R": {
         "minimum": 0,
         "title": "R",
         "type": "number"
      }
   },
   "required": [
      "R"
   ]
}

Fields:
field name: Literal['Resistance'] = 'Resistance'#
field R: NonNegativeFloat [Required]#
Constraints:
  • ge = 0

Z(freqs: ndarray) → ndarray[source]#

Impedance of the resistor.

pydantic model twpasolver.models.oneport.Capacitance[source]#

Bases: OnePortModel

Model of a capacitor.

Show JSON schema
{
   "title": "Capacitance",
   "description": "Model of a capacitor.",
   "type": "object",
   "properties": {
      "Z0_ref": {
         "default": 50.0,
         "description": "Reference line impedance of the two-port component.",
         "title": "Z0 Ref",
         "type": "number"
      },
      "N": {
         "default": 1,
         "description": "Number of repetitions of the model in the computed abcd matrix.",
         "minimum": 0,
         "title": "N",
         "type": "integer"
      },
      "twoport_parallel": {
         "default": false,
         "description": "Insert component in parallel when transforming to twoport representation.",
         "title": "Twoport Parallel",
         "type": "boolean"
      },
      "name": {
         "const": "Capacitance",
         "default": "Capacitance",
         "title": "Name",
         "type": "string"
      },
      "C": {
         "minimum": 0,
         "title": "C",
         "type": "number"
      }
   },
   "required": [
      "C"
   ]
}

Fields:
field name: Literal['Capacitance'] = 'Capacitance'#
field C: NonNegativeFloat [Required]#
Constraints:
  • ge = 0

Z(freqs: ndarray) → ndarray[source]#

Impedance of the capacitor.

pydantic model twpasolver.models.oneport.Inductance[source]#

Bases: OnePortModel

Model of an inductor.

Show JSON schema
{
   "title": "Inductance",
   "description": "Model of an inductor.",
   "type": "object",
   "properties": {
      "Z0_ref": {
         "default": 50.0,
         "description": "Reference line impedance of the two-port component.",
         "title": "Z0 Ref",
         "type": "number"
      },
      "N": {
         "default": 1,
         "description": "Number of repetitions of the model in the computed abcd matrix.",
         "minimum": 0,
         "title": "N",
         "type": "integer"
      },
      "twoport_parallel": {
         "default": false,
         "description": "Insert component in parallel when transforming to twoport representation.",
         "title": "Twoport Parallel",
         "type": "boolean"
      },
      "name": {
         "const": "Inductance",
         "default": "Inductance",
         "title": "Name",
         "type": "string"
      },
      "L": {
         "minimum": 0,
         "title": "L",
         "type": "number"
      }
   },
   "required": [
      "L"
   ]
}

Fields:
field name: Literal['Inductance'] = 'Inductance'#
field L: NonNegativeFloat [Required]#
Constraints:
  • ge = 0

Z(freqs: ndarray) → ndarray[source]#

Impedance of the inductor.

pydantic model twpasolver.models.oneport.Stub[source]#

Bases: OnePortModel

Model of a stub.

Show JSON schema
{
   "title": "Stub",
   "description": "Model of a stub.",
   "type": "object",
   "properties": {
      "Z0_ref": {
         "default": 50.0,
         "description": "Reference line impedance of the two-port component.",
         "title": "Z0 Ref",
         "type": "number"
      },
      "N": {
         "default": 1,
         "description": "Number of repetitions of the model in the computed abcd matrix.",
         "minimum": 0,
         "title": "N",
         "type": "integer"
      },
      "twoport_parallel": {
         "default": false,
         "description": "Insert component in parallel when transforming to twoport representation.",
         "title": "Twoport Parallel",
         "type": "boolean"
      },
      "name": {
         "const": "Stub",
         "default": "Stub",
         "title": "Name",
         "type": "string"
      },
      "L": {
         "minimum": 0,
         "title": "L",
         "type": "number"
      },
      "C": {
         "minimum": 0,
         "title": "C",
         "type": "number"
      },
      "length": {
         "minimum": 0,
         "title": "Length",
         "type": "number"
      },
      "open": {
         "default": true,
         "title": "Open",
         "type": "boolean"
      }
   },
   "required": [
      "L",
      "C",
      "length"
   ]
}

Fields:
field name: Literal['Stub'] = 'Stub'#
field L: NonNegativeFloat [Required]#
Constraints:
  • ge = 0

field C: NonNegativeFloat [Required]#
Constraints:
  • ge = 0

field length: NonNegativeFloat [Required]#
Constraints:
  • ge = 0

field open: bool = True#
Z(freqs: ndarray) → ndarray[source]#

Impedance of the stub.