Modules

class pycircuit.circuit.Circuit(*args, **kvargs)

Basic circuit class

The circuit class models electric circuits but could be used for any conservative system. A circuit object contains a list of nodes and branches which are associated with node voltages and branch currents in the modelled system. Note that the values of these quantities are stored in separate analysis classes, never inside a circuit object.

The nodes are connected to the outside through terminals. When the circuit is instanciated, the outside nodes are passed to the object via the terminals.

Attributes
nodes

A list that contains Node objects. The first k nodes are terminal nodes where k is the number of terminals.

branches

list of Branch objects. The solver will solve for the currents through the branches.

terminals

list of terminal names

instparams

A list of valid instance parameters (Parameter objects)

ipar

A ParameterDict containing instance specific parameters

nodenames

A dictionary that maps a local node name to the node object in nodes. If the node is connnected to superior hierarchy levels through a terminal the terminal name must be the same as the local node name

terminalhook

Temporary storage of information about what nodes in the superior hierarchy level the terminals should be connected to during instantiation. It is a dictionary where the keys are terminal names and the values are node objects. The value is None when it is not used. The only reason for this attribute is to allow for bottom-up instantiations like: cir1[‘I1’] = R(‘n1’, gnd)

linear

A boolean value that is true if i(x) and q(x) are linear functions

class pycircuit.circuit.SubCircuit(*args, **kvargs)

SubCircuit is container for circuit instances

Attributes
elements

dictionary of Circuit objects keyed by its instance name

elementnodemap

list of translation lists which translate between node indices of the elements and node indices of the parent

term_node_map

dictionary of instance terminal to node object maps keyed by the instance name. The maps are themselves dictionaries keyed by the terminal names.