Tuesday, February 22, 2022

Nodal analysis of a RLC circuit with controlled sources

Consider the circuit below, which contains independent and dependent current and voltage sources. The circuit is from [1], Figure 4.8. Circuit analysis is a fundamental part of electrical engineering and this post describes using Python to analyze electrical circuits. The schematic of the circuit was redrawn in LTspice [2].


The zero volt source, V2, was added to the schematic so that the current through R4 could be measured since this current controls H1. The voltages and currents in the circuit were solved for in a Jupyter notebook running Python and using the SymPy and SciPy libraries. The netlist is used to generate modified nodal equations with the python program described here. To view the notebook click here, to open the notebook viewer. The Jupyter notebook is located on github, click here, to follow the link to the repository.

References  

1. Basic Electric Circuit Analysis, D. E. Johnson, J. L. Hilburn, and J. R. Johnson, Prentice-Hall, 1978

2. https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html

Wednesday, February 16, 2022

Thevenin equivalent circuit

The Thevenin equivalent circuit is the reduction of a linear one port circuit to a single source and impedance and is based on Thevenin’s Theorem. This notebook describes solving problem 11.25, given in chapter 11 of [1]. The Python libraries of SimPy and Numpy are used to perform the math in the proposed solution. The problem asks the student to replace the circuit to the left of terminals a-b by its Thevenin equivalent and find V. The schematic was drawn using LTspice [2] and the nodes were numbered. Terminals a-b are across the resistor R3. The circuit given in the textbook does not include a reference node, however the node at the bottom of the schematic was chosen as the reference node, ground.


Having drawn the circuit in LTspice, the netlist was exported as a text file. The solution is worked out in the jupyter notebook which can be viewed here

The Jupyter notebook is located on github, click here to follow the link to the repository.


Reference

1. Basic Electric Circuit Analysis, D. E. Johnson, J. L. Hilburn, and J. R. Johnson, Prentice-Hall, 1978

2. LTspice, last accessed on 2/24/2022.