You are on page 1of 164

Techniques for circuit simulation

M. B. Patil
www.ee.iitb.ac.in/~sequel
Department of Electrical Engineering
Indian Institute of Technology Bombay

M. B. Patil, IIT Bombay

Outline

* Circuit simulation: introduction


* Nodal analysis
* Modified nodal analysis
* Sparse tableau approach
* Nonlinear circuits
* Transient (dynamic) analysis

M. B. Patil, IIT Bombay

Circuit simulation

* DC analysis
* transient (time-domain) analysis
* AC (frequency-domain) analysis
* logic-level simulation
* mixed-signal simulation
* noise computation
* periodic steady state computation
* sensitivity analysis

M. B. Patil, IIT Bombay

Why do we need circuit simulation?

R1
is
Vs

R2

Example 1
M. B. Patil, IIT Bombay

Why do we need circuit simulation?

R1
is
Vs

R2

Example 1
M. B. Patil, IIT Bombay

R3

Why do we need circuit simulation?

R1
is
Vs

R2
R4

Example 1
M. B. Patil, IIT Bombay

R3

Why do we need circuit simulation?

R5
R1
is
Vs

R2
R4

Example 1
M. B. Patil, IIT Bombay

R3

Why do we need circuit simulation?

R5
R1
is
Vs

R6
R2
R4

Example 1
M. B. Patil, IIT Bombay

R3

Why do we need circuit simulation?

R1

VC1
Vs (t)

Example 2
M. B. Patil, IIT Bombay

C1

Why do we need circuit simulation?

R1

VC1
Vs (t)

Example 2
M. B. Patil, IIT Bombay

C1

Why do we need circuit simulation?

R1

R2

VC1
Vs (t)

Example 2
M. B. Patil, IIT Bombay

C1

C2

Why do we need circuit simulation?

R3

R1

R2

VC1
Vs (t)

Example 2
M. B. Patil, IIT Bombay

C1

C2

Circuit simulation on a computer

* Must be efficient in terms of CPU time (especially for large circuits).

M. B. Patil, IIT Bombay

Circuit simulation on a computer

* Must be efficient in terms of CPU time (especially for large circuits).


* Must make good use of the memory available. If a matrix is sparse,
it should not be stored in the a(i, j) form.

M. B. Patil, IIT Bombay

Circuit simulation on a computer

* Must be efficient in terms of CPU time (especially for large circuits).


* Must make good use of the memory available. If a matrix is sparse,
it should not be stored in the a(i, j) form.
* The approach must be systematic. Tricks such as resistors in
series or parallel, star-to-delta conversion, etc. will work in special
cases. What we need is a general-purpose method that will work for
all circuits.

M. B. Patil, IIT Bombay

Outline

* Circuit simulation: introduction


* Nodal analysis
* Modified nodal analysis
* Sparse tableau approach
* Nonlinear circuits
* Transient (dynamic) analysis

M. B. Patil, IIT Bombay

Nodal Analysis of a linear circuit

* Take some node as the reference node and denote


the node voltages of the remaining nodes by e1 , e2 ,
etc.
e1

R1
R2

I0

e2
v3

R3

k v3
0

R4

e3

SPICE file
I0 1 0 1m
R1 1 2 1k
R2 2 0 1.2k
R3 2 3 200
R4 0 3 1k
VCCS1 1 3 2 3 0.5m

M. B. Patil, IIT Bombay

Nodal Analysis of a linear circuit

* Take some node as the reference node and denote


the node voltages of the remaining nodes by e1 , e2 ,
etc.
* Write KCL at each node in terms of the node
voltages. Follow a fixed convention, e.g., current
leaving a node is positive.

e1

R1
R2

I0

e2
v3

R3

k v3
0

R4

e3

SPICE file
I0 1 0 1m
R1 1 2 1k
R2 2 0 1.2k
R3 2 3 200
R4 0 3 1k
VCCS1 1 3 2 3 0.5m

M. B. Patil, IIT Bombay

Nodal Analysis of a linear circuit

* Take some node as the reference node and denote


the node voltages of the remaining nodes by e1 , e2 ,
etc.
* Write KCL at each node in terms of the node
voltages. Follow a fixed convention, e.g., current
leaving a node is positive.
* When all KCL equations are treated, we have the
admittance matrix and the RHS vector.

e1

R1
R2

I0

e2
v3

R3

k v3
0

R4

e3

SPICE file
I0 1 0 1m
R1 1 2 1k
R2 2 0 1.2k
R3 2 3 200
R4 0 3 1k
VCCS1 1 3 2 3 0.5m

M. B. Patil, IIT Bombay

Nodal Analysis of a linear circuit

* Take some node as the reference node and denote


the node voltages of the remaining nodes by e1 , e2 ,
etc.
* Write KCL at each node in terms of the node
voltages. Follow a fixed convention, e.g., current
leaving a node is positive.
* When all KCL equations are treated, we have the
admittance matrix and the RHS vector.
* Solve the resulting linear system of equations,
Ye = Is for the node voltages.

M. B. Patil, IIT Bombay

e1

R1
R2

I0

e2
v3

R3

k v3
0

R4

e3

SPICE file
I0 1 0 1m
R1 1 2 1k
R2 2 0 1.2k
R3 2 3 200
R4 0 3 1k
VCCS1 1 3 2 3 0.5m

Nodal Analysis of a linear circuit

* Take some node as the reference node and denote


the node voltages of the remaining nodes by e1 , e2 ,
etc.
* Write KCL at each node in terms of the node
voltages. Follow a fixed convention, e.g., current
leaving a node is positive.
* When all KCL equations are treated, we have the
admittance matrix and the RHS vector.
* Solve the resulting linear system of equations,
Ye = Is for the node voltages.
* The equation assembly (also called parsing) can be
done element-by-element, i.e., by considering one line
of the circuit file at a time.

M. B. Patil, IIT Bombay

e1

R1
R2

I0

e2
v3

R3

k v3
0

R4

e3

SPICE file
I0 1 0 1m
R1 1 2 1k
R2 2 0 1.2k
R3 2 3 200
R4 0 3 1k
VCCS1 1 3 2 3 0.5m

Nodal Analysis of a linear circuit

* Take some node as the reference node and denote


the node voltages of the remaining nodes by e1 , e2 ,
etc.
* Write KCL at each node in terms of the node
voltages. Follow a fixed convention, e.g., current
leaving a node is positive.
* When all KCL equations are treated, we have the
admittance matrix and the RHS vector.
* Solve the resulting linear system of equations,
Ye = Is for the node voltages.
* The equation assembly (also called parsing) can be
done element-by-element, i.e., by considering one line
of the circuit file at a time.
* The computer cannot see the entire circuit; it can,
however, go through the circuit file line by line.

M. B. Patil, IIT Bombay

e1

R1
R2

I0

e2
v3

R3

k v3
0

R4

e3

SPICE file
I0 1 0 1m
R1 1 2 1k
R2 2 0 1.2k
R3 2 3 200
R4 0 3 1k
VCCS1 1 3 2 3 0.5m

Step 1: Initialize

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

e1

e2

e3

k v3

Step 2

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

e1

e2

e3

k v3

Step 2

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

e1

I0

e2

e3

k v3

Step 3

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

e1

I0

e2

e3

k v3

Step 3

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

e1

I0

G1

G1

e2

e3

k v3

Step 4

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

e1

I0

G1

G1

e2

e3

k v3

Step 4

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

