node branch equations

ECE1254H Modeling of Multiphysics Systems. Lecture 3: Nodal Analysis. Taught by Prof. Piero Triverio

September 24, 2014 ece1254 , , ,

[Click here for a PDF of this post with nicer formatting]

Disclaimer

Peeter’s lecture notes from class. These may be incoherent and rough.

Nodal Analysis

Avoiding branch currents can reduce the scope of the computational problem. Consider the same circuit fig. 1, this time introducing only node voltages as unknowns

fig. 1.  Resistive circuit with current sources

fig. 1. Resistive circuit with current sources

Unknowns: node voltages: \(V_1, V_2, \cdots V_4\)

Equations are KCL at each node except \(0\).

  1. \(
    \frac{V_1 – 0}{R_A} +
    \frac{V_1 – V_2}{R_B} + i_{S,A} = 0
    \)

  2. \(
    \frac{V_2 – 0}{R_E} +
    \frac{V_2 – V_1}{R_B} + i_{S,B} + i_{S,C} = 0
    \)

  3. \(
    \frac{V_3 – V_4}{R_C} – i_{S,C} = 0
    \)

  4. \(
    \frac{V_4 – 0}{R_D}
    +\frac{V_4 – V_3}{R_C}
    – i_{S,A} – i_{S,B} = 0
    \)

In matrix form this is

\begin{equation}\label{eqn:multiphysicsL3:20}
\begin{bmatrix}
\inv{R_A} + \inv{R_B} & – \inv{R_B} & 0 & 0 \\
-\inv{R_B} & \inv{R_B} + \inv{R_E} & 0 & 0 \\
0 & 0 & \inv{R_C} & -\inv{R_C} \\
0 & 0 & -\inv{R_C} & \inv{R_C} + \inv{R_D}
\end{bmatrix}
\begin{bmatrix}
V_1 \\
V_2 \\
V_3 \\
V_4 \\
\end{bmatrix}
=
\begin{bmatrix}
-i_{S,A} \\
-i_{S,B} – i_{S,C} \\
i_{S,C} \\
i_{S,A} + i_{S,B}
\end{bmatrix}
\end{equation}

Introducing the nodal matrix

\begin{equation}\label{eqn:multiphysicsL3:40}
G \overline{{V}}_N = \overline{{I}}_S
\end{equation}

We identify the {stamp} for a resister of value \(R\) between nodes \(n_1\) and \(n_2\)

stamp matrix

stamp matrix

where we have a set of rows and columns for each of the node voltages \(n_1, n_2\).

Note that some care is required to use this nodal analysis method since we required the invertible relationship \(i = V/R\). We also cannot handle short circuits \(V = 0\), or voltage sources \(V = 5\) (say). We will also have trouble with differential terms like inductors.

Recap of node branch equations

We had

  • KCL: \( A \cdot \overline{{I}}_B = \overline{{I}}_S\)
  • Constitutive: \( \overline{{I}}_B = \alpha A^\T \overline{{V}}_N \),
  • Nodal equations: \( A \alpha A^\T \overline{{V}}_N = \overline{{I}}_S \)

where \(\overline{{I}}_B\) was the branch currents, \(A\) was the incidence matrix, and \(\alpha = \begin{bmatrix}\inv{R_1} & & \\ & \inv{R_2} & \\ & & \ddots \end{bmatrix} \).

The stamp can be observed in the multiplication of the contribution for a single resistor, where we see that the incidence matrix has the form \( G = A \alpha A^\T \)

stamp factor

stamp factor

Theoretical facts

Noting that \(\lr{ A B }^\T = B^\T A^\T \), it is clear that the nodal matrix \(G = A \alpha A^\T \) is symmetric

\begin{equation}\label{eqn:multiphysicsL3:80}
G^\T
=
\lr{ A \alpha A^\T }^\T
=
\lr{ A^\T }^\T \alpha^\T A^\T
=
A \alpha A^\T
= G
\end{equation}

Modified nodal analysis (MNA)

This is the method that we find in software such as spice.

To illustrate the method, consider the same circuit, augmented with an additional voltage sources as in fig. 4.

fig. 4.  Resistive circuit with current and voltage sources

