twpasolver.models.oneport module#
One-port network components.
This module provides classes for modeling one-port RF network components. These components are described by their impedance as a function of frequency and can be used to build and analyze more complex RF networks.
- pydantic model twpasolver.models.oneport.OnePortModel[source]#
Bases:
TwoPortModel,ABCBase 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]#
Get impedance of component as function of frequency.
- Parameters:
freqs (np.ndarray) – Array of frequencies.
- Returns:
Impedance of the component.
- Return type:
np.ndarray
- pydantic model twpasolver.models.oneport.OnePortArray[source]#
Bases:
OnePortModel,ModelArrayContainer for direct compositions of OnePortModels.
Show JSON schema
{ "$defs": { "Capacitance": { "description": "Model of a capacitor.", "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" ], "title": "Capacitance", "type": "object" }, "Inductance": { "description": "Model of an inductor.", "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" ], "title": "Inductance", "type": "object" }, "OnePortArray": { "description": "Container for direct compositions of OnePortModels.", "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 OnePortModel representing the basic cells. Nested cells are allowed.", "items": { "discriminator": { "mapping": { "Capacitance": "#/$defs/Capacitance", "Inductance": "#/$defs/Inductance", "OnePortArray": "#/$defs/OnePortArray", "Resistance": "#/$defs/Resistance", "Stub": "#/$defs/Stub" }, "propertyName": "name" }, "oneOf": [ { "$ref": "#/$defs/Resistance" }, { "$ref": "#/$defs/Inductance" }, { "$ref": "#/$defs/Capacitance" }, { "$ref": "#/$defs/Stub" }, { "$ref": "#/$defs/OnePortArray" } ] }, "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" } }, "title": "OnePortArray", "type": "object" }, "Resistance": { "description": "Model of a resistor.", "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" ], "title": "Resistance", "type": "object" }, "Stub": { "description": "Model of a stub.", "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" ], "title": "Stub", "type": "object" } }, "$ref": "#/$defs/OnePortArray" }
- Fields:
- Validators:
- field name: Literal['OnePortArray'] = 'OnePortArray'#
- pydantic model twpasolver.models.oneport.Resistance[source]#
Bases:
OnePortModelModel 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" ] }
- field name: Literal['Resistance'] = 'Resistance'#
- field R: NonNegativeFloat [Required]#
- Constraints:
ge = 0
- pydantic model twpasolver.models.oneport.Capacitance[source]#
Bases:
OnePortModelModel 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" ] }
- field name: Literal['Capacitance'] = 'Capacitance'#
- field C: NonNegativeFloat [Required]#
- Constraints:
ge = 0
- pydantic model twpasolver.models.oneport.Inductance[source]#
Bases:
OnePortModelModel 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" ] }
- field name: Literal['Inductance'] = 'Inductance'#
- field L: NonNegativeFloat [Required]#
- Constraints:
ge = 0
- pydantic model twpasolver.models.oneport.Stub[source]#
Bases:
OnePortModelModel 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