G1

e1

I0

G1+G2

e2

e3

k v3

Step 5

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

G1

e1

I0

G1+G2

e2

e3

k v3

Step 5

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

k v3

G1
G1+G2
G3
G3

e1

I0

G3

e2

G3

e3

Step 6

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

k v3

G1
G1+G2
G3
G3

e1

I0

G3

e2

G3

e3

Step 6

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

k v3

G1
G1+G2
G3
G3

e1

I0

G3

e2

G3+G4

e3

Step 7

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

k v3

G1
G1+G2
G3
G3

e1

I0

G3

e2

G3+G4

e3

Step 7

R1

e1

R2

I0
0

M. B. Patil, IIT Bombay

R4

e2
R3

v3

e3

KCL at 1

G1

G1

k v3

G1 k
G1+G2
G3
G3 +k

e1

I0

G3

e2

G3+G4

e3

Outline

* Circuit simulation: introduction


* Nodal analysis
* Modified nodal analysis
* Sparse tableau approach
* Nonlinear circuits
* Transient (dynamic) analysis

M. B. Patil, IIT Bombay

Modified Nodal Analysis (MNA) of a linear circuit


e
1

R2
v2

R1

R3

e2
i1
V0

e3
i2
v
2

* When a voltage source is involved, we cannot write its current in terms of


node voltages (e1 , e2 , etc.). The NA approach has to be modified
MNA.

M. B. Patil, IIT Bombay

Modified Nodal Analysis (MNA) of a linear circuit


e
1

R2
v2

R1

R3

e2
i1
V0

e3
i2
v
2

* When a voltage source is involved, we cannot write its current in terms of


node voltages (e1 , e2 , etc.). The NA approach has to be modified
MNA.
* Treat the current through the voltage source as an additional unknown.

M. B. Patil, IIT Bombay

Modified Nodal Analysis (MNA) of a linear circuit


e
1

R2
v2

R1

R3

e2
i1
V0

e3
i2
v
2

* When a voltage source is involved, we cannot write its current in terms of


node voltages (e1 , e2 , etc.). The NA approach has to be modified
MNA.
* Treat the current through the voltage source as an additional unknown.
* We also need to get an additional equation since the number of unknowns
has gone up by 1. This equation is provided by the branch equation of the
voltage source.

M. B. Patil, IIT Bombay

Modified Nodal Analysis (MNA) of a linear circuit


e
1

R2
v2

R1

R3

e2
i1
V0

e3
i2
v
2

* When a voltage source is involved, we cannot write its current in terms of


node voltages (e1 , e2 , etc.). The NA approach has to be modified
MNA.
* Treat the current through the voltage source as an additional unknown.
* We also need to get an additional equation since the number of unknowns
has gone up by 1. This equation is provided by the branch equation of the
voltage source.
* The solution vector now contains the voltage source currents in
addition to the node voltages.
M. B. Patil, IIT Bombay

Modified Nodal Analysis of a linear circuit


e1

R2
v2

R1

R3

e2

e3

i1
V0

i2

+
VS1

v
2

VS2

KCL at 1

e1

KCL at 2

e2

KCL at 3

e3

BCE for VS1

i1

BCE for VS2

i2

M. B. Patil, IIT Bombay

Modified Nodal Analysis of a linear circuit


e1

R2
v2

R1

R3

e2

e3

i1
V0

i2

+
VS1

v
2

VS2

KCL at 1

G1

e1

KCL at 2

e2

KCL at 3

e3

BCE for VS1

i1

BCE for VS2

i2

M. B. Patil, IIT Bombay

Modified Nodal Analysis of a linear circuit


e1

R2
v2

R1

R3

e2

e3

i1
V0

i2

+
VS1

v
2

VS2

KCL at 1

G1+G2

KCL at 2

G2

G2
G2

e1

e2

KCL at 3

e3

BCE for VS1

i1

BCE for VS2

i2

M. B. Patil, IIT Bombay

Modified Nodal Analysis of a linear circuit


e1

R2
v2

R1

R3

e2

e3

i1
V0

i2

+
VS1

v
2

VS2

KCL at 1

G1+G2

KCL at 2

G2

KCL at 3

G2

e1

G2+G3

G3

e2

G3

G3

e3

BCE for VS1

i1

BCE for VS2

i2

M. B. Patil, IIT Bombay

Modified Nodal Analysis of a linear circuit


e1

R2
v2

R1

R3

e2

e3

i1
V0

i2

+
VS1

v
2

VS2

KCL at 1

G1+G2

KCL at 2

G2

KCL at 3

BCE for VS1

BCE for VS2

M. B. Patil, IIT Bombay

G2

e1

G2+G3

G3

G3

G3

e2

e3

i1
i2

V0

Modified Nodal Analysis of a linear circuit


R2

e1

R3

e2

v2
R1

e3

i1
V0

i2

v
2

VS2

VS1
0

KCL at 1

G1+G2

KCL at 2

G2

KCL at 3

M. B. Patil, IIT Bombay

e1

G2+G3

G3

G3

G3

e2

e3

i1

BCE for VS1

BCE for VS2

G2

i2

V0

Outline

* Circuit simulation: introduction


* Nodal analysis
* Modified nodal analysis
* Sparse tableau approach
* Nonlinear circuits
* Transient (dynamic) analysis

M. B. Patil, IIT Bombay

Sparse Tableau Analysis (STA)

* Variables: node voltages, branch currents, and branch voltages

M. B. Patil, IIT Bombay

Sparse Tableau Analysis (STA)

* Variables: node voltages, branch currents, and branch voltages


* No need for special treatment of voltage sources or any other
elements

M. B. Patil, IIT Bombay

Sparse Tableau Analysis (STA)

* Variables: node voltages, branch currents, and branch voltages


* No need for special treatment of voltage sources or any other
elements
* Circuit topology and element equations are decoupled.

M. B. Patil, IIT Bombay

Sparse Tableau Analysis (STA)

* Variables: node voltages, branch currents, and branch voltages


* No need for special treatment of voltage sources or any other
elements
* Circuit topology and element equations are decoupled.
* Easier to implement as compared to MNA

M. B. Patil, IIT Bombay

v3

V2

STA
example

R2

i2
v2

i3

R3

i6
v6

v
4

v4

V3

V0

V4
i4

i5
v5

I0

R1
V1

v1

1 1
1 1
1 1
1
1 1

0
R1
R2
R3

M. B. Patil, IIT Bombay

i1

i1
i2
0
i3
i4
i5
1
1
i6
1 1
1
v1
1 1
1
1 1 v2
1
1 v3
1
v4
1
1
v5
1
v6
1

V1
1
0
V2
1
V3
V4
1

I0
V0

v3

V2

STA
example

R2

i2
v2

i3

R3

i6
v6

v
4

v4

V3

V0

V4
i4

i5
v5

I0

R1
V1

KCL

v1

1 1
1 1
1 1
1
1 1

0
R1
R2
R3

M. B. Patil, IIT Bombay

i1

i1
i2
0
i3
i4
i5
1
1
i6
1 1
1
v1
1 1
1
1 1 v2
1
1 v3
1
v4
1
1
v5
1
v6
1

V1
1
0
V2
1
V3
V4
1

I0
V0

v3

V2

STA
example

R2

i2
v2

i3

R3

i6
v6

v
4

v4

V3

V0

V4
i4

i5
v5

I0

R1
V1

v1

KCL

1 1
1 1
1 1
1
1 1

