zero.components module

Electronic components

class zero.components.Capacitor(value=None, node1=None, node2=None, *args, **kwargs)[source]

Bases: zero.components.PassiveComponent

Represents a capacitor or set of series or parallel capacitors

BASE_NAME = 'c'
DISPLAY_UNIT = 'F'
ELEMENT_TYPE = 'capacitor'
property capacitance

Capacitance in farads.

impedance(frequency)[source]

The impedance.

Parameters

frequency (float or array_like)

Returns

complex – The impedance.

class zero.components.Component(name=None, nodes=None)[source]

Bases: zero.elements.BaseElement

Represents a circuit component.

Parameters
  • name (str, optional) – The component name. Must be unique.

  • nodes (sequence of Node or str, optional) – The component nodes.

noise

The component noise sources.

Type

set of ComponentNoise

BASE_NAME = '?'
DISPLAY_UNIT = '?'
ELEMENT_TYPE = 'component'
ELEMENT_UNIT = 'A'
add_noise(noise)[source]

Add a noise source to the component.

Parameters

noise (Noise) – The noise to add.

Raises

ValueError – If specified noise is already present.

property label

Get component label.

Returns

str – The component label.

property nodes

The component nodes.

Returns

list of Node – The component nodes.

exception zero.components.ComponentNotFoundError(name, *args, **kwargs)[source]

Bases: zero.elements.ElementNotFoundError

class zero.components.CouplingFactorDict(inductor, *args, **kwargs)[source]

Bases: collections.abc.MutableMapping

Collection to get and set coupling factors between inductors

class zero.components.Inductor(*args, **kwargs)[source]

Bases: zero.components.PassiveComponent

Represents an inductor or set of series or parallel inductors

BASE_NAME = 'l'
DISPLAY_UNIT = 'H'
ELEMENT_TYPE = 'inductor'
property coupled_inductors

Inductors coupled to this one

impedance(frequency)[source]

The impedance.

Parameters

frequency (float or array_like) – The frequency.

Returns

complex – The impedance.

impedance_from(other, frequency)[source]

Calculate the impedance this inductor has due to the specified coupled inductor

Parameters
  • other (Inductor) – The other inductor.

  • frequency (float or array_like) – The frequency.

Returns

complex – The impedance.

property inductance

Inductance in henries.

inductance_from(other)[source]

Calculate the mutual inductance this inductor has with the specified inductor

Parameters

other (Inductor) – The other inductor.

Returns

Quantity – The mutual inductance between this inductor and the specified one.

Raises

TypeError – If the specified inductor is not of type Inductor

class zero.components.Input(nodes, input_type, impedance=None, is_noise=False, **kwargs)[source]

Bases: zero.components.Component

Represents the circuit’s voltage input

BASE_NAME = 'in'
ELEMENT_TYPE = 'input'
property impedance
property node1
property node2
property node_n
property node_p
class zero.components.Node(name)[source]

Bases: zero.elements.BaseElement

Represents a circuit node (connection between components)

Nodes are considered equal if they have the same case-independent name. Nodes are singletons, and as such instantiating a node with a name matching that of a previously instantiated node will result in the previous object being returned.

Parameters

name (str) – Node name.

ELEMENT_UNIT = 'V'
property label
exception zero.components.NodeNotFoundError(name, *args, **kwargs)[source]

Bases: zero.elements.ElementNotFoundError

class zero.components.OpAmp(node1, node2, node3, **kwargs)[source]

Bases: zero.config.components.LibraryOpAmp, zero.components.Component

Represents an (almost) ideal op-amp.

An op-amp produces voltage noise across its input and output nodes, and current noise is present at its input nodes.

Parameters
  • node1 (Node) – Non-inverting input node.

  • node2 (Node) – Inverting input node.

  • node3 (Node) – Output node.

BASE_NAME = 'op'
ELEMENT_TYPE = 'op-amp'
property has_inv_current_noise
property has_non_inv_current_noise
property has_voltage_noise
property inv_current_noise
property node1
property node2
property node3
property non_inv_current_noise
property voltage_noise
class zero.components.PassiveComponent(value=None, node1=None, node2=None, *args, **kwargs)[source]

Bases: zero.components.Component

Represents a passive component.

A passive component is one that consumes or temporarily stores energy, but does not produce or amplify it. Examples include resistors, capacitors and inductors.

Parameters
  • value (any, optional) – The component value.

  • node1 (Node, optional) – The first component node.

  • node2 (Node, optional) – The second component node.

value

The component value.

Type

float

abstract impedance(frequency)[source]

The passive impedance.

property node1

The first component node.

Returns

Node – The first component node.

property node2

The second component node.

Returns

Node – The second component node.

property value

The component value.

Returns

float – The component value.

class zero.components.Resistor(*args, **kwargs)[source]

Bases: zero.components.PassiveComponent

Represents a resistor or set of series or parallel resistors

BASE_NAME = 'r'
DISPLAY_UNIT = 'Ω'
ELEMENT_TYPE = 'resistor'
impedance(*args)[source]

The impedance.

Returns

complex – The impedance.

property johnson_noise
property resistance

Resistance in ohms.