Circuit Diagrams Kirchoff's Laws: Loop and junction/node rules

As we have seen in the previous chapters, to form equations of motion (state equations) for systems composed of many elements, in addition to the constitutive laws of the elements themselves you need equations relating the dynamic variables that apply to the elements. Here those variables are current and voltages. We have mentioned the junction/node rule and the Loop rule briefly in the previous sections. Here we will reiterate them:

Kirchoff's Current Law (KCL):

At a junction or node, since there can be no net accumulation of charge, the sum of the currents must be zero. To set the sum equal to zero, we have to remember to assign the signs of the currents into the node as positive and the currents out of the node as negative. Alternatively, we can state the Junction Rule (or KCL) as:

S i into node = S i away from node
Here is an example: i1 - i2 - i3 = 0  or  i1 = i2 + i3
Remember that as before, the current direction that we draw on our diagrams is really just defining what we mean by positive current in that section of the diagram. If in the end, that current turns out to be negative, that means the current is in reality flowing in the opposite direction of what we assumed.

In circuit diagrams, nodes are sometimes indicated by a black dot, but more often not. What's more, since electrical circuits tend to involve a lot of wires, often wires cross each other without connecting. Usually it's clear what is meant, as in the first four figures below. In those figures, connections are indicated by a solid dot or simply by two solid lines connecting; crosses (meaning wires which go over one another, but are not physically connected) are indicated by a break in the line, or a deviation of the line. However, occasionally (especially on that ratty circuit diagram on the back of your dryer or furnace) you will find a diagram in which solid lines crossing without a dot or a break really mean crosses (no connection), while all connections have a solid dot. You can recognize the latter "sloppy" diagrams because they show no wires with breaks or deviations in them. Kirchoff's Voltage Law (KVL):

Voltage relationships are a bit trickier. You can use Kirchoff's loop rule (as we did for hydraulic systems) which says that the sum of the voltages added up around any closed loop is zero: (1)
Be sure to use the right signs!!!

for all elements except batteries, the Vi in equation (1) will be positive if you are traversing the loop in the direction of the current arrow going through that element. The Vi will be negative if you are traversing the loop opposite direction of the current arrow for that element.  For batteries, the Vi in equation (1) will be positive if you are traversing the loop such that you reach the positive terminal of the battery first (regardless of the current arrow direction). The Vi will be negative if you are traversing the loop such that you reach the negative terminal of the battery first.
You can draw voltmeters on the diagrams, or at least indicate their + and - ends and it may help you to get the signs right. The voltmeters must be drawn in a manner consistent with the above. You can apply Kirchoff's loop rule to any loop in a circuit. It doesn't have to be isolated from other elements, or from other loops. Shown is just a small chunk of a larger circuit, and there's only one complete loop visible, but you can imagine that each of the elements could be considered to be part of other loops as well.  With the signs of the voltages carefully considered, Kirchoff's loop rule says  V1 + V2 - V3 = 0 You can think about going around the loop adding up voltages, with a minus sign whenever you hit the pointy end of an arrow.  Typically you won't draw current arrows at random -- you'll draw them predominantly from one side toward the other, here north to south.
While literally going around loops adding up voltages is formally correct, nobody ever does it. It's cumbersome, especially because most real circuit diagrams usually look like the one below. They have busses - certain wires that connect to a lot of components. And they have a lot of loops. Although it is hard to read above, in this figure many of the wires are labeled with a specific potential. The potential of those certain wires usually has some meaning - it represents a signal from one part of the circuit to another, or it is a common voltage source for a lot of components. So, in addition to labeling the voltage across components, you often see the so-called voltage "of" certain wires labeled. Voltage is still an across variable! The voltage "of" (really, potential of) a wire means the voltage of the wire relative to ground. When we encounter such diagrams, we can retreat from writing loop rules and do the following:

Series and Parallel Rules

When the voltages of certain wires are named, we can return to the series and parallel rules stated earlier to obtain equations relating the voltages in a circuit:

For N elements connected in series:

V = V1 + V2 + V3 + . . . + VN = Va - Vb
where, Va and Vb are given potentials of the left and right wires (their voltages relative to ground). While, for N elements connected in parallel:

V = V1 = V2 = V3 = . . . = VN = Va - Vb We can analyze any segment of a circuit using these rules, similar to how we related velocities in segments of mechanical systems. Here is an example: Note that there are two "named" voltages of wires here. These are voltages relative to ground. Ground is the symbol at the bottom, and the voltage of that wire is of course zero.  Picking any two of the "named" wires, you can use their voltage difference with the series and parallel rules to write an equation relating the voltages across elements between those chosen "named" wires. For instance, picking +12 volts and ground, we can write  +12 - 0 = Vc + V1 + V2 or picking Vbus and ground,  Vbus - 0 = V1 + V2 = V3 Warning -- you do still have to be careful about signs.
Note that if we had written a loop rule for the loop shown, it would be V1 + V2 - V3 = 0. And note that this is exactly the same as the equation obtained in the box above, namely Vbus - 0 = V1 + V2 = V3.

