lcapy.nodalanalysis.NodalAnalysis
- class lcapy.nodalanalysis.NodalAnalysis(cct, node_prefix='')
Bases:
objectThis is for nodal analysis.
>>> from lcapy import Circuit, NodalAnalysis >>> cct = Circuit(''' ... V1 1 0 {u(t)}; down ... R1 1 2; right=2 ... L1 2 3; down=2 ... W1 0 3; right ... W 1 5; up ... W 2 6; up ... C1 5 6; right=2 ...''')
To perform nodal analysis in the Laplace domain:
>>> na = NodalAnalysis(cct.laplace())
To display the equations found by applying KCL at each node:
>>> na.nodal_equations().pprint()
To display the system of equations (in matrix form) that needs to be solved:
>>> na.matrix_equations().pprint()
This only works for dc, ac, or laplace domains. For example,
>>> NodalAnalysis(cct.laplace()).matrix_equations().pprint()
Methods
__init__(cct[, node_prefix])cct is a netlist node_prefix can be used to avoid ambiguity between component voltages and node voltages.
Return dictionary of equations keyed by node name.
from_circuit(cct[, node_prefix])matrix_equations([form, invert])Return the equations in matrix form.
Return the equations found by applying KCL at each node.
pdb()Enter the python debugger.
Determine the unknown voltages using Laplace transforms and return as a dict
Attributes
Return A matrix where A y = b.
Return b vector where A y = b.
nodesReturn tuple of the unknown voltages
Return y vector where A y = b.
- property A
Return A matrix where A y = b.
- property b
Return b vector where A y = b.
- equations_dict()
Return dictionary of equations keyed by node name.
- matrix_equations(form='default', invert=False)
Return the equations in matrix form.
- Forms can be:
‘default’ ‘A y = b’ ‘b = A y’ ‘Ainv b = y’ ‘y = Ainv b’
If invert is True, evaluate the matrix inverse.
- nodal_equations()
Return the equations found by applying KCL at each node. This is a directory of equations keyed by the node name.
- pdb()
Enter the python debugger.
- solve_laplace()
Determine the unknown voltages using Laplace transforms and return as a dict
- property unknowns
Return tuple of the unknown voltages
- property y
Return y vector where A y = b.