fig. 4. Resistive circuit with current and voltage sources

We know wish to have the following unknowns

  • node voltages (\(N-1\)): \( V_1, V_2, \cdots V_5 \)
  • branch currents for selected components (\(K\)): \( i_{S,C}, i_{S,D} \)

We will have two less unknowns for this system than with standard nodal analysis. Our equations are

  1. \(
    -\frac{V_5-V_1}{R_A}
    +\frac{V_1-V_2}{R_B}
    + i_{S,A} = 0
    \)

  2. \(
    \frac{V_2-V_5}{R_E}
    +\frac{V_2-V_1}{R_B}
    + i_{S,B}
    + i_{S,C}
    = 0
    \)

  3. \(
    -i_{S,C} +
    \frac{V_3-V_4}{R_C} = 0
    \)

  4. \(
    \frac{V_4-0}{R_D}
    +\frac{V_4-V_3}{R_C}
    – i_{S,A}
    – i_{S,B}
    = 0
    \)

  5. \(
    \frac{V_5-V_2}{R_E}
    +\frac{V_5-V_1}{R_A}
    + i_{S,D} = 0
    \)

Put into giant matrix form, this is

giant matrix

giant matrix

Call the extension to the nodal matrix \(G\), the {voltage incidence matrix} \(A_V\).

ECE1254H Modeling of Multiphysics Systems. Lecture 2: Assembling system equations automatically. Taught by Prof. Piero Triverio

September 23, 2014 ece1254 , ,

[Click here for a PDF of this post with nicer formatting]

Disclaimer

Peeter’s lecture notes from class. These may be incoherent and rough.

Assembling system equations automatically. Node/branch method

Consider the sample circuit of fig. 1.

fig. 1.  Sample resistive circuit

fig. 1. Sample resistive circuit

Step 1. Choose unknowns:

For this problem, let’s take

  • node voltages: \(V_1, V_2, V_3, V_4\)

  • branch currents: \(i_A, i_B, i_C, i_D, i_E\)

We do not need to introduce additional labels for the source current sources.
We always introduce a reference node and call that zero.

For a circuit with \(N\) nodes, and \(B\) resistors, there will be \(N-1\) unknown node voltages and \(B\) unknown branch currents, for a total number of \(N – 1 + B\) unknowns.

Step 2. Conservation equations:

KCL

  • 0: \(i_A + i_E – i_D = 0\)
  • 1: \(-i_A + i_B + i_{S,A} = 0\)
  • 2: \(-i_B + i_{S,B} – i_E + i_{S,C} = 0\)
  • 3: \(i_C – i_{S,C} = 0\)
  • 4: \(-i_{S,A} – i_{S,B} + i_D – i_C = 0\)

Grouping unknown currents, this is

  • 0: \(i_A + i_E – i_D = 0\)
  • 1: \(-i_A + i_B = -i_{S,A}\)
  • 2: \(-i_B -i_E = -i_{S,B} -i_{S,C}\)
  • 3: \(i_C = i_{S,C}\)
  • 4: \(i_D – i_C = i_{S,A} + i_{S,B}\)

Note that one of these equations is redundant (sum 1-4). In a circuit with \(N\) nodes, we can write at most \(N-1\) independent KCLs.

In matrix form

\begin{equation}\label{eqn:multiphysicsL2:20}
\begin{bmatrix}
-1 & 1 & 0 & 0 & 0 \\
0 & -1 & 0 & 0 & -1 \\
0 & 0 & 1 & 0 & 0 \\
0 & 0 & -1 & 1 & 0
\end{bmatrix}
\begin{bmatrix}
i_A \\
i_B \\
i_C \\
i_D \\
i_E \\
\end{bmatrix}
=
\begin{bmatrix}
-i_{S,A} \\
-i_{S,B} -i_{S,C} \\
i_{S,C} \\
i_{S,A} + i_{S,B}
\end{bmatrix}
\end{equation}

We call this first matrix of ones and minus ones the incidence matrix \(A\). This matrix has \(B\) columns and \(N-1\) rows. We call the known current matrix \(\overline{I}_S\), and the branch currents \(\overline{I}_B\). That is

