MNA

Final notes for ECE1254, Modelling of Multiphysics Systems

December 27, 2014 ece1254 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Capture

I’ve now finished my first grad course, Modelling of Multiphysics Systems, taught by Prof Piero Triverio.

I’ve posted notes for lectures and other material as I was taking the course, but now have an aggregated set of notes for the whole course posted.
This is now updated with all my notes from the lectures, solved problems, additional notes on auxillary topics I wanted to explore (like SVD), plus the notes from the Harmonic Balance report that Mike and I will be presenting in January.

This version of my notes also includes all the matlab figures regenerating using http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig, which allows a save-as pdf, which rescales much better than Matlab saveas() png’s when embedded in latex.  I’m not sure if that’s the best way to include Matlab figures in latex, but they are at least not fuzzy looking now.

All in all, I’m pretty pleased with my notes for this course.  They are a lot more readable than any of the ones I’ve done for the physics undergrad courses I was taking (https://peeterjoot.com/writing/).  While there was quite a lot covered in this course, the material really only requires an introductory circuits course and some basic math (linear algebra and intro calculus), so is pretty accessible.

This was a fun course.  I recall, back in ancient times when I was a first year student, being unsatisfied with all the ad-hoc strategies we used to solve circuits problems.  This finally answers the questions of how to tackle things more systematically.

Here’s the contents outline for these notes:

Preface
Lecture notes
1 nodal analysis
1.1 In slides
1.2 Mechanical structures example
1.3 Assembling system equations automatically. Node/branch method
1.4 Nodal Analysis
1.5 Modified nodal analysis (MNA)
2 solving large systems
2.1 Gaussian elimination
2.2 LU decomposition
2.3 Problems
3 numerical errors and conditioning
3.1 Strict diagonal dominance
3.2 Exploring uniqueness and existence
3.3 Perturbation and norms
3.4 Matrix norm
4 singular value decomposition, and conditioning number
4.1 Singular value decomposition
4.2 Conditioning number
5 sparse factorization
5.1 Fill ins
5.2 Markowitz product
5.3 Markowitz reordering
5.4 Graph representation
6 gradient methods
6.1 Summary of factorization costs
6.2 Iterative methods
6.3 Gradient method
6.4 Recap: Summary of Gradient method
6.5 Conjugate gradient method
6.6 Full Algorithm
6.7 Order analysis
6.8 Conjugate gradient convergence
6.9 Gershgorin circle theorem
6.10 Preconditioning
6.11 Symmetric preconditioning
6.12 Preconditioned conjugate gradient
6.13 Problems
7 solution of nonlinear systems
7.1 Nonlinear systems
7.2 Richardson and Linear Convergence
7.3 Newton’s method
7.4 Solution of N nonlinear equations in N unknowns
7.5 Multivariable Newton’s iteration
7.6 Automatic assembly of equations for nonlinear system
7.7 Damped Newton’s method
7.8 Continuation parameters
7.9 Singular Jacobians
7.10 Struts and Joints, Node branch formulation
7.11 Problems
8 time dependent systems
8.1 Assembling equations automatically for dynamical systems
8.2 Numerical solution of differential equations
8.3 Forward Euler method
8.4 Backward Euler method
8.5 Trapezoidal rule (TR)
8.6 Nonlinear differential equations
8.7 Analysis, accuracy and stability (Dt ! 0)
8.8 Residual for LMS methods
8.9 Global error estimate
8.10 Stability
8.11 Stability (continued)
8.12 Problems
9 model order reduction
9.1 Model order reduction
9.2 Moment matching
9.3 Model order reduction (cont).
9.4 Moment matching
9.5 Truncated Balanced Realization (1000 ft overview)
9.6 Problems
Final report
10 harmonic balance
10.1 Abstract
10.2 Introduction
10.2.1 Modifications to the netlist syntax
10.3 Background
10.3.1 Discrete Fourier Transform
10.3.2 Harmonic Balance equations
10.3.3 Frequency domain representation of MNA equations
10.3.4 Example. RC circuit with a diode.
10.3.5 Jacobian
10.3.6 Newton’s method solution
10.3.7 Alternative handling of the non-linear currents and Jacobians
10.4 Results
10.4.1 Low pass filter
10.4.2 Half wave rectifier
10.4.3 AC to DC conversion
10.4.4 Bridge rectifier
10.4.5 Cpu time and error vs N
10.4.6 Taylor series non-linearities
10.4.7 Stiff systems
10.5 Conclusion
10.6 Appendices
10.6.1 Discrete Fourier Transform inversion
Appendices
a singular value decomposition
b basic theorems and definitions
c norton equivalents
d stability of discretized linear differential equations
e laplace transform refresher
f discrete fourier transform
g harmonic balance, rough notes
g.1 Block matrix form, with physical parameter ordering
g.2 Block matrix form, with frequency ordering
g.3 Representing the linear sources
g.4 Representing non-linear sources
g.5 Newton’s method
g.6 A matrix formulation of Harmonic Balance non-linear currents
h matlab notebooks
i mathematica notebooks
Index
Bibliography

Laplace transform refresher

November 27, 2014 ece1254 , , , ,

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

Laplace transforms were used to solve the MNA equations for time dependent systems, and to find the moments used to in MOR.

For the record, the Laplace transform is defined as:

\begin{equation}\label{eqn:laplaceTransformVec:20}
\boxed{
\LL( f(t) ) =
\int_0^\infty e^{-s t} f(t) dt.
}
\end{equation}

The only Laplace transform pair used in the lectures is that of the first derivative

\begin{equation}\label{eqn:laplaceTransformVec:40}
\begin{aligned}
\LL(f'(t)) &=
\int_0^\infty e^{-s t} \ddt{f(t)} dt \\
&=
\evalrange{e^{-s t} f(t)}{0}{\infty} – (-s) \int_0^\infty e^{-s t} f(t) dt \\
&=
-f(0) + s \LL(f(t)).
\end{aligned}
\end{equation}

Here it is loosely assumed that the real part of \( s \) is positive, and that \( f(t) \) is “well defined” enough that \( e^{-s \infty } f(\infty) \rightarrow 0 \).

Where used in the lectures, the laplace transforms were of vectors such as the matrix vector product \( \LL(\BG \Bx(t)) \). Because such a product is linear, observe that it can be expressed as the original matrix times a vector of Laplace transforms

\begin{equation}\label{eqn:laplaceTransformVec:60}
\begin{aligned}
\LL( \BG \Bx(t) )
&=
\LL {\begin{bmatrix}
G_{i k} x_k(t)
\end{bmatrix}}_i \\
&=
{\begin{bmatrix}
G_{i k} \LL x_k(t)
\end{bmatrix}}_i \\
&=
\BG
{\begin{bmatrix}
\LL x_i(t)
\end{bmatrix}}_i.
\end{aligned}
\end{equation}

The following notation was used in the lectures for such a vector of Laplace transforms

\begin{equation}\label{eqn:laplaceTransformVec:80}
\BX(s) = \LL \Bx(t) =
{\begin{bmatrix}
\LL x_i(t)
\end{bmatrix}}_i.
\end{equation}

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\).