Professional Documents
Culture Documents
M. B. Patil
www.ee.iitb.ac.in/~sequel
* DC analysis
* transient (time-domain) analysis
* AC (frequency-domain) analysis
* logic-level simulation
* mixed-signal simulation
* noise computation
* periodic steady state computation
* sensitivity analysis
R1
is
Vs R2
Example 1
R1
is
Vs R2 R3
Example 1
R1
is
Vs R2 R3
R4
Example 1
R5
R1
is
Vs R2 R3
R4
Example 1
R5
R1
is
R6
Vs R2 R3
R4
Example 1
R1
VC1 C1
Vs (t)
Example 2
R1
VC1 C1
Vs (t)
Example 2
R1 R2
VC1 C1 C2
Vs (t)
Example 2
D R3
R1 R2
VC1 C1 C2
Vs (t)
Example 2
R2
R3 v3
I0
k v3
0 e3
R4
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
0 e3
R4
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
R1 KCL at 1 0 0 0 e1 0
e1 e2
R2 2 0 0 0 e2 0
R3 v3
I0
k v3
3 0 0 0 e3 0
0 e3
R4
R1 KCL at 1 0 0 0 e1 0
e1 e2
R2 2 0 0 0 e2 0
R3 v3
I0
k v3
3 0 0 0 e3 0
0 e3
R4
R1 KCL at 1 0 0 0 e1 I0
e1 e2
R2 2 0 0 0 e2 0
R3 v3
I0
k v3
3 0 0 0 e3 0
0 e3
R4
R1 KCL at 1 0 0 0 e1 I0
e1 e2
R2 2 0 0 0 e2 0
R3 v3
I0
k v3
3 0 0 0 e3 0
0 e3
R4
R1 KCL at 1 G1 G1 0 e1 I0
e1 e2
R2 2 G1 G1 0 e2 0
R3 v3
I0
k v3
3 0 0 0 e3 0
0 e3
R4
R1 KCL at 1 G1 G1 0 e1 I0
e1 e2
R2 2 G1 G1 0 e2 0
R3 v3
I0
k v3
3 0 0 0 e3 0
0 e3
R4
R1 KCL at 1 G1 G1 0 e1 I0
e1 e2
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0 + αv
2
VS1 VS2
G1+G2 G2 e1
KCL at 1
KCL at 2 G2 G2+G3 G3 e2
KCL at 3 G3 G3 e3
R2 e2 R3
e1 e3
v2 i1 i2
R1 V0 + αv
2
VS1 VS2
G1+G2 G2 e1
KCL at 1
KCL at 2 G2 G2+G3 G3 1 e2
KCL at 3 G3 G3 e3
R2 e2 R3
e1 e3
v2 i1 i2
R1 V0 + αv
2
VS1 VS2
G1+G2 G2 e1
KCL at 1
KCL at 2 G2 G2+G3 G3 1 e2
KCL at 3 G3 G3 1 e3
v2 v6 V0 v5 I0
αv
4
R1
V1 i1 0
v1
1 −1 i1
1 1 i2
−1 1 1
0 i3
−1 1 i4
1 −1 i5
1 1 −1 i6
1 −1 1 v1
0 1 −1 1 v2
1 −1 v3
1 −1 v4
−R1 1 v5
1 −α v6
−R2 1 V1
−R3 1
0 V2
1 V3 −I0
1 V4 V0
v2 v6 V0 v5 I0
αv
4
R1
V1 i1 0
v1
1 −1 i1
1 1 i2
KCL
−1 1 1
0 i3
−1 1 i4
1 −1 i5
1 1 −1 i6
1 −1 1 v1
0 1 −1 1 v2
1 −1 v3
1 −1 v4
−R1 1 v5
1 −α v6
−R2 1 V1
−R3 1
0 V2
1 V3 −I0
1 V4 V0
v2 v6 V0 v5 I0
αv
4
R1
V1 i1 0
v1
1 −1 i1
1 1 i2
KCL
−1 1 1
0 i3
−1 1 i4
1 −1 i5
1 1 −1 i6
Branch Voltage 1 −1 1 v1
Definition 0 1 −1 1 v2
1 −1 v3
1 −1 v4
−R1 1 v5
1 −α v6
−R2 1 V1
−R3 1
0 V2
1 V3 −I0
1 V4 V0
v2 v6 V0 v5 I0
αv
4
R1
V1 i1 0
v1
1 −1 i1
1 1 i2
KCL
−1 1 1
0 i3
−1 1 i4
1 −1 i5
1 1 −1 i6
Branch Voltage 1 −1 1 v1
Definition 0 1 −1 1 v2
1 −1 v3
1 −1 v4
−R1 1 v5
1 −α v6
Branch −R2 1 V1
Equations −R3 1
0 V2
1 V3 −I0
1 V4 V0
V1 V2
R
+
Vs + V0 D
V1 V2
R
+ V0 − V2
+ = Is [exp (V2 /VT ) − 1]
Vs V0 D R
V1 V2
R
+ V0 − V2
+ = Is [exp (V2 /VT ) − 1]
Vs V0 D R
V0 − V2
−Is [exp (V2 /VT ) − 1] = 0
0 R
V1 V2
R
+ V0 − V2
+ = Is [exp (V2 /VT ) − 1]
Vs V0 D R
V0 − V2
−Is [exp (V2 /VT ) − 1] = 0
0 R
f (x0 )
∆x = −
f 0 (x0 )
800
600
f (x)
400
1
200
2
P 3
0
2 3 4 5 6 7 8 9 10
x
Solution of x 3 − 20 x = 0, with x = 8 as the initial guess.
4
−5
−6
−7
−8
N−R iterations
Fixed−point iterations
−9
5
−10
−5 −4 −3 −2 −1 0 1
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.)
1
3 2
14
5
12
6 5.0
4.0 6.0
3.0 7.0
2.0 8.0
1.0 9.0
x2 10
10.0
11.0
8
12.0
13.0
6
14.0
1.5
3
1
1
0.5
f(x)
P
0
−0.5
2
−1
4
−1.5
−10 0 10 20 30 40
x
Instead of
1.5
1
1
0.5
f(x)
−0.5
2
−1
−1.5
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
x
10 2
No damping
k=0.2
−2
10
k=0.5
|f|
−6
10
k=0.8
k=0.2
−10 (first 3 iterations)
10
−14
10
0 4 8 12 16 20
Iteration Number
Application of the N-R method to f (x) = tan−1 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.)
|| f || 2
−5 −5
10 10
k=1
−10 −10 k=105
10 10
−15
(a) −15
(b) k=1
10 10
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12
Iteration Number 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.
|| f || 2
−5 −5
10 10
k=1
−10 −10 k=105
10 10
−15
(a) −15
(b) k=1
10 10
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12
Iteration Number 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.
|| f || 2
−5 −5
10 10
k=1
−10 −10 k=105
10 10
−15
(a) −15
(b) k=1
10 10
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12
Iteration Number 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.
MNA equations:
i1 + G (e1 − e2 ) = 0,
e1 e2
G (e2 − e1 ) + iD (e2 ) = 0,
i1 R iD
+ e1 = V0 ,
Vs + V0 D
where
0
iD (e2 ) = Is0 [exp (e2 /VT ) − 1] .
* The circuit equations can be assembled using the MNA or STA approach.
MNA equations:
i1 + G (e1 − e2 ) = 0,
e1 e2
G (e2 − e1 ) + iD (e2 ) = 0,
i1 R iD
+ e1 = V0 ,
Vs + V0 D
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.
MNA equations:
i1 + G (e1 − e2 ) = 0,
e1 e2
G (e2 − e1 ) + iD (e2 ) = 0,
i1 R iD
+ e1 = V0 ,
Vs + V0 D
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 J∆x = −f.
Vs (t) Vs (t)
(a) (b)
Vs (t) Vs (t)
(c) (d)
Vs (t) Vs (t)
(a) (b)
Vs (t) Vs (t)
(c) (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).
Vs (t) Vs (t)
(a) (b)
Vs (t) Vs (t)
(c) (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.
a b
R
iC
vC C
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 .
a b
R
iC
vC C
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 .
∆ t1 ∆ t2 ∆ t3 ∆ t N−1
......
t0 t1 t2 t3 t N−1 t N time
t begin t end
∆ t1 ∆ t2 ∆ t3 ∆ t N−1
......
t0 t1 t2 t3 t N−1 t N time
t begin t end
∆ t1 ∆ t2 ∆ t3 ∆ t N−1
......
t0 t1 t2 t3 t N−1 t N time
t begin t end
R
Vs C V
10 10 10
8 8 8
V (Volts)
V (Volts)
V (Volts)
6 6 6
4 4 4
2 2 2
(a) (b) (c)
0 0 0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25
Time (sec) Time (sec) Time (sec)
R
Vs C V
10 10 10
8 8 8
V (Volts)
V (Volts)
V (Volts)
6 6 6
4 4 4
2 2 2
(a) (b) (c)
0 0 0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25
Time (sec) Time (sec) Time (sec)
R
Vs C V
10 10 10
8 8 8
V (Volts)
V (Volts)
V (Volts)
6 6 6
4 4 4
2 2 2
(a) (b) (c)
0 0 0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25
Time (sec) Time (sec) Time (sec)
x
h
x n+1
xn
tn t n+1 t
dx
Method Approximation for = f (t, x)
dt
xn+1 − xn
Forward Euler = f (tn , xn )
h
x
h
x n+1
xn
tn t n+1 t
dx
Method Approximation for = f (t, x)
dt
xn+1 − xn
Forward Euler = f (tn , xn )
h
xn+1 − xn
Backward Euler = f (tn+1 , xn+1 )
h
x
h
x n+1
xn
tn t n+1 t
dx
Method Approximation for = f (t, x)
dt
xn+1 − xn
Forward Euler = f (tn , xn )
h
xn+1 − xn
Backward Euler = f (tn+1 , xn+1 )
h
xn+1 − xn 1
Trapezoidal = [f (tn , xn ) + f (tn+1 , xn+1 )]
h 2
xn+1 − xn
FE : = f (tn , xn ) = −xn
h
xn+1 − xn
BE : = f (tn+1 , xn+1 ) = −xn+1
h
xn+1 − xn 1 1
TRZ : = [f (tn , xn ) + f (tn+1 , xn+1 )] = − (xn + xn+1 )
h 2 2
FE : xn+1 = xn (1 − h)
1
BE : xn+1 = xn
1+h
1 − h/2
TRZ : xn+1 = xn
1 + h/2
d x̂
x̂n+1 = x̂n + h + · · · = x̂n + h(−e −tn ) + · · · = x̂n (1 − h + h2 /2 − h3 /6 + · · · ) .
dt
d x̂
x̂n+1 = x̂n + h + · · · = x̂n + h(−e −tn ) + · · · = x̂n (1 − h + h2 /2 − h3 /6 + · · · ) .
dt
Compare with
FE : xn+1 = xn (1 − h)
d x̂
x̂n+1 = x̂n + h + · · · = x̂n + h(−e −tn ) + · · · = x̂n (1 − h + h2 /2 − h3 /6 + · · · ) .
dt
Compare with
FE : xn+1 = xn (1 − h)
1
BE : xn+1 = xn = xn (1 − h + h2 + · · · )
1+h
d x̂
x̂n+1 = x̂n + h + · · · = x̂n + h(−e −tn ) + · · · = x̂n (1 − h + h2 /2 − h3 /6 + · · · ) .
dt
Compare with
FE : xn+1 = xn (1 − h)
1
BE : xn+1 = xn = xn (1 − h + h2 + · · · )
1+h
1 − h/2
TRZ : xn+1 = xn = xn (1 − h + h2 /2 − h3 /4 + · · · )
1 + h/2
d x̂
x̂n+1 = x̂n + h + · · · = x̂n + h(−e −tn ) + · · · = x̂n (1 − h + h2 /2 − h3 /6 + · · · ) .
dt
Compare with
FE : xn+1 = xn (1 − h)
1
BE : xn+1 = xn = xn (1 − h + h2 + · · · )
1+h
1 − h/2
TRZ : xn+1 = xn = xn (1 − h + h2 /2 − h3 /4 + · · · )
1 + h/2
d x̂
x̂n+1 = x̂n + h + · · · = x̂n + h(−e −tn ) + · · · = x̂n (1 − h + h2 /2 − h3 /6 + · · · ) .
dt
Compare with
FE : xn+1 = xn (1 − h)
1
BE : xn+1 = xn = xn (1 − h + h2 + · · · )
1+h
1 − h/2
TRZ : xn+1 = xn = xn (1 − h + h2 /2 − h3 /4 + · · · )
1 + h/2
x 10 0
FE
10−4 BE
ǫlocal
ǫlocal
TRZ
10−8
numerical
exact
10−12
tn tn+1 tn+2 t 10−4 10−3 10−2 10−1 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.
x 10 0
FE
10−4 BE
ǫlocal
ǫlocal
TRZ
10−8
numerical
exact
10−12
tn tn+1 tn+2 t 10−4 10−3 10−2 10−1 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.
x 10 0
FE
10−4 BE
ǫlocal
ǫlocal
TRZ
10−8
numerical
exact
10−12
tn tn+1 tn+2 t 10−4 10−3 10−2 10−1 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.
1.0
h=0.5
TRZ
0.8
BE
exact
0.6
x
0.4
0.2
0.0
0 1 2 3 4 5
t
1.0
h=0.5
TRZ
0.8
BE
exact
0.6
x
0.4
0.2
0.0
0 1 2 3 4 5
t
* The higher accuracy of the TRZ method allows larger time steps.
h=0.1
1.0
exact
0.8 FE
BE
0.6
0.4
0.2
0.0
0 1 2 3 4
h=0.1
1.0
exact
0.8 FE
BE
0.6
0.4
0.2
0.0
0 1 2 3 4
h=0.5
1.0
0.8
0.6
0.4
0.2
0.0
0 1 2 3 4
h=0.1 h=2.0
1.0 1
exact
0.8 FE
BE
0.6
0
0.4
0.2
0.0 −1
0 1 2 3 4 0 5 10 15 20
h=0.5
1.0
0.8
0.6
0.4
0.2
0.0
0 1 2 3 4
h=0.1 h=2.0
1.0 1
exact
0.8 FE
BE
0.6
0
0.4
0.2
0.0 −1
0 1 2 3 4 0 5 10 15 20
h=0.5 h=2.1
1.0 3
0.8 2
1
0.6
0
0.4
−1
0.2 −2
0.0 −3
0 1 2 3 4 0 5 10 15 20
vCn+1 − vCn 1
= iCn+1 .
h C
h n+1 C n+1 C n
i.e., vCn+1 = i + vCn OR iCn+1 = v − vC .
C C h C h
vCn+1 − vCn 1
= iCn+1 .
h C
h n+1 C n+1 C n
i.e., vCn+1 = i + vCn OR iCn+1 = v − vC .
C C h C h
vCn+1
vCn
in+1
C
+
h/C
iC
h/C
vC
in+1
C
vCn C/h
t = t + ∆t
∆t = k1 ∆t Yes
N−R ∆t = ∆t/k2
No No
Stop
5
4
V2, V4 (Volts)
V2
3
Automatic time step selection
2
based on convergence of N−R
V4
iterations 1
0
120
100
V1 R1 V2 V3 R0 80
h ( µ sec)
V4
60
Vs R2 C C0 40
20
0
0
2 3 4 5 6
time (msec)
V (Volts)
20
+ C R V
0
0 0 0.01 0.02 0.03
Time (sec)
20.48
V (Volts)
20.44
V (Volts)
20
+ C R V
0
0 0 0.01 0.02 0.03
Time (sec)
20.48
V (Volts)
20.44
0.4
C D
c 0.2
a
R1 b
Vc
0
Vs R2
−0.2
0
−0.4
0 0.01 0.02
time
* Start with an initial guess for the state variable(s) (the capacitor voltage
here).
0.4
C D
c 0.2
a
R1 b
Vc
0
Vs R2
−0.2
0
−0.4
0 0.01 0.02
time
* Start with an initial guess for the state variable(s) (the capacitor voltage
here).
* Integrate for one cycle. Is Vc (T ) = Vc (0)?
0.4
C D
c 0.2
a
R1 b
Vc
0
Vs R2
−0.2
0
−0.4
0 0.01 0.02
time
* 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].
* Note the dramatic reduction in computational effort for the SSW method
as compared to transient analysis.
[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 Designer’s 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.