Background: This page provides a visual representation of nodal circuit analysis applied to simple circuits.
Sample Circuits:
Circuit Components:
Wire
Resistor
Current Source
Ground
Circuit Tools:
Probe
Examine
Eraser
Drawing Properties:
Node Coloring:
Voltage Depiction:
Nodes
Wires
None
Introduction: This application demonstrates the evaluation of a circuit using nodal circuit analysis. The application provides a design interface for constructing a circuit, and an algorithm to identify and
color-code nodes; apply node voltage analysis to the circuit; and identify node voltages.
Directions: A circuit can be designed on the grid below using the following tools:
Generating Circuits: Selecting "Circuit 1," "Circuit 2," etc. will display a pregenerated circuit. Selecting "Randomize" will generate a random circuit with a few components.
Drawing Circuit: Selecting "Wire" will allows wires to be drawn on the grid. Selecting "Resistor," "Current Source," or "Ground" and then selecting a grid segment will place the component, and display component properties that can be modified. Selecting "Eraser" will allow components to be removed (again, dragging is permitted). Selecting "Reset Circuit" will reset the schematic.
Examining Circuit: Selecting "Probe" will display properties by pointing at any component (and left-clicking the component will switch to "Examine" mode). Selecting "Examine" will display properties for any component that is clicked on. (Right-clicking on any component, in any mode, will also switch to the "Examine" mode for the selected component.)
Graphing Properties: Selecting "Recolor" will alter the colors of the nodes. Checking or unchecking "Node Coloring" will toggle between a colorized and black-and-white depiction. Selecting one of the options in "Voltage Depiction" will alter the way in which voltage is depicted.
More Info:
Circuits that involve only resistors and constant current sources can be algorithmically evaluated using
mesh voltage analysis to determine
the voltages around the circuit. This technique involves identifying nodes within the circuit; constructing
a conductance matrix that relates the set of resistors to the currents flowing through each node; and
solving the matrix to determine the voltage of each node.
Nodal circuit analysis is performed whenever the circuit is altered. The results are displayed as color-coded
nodes, where the voltage of each node is indicated by ripples (propagating outward for positive voltage, and
inward for negative voltage). The elements of the circuit can be examined to determine the voltages of the nodes, as well as the voltage, current, and power consumed by each resistor.
A few notes about the output:
A ground element must be attached to the reference node. Only one ground element can be present in the
circuit.
Elements that are short-circuited (e.g., a resistor or current source with both ends connected to the same node)
are not factored into the circuit. This makes sense, since a short-circuited resistor will have the same
potential at both ends and therefore pass no current; and a short-circuited current source cannot function properly,
as it cannot create a voltage difference between two points on the same node.
This technique involves repeated determination of an n x n matrix, where n is the
total number of nodes. The evaluation of circuits with large numbers of nodes involves a brief delay, which increases
exponentially with higher numbers of nodes. Displaying and exploring a circuit should not be delayed after the
evaluation is complete. However, evaluation is only performed when a ground element is present - so if you wish to
make significant changes to a complicated circuit without triggering frequent reevaluation, simply take out the
ground element and then reinsert it when your changes are complete.
Because this nodal circuit analysis is based on the conductance matrix determinant, some configurations may cause problems.
As one example, if the circuit includes two current sources with only wire (no resistors) in between, the row of the
conductance matrix for this circuit is zero, which causes the determinant to be zero.
The most difficult part of this project was simply identifying the segments and
coordinates that comprise each node. The following process was devised for this task:
The circuit is represented as a three-dimensional array of grid segments,
represented by x-coordinate, y-coordinate, and orientation (0 = horizontal,
1 = vertical). Each element of the array stores the component type, orientation
(important for voltage sources), and value (resistance or voltage supplied).
This matrix is also constructed with an extra, invisible segment beyond the
boundary: i.e., the (n x n circuit shown is modeled as
n+2 x n+2 circuit elements, with the edges not drawn or
selectable). This model permits the outermost segments to remain empty, and
extensively reduces bounds-checking during the following steps.
Starting with the coordinate to which the ground is attached, a trace is performed
through all of the connected wire segments, ending with each resistor or current source.
All of the wires and coordinates identified in this trace are identified as node 0.
Starting from the top-left, the schematic is scanned to identify every wire segment
that is not yet associated with any node. When an unassigned wire segment is found, a
trace is performed, as above, to add the network of connected wire segments to the node.
This process continues until all wire segments have been assigned to some node.
A conductance matrix is created by evaluating each resistor and determining the nodes
to which the wires at each end of the resistor are assigned (presuming that they are
different; if not, then the resistor is shorted and does not function - see above). Also,
each current source is examined to determine the nodes to which the wire at each of the
current source is assigned.
The conductance matrix is solved, via Cramer's Rule and expansion of minors - which
is not even remotely optimized or performant (hence the limited scalability to larger
circuits), but could be easily replaced with more efficient algorithms. The matrix solution
indicates the voltage of each node.
One area that could be added to this demonstration: the direction and rate of current flow
through each segment. However, this task is difficult because the model presumes that the
individual segments have no resistance (otherwise, they would constitute different nodes).
A complex network of segments can therefore have multiple equivalent solutions, and while
one can be chosen arbitrarily, it just seems like a bad idea that generates unlikely and
unexpected results - and is outside the scope of this project.