Branch Voltage
Definition

0
R1
R2
R3

M. B. Patil, IIT Bombay

i1

i1
i2
0
i3
i4
i5
1
1
i6
1 1
1
v1
1 1
1
1 1 v2
1
1 v3
1
v4
1
1
v5
1
v6
1

V1
1
0
V2
1
V3
V4
1

I0
V0

v3

V2

STA
example

R2

i2
v2

i3

R3

i6
v6

v
4

v4

V3

V0

V4
i4

i5
v5

I0

R1
V1

v1

KCL

1 1
1 1
1 1
1
1 1

Branch Voltage
Definition

0
R1

Branch
Equations

M. B. Patil, IIT Bombay

R2
R3

i1

i1
i2
0
i3
i4
i5
1
1
i6
1 1
1
v1
1 1
1
1 1 v2
1
1 v3
1
v4
1
1
v5
1
v6
1

V1
1
0
V2
1
V3
V4
1

I0
V0

Comparison of MNA and STA

* STA matrix is larger, but more sparse.

M. B. Patil, IIT Bombay

Comparison of MNA and STA

* STA matrix is larger, but more sparse.


* If A is an N N matrix, the CPU time to solve Ax = b is proportional to
N , where is 3 for a dense matrix and typically 1.5 to 2 for a sparse
matrix.

M. B. Patil, IIT Bombay

Comparison of MNA and STA

* STA matrix is larger, but more sparse.


* If A is an N N matrix, the CPU time to solve Ax = b is proportional to
N , where is 3 for a dense matrix and typically 1.5 to 2 for a sparse
matrix.
* STA is generally slower than MNA, but this is not a concern for relatively
small problems (including many problems in power electronics).

M. B. Patil, IIT Bombay

Comparison of MNA and STA

* STA matrix is larger, but more sparse.


* If A is an N N matrix, the CPU time to solve Ax = b is proportional to
N , where is 3 for a dense matrix and typically 1.5 to 2 for a sparse
matrix.
* STA is generally slower than MNA, but this is not a concern for relatively
small problems (including many problems in power electronics).
* Historically, STA was the first systematic approach used for circuit
simulation (ASTAP by IBM). SPICE, based on MNA, was developed
subsequently at UC Berkeley.

M. B. Patil, IIT Bombay

Comparison of MNA and STA

* STA matrix is larger, but more sparse.


* If A is an N N matrix, the CPU time to solve Ax = b is proportional to
N , where is 3 for a dense matrix and typically 1.5 to 2 for a sparse
matrix.
* STA is generally slower than MNA, but this is not a concern for relatively
small problems (including many problems in power electronics).
* Historically, STA was the first systematic approach used for circuit
simulation (ASTAP by IBM). SPICE, based on MNA, was developed
subsequently at UC Berkeley.
* Most of the circuit simulation programs available today are based on
MNA, and many of them make use of SPICE.

M. B. Patil, IIT Bombay

Outline

* Circuit simulation: introduction


* Nodal analysis
* Modified nodal analysis
* Sparse tableau approach
* Nonlinear circuits
* Transient (dynamic) analysis

M. B. Patil, IIT Bombay

Nonlinear circuits: Newton-Raphson method


V1

Vs

+
0

M. B. Patil, IIT Bombay

V2
+
V0

R
D

Nonlinear circuits: Newton-Raphson method


V1

Vs

+
0

M. B. Patil, IIT Bombay

V2
+
V0

R
D

V0 V2
R

= Is [exp (V2 /VT ) 1]

Nonlinear circuits: Newton-Raphson method


V1

Vs

+
0

M. B. Patil, IIT Bombay

V2
+
V0

R
D

V0 V2
R
V0 V2
R

= Is [exp (V2 /VT ) 1]


Is [exp (V2 /VT ) 1] = 0

Nonlinear circuits: Newton-Raphson method


V1

Vs

V2
+
V0

V0 V2
R
V0 V2
R

= Is [exp (V2 /VT ) 1]


Is [exp (V2 /VT ) 1] = 0

Rewrite as f (V2 ) = 0. In general, consider f (x) = 0. Expand around an initial


guess x0 .
f (x0 + x) = f (x0 ) + x f 0 (x0 ) +
We want x such that f (x0 + x) = 0 .
x =

M. B. Patil, IIT Bombay

f (x0 )
f 0 (x0 )

Newton-Raphson method: graphical interpretation of x = ff0(x(x00))

800

f (x)

600

400

200

0
2

3
5

Solution of x 3 20 x = 0, with x = 8 as the initial guess.

M. B. Patil, IIT Bombay

10

Newton-Raphson method: convergence

x (i)

f (x (i) )

x (i)

0.800000101

0.352103

-0.204101

0.595349101

0.919102

-0.106101

0.488846101

0.190102

-0.368

-0.470101

0.45199210

0.19410

0.44728810

0.29810

-0.746103

0.447214101

0.748105

-0.187106

0.447214101

0.4701012

-0.1171013

Solution of f (x) = x 3 20 x = 0, with x = 8 as the initial guess.

M. B. Patil, IIT Bombay

Convergence of Newton-Raphson method

Consider solving f (x) = 0 with the N-R method. Define


g (x) = x

M. B. Patil, IIT Bombay

f (x)
.
f 0 (x)

(1)

Convergence of Newton-Raphson method

Consider solving f (x) = 0 with the N-R method. Define


g (x) = x

f (x)
.
f 0 (x)

(1)

The N-R iteration can be written as [8],


x (n+1) = x (n) + x (n) = g (x (n) ) .

M. B. Patil, IIT Bombay

(2)

Convergence of Newton-Raphson method

Consider solving f (x) = 0 with the N-R method. Define


g (x) = x

f (x)
.
f 0 (x)

(1)

The N-R iteration can be written as [8],


x (n+1) = x (n) + x (n) = g (x (n) ) .

(2)

Application of Taylors theorem to Eq. 1 yields,


g (x) = g (r ) + g 0 (r )(x r ) +
where lies between x and r .

M. B. Patil, IIT Bombay

g 00 ()
(x r )2 ,
2

(3)

Convergence of Newton-Raphson method

Consider solving f (x) = 0 with the N-R method. Define


g (x) = x

f (x)
.
f 0 (x)

(1)

The N-R iteration can be written as [8],


x (n+1) = x (n) + x (n) = g (x (n) ) .

(2)

Application of Taylors theorem to Eq. 1 yields,


g (x) = g (r ) + g 0 (r )(x r ) +

g 00 ()
(x r )2 ,
2

(3)

where lies between x and r .


The derivative g 0 (x) can be obtained from Eq. 1 as,
g 0 (x) = 1

M. B. Patil, IIT Bombay

[f 0 (x)]2 f (x)f 00 (x)


.
[f 0 (x)]2

(4)

Convergence of Newton-Raphson method

Since f (r ) = 0, we get g (r ) = r from Eq. 1 and g 0 (r ) = 0 from Eq. 4. Substituting for


g (r ) and g 0 (r ) in Eq. 3, we get,
g (x) = r +

M. B. Patil, IIT Bombay

g 00 ()
(x r )2 .
2

(5)

Convergence of Newton-Raphson method

Since f (r ) = 0, we get g (r ) = r from Eq. 1 and g 0 (r ) = 0 from Eq. 4. Substituting for


g (r ) and g 0 (r ) in Eq. 3, we get,
g (x) = r +

g 00 ()
(x r )2 .
2

