twpasolver.models.modelarray module#

Generic models for user-defined ABCD matrices and TwoPortModel lists.

This module provides a generic container class for arrays of TwoPortModels, allowing for the organization and manipulation of multiple two-port network models, including nested lists.

pydantic model twpasolver.models.modelarray.ModelArray[source]#

Bases: TwoPortModel

Generic container for arrays of TwoPortModels.

Show JSON schema
{
   "title": "ModelArray",
   "description": "Generic container for arrays of TwoPortModels.",
   "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"
      }
   }
}

Fields:
Validators:
field cells: list[Any] [Optional]#

List of TwoPortModels representing the basic cells. Nested lists are allowed.

Validated by:
validator validate_nested_cells  »  cells[source]#

Recursively create ModelArrays inside nested lists.

Parameters:

cells (list[TwoPortModel]) – List of TwoPortModels or nested lists of TwoPortModels.

Returns:

Validated and potentially nested ModelArrays.

Return type:

list[TwoPortModel]

append(other: TwoPortModel) None[source]#

Append new model to internal cell array.

Parameters:

other (TwoPortModel) – The model to append to the cells list.