Finally, notice that I named too many voltages. You can tell right away from the diagram that Vbus = V3. So it would have been more efficient just to call it Vbus, and not bother to name V3.

Analyzing a circuit diagram

Here is another example - we will examine this circuit, writing Kirchoff's Laws, element constitutive laws, and start to think about how we would get state equations for the system. This circuit looks pretty complicated. Five resistors, two capacitors, and two busses with named voltages. Hopefully the values of the components is given. Here I've just given them names (R1, etc) A first step is to pick directions for currents. Take a look at all the nodes and make sure a direction has been chosen for every current impinging on any node.  Note that I did not specify a positive direction of current in the red wire ... this is because the red wire contains no elements. In fact, this wire simply connects R3, R4, R5 and C1 together and can be drawn as an elongated node, which we will do in the next picture.  Rather than give each current its own name, we'll use the convention that iR1 means the current of the arrow associated with R1.  (There are so many currents and voltages, that it's really worthwhile to be frugal about names.) We could write the name of the voltage across each component next to that component, but it's getting crowded there. So let's just use the notation that VC1 means the voltage across capacitor C1.  For nodes that involve three or more currents, assign a "named" voltage (relative to ground), taking advantage of the voltages that are already named by the existing components.  Two of the nodes were already named: +12 and ground. For the remaining two nodes, I recycled the existing names VR2 and VC1, so I didn't have to invent any new names.
Now that everything is named we can start writing loop and node equations. Loop equations can be actual loops, or just using the series and parallel rules with named voltages. You need a node equation for every node - and there are three of these in this circuit indicated in red. You need a loop equation that involves every component and every named voltage.
 Nodes:  iR1 = iR2 + iR3  iR3 + iR4 = iC1 + iC2  iR5 = iC2 Loops:  12 = VR1 + VR2  12 = VR4 + VC1  VR2 = VR3 + VC1  VC1 = VR5 + VC2
Just like in hydraulic systems, there will be some loop equations that are redundant. For example, for this system, we could also have written 12 = VR4 + VR5 + VC2, but this is equivalent to the second and fourth loop equations above.

Next collect the constitutive laws of every component.
 Resistors:  VR1 = R1 iR1  VR2 = R2 iR2  VR3 = R3 iR3  VR4 = R4 iR4  VR5 = R5 iR5 Capacitors:  VC1 = (1/C1) qC1  VC2 = (1/C2) qC2
The above equations are all of your raw materials. If there are no capacitors, you can solve them straight away, and find all the voltages and currents. You don't get diffeqs in that case. You don't get equations of motion, because there is no motion (motion means change-with-time, not literal motion). There are just plain unchanging answers for all the voltages and currents.

Writing State Equations:

If there are capacitors, however, the voltages and currents will be functions of time. Now there is motion. The equations of motion are differential equations. You will have one state equation for each capacitor (just like in mechanical systems we have one diffeq for each spring), and these differential equations will be coupled (also like in mechanical systems). To get started building these diffeqs, use the definition of charge, q'=i, to change the capacitor constitutive laws into the beginnings of diffeqs (called differential equation kernals):
 q'C1 = iC1  q'C2 = iC2 (2)
These two equations are the beginnings of your equations of motion. The charges qC1 and qC2 are the state variables. You should expect to wind up with two state equations, which are differential equations that involve only two dynamic variables, qC1 and qC2, and not the other voltages and currents. Note that we could choose VC1 and VC2 to be the state variables for the capacitors instead of the charges. There is no problem with this since the voltage and charge of a capacitor are simply related through the capacitance, C. When we work problems in future sections we may choose to do this.

There are now 16 equations: 3 for nodes, 4 for loops, 5 for resistors, 2 for capacitors, and 2 definitional equations relating charge and current in the capacitors. And there are now 16 variables: a current and a voltage for each of 7 components, and a charge for each capcitor.

If you don't stop at this point and count variables and equations in this way, you are likely to proceed into a lot of hopeless algebra. Hopeless because you missed a node or loop equation! So catch your mistake early, at the counting stage.

Now the task is to eliminate all the dynamic variables from the right side of (2) except the state variables You should wind up with two equations relating the time derivatives of the state variables, q'C1 and q'C2, to the state variables themselves, qC1 and qC2:

q'C1 = blah-blah-blah about qC1 and qC2

q'C1 = yak-yak-yak about qC1 and qC2