Kirchhoff’s Current and Voltage Law (KCL and KVL) with Xcos example

Real world applications electric circuits are, most of the time, quite complex and hard to analyze. But, by breaking them apart into smaller subsystems (circuits), we can apply Kirchhoff’s Current Law (KCL) and Kirchhoff’s Voltage Law (KVL) in order to calculate the voltage drop and current across / through every electrical component.

Kirchhoff’s Current Law (KCL)

In an electrical circuit, a node (or junction) is the intersection point of at least 3 wires. If, by convention, we consider that the current going in the node is positive (+) and the current going out from the node is negative (-), we can write Kirchhoff’s Current Law (KCL) as:

$\bbox[#FFFF9D]{\sum_{k=1}^{n} I_k=0}$

where:

n [-] – is the total number of wires going into the node
Ik [A] – the electrical current through the wire k

In words, Kirchhoff’s Current Law translates as: the sum of the electrical currents, in any node of a circuit, is zero.

Kirchhoff’s Current Law is based on the principle of conservation of electric charge and states that, in every node of an electrical circuit, the sum of the electrical currents flowing into the node is equal with the sum of the electrical currents flowing out of the node.

Let’s take as example the following electrical circuit. The node consists of 4 wires, each with an electrical current passing through. Even if the wires are connected to different electrical components (coil, resistor, voltage source, etc.), Kirchhoff’s Current Law is applicable.

Image: Kirchhoff’s Current Law (KCL)

where:

L1 [H] – inductance of a lamp
R1 [Ω] – resistance of a resistor
E [V] – electromotive force
I1 [A] – current through the inductor
I2 [A] – current through the wire
I3 [A] – current through the resistor
I4 [A] – current through the voltage source

For this particular node Kirchhoff’s Current Law can be written as:

$I_1 + I_2 – I_3 – I_4 = 0$

If we want to separate the electrical currents going in the node from the electrical current going out from the node, we can write:

$I_1 + I_2 = I_3 + I_4$

For a better understanding of Kirchhoff’s Current Law, we can compare the electrical circuit with a fluid circuit. Imagine having a pipe through which a fluid is flowing with the volumetric flow rate Q1. If the pipe is split into three smaller pipes, the sum of the volumetric flow rates of the outgoing pipes will be equal with the volumetric flow rate of the incoming pipe.

Image: Kirchhoff’s Current Law – analogy with fluids

$Q_1 = Q_2 + Q_3 + Q_4$

where:

Q1 [m3/s] – incoming volumetric flow rate
Q2, Q3, Q4 [m3/s] – outgoing volumetric flow rate

Kirchhoff’s Current Law is applicable to any lumped parameter electrical circuit.

Kirchhoff’s Voltage Law (KVL)

An electrical circuit can contain at least one or more closed loops (mesh, network). Kirchhoff’s Voltage Law (KVL) states that, for any loop in an electrical circuit, the sum of the electrical voltage across the loop is zero.

$\sum _{k=1}^{n}U_{k}=0$

where:

n [-] – is the total number of voltages
Uk [V] – the voltage the branch k

Kirchhoff’s Voltage Law is based on the principle of the conservation of energy. It can be also written in the form: the sum of the electromotive forces (emf) in any circuit loop is equal with the sum of voltage drops in the same loop.

Let’s take as example the following circuit. It has two loops, A and B, and two nodes, C and D. With the arrows is defined the positive flow of the electrical current.

Image: Kirchhoff’s Voltage Law (KVL) circuit example

For loop A, Kirchhoff’s Voltage Law is:

$I_1 R_1 + I_3 R_3 = E_2 + E_1$

For loop B, Kirchhoff’s Voltage Law is:

$I_2 R_2 + I_3 R_3 = E_2 + E_3$

To have a complete set of equations, we can write Kirchhoff’s Current Law for node C:

$I_1 + I_2 = I_3$

We have only one KCL equation because, for node D, the same electrical current relationship applies.

Kirchhoff’s Voltage Law applies to lumped parameters electrical circuits which can contain also other types of passive components like capacitors or inductors.

Example. Calculate the voltage drop and electrical current for each component of the following electrical circuit, using Kirchhoff’s Current and Voltage Laws.

Image: Simple electric circuit schematic

where:

E [V] – electromotive force
R1, 2, 3, 4 [Ω] – electric resistance

For this example we will consider that: E = 12 V, R1 = 1 Ω, R2 = 2 Ω, R3 = 3 Ω and R4 = 4 Ω.

The electrical circuit has two loops, A and B, and two nodes, C and D. The first step is to highlight the currents flowing through the wires and the voltage drop across every component (resistor).

Image: Simple electric circuit schematic – voltages and currents

where:

Ia, b, c [A] – electric current
U1, 2, 3, 4 [V] – voltage drop

The first equation is deduced by writing KCL for node C:

$I_a = I_b + I_c \tag{1}$

Second and third equations are defined by KVL for loops A and B:

$\begin{split} U_1 + U_3 + U_2 = E\\ U_4 – U_3 = 0 \end{split}$

From Ohm’s Law we know that:

$U = IR$

Rewriting the equations for the both loops, we get:

$I_a R_1 + I_c R_3 + I_a R_2 = E \tag{2}$ $I_b R_4 – I_c R_3 = 0 \tag{3}$

Replacing equation (1) in (2) gives:

$(I_b + I_c)(R_1 + R_2) + I_c R_3 = E$ $I_b (R_1 + R_2) + I_c (R_1 + R_2 + R_3) = E \tag{4}$

From equation (3) we get the expression of Ib:

$I_b = \frac{I_c R_3}{R_4} \tag{5}$

Replacing (5) in (4) gives:

$\begin{split} \frac{I_c R_3}{R_4} \left ( R_1 + R_2 \right ) + I_c (R_1 + R_2 + R_3) &= E\\ I_c \left ( \frac{R_3 (R_1 + R_2)}{R_4} + R_1 + R_2 + R_3 \right ) &= E\\ I_c &= \frac{E}{\frac{R_3(R_1 + R_2)}{R_4} + R_1 + R_2 + R_3} \end{split}$

Replacing the values of the resistances and electromotive force, we get the value of Ic:

$I_c = 1.454545 \quad A$

Now we can calculate the rest of the currents and voltage drops:

$\begin{split} I_b &= \frac{I_c R_3}{R_4} &= 1.090909 \quad A\\ I_a &= I_b + I_c &= 2.545454 \quad A\\ U_1 &= I_a R_1 &= 2.545454 \quad V\\ U_2 &= I_a R_2 &= 5.090908 \quad V\\ U_3 &= I_c R_3 &= 4.363635 \quad V\\ U_4 &= I_b R_4 &= 4.363636 \quad V\\ \end{split}$

In order to verify if our calculations are correct, we are going to create an Xcos block diagram for our electric circuit. In the Electrical Palette within Xcos we are going to use the:  ConstantVoltage block, Resistor block, Ground block and VoltageSensor and CurrentSensor for displaying the calculated values.

Image: Simple electric circuit – Xcos block diagram

The voltage source and resistance parameters are define in the Scilab workspace. Also the values of the currents and voltages are calculated in Scilab for a further verification with the script:

clc()
R1=1;
R2=2;
R3=3;
R4=4;
E=12;
Ic = E/(R3*(R1+R2)/R4+R1+R2+R3);
Ib=Ic*R3/R4;
Ia=Ib+Ic;
U1=R1*Ia;
U2=R2*Ia;
U3=R3*Ic;
U4=R4*Ib;

First we run the Scilab instructions, second we simulate the Xcos diagram. Since it’s a static model (no dynamics) the simulation time can be as small as possible (e.g. 1 s).

As you can see, the results are matching which gives confidence to our calculation method and equations.

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!