# Electronic – KCL vs KVL in circuit analysis

simulationspice

I'm making a simplified version of SPICE to teach basic electronics to high school students (This is for a high school independent study).

Why does SPICE analyze circuits using Kirchhoff's current law instead of Kirchhoff's voltage law? Usually you have a voltage source to start with instead of a current source, and it is easier and more efficient to analyze a circuit using voltage instead of current.

Using voltage to analyze circuit: (See best answer)
Circuit Simulation

Using current to analyze circuit:
http://en.wikipedia.org/wiki/Nodal_analysis

Thanks!

The nodal analysis (KCL) and mesh analysis (KVL) will give equivalent results when analyzing any given circuit...Though of course there are different special cases for each one (a voltage source doesn't map neatly into KCL, while a current source doesn't map neatly into KVL, for example).

One difference is that it's relatively easy to automatically set up your equations for KCL. Each node (except GND) has one associated equation. So as the simulator is scanning the netlist, whenever a node is mentioned as connected to a device, either a term is added to the equation for that node, or a new equation is set up if the node was never mentioned before.

To set up the equations for KVL, you have to do some additional analysis to find all of the loops in the circuit so as to build an equation for each loop. Nowadays there are probably well-established graph analysis algorithms to identify those loops. But when the first SPICE simulators were written, in the early 1970's, even if those algorithms did exist (probably many of them actually did), implementing them would have meant substantial extra work for the grad students who were developing SPICE.