Replace x by x (n) and use the fact that g (x (n) ) is the same as x (n+1) in the N-R
procedure, to get


2
g 00 ()  (n)
x (n+1) r =
x r
.
2

M. B. Patil, IIT Bombay

(5)

(6)

Convergence of Newton-Raphson method

Since f (r ) = 0, we get g (r ) = r from Eq. 1 and g 0 (r ) = 0 from Eq. 4. Substituting for


g (r ) and g 0 (r ) in Eq. 3, we get,
g (x) = r +

g 00 ()
(x r )2 .
2

(5)

Replace x by x (n) and use the fact that g (x (n) ) is the same as x (n+1) in the N-R
procedure, to get


2
g 00 ()  (n)
x (n+1) r =
x r
.
(6)
2
As x (n) converges to r , so does ; and we can replace g 00 () by g 00 (r ), a constant.
Further, if we define (n) x (n) r (the error at the nth N-R iteration), we can
write Eq. 6 as
(n+1) = k [(n) ]2 ,
(7)
where k = g 00 (r )/2. Eq. 7 describes the well-known feature of quadratic
convergence of the N-R method, i.e., the error goes down quadratically as x (n) r .

M. B. Patil, IIT Bombay

Convergence of Newton-Raphson method


0
4

2
10

2
3

15
3
20

log [ (n+1) ]

25
4

5
6
7
8

NR iterations
Fixedpoint iterations

9
5
10
5