\begin{equation}\label{eqn:multiphysicsL2:40}
A \overline{I}_B = \overline{I}_S.
\end{equation}

Observe that we have both a plus and minus one in all columns except for those columns impacted by our neglect of the reference node current conservation equation.

Algorithm for filling \(A\)

In the input file, to describe a resistor of fig. 2, you’ll have a line of the form

R name \(n_1\) \(n_2\) value

fig. 2.  Resistor node convention

fig. 2. Resistor node convention

The algorithm to process resistor lines is

\begin{equation*}
\begin{aligned}
&A \leftarrow 0 \\
&ic \leftarrow 0 \\
&\text{forall resistor lines} \\
&ic \leftarrow ic + 1, \text{adding one column to \(A\)} \\
&\text{if}\ n_1 != 0 \\
&A(n_1, ic) \leftarrow +1 \\
&\text{endif} \\
&\text{if}\ n_2 != 0 \\
&A(n_2, ic) \leftarrow -1 \\
&\text{endif} \\
&\text{endfor} \\
\end{aligned}
\end{equation*}

Algorithm for filling \(\overline{I}_S\)

Current sources, as in fig. 3, a line will have the specification (FIXME: confirm… didn’t write this down).

I name \(n_1\) \(n_2\) value

fig. 3.  Current source conventions

fig. 3. Current source conventions

\begin{equation*}
\begin{aligned}
&\overline{I}_S = \text{zeros}(N-1, 1) \\
&\text{forall current lines} \\
&\overline{I}_S(n_1) \leftarrow \overline{I}_S(n_1) – \text{value} \\
&\overline{I}_S(n_2) \leftarrow \overline{I}_S(n_1) + \text{value} \\
&\text{endfor}
\end{aligned}
\end{equation*}

Step 3. Constitutive equations:

\begin{equation}\label{eqn:multiphysicsL2:60}
\begin{bmatrix}
i_A \\
i_B \\
i_C \\
i_D \\
i_E
\end{bmatrix}
=
\begin{bmatrix}
1/R_A & & & & \\
& 1/R_B & & & & \\
& & 1/R_C & & & \\
& & & 1/R_D & & \\
& & & & & 1/R_E
\end{bmatrix}
\begin{bmatrix}
v_A \\
v_B \\
v_C \\
v_D \\
v_E
\end{bmatrix}
\end{equation}

Or

\begin{equation}\label{eqn:multiphysicsL2:80}
\overline{I}_B = \alpha \overline{V}_B,
\end{equation}

where \(\overline{V}_B\) are the branch voltages, not unknowns of interest directly. We can write

\begin{equation}\label{eqn:multiphysicsL2:100}
\begin{bmatrix}
v_A \\
v_B \\
v_C \\
v_D \\
v_E
\end{bmatrix}
=
\begin{bmatrix}
-1 & & & \\
1 & -1 & & \\
& & 1 & -1 \\
& & & 1 \\
& -1 & &
\end{bmatrix}
\begin{bmatrix}
v_1 \\
v_2 \\
v_3 \\
v_4
\end{bmatrix}
\end{equation}

Observe that this is the transpose of \(A\), allowing us to write

\begin{equation}\label{eqn:multiphysicsL2:120}
\overline{V}_B = A^\T \overline{V}_N.
\end{equation}

Solving

  • KCLs: \(A \overline{I}_B = \overline{I}_S\)

  • constitutive: \(\overline{I}_B = \alpha \overline{V}_B \Rightarrow \overline{I}_B = \alpha A^\T \overline{V}_N\)

  • branch and node voltages: \(\overline{V}_B = A^\T \overline{V}_N\)

In block matrix form, this is

\begin{equation}\label{eqn:multiphysicsL2:140}
\begin{bmatrix}
A & 0 \\
I & -\alpha A^\T
\end{bmatrix}
\begin{bmatrix}
\overline{I}_B \\
\overline{V}_N
\end{bmatrix}
=
\begin{bmatrix}
\overline{I}_S \\
0
\end{bmatrix}.
\end{equation}

Is it square? We see that it is after observing that we have

  • \(N-1\) rows in \(A\) , and \(B\) columns.
  • \(B\) rows in \(I\).
  • \(N-1\) columns.