log [

(n)

log ((n+1) ) versus log ((n) ) with the N-R scheme and the fixed-point iteration method for
f (x) = x 2 6x + 8 = 0, with x = 0 as the initial guess. The green line represents
g 00 (r ) (n) 2
(n+1) =
( ) . The iteration numbers are also shown for each scheme. Note the quadratic
2
convergence of the N-R method. (Both schemes were found to converge to r = 2 for the specified
initial guess.)
M. B. Patil, IIT Bombay

Newton-Raphson method for N equations

Consider a system of N ODEs:

f1 (x)
f2 (x)

f=
.. ,
fN (x)

f1 (x1 , x2 , . . , xN ) = 0 ,
f2 (x1 , x2 , . . , xN ) = 0 ,
....

fN (x1 , x2 , . . , xN ) = 0 .
The correction vector x can be obtained
by solving
(i)

(i)

= f

(i)

where i is the iteration number, J is the


Jacobian matrix, and f is the function
vector.

M. B. Patil, IIT Bombay

f1
x1

f2

1
J=
x
..

fN

x1

f1
x2
f2
x2
..
fN
x2

..
..
..
..

f1
xN

f2

xN
.

fN
xN

N-R method: example with two variables

(i)

(i)

(i)

(i)

x1

x2

|| f ||2

x1

x2

0.40000101

0.15000102

0.10241102

0.73776 101

0.16223 101

0.25244101

0.14675102

0.78909101

0.34368 101

0.37631 101

0.18371101

0.13922102

0.61523101

0.17887 101

0.39712 101

0.14793101

0.13128102

0.48512101

0.10737 101

0.35342 101

0.70747

0.29789 101

0.49427

6
7
8
9
10

0.1264610

0.1123110
0.62883
0.70976
0.71263
0.71263

0.1242110

0.1182610

0.9371110

0.9290210

0.9287310

0.9287310

0.3848110
0.3062010
0.95091

0.24548 101
1

0.80932 101

0.28690 102

0.35381 105

11

0.53753 1011

0.8093210
1

0.3148710

0.3873510

10

0.5885510

0.2869010
0.3538110
0.5375910

Application of the N-R method to a system of two equations, with f1 x1 + x2 10 = 0, and


f2 x2 15 tan1 (x1 ) = 0.

M. B. Patil, IIT Bombay

N-R method: example with two variables

1
3

14
4
5
12
6
4.0
3.0

5.0

6.0
7.0

2.0

x2

8.0
9.0

1.0

10

10.0
11.0
8
12.0

13.0
6
14.0
0

0.5

1.5

2.5

3.5

x1

Application of the N-R method to a system of two equations, with f1 x1 + x2 10 = 0, and


f2 x2 15 tan1 (x1 ) = 0. The contours are labelled by the 2-norm, || f ||2 . Circled integers
represent the iteration numbers.

M. B. Patil, IIT Bombay

Newton-Raphson method: convergence issues


2
1.5

f(x)

0.5
P

0
0.5
2

1
4
1.5
10

10

20

30

40

Application of the N-R method to f (x) = tan1 x = 0, with x = 1.5 as the


initial guess.

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

Instead of
x (n+1) = x (n) + x (n) ,
as in the standard N-R algorithm, we use
x (n+1)

=
=

x (n) + k x (n)
n
o
x (n) + k [f 0 (x (n) )]1 f (x (n) ) ,

where k (< 1 ) is the damping factor.

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

1.5
1

f(x)

0.5
0
0.5
2
1
1.5
2

1.5

0.5

0.5

1.5

Application of the N-R method to f (x) = tan1 x = 0, with x = 1.5 as the


initial guess and a damping factor k = 0.7.
M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping


10 2
No damping
k=0.2
2

10

|f|

k=0.5
6

10

k=0.8
k=0.2
(first 3 iterations)

10

10

14

10

12

16

20

Iteration Number

Application of the N-R method to f (x) = tan1 x = 0, with x = 1.5 as the initial guess and
f
different damping factors. (For the case with no damping, N-R iterations stopped due to
x
becoming too small.)

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

* Damping improves chances of convergence.

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

* Damping improves chances of convergence.


* However, it makes convergence slower as compared to the standard N-R
method.

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

* Damping improves chances of convergence.


* However, it makes convergence slower as compared to the standard N-R
method.
* Damping should be used only when the standard N-R method fails to
converge.

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

* Damping improves chances of convergence.


* However, it makes convergence slower as compared to the standard N-R
method.
* Damping should be used only when the standard N-R method fails to
converge.
* Damping is very useful in power electronic circuits since they are highly
non-linear (due to switches).

M. B. Patil, IIT Bombay

Newton-Raphson method: use of damping

* Damping improves chances of convergence.


* However, it makes convergence slower as compared to the standard N-R
method.
* Damping should be used only when the standard N-R method fails to
converge.
* Damping is very useful in power electronic circuits since they are highly
non-linear (due to switches).
* For transient simulation, in addition to damping, reducing the time step
may also help in convergence.

M. B. Patil, IIT Bombay

N-R method: effect of scaling and precision


Consider the system of equations,

M. B. Patil, IIT Bombay

f1 (x1 , x2 )

k (x1 + x2 6 3) = 0 ,

f2 (x1 , x2 )

10x12 x22 + 45 = 0 .

(8)

N-R method: effect of scaling and precision


Consider the system of equations,
f1 (x1 , x2 )

k (x1 + x2 6 3) = 0 ,

f2 (x1 , x2 )

10x12 x22 + 45 = 0 .

1010

1010
Single Precision

Double Precision
10 5

100

k=105

10

k=1

10

|| f || 2

|| f || 2

10 5

100
5

10

k=105

10

10

15

(8)

10
(a)

15

10

k=1

(b)

10
1

5 6 7 8 9 10 11 12
Iteration Number

5 6 7 8 9 10 11 12
Iteration Number

|| f || 2 versus N-R iteration number for Eq. 8, with x1 = x2 = 1 as the initial guess, (a) Single
precision arithmetic, (b) Double precision arithmetic.

M. B. Patil, IIT Bombay

N-R method: effect of scaling and precision


Consider the system of equations,
f1 (x1 , x2 )

k (x1 + x2 6 3) = 0 ,

f2 (x1 , x2 )

10x12 x22 + 45 = 0 .

1010

1010
Single Precision

Double Precision
10 5

100

k=105

10

k=1

10

|| f || 2

|| f || 2

10 5

100
5

10

k=105

10

10

15

(8)

10
(a)

15

10

k=1

(b)

10
1

5 6 7 8 9 10 11 12
Iteration Number

5 6 7 8 9 10 11 12
Iteration Number

|| f || 2 versus N-R iteration number for Eq. 8, with x1 = x2 = 1 as the initial guess, (a) Single
precision arithmetic, (b) Double precision arithmetic.

* If k is made larger, the norm saturates at a higher value.

M. B. Patil, IIT Bombay

N-R method: effect of scaling and precision


Consider the system of equations,
f1 (x1 , x2 )

k (x1 + x2 6 3) = 0 ,

f2 (x1 , x2 )

10x12 x22 + 45 = 0 .

1010

1010
Single Precision

Double Precision
10 5

100

k=105

10

k=1

10

|| f || 2

|| f || 2

10 5

100
5

10

k=105

10

10

15

(8)

10
(a)

15

10

k=1

(b)

10
1

5 6 7 8 9 10 11 12
Iteration Number

5 6 7 8 9 10 11 12
Iteration Number

|| f || 2 versus N-R iteration number for Eq. 8, with x1 = x2 = 1 as the initial guess, (a) Single
precision arithmetic, (b) Double precision arithmetic.

* If k is made larger, the norm saturates at a higher value.


* Precision has a significant effect on the lowest achievable norm.
M. B. Patil, IIT Bombay

Non-linear circuit analysis

MNA equations:
e1

e2

i1
Vs

+
V0

iD

i1 + G (e1 e2 )

0,

G (e2 e1 ) + iD (e2 )

0,

e1

V0 ,

where
0

iD (e2 ) = Is0 [exp (e2 /VT ) 1] .

* The circuit equations can be assembled using the MNA or STA approach.

M. B. Patil, IIT Bombay

Non-linear circuit analysis

MNA equations:
e1

e2

i1
Vs

+
V0

iD

i1 + G (e1 e2 )

0,

G (e2 e1 ) + iD (e2 )

0,

e1

V0 ,

where
0

iD (e2 ) = Is0 [exp (e2 /VT ) 1] .

* The circuit equations can be assembled using the MNA or STA approach.
* Since the equations are non-linear, the N-R method is used to solve them.

M. B. Patil, IIT Bombay

Non-linear circuit analysis

MNA equations:
e1

e2

i1
Vs

+
V0

iD

i1 + G (e1 e2 )

0,

G (e2 e1 ) + iD (e2 )

0,

e1

V0 ,

where
0

iD (e2 ) = Is0 [exp (e2 /VT ) 1] .

* The circuit equations can be assembled using the MNA or STA approach.
* Since the equations are non-linear, the N-R method is used to solve them.
* More expensive than a linear circuit of the same size, since several
(typically 3 to 5) N-R iterations are involved, each requiring the solution
of Jx = f.

M. B. Patil, IIT Bombay

Outline

* Circuit simulation: introduction


* Nodal analysis
* Modified nodal analysis
* Sparse tableau approach
* Nonlinear circuits
* Transient (dynamic) analysis

M. B. Patil, IIT Bombay

Transient (dynamic) analysis

Vs (t)

(a)

Vs (t)

(c)

M. B. Patil, IIT Bombay

Vs (t)

(b)

Vs (t)

(d)

Transient (dynamic) analysis

Vs (t)

(a)

Vs (t)

(c)

Vs (t)

(b)

Vs (t)

(d)

* In (a) and (b), we can use the techniques seen earlier. At a given time t,
we simply need to replace the source with a DC source with voltage =
Vs (t).

M. B. Patil, IIT Bombay

Transient (dynamic) analysis

Vs (t)

(a)

Vs (t)

(c)

Vs (t)

(b)

Vs (t)

(d)

* In (a) and (b), we can use the techniques seen earlier. At a given time t,
we simply need to replace the source with a DC source with voltage =
Vs (t).
* In (c) and (d), the situation is very different due to the presence of a
capacitor which involves time derivatives.
M. B. Patil, IIT Bombay

Transient analysis

b
R

iC
vC

0
dvC
* The capacitor current, iC = C
, cannot be written in terms of the
dt
instantaneous node voltages or branch voltages since its value depends on
the past behaviour of vC .

M. B. Patil, IIT Bombay

Transient analysis

b
R

iC
vC

0
dvC
* The capacitor current, iC = C
, cannot be written in terms of the
dt
instantaneous node voltages or branch voltages since its value depends on
the past behaviour of vC .
* We need some way of approximating the derivative in terms of the past
behaviour of vC .

M. B. Patil, IIT Bombay

Discretization of time

t1 t2

t3

t N1
......

t0
t begin

t1

t2

t3

t N1 t N

time

t end

* Discretization of time is required since numerical solution can only be


obtained at a finite number of points.

M. B. Patil, IIT Bombay

Discretization of time

t1 t2

t3

t N1
......

t0

t1

t2

t3

t begin

t N1 t N

time

t end

* Discretization of time is required since numerical solution can only be


obtained at a finite number of points.
* The time steps (ti ) may not be uniform.

M. B. Patil, IIT Bombay

Discretization of time

t1 t2

t3

t N1
......

t0

t1

t2

t3

t begin

t N1 t N

time

t end

* Discretization of time is required since numerical solution can only be


obtained at a finite number of points.
* The time steps (ti ) may not be uniform.
* Generally, the time steps are computed dynamically, not a priori.

M. B. Patil, IIT Bombay

Discretization of time

R
C

Vs

10

10

6
4

V (Volts)

10

V (Volts)

V (Volts)

6
4
2

10
15
Time (sec)

20

(b)
25

(a) Typical simulator output.

M. B. Patil, IIT Bombay

4
2

(a)
0

10
15
Time (sec)

20

(c)
25

10
15
Time (sec)

20

25

Discretization of time

R
C

Vs

10

10

6
4

V (Volts)

10

V (Volts)

V (Volts)

6
4
2

10
15
Time (sec)

20

4
2

(a)
0

(b)
25

10
15
Time (sec)

20

(c)
25

(a) Typical simulator output.


(b) After connecting the output points with line segments.

M. B. Patil, IIT Bombay

10
15
Time (sec)

20

25

Discretization of time

R
C

Vs

10

10

6
4

V (Volts)

10

V (Volts)

V (Volts)

6
4
2

10
15
Time (sec)

20

4
2

(a)
0

(b)
25

10
15
Time (sec)

20

(c)
25

10
15
Time (sec)

(a) Typical simulator output.


(b) After connecting the output points with line segments.
(c) After removing the output points (but retaining the segments), the
waveform looks continuous, but this is an illusion!
M. B. Patil, IIT Bombay

20

25

Transient analysis: a quick look


x

x n+1
xn

tn

t n+1

dx
= f (t, x)
dt

Method

Approximation for

Forward Euler

xn+1 xn
= f (tn , xn )
h

M. B. Patil, IIT Bombay

Transient analysis: a quick look


x

x n+1
xn

tn

Method
Forward Euler
Backward Euler

M. B. Patil, IIT Bombay

t n+1

Approximation for

dx
= f (t, x)
dt

xn+1 xn
= f (tn , xn )
h
xn+1 xn
= f (tn+1 , xn+1 )
h

Transient analysis: a quick look


x

x n+1
xn

tn

Method
Forward Euler
Backward Euler
Trapezoidal

M. B. Patil, IIT Bombay

t n+1

Approximation for

dx
= f (t, x)
dt

xn+1 xn
= f (tn , xn )
h
xn+1 xn
= f (tn+1 , xn+1 )
h
1
xn+1 xn
= [f (tn , xn ) + f (tn+1 , xn+1 )]
h
2

Application to x = x, with x(0) = 1

FE :
BE :
TRZ :

xn+1 xn
=
h
xn+1 xn
=
h
xn+1 xn
=
h

f (tn , xn )

= xn

f (tn+1 , xn+1 )

= xn+1

1
[f (tn , xn ) + f (tn+1 , xn+1 )]
2

1
= (xn + xn+1 )
2

Simple manipulation yields the following approximations:

M. B. Patil, IIT Bombay

FE :

xn+1 =

xn (1 h)

BE :

xn+1 =

xn

1
1+h

TRZ :

xn+1 =

xn

1 h/2
1 + h/2

Application to x = x, with x(0) = 1


The exact solution is x(t) = e t . Expanding around tn , we get,
xn+1 = xn + h

d x
+ = xn + h(e tn ) + = xn (1 h + h2 /2 h3 /6 + ) .
dt

M. B. Patil, IIT Bombay

Application to x = x, with x(0) = 1


The exact solution is x(t) = e t . Expanding around tn , we get,
xn+1 = xn + h

d x
+ = xn + h(e tn ) + = xn (1 h + h2 /2 h3 /6 + ) .
dt

Compare with
FE :

M. B. Patil, IIT Bombay

xn+1 =

xn (1 h)

Application to x = x, with x(0) = 1


The exact solution is x(t) = e t . Expanding around tn , we get,
xn+1 = xn + h

d x
+ = xn + h(e tn ) + = xn (1 h + h2 /2 h3 /6 + ) .
dt

Compare with
FE :

xn+1 =

xn (1 h)

BE :

xn+1 =

xn

M. B. Patil, IIT Bombay

1
= xn (1 h + h2 + )
1+h

Application to x = x, with x(0) = 1


The exact solution is x(t) = e t . Expanding around tn , we get,
xn+1 = xn + h

d x
+ = xn + h(e tn ) + = xn (1 h + h2 /2 h3 /6 + ) .
dt

Compare with
FE :

xn+1 =

xn (1 h)

BE :

xn+1 =

xn

1
= xn (1 h + h2 + )
1+h

TRZ :

xn+1 =

xn

1 h/2
= xn (1 h + h2 /2 h3 /4 + )
1 + h/2

M. B. Patil, IIT Bombay

Application to x = x, with x(0) = 1


The exact solution is x(t) = e t . Expanding around tn , we get,
xn+1 = xn + h

d x
+ = xn + h(e tn ) + = xn (1 h + h2 /2 h3 /6 + ) .
dt

Compare with
FE :

xn+1 =

xn (1 h)

BE :

xn+1 =

xn

1
= xn (1 h + h2 + )
1+h

TRZ :

xn+1 =

xn

1 h/2
= xn (1 h + h2 /2 h3 /4 + )
1 + h/2

* If h  1, the three approximations are equivalent, as we would expect.

M. B. Patil, IIT Bombay

Application to x = x, with x(0) = 1


The exact solution is x(t) = e t . Expanding around tn , we get,
xn+1 = xn + h

d x
+ = xn + h(e tn ) + = xn (1 h + h2 /2 h3 /6 + ) .
dt

Compare with
FE :

xn+1 =

xn (1 h)

BE :

xn+1 =

xn

1
= xn (1 h + h2 + )
1+h

TRZ :

xn+1 =

xn

1 h/2
= xn (1 h + h2 /2 h3 /4 + )
1 + h/2

* If h  1, the three approximations are equivalent, as we would expect.


* If the starting point x(tn ) is the same, the error (difference between the
exact and numerical solutions) is O(h2 ) for FE and BE, and O(h3 ) for
TRZ.
M. B. Patil, IIT Bombay

Application to x = x, with x(0) = 1


10 0

FE

104

BE

local

local

TRZ

108

numerical
exact

tn

tn+1

tn+2

1012
104

103

102

101

step size (h)

* The local error is the error made in a single step, assuming that the
starting point is exact. In this case, starting from the exact value,
x(0) = 1, the difference |x(h) x(h)| has been computed.

M. B. Patil, IIT Bombay

100

Application to x = x, with x(0) = 1


10 0

FE

104

BE

local

local

TRZ

108

numerical
exact

tn

tn+1

tn+2

1012
104

103

102

101

step size (h)

* The local error is the error made in a single step, assuming that the
starting point is exact. In this case, starting from the exact value,
x(0) = 1, the difference |x(h) x(h)| has been computed.
* If h h/10, the error decreases by a factor of 102 for the FE and BE
methods, and by 103 for the TRZ method.

M. B. Patil, IIT Bombay

100

Application to x = x, with x(0) = 1


10 0

FE

104

BE

local

local

TRZ

108

numerical
exact

tn

tn+1

tn+2

1012
104

103

102

101

100

step size (h)

* The local error is the error made in a single step, assuming that the
starting point is exact. In this case, starting from the exact value,
x(0) = 1, the difference |x(h) x(h)| has been computed.
* If h h/10, the error decreases by a factor of 102 for the FE and BE
methods, and by 103 for the TRZ method.
* The TRZ method is therefore said to be more accurate than FE or BE.
M. B. Patil, IIT Bombay

Application to x = x, with x(0) = 1

1.0

h=0.5
TRZ
BE
exact

0.8

0.6
0.4
0.2
0.0

M. B. Patil, IIT Bombay

Application to x = x, with x(0) = 1

1.0

h=0.5
TRZ
BE
exact

0.8

0.6
0.4
0.2
0.0

* The higher accuracy of the TRZ method allows larger time steps.

M. B. Patil, IIT Bombay

Comparison of FE and BE for x = x, x(0) = 1

h=0.1
1.0
exact
FE
BE

0.8
0.6
0.4
0.2
0.0

M. B. Patil, IIT Bombay

Comparison of FE and BE for x = x, x(0) = 1

h=0.1
1.0
exact
FE
BE

0.8
0.6
0.4
0.2
0.0

h=0.5
1.0
0.8
0.6
0.4
0.2
0.0

M. B. Patil, IIT Bombay

Comparison of FE and BE for x = x, x(0) = 1

h=2.0

h=0.1
1

1.0
exact
FE
BE

0.8
0.6

0
0.4
0.2
0.0

h=0.5
1.0
0.8
0.6
0.4
0.2
0.0

M. B. Patil, IIT Bombay

10

15

20

Comparison of FE and BE for x = x, x(0) = 1

h=2.0

h=0.1
1

1.0
exact
FE
BE

0.8
0.6

0
0.4
0.2
0.0

h=0.5

10

15

20

15

20

h=2.1

1.0

0.8

2
1

0.6

0
0.4

0.2
0.0

2
0

M. B. Patil, IIT Bombay

10

Comparison of FE and BE for x = x, x(0) = 1

* Although the FE and BE methods are comparable in accuracy, the FE


method is unstable and therefore not useful for circuit simulation.

M. B. Patil, IIT Bombay

Comparison of FE and BE for x = x, x(0) = 1

* Although the FE and BE methods are comparable in accuracy, the FE


method is unstable and therefore not useful for circuit simulation.
* Can we not use a smaller time step and avoid the instability problem?

M. B. Patil, IIT Bombay

Comparison of FE and BE for x = x, x(0) = 1

* Although the FE and BE methods are comparable in accuracy, the FE


method is unstable and therefore not useful for circuit simulation.
* Can we not use a smaller time step and avoid the instability problem?
Yes, but it increases the simulation time, and in some cases (stiff circuits),
by orders of magnitude!

M. B. Patil, IIT Bombay

Comparison of FE and BE for x = x, x(0) = 1

* Although the FE and BE methods are comparable in accuracy, the FE


method is unstable and therefore not useful for circuit simulation.
* Can we not use a smaller time step and avoid the instability problem?
Yes, but it increases the simulation time, and in some cases (stiff circuits),
by orders of magnitude!
* The issue of stability rules out many other methods as well.

M. B. Patil, IIT Bombay

Explicit and implicit methods


Consider the ODE,
dx
= x 2 , with 1 t 5, x(1) = 1 .
dt

M. B. Patil, IIT Bombay

Explicit and implicit methods


Consider the ODE,
dx
= x 2 , with 1 t 5, x(1) = 1 .
dt
Application of the FE, BE, and TRZ formulas yields,
xn+1

M. B. Patil, IIT Bombay

= xn + h (xn2 )

xn+1

= xn +

2
h (xn+1
)

xn+1

= xn +

h
2
(xn2 xn+1
)
2

(FE ) ,
(BE ) ,
(TRZ ) .

Explicit and implicit methods


Consider the ODE,
dx
= x 2 , with 1 t 5, x(1) = 1 .
dt
Application of the FE, BE, and TRZ formulas yields,
xn+1

= xn + h (xn2 )

xn+1

= xn +

2
h (xn+1
)

xn+1

= xn +

h
2
(xn2 xn+1
)
2

(FE ) ,
(BE ) ,
(TRZ ) .

* In the FE formula, xn+1 can be explicitly evaluated in terms of xn .

M. B. Patil, IIT Bombay

Explicit and implicit methods


Consider the ODE,
dx
= x 2 , with 1 t 5, x(1) = 1 .
dt
Application of the FE, BE, and TRZ formulas yields,
xn+1

= xn + h (xn2 )

xn+1

= xn +

2
h (xn+1
)

xn+1

= xn +

h
2
(xn2 xn+1
)
2

(FE ) ,
(BE ) ,
(TRZ ) .

* In the FE formula, xn+1 can be explicitly evaluated in terms of xn .


* The BE and TRZ formulas result in equations which must be solved for
xn+1 . This is much more work, and it gets worse when there are many
equations involved.

M. B. Patil, IIT Bombay

Explicit and implicit methods


Consider the ODE,
dx
= x 2 , with 1 t 5, x(1) = 1 .
dt
Application of the FE, BE, and TRZ formulas yields,
xn+1

= xn + h (xn2 )

xn+1

= xn +

2
h (xn+1
)

xn+1

= xn +

h
2
(xn2 xn+1
)
2

(FE ) ,
(BE ) ,
(TRZ ) .

* In the FE formula, xn+1 can be explicitly evaluated in terms of xn .


* The BE and TRZ formulas result in equations which must be solved for
xn+1 . This is much more work, and it gets worse when there are many
equations involved.
* However, the FE method is not useful because it can be unstable in some
cases.
M. B. Patil, IIT Bombay

Choice of method for transient simulation

* Two major concerns: accuracy (order) and stability

M. B. Patil, IIT Bombay

Choice of method for transient simulation

* Two major concerns: accuracy (order) and stability


* A method with a higher accuracy (order) is more efficient as it allows a
larger time step fewer time points faster simulation.

M. B. Patil, IIT Bombay

Choice of method for transient simulation

* Two major concerns: accuracy (order) and stability


* A method with a higher accuracy (order) is more efficient as it allows a
larger time step fewer time points faster simulation.
* However, high-order methods are conditionally stable, i.e., if the time step
is large (compared to the smallest time constant in the circuit), the
solution grows indefinitely, as in the FE example.

M. B. Patil, IIT Bombay

Choice of method for transient simulation

* Two major concerns: accuracy (order) and stability


* A method with a higher accuracy (order) is more efficient as it allows a
larger time step fewer time points faster simulation.
* However, high-order methods are conditionally stable, i.e., if the time step
is large (compared to the smallest time constant in the circuit), the
solution grows indefinitely, as in the FE example.
* Power electronic circuits are usually stiff (i.e., they involve time constants
which are vastly different), and one cannot afford to make h smaller than
the smallest because
(a) such a high resolution is not required,
(b) it would dramatically increase the simulation time.

M. B. Patil, IIT Bombay

Choice of method for transient simulation

* Two major concerns: accuracy (order) and stability


* A method with a higher accuracy (order) is more efficient as it allows a
larger time step fewer time points faster simulation.
* However, high-order methods are conditionally stable, i.e., if the time step
is large (compared to the smallest time constant in the circuit), the
solution grows indefinitely, as in the FE example.
* Power electronic circuits are usually stiff (i.e., they involve time constants
which are vastly different), and one cannot afford to make h smaller than
the smallest because
(a) such a high resolution is not required,
(b) it would dramatically increase the simulation time.
* The stability constraints significantly reduce the choices available for
circuit simulation. BE, Gear (order 2), and Trapezoidal methods are
commonly used.

M. B. Patil, IIT Bombay

Equivalent circuit for a capacitor


With Backward Euler method, we get
vCn+1 vCn
1
= iCn+1 .
h
C
i.e., vCn+1 =

M. B. Patil, IIT Bombay

h n+1
i
+ vCn
C C

OR

iCn+1 =

C n+1 C n
v
vC .
h C
h

Equivalent circuit for a capacitor


With Backward Euler method, we get
vCn+1 vCn
1
= iCn+1 .
h
C
i.e., vCn+1 =

h n+1
i
+ vCn
C C

OR

iCn+1 =

C n+1 C n
v
vC .
h C
h
vCn+1
vCn

in+1
C

+
h/C

iC
vC

h/C
in+1
C

vCn C/h
M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.

M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.
* Automatic time step selection is based on (a) estimate of the local
truncation error at a given time step, (b) convergence behaviour of N-R
iterations.

M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.
* Automatic time step selection is based on (a) estimate of the local
truncation error at a given time step, (b) convergence behaviour of N-R
iterations.
* Power electronic circuits are generally nonlinear; time step has a
significant impact on convergence of N-R iterations. Option (b) is
therefore very effective.

M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.
* Automatic time step selection is based on (a) estimate of the local
truncation error at a given time step, (b) convergence behaviour of N-R
iterations.
* Power electronic circuits are generally nonlinear; time step has a
significant impact on convergence of N-R iterations. Option (b) is
therefore very effective.
* N-R convergence

M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.
* Automatic time step selection is based on (a) estimate of the local
truncation error at a given time step, (b) convergence behaviour of N-R
iterations.
* Power electronic circuits are generally nonlinear; time step has a
significant impact on convergence of N-R iterations. Option (b) is
therefore very effective.
* N-R convergence
- The solution obtained at ti serves as the initial guess at ti+1 .

M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.
* Automatic time step selection is based on (a) estimate of the local
truncation error at a given time step, (b) convergence behaviour of N-R
iterations.
* Power electronic circuits are generally nonlinear; time step has a
significant impact on convergence of N-R iterations. Option (b) is
therefore very effective.
* N-R convergence
- The solution obtained at ti serves as the initial guess at ti+1 .
- t too large N-R iterations may not converge.

M. B. Patil, IIT Bombay

Time step selection

* In some circuits, a constant t is appropriate; in others, especially with


many switching events, automatic time step selection is more effective.
* Automatic time step selection is based on (a) estimate of the local
truncation error at a given time step, (b) convergence behaviour of N-R
iterations.
* Power electronic circuits are generally nonlinear; time step has a
significant impact on convergence of N-R iterations. Option (b) is
therefore very effective.
* N-R convergence
- The solution obtained at ti serves as the initial guess at ti+1 .
- t too large N-R iterations may not converge.
- t too small large simulation time.

M. B. Patil, IIT Bombay

Automatic time step selection

Start (t = t0)

t = t + t

t = k1 t

Yes
NR

t = t/k2

Converged?

t = tmin ?

No

No
t = tmax ?

Yes

No

Yes
Stop

M. B. Patil, IIT Bombay

Automatic time step selection: example

V2, V4 (Volts)

Automatic time step selection


based on convergence of NR
iterations

4
V2

3
2
V4

1
0
120

V1

Vs

V3

V2

R2

R0
V4
C0

h ( sec)

100
R1

80
60
40
20

M. B. Patil, IIT Bombay

4
time (msec)

Transient simulation: are the results accurate?

* very difficult to judge except for simple problems

M. B. Patil, IIT Bombay

Transient simulation: are the results accurate?

* very difficult to judge except for simple problems


* In practice, reduce t by a factor of 2 and see if the results are different.

M. B. Patil, IIT Bombay

Transient simulation: are the results accurate?

* very difficult to judge except for simple problems


* In practice, reduce t by a factor of 2 and see if the results are different.
* Usually, the user would have some idea of the time scale, For example,
(a) Buck converter: t = Tc /50 may be appropriate.
(b) Half-wave rectifier: t = T /50 may be appropriate.
Such a rule of thumb provides a good starting point.

M. B. Patil, IIT Bombay

Steady-State Waveform (SSW) Analysis

* In many periodic systems, only the steady-state behaviour is of interest


(and not how it is attained). e.g., power electronic circuits, rf circuits

M. B. Patil, IIT Bombay

Steady-State Waveform (SSW) Analysis

* In many periodic systems, only the steady-state behaviour is of interest


(and not how it is attained). e.g., power electronic circuits, rf circuits
* Transient simulation (from some initial condition to the steady state) may
involve thousands of cycles; this is very expensive.

M. B. Patil, IIT Bombay

Steady-State Waveform (SSW) Analysis

* In many periodic systems, only the steady-state behaviour is of interest


(and not how it is attained). e.g., power electronic circuits, rf circuits
* Transient simulation (from some initial condition to the steady state) may
involve thousands of cycles; this is very expensive.
* Total time for which transient simulation needs to be performed to reach
the steady state is not known a priori; need to rely on a trial-and-error
approach.

M. B. Patil, IIT Bombay

Steady-State Waveform (SSW) Analysis

* In many periodic systems, only the steady-state behaviour is of interest


(and not how it is attained). e.g., power electronic circuits, rf circuits
* Transient simulation (from some initial condition to the steady state) may
involve thousands of cycles; this is very expensive.
* Total time for which transient simulation needs to be performed to reach
the steady state is not known a priori; need to rely on a trial-and-error
approach.
* It is much faster to obtain the steady-state information directly where a
nonlinear problem in the state variables is solved.

M. B. Patil, IIT Bombay

SSW Analysis: Buck Converter


L

40

i
C

R V

V (Volts)

20

0.01
0.02
Time (sec)

0.03

V (Volts)

20.48

20.44
0.026

0.028
Time (sec)

0.030

* A large number of cycles are required if transient simulation is used.


(Note that, for this example, the steady state is not quite reached as
indicated by the small amplitude variation.)

M. B. Patil, IIT Bombay

SSW Analysis: Buck Converter


L

40

i
C

R V

V (Volts)

20

0.01
0.02
Time (sec)

0.03

V (Volts)

20.48

20.44
0.026

0.028
Time (sec)

0.030

* A large number of cycles are required if transient simulation is used.


(Note that, for this example, the steady state is not quite reached as
indicated by the small amplitude variation.)
* If a component value (L or C ) is changed, we would not know how long
to simulate to attain steady state. This is cumbersome.
M. B. Patil, IIT Bombay

SSW Analysis: Basic idea


0.4
C
R1

R2

Vs

0.2

Vc

0.2
0
0.4

0.01
time

0.02

* Start with an initial guess for the state variable(s) (the capacitor voltage
here).

M. B. Patil, IIT Bombay

SSW Analysis: Basic idea


0.4
C
R1

R2

Vs

0.2

Vc

0.2
0
0.4

0.01
time

0.02

* Start with an initial guess for the state variable(s) (the capacitor voltage
here).
* Integrate for one cycle. Is Vc (T ) = Vc (0)?

M. B. Patil, IIT Bombay

SSW Analysis: Basic idea


0.4
C
R1

R2

Vs

0.2

Vc

0.2
0
0.4

0.01
time

0.02

* Start with an initial guess for the state variable(s) (the capacitor voltage
here).
* Integrate for one cycle. Is Vc (T ) = Vc (0)?
* If yes (red curve), we have obtained the SSW solution; if not, we need to
compute a better initial guess (in an outer Newton-Raphson loop) and
repeat [7].
M. B. Patil, IIT Bombay

SSW: Examples

Example

Ntrns

Nssw

750

Boost Converter

625

C
uk Converter

1250

1- half-wave rectifier

150

1- half-controlled bridge converter

110

3- diode bridge rectifier

200

Induction motor

125

17

Buck Converter

* Note the dramatic reduction in computational effort for the SSW method
as compared to transient analysis.

M. B. Patil, IIT Bombay

References

[1] L. O. Chua and P. M. Lin, Computer-Aided Analysis of Electronic Circuits, Englewood Cliffs:
Prentice-Hall, 1976.
[2] W. J. McCalla, Fundamentals of Computer-Aided Circuit Simulation, Boston: Kluwer
Academic Publishers, 1987.
[3] R. Raghuram, Computer Simulation of Electronic Circuits, New Delhi: Wiley Eastern, 1989.
[4] K. S. Kundert, The Designers Guide to SPICE and SPECTRE, Boston: Kluwer Academic
Publishers, 1995.
[5] M. B. Patil, V. Ramanarayanan, and V. T. Ranganathan, Simulation of Power Electronic
Circuits, to be published.
[6] C. D. Hachtel and R. K. Brayton and F. G. Gustavson, The sparse tableau approach to
network analysis and design, IEEE Trans. CT, vol. 18, pp. 101-113, 1971.
[7] F. R. Colon and T. N. Trick, Fast periodic steady-state analysis for large-signal electronic
circuits, IEEE J. Solid-State Circuits, vol. 8, pp. 260-269, 1973.
[8] C. F. Gerald and P. O. Whitley, Applied Numerical Analysis, Delhi: Pearson Education India,
1999.

M. B. Patil, IIT Bombay

You might also like