+ All Categories
Home > Documents > Lecture 7. Element Stamping - SJTU

Lecture 7. Element Stamping - SJTU

Date post: 01-Oct-2021
Category:
Upload: others
View: 5 times
Download: 1 times
Share this document with a friend
58
2010-9-27 Slide 1 PRINCIPLES OF CIRCUIT SIMULATION PRINCIPLES OF CIRCUIT SIMULATION Lecture 7. Lecture 7. Element Stamping Element Stamping Guoyong Shi, PhD [email protected] School of Microelectronics Shanghai Jiao Tong University Spring 2010
Transcript
Page 1: Lecture 7. Element Stamping - SJTU

2010-9-27 Slide 1

PRINCIPLES OF CIRCUIT SIMULATIONPRINCIPLES OF CIRCUIT SIMULATION

Lecture 7. Lecture 7. Element StampingElement Stamping

Guoyong Shi, [email protected] of Microelectronics

Shanghai Jiao Tong UniversitySpring 2010

Page 2: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 2

Outline Outline • Basic Concepts

– KVL/KCL– Circuit Element Equations

• Sparse Tabular Analysis (STA)• Nodal Analysis• Modified Nodal Analysis (MNA)

• Part 1: Static Element Stamping

Page 3: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 3

Formulation of Circuit Equations Formulation of Circuit Equations • Kirchoff Current Law (KCL)

• Kirchoff Voltage Law (KVL)

• Circuit Element Equations

Page 4: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 4

Basic Concepts Basic Concepts

Node num Circuit Element

BranchReference/datum node

R1G2v3

R3

+ v3 - IS5R4

1

0

2

Page 5: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 5

Basic Physical Quantities Basic Physical Quantities

Node/Terminal Voltage e

Every circuit element (1 or 2 ports) is characterized by (i,v)

equations

Branch current iBranch voltage v

Reference node: e = 0

KVL for loops

KCL for nodes

R1G2v3

R3

+ v3 - IS5R4

1

0

2

Page 6: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 6

Circuit Element EquationsCircuit Element Equations• Mathematical models of circuit components are expressed in

terms of ideal elements:– Inductors– Capacitors– Resistors– Current Sources– Voltage Sources– Two Ports – ……….

• Physical quantities – current, voltage• Some times, we need to use quantities: charge (nonlinear

capacitor), flux (nonlinear inductor)

Page 7: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 7

Reference DirectionsReference Directions

• i and v are branch currents and voltages, respectively• (Default) For each branch, current is directed from higher

potential to lower potential

+

-

V

i

Two-terminal

+

-

+

-V1 V2

i1

i1

i2

i2

Two-port

Page 8: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 8

Resistor Resistor Resistors Symbol Voltage

controlledCurrent

controlled

Linear i = (1/R) v v = R i

Nonlinear i = i (v) v = v (i)

+ -V

i

i

V+ -

Page 9: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 9

CapacitorCapacitor

Capacitor Symbol Voltage controlled

Linear q = C vi = dq / dtTime-invariant C:

i = C dv/dt

Nonlinear q = q (v)i = dq / dtTime-invariant C:

i = C(v) dv/dt

i

V+ -

i

+ V -

Page 10: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 10

TwoTwo--Port ElementsPort Elements

Controlled Sources

Symbol linear Nonlinear

VCVS vk = Ek vc

ic = 0vk = vk(vc)ic = 0

CCCS ik = Fk icvc = 0

ik = ik (ic)vc = 0

-

+++Vc Ek -

-

Ic Ik

Vk

-

++

Vc Fk-

Ic Ik

Vk

Page 11: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 11

Topological Equations Topological Equations

KCL (branch currents)Current leaving a node is "+"

KVL(nodal voltages)Voltage dropping is "+"

v1 + e2 – e1 = 0

i1-i2-i3 = 0i1i3

i21

23

4

1

v121

+ -

GND

e2e1

Page 12: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 12

Matrix FormsMatrix Forms

Tellegen’s equation iTv = 0 (conservation of energy)

12

1 1 1 0 0 03

0 0 1 1 1 045

iiiii

=− −

⎡ ⎤⎢ ⎥

⎡ ⎤ ⎡ ⎤⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎣ ⎦ ⎣ ⎦⎢ ⎥

⎢ ⎥⎣ ⎦

1 1 0 02 1 0 0

13 1 1 0

24 0 1 05 0 1 0

vv

ev

evv

⎡ ⎤ ⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥

⎡ ⎤⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎣ ⎦

⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦ ⎣ ⎦

− =−

branch voltage vector

Nodal voltages

2

1

KCL: A i = 0KVL v – ATe = 0

R1G2v3

R3

+ v3 - IS5R4

1

0

2i1

i2i3

i4i5

e = 0

+

-v4

+

-v5

+

-v1

Ai

Page 13: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 13

Incidence Matrix A Incidence Matrix A

Properties• A is unimodular (all minors equal to 1, -1, or 0)• Only 2 nonzero entries in any column• Sum of all rows of A is a zero vector.

Thus, pick a node as the reference (ground) node

(+1,-1,0)

branch1 2 3….. j…

123.i:

+1; if node i is + terminal of branch jAij = -1; if node i is – terminal of branch j

0; if node i is not connected to the branch j

Anode

i1 i2+Each branch is directed

Page 14: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 14

Equation AssemblyEquation Assembly• How does a computer assemble equations

from the circuit description (netlist)?• Two systematic methods:

1. Sparse Tableau Analysis (STA)Used by early ASTAP simulator (IBM)2. Modified Nodal Analysis (MNA)Used by SPICE simulators

Page 15: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 15

Sparse Tableau Analysis (STA) Sparse Tableau Analysis (STA)

Proposed by (Brayton, Gustavson, Hachtel 1969-71 )– Write KCL : Ai = 0 n equations (one for each node)– Write KVL : v – ATe = 0 b equations (one for each branch)– Write Circuit Element (Branch) Equations :

Kii + Kvv = S b equations

current controlled

voltage controlled

sources

Page 16: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 16

Sparse Tableau Analysis Sparse Tableau Analysis

0 0 00 0

0

A iTl A v

K K e Svi

⎫⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎪⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎪⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎬⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎪⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎪⎢ ⎥⎣ ⎦ ⎭

− =

Put all (n + 2b) equations together:

sparse tableau

n + 2b unknownsn = #nodesb = #branches

Page 17: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 17

Advantages of STA Advantages of STA • STA can be applied to any (linearized) circuit• STA equations can be assembled directly from netlist• STA coefficient matrix is very sparse

2b 2b

b b

b (2b+2b+b+b+b) nonzeros

∴ sparsity is 72( 2 )

bn b+

Caution:Sophisticated programming techniques and data structures are required for achieving the time and memory efficiency

0 0 00 0

0

T

i v

A iI A v

K K e S

⎛ ⎞ ⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟ ⎜ ⎟− =⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎝ ⎠ ⎝ ⎠⎝ ⎠

Page 18: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 18

Modified Nodal Analysis (MNA)Modified Nodal Analysis (MNA)• A more compact formulation• In MNA, every element is in conductance form!

• We’ll review the steps how MNA is done.

• Introduced by McCalla, Nagel, Rohrer, Ruehli, Ho (1975)

Page 19: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 19

Nodal Analysis Nodal Analysis

Step 1: Write KCL: i1 + i2 + i3 = 0 (node 1)-i3 + i4 – i5 = 0 (node 2)

Step 2: Substitute branch equations to rewrite KCL in branch voltages:

1 11 2* 3 3 01 3v G v vR R+ + =

1 13 4 53 4v v ISR R− + =

R1G2v3

R3

+ v3 - IS5R4

1

0

2i1

i2i3

i4i5

e = 0

+

-v4

+

-v5

+

-v1

(1)

(2)

Page 20: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 20

Nodal AnalysisNodal AnalysisStep 3: Substitute branch voltages by nodal voltages (using KVL):

1 11 2( 1 2) ( 1 2) 01 3e G e e e e

R R+ − + − =

1 1- ( 1- 2) 2 53 4

e e e ISR R

+ =

Yn e = S

(1)

(2)

Put in matrixform

2 21 3 3 1

52

3 4 3

1 1 10

1 1 1 S

G GR R R e

IeR R R

⎡ ⎤+ + − −⎢ ⎥ ⎛ ⎞⎛ ⎞⎢ ⎥ = ⎜ ⎟⎜ ⎟⎢ ⎥ ⎝ ⎠ ⎝ ⎠− +⎢ ⎥⎣ ⎦

Page 21: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 21

Regularity in MNA MatrixRegularity in MNA Matrix

• Each element contributes (in conductance form) only to the entries with row-column positions corresponding to the node numbers.

• Such a regular format is called a “stamp”

R1G2v3

R3

+ v3 - IS5R4

1

0

2i1

i2i3

i4i5

e = 0

+

-v4

+

-v5

+

-v1

2 21 3 3

3 4 3

1 1 1

1 1 1

G GR R R

R R R

⎡ ⎤+ + − −⎢ ⎥⎢ ⎥⎢ ⎥− +⎢ ⎥⎣ ⎦

1

2

1 2

Coefficient matrix

Stamping

Page 22: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 22

Resistor StampResistor StampSPICE Netlist Format (R)

Rk N+ N- value_of_Rk

N-

N+

Rk

1 1

1 1

k k

k k

R R

R R

N+

N+

N-

N-

Page 23: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 23

VCCS StampVCCS StampSPICE Netlist Format (VCCS)

Gk N+ N- NC+ NC- value_of_Gk

+Vc-

N+

N-

Vc+

Vc-

k k

k k

G G

G G

Nc+

N+

N-

Nc-

Similar to a resistor; but note that the row/col indices are different.

Page 24: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 24

Current Source StampCurrent Source StampSPICE Netlist Format (Current Source)

ISK N+ N- value_of_Ik

N+

I k

N-

+

-

N+

N-

⎛ ⎞⎜ ⎟−⎜ ⎟⎜ ⎟⎜ ⎟+⎜ ⎟⎜ ⎟⎝ ⎠

k

k

I

I

Right-Hand Side (RHS)

Note the signs in this case!

Page 25: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 25

Relation between STA and NARelation between STA and NA

00 0

0 0 0

i vT

K K i SI A v

A e

−⎛ ⎞⎛ ⎞ ⎛ ⎞⎜ ⎟⎜ ⎟ ⎜ ⎟− =⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠⎝ ⎠ ⎝ ⎠

1 100 0

0 0 0

i v iT

I K K i K SI A v

A e

− −⎛ ⎞ ⎛ ⎞− ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟− =⎜ ⎟ ⎜ ⎟⎜ ⎟

⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠⎝ ⎠ ⎝ ⎠

1iK −

A−

1 1

1 1

00 00 0

i v iT

i v i

I K K i K SI A v

AK K e AK S

− −

− −

⎛ ⎞ ⎛ ⎞− ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟− =⎜ ⎟ ⎜ ⎟⎜ ⎟

⎜ ⎟⎜ ⎟ ⎜ ⎟−⎝ ⎠⎝ ⎠ ⎝ ⎠

Page 26: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 26

Relation between STA and NARelation between STA and NA

IseYn =IsMNAMNA

Tableau Matrix

After solving e, we get v, then get i.

1 1

1 1

00 00 0

i v iT

i v i

I K K i K SI A v

AK K e AK S

− −

− −

⎛ ⎞ ⎛ ⎞− ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟− =⎜ ⎟ ⎜ ⎟⎜ ⎟

⎜ ⎟⎜ ⎟ ⎜ ⎟−⎝ ⎠⎝ ⎠ ⎝ ⎠

1i vAK K−−

1 1

1 1

00 00 0

i v iT

Ti v i

I K K i K SI A v

AK K A e AK S

− −

− −

⎛ ⎞ ⎛ ⎞− ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟− =⎜ ⎟ ⎜ ⎟⎜ ⎟

⎜ ⎟⎜ ⎟ ⎜ ⎟−⎝ ⎠⎝ ⎠ ⎝ ⎠

Yn

Page 27: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 27

Nodal Analysis Nodal Analysis ---- Advantages & ProblemAdvantages & Problem

• Advantages:– Circuit equations can be assembled by stamping– Yn is sparse (but not as sparse as STA) and small (nxn),

smaller than STA (n + 2b*n + 2b )– Yn has non-zero diagonal entries and is often diagonally

dominant• Problem:

Nodal Analysis cannot handle the following– Floating independent voltage source (not connected to

ground)– VCVS (E-ELEMENT)– CCCS (F-ELEMENT)– (VCCS ok!) (G-ELEMENT)– CCVS (H-ELEMENT)

Page 28: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 28

ModifiedModified Nodal Analysis (Nodal Analysis (MMNA) NA)

R1 G2v3 R4

R3

+ v3 -

IS5 R8

ES6- +

- +

E7v3

1 2 3

40

+

Page 29: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 29

Modified Nodal Analysis (MNA) Modified Nodal Analysis (MNA)

Step 1: Write KCL

i1 + i2 + i3 = 0 (1)-i3 + i4 – i5 – i6 = 0 (2)i6 + i8 = 0 (3)i7 – i8 = 0 (4)

R1 G2v3 R4

R3

+ v3 -

IS5 R8

ES6- +

E7v3

1 2 3

40

+

i1 i2 i3 i4 i5

i6i8

+i7

Page 30: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 30

Modified Nodal Analysis (MNA) Modified Nodal Analysis (MNA) Step 2: Substitute branch currents by branch voltages

1 11 2 3 3 01 3v G v v

R R+ + =

1 13 4 6 53 4v v i ISR R− + − =

16 8 08i vR+ =

17 8 08i vR− =

(1)

(2)

(3)

(4)

Page 31: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 31

Modified Nodal Analysis (MNA) Modified Nodal Analysis (MNA)

Step 3: Write down unused branch equations

6 6v ES=

7 7 3 0v E v− =

(4)(5)

R1 G2v3 R4

R3

+ v3 -

IS5 R8

ES6- +

E7v3

1 2 3

40

+

i1 i2 i3 i4 i5

i6i8

+i7

Page 32: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 32

Modified Nodal Analysis (MNA)Modified Nodal Analysis (MNA)Step 4: Substitute branch voltages by nodal voltages

1 11 2( 1 2) ( 1 2) 01 3e G e e e e

R R+ − + − =

1 1( 1 2) 2 6 53 4

e e e i ISR R

− − + − =

16 ( 3 4) 08

i e eR

+ − =

17 ( 3 4) 08

i e eR

− − =

( 3 2) 6e e ES− =

4 7( 1 2) 0e E e e− − =

(1)

(2)

(3)

(4)

(5)

(6)

Page 33: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 33

Modified Nodal Analysis (MNA)Modified Nodal Analysis (MNA)1 1 1

2 2 0 0 0 01 3 3

1 1 1 1 00 0 1 0

2 53 3 41 1 3 0

0 0 1 0 4 08 86 61 1

0 0 0 1 7 08 80 1 1 0 0 07 7 0 1 0 0

G GR R R

ee ISR R ReeR Ri ESiR R

E E

+ + − −

− + −

=−

−− −

⎡ ⎤⎢ ⎥⎢ ⎥⎡ ⎤ ⎡ ⎤⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦⎢ ⎥⎢ ⎥⎣ ⎦

node voltages

some branch currents0nY B e

RHSC i⎛ ⎞ ⎛ ⎞

=⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

node-1 node-2

branch-6

branch-7

branch-6

branch-7

branch branch

node-3

node-2

node-3 node-4

node-1

node-4

32I6

ES6

Page 34: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 34

Voltage Source StampVoltage Source Stamp

SPICE Netlist Format (Floating voltage source)VK N+ N- value_of_Vk

N+i k

N-

+- V k

0

-1

1

-1

0

0

1

0

0 00Vk

N+ N- ikN+N-

branch k

RHS

current introduced!

Page 35: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 35

CCCS StampCCCS StampSPICE Netlist Format (CCCS)

FK N+ N- Vname value_of_FKVname NC+ NC- value

Vcci

NC+

NC-

N+

N-

ckF i

kiRHS

00

00

Vc

N+ N- NC + NC-N+ FkN- -Fk

NC+ 1NC-

br Vc 1 -1-1

ic

* If ‘Vname’ is used as a CC for multiple times, it is stamped only once though!

Page 36: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 36

CCVS StampCCVS StampSPICE Netlist Format (CCVS)

HK N+ N- Vname value_of_HKVname NC+ NC- value

N+i k

+-

Hkij

N-

Vcci

NC+

NC-

N+ N- NC+ NC-N+ 1N- -1

NC+ 1NC- -1br-k 1 -1 -HKbr-c 1 -1

icik RHS00

00

Vc

* If ‘Vname’ is used as a CC for multiple times, it is stamped only once though!

Page 37: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 37

VCVS StampVCVS StampSPICE Netlist Format (VCVS)

EK N+ N- NC+ NC- value_of_EK

N+i k

N-

+-

EkVj

NC+

V j

NC-

N+ N- NC+ NC- ikN+ 1N- -1

NC+NC-br k 1 -1 -Ek Ek

Page 38: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 38

General Rules for MNA General Rules for MNA • A branch current is introduced as an

additional variable for a voltage source or an inductor

• For current sources, resistors, conductance and capacitors, the branch current is introduced only if– Any circuit element depends on that branch

current; or– The branch current is requested as an output.

Page 39: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 39

Modified Nodal Analysis (MNA) Modified Nodal Analysis (MNA) Advantages of MNA• MNA can be applied to any circuit• MNA equations can be assembled “directly”

from a circuit description (e.g. netlist)

Problem• Sometimes zeros appear on the main diagonal;

causing some principle minors to be singular (numerical instability.)

Page 40: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 40

SummarySummary• KVL/KCL + Circuit Element Equations • Equations formulation: STA and MNA• MNA was implemented in most simulators

(SPICE)• Element stamps

• A key observation: – Circuit matrix structure will not change! (exploited

by SPICE for speedup – symbolic factorization)

Page 41: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 41

Assignment 3Assignment 3• Implement a netlist parser that reads a simple netlist

with the following elements– R– Vsource, Isource– VCVS, CCCS, VCCS, CCVS

Print the stamps and the RHS with row and column indices.

Page 42: Lecture 7. Element Stamping - SJTU

2010-9-27 Slide 42

PRINCIPLES OF CIRCUIT SIMULATIONPRINCIPLES OF CIRCUIT SIMULATION

Part 2. Part 2. Dynamic Element StampingDynamic Element Stamping

Page 43: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 43

OutlineOutline• Discretization Formulas for d/dt• Element Stamps for Linear Capacitors and

Inductors

Page 44: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 44

Circuit with dynamic elementCircuit with dynamic element

0)0(,VVdt

dVRC scc ==+ cV +

-Vs

RC

+

-Vc

RCett

=⎟⎟⎠

⎞⎜⎜⎝

⎛−=

−ττ ,1V)(V sc Vs

)(tVc

t• How to solve it numerically?

Analytical solution

Page 45: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 45

Numerical Solution Numerical Solution

0)0(,VVdtdV

s ==+ V

• Replace the derivative by difference

( ) ( ) s

V t h V(t)V t V

h+ −

+ =

Assuming τ = RC = 1

h = time step (small)

Becomes iteration

There are many ways to do discretization.There are many ways to do There are many ways to do discretizationdiscretization..

( ) ( ) [ ( )]sV t h V t h V V t+ = + −

Page 46: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 46

Forward Euler (FE)Forward Euler (FE)

−− −

−≈ =

i1

1 1

( ) ( )( ) ( ( ))n n

n ny t y t y t f y t

h

Direct iteration; (no linear / nonlinear solve involved)

f(y(t))dt

dy(t)(t)y ==.

current time

tangent at tn-1

( )− −= + i1 1( ) ( ) ( )n n ny t y t h f y t

1−nt nt

h

)(ty

Page 47: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 47

Backward Euler (BE)Backward Euler (BE)

−−≈ =

i1( ) ( )

( ) ( ( ))n nn n

y t y t y t f y th

f(y(t))dt

dy(t)(t)y ==.

( )1( ) ( ) ( )n n ny t y t h f y t−= + i

y(tn) appears on both sides of the equation; need to solve y(tn) by iterations if f(·) is nonlinear.

current time

tangent at tn

1−nt nt

h

)(ty

Page 48: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 48

FE and BEFE and BE

• Although B.E. requires more computation, it is preferred in practice because it is more numerically stable.

• Will discuss on this later.

( )− −= + i1 1( ) ( ) ( )n n ny t y t h f y t

( )1( ) ( ) ( )n n ny t y t h f y t−= + i

Forward Euler:

Backward Euler:

Page 49: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 49

Trapezoidal Rule (TR)Trapezoidal Rule (TR)= =

i ( )( ) ( ( ))

dy ty t f y tdt

. .1

1( ) ( ) 1 ( ) ( )

2n n

n ny t y t y t y t

h−

−⎡ ⎤−

≈ +⎢ ⎥⎣ ⎦

[ ]11

( ) ( ) 1 ( ( )) ( ( ))2

n nn n

y t y t f y t f y th

−−

−≈ +

[ ]1 1( ) ( ) ( ( )) ( ( ))2n n n nhy t y t f y t f y t− −= + +

Again, requires solving y(tn) from a set of nonlinear equations

1−nt nt

h

)(ty

slope of secant averaged tangent

tangents at both tn-1 and tn

Page 50: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 50

FE, BE and TRFE, BE and TR

• Trapezoidal rule has even better numerical property than B.E.

( )− −= + i1 1( ) ( ) ( )n n ny t y t h f y t

( )1( ) ( ) ( )n n ny t y t h f y t−= + i

Forward Euler:

Backward Euler:

[ ]1 1( ) ( ) ( ( )) ( ( ))2n n n nhy t y t f y t f y t− −= + +Trapezoidal Rule:

f(y(t))dt

dy(t)(t)y ==.

Page 51: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 51

Interpretation of Trapezoidal RuleInterpretation of Trapezoidal RuleTrapezoidal rule comes from numerical integration –computing the area under a curve

τ τ−

− −

−−

=

= +

≈ + +⎡ ⎤⎣ ⎦

− ⎡ ⎤≈ +⎢ ⎥⎣ ⎦

i

i i

1

1

1 1

11

( ) ( )

( ) ( ) ( )

( ) ( ) ( ) ( )2

( ) ( ) 1( ) ( )

2

n

n

t

n nt

n n n n

n nn n

x t g t

x t x t g d

hx t x t g t g t

x t x t x t x th

1−nt nt

)(tg

h

Trapezoidal Rule

area under the curve

approximated by a trapezoidal

Page 52: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 52

Stamps of Dynamic ElementsStamps of Dynamic Elements• Stamps for dynamic elements can be derived

from a discretization method: – Capacitor (C)– Inductor (L)– Others ...

Page 53: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 53

Capacitor StampCapacitor Stamp

NA StampNA Stamp MNA StampMNA Stamp

)(

)(

htvhC

hC

hC

htvhC

hC

hC

−−−

−−+N

+N −N

−N

RHS

C

−+ )(tv

i+N −N

)(1

0101

htvhC

hC

hC

−−−

−+N

−N

+N −N i RHS

( )( ) dv ti t Cdt

=

[ ]= − − = − −( ) ( ) ( ) ( ) ( )C C Ci t v t v t h v t v t hh h h

discretized by B.E.

treated as source

− = −( ) ( ) ( )C Cv t i t v t hh h

branch C

Page 54: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 54

Inductor StampInductor Stamp

( ) ( )( ) di i t i t hv t L Ldt h

− −= ≈

MNA StampMNA Stamp

)(11

0101

htihL

hL

−−−−

−+N

−N

+N −N i RHS

L

−+ )(tv

i+N

−N

( ) ( ) ( )L Lv t i t i t hh h

− = − −

discretized by B.E.

(must introduce current)

branch L

Page 55: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 55

Stamps for C & LStamps for C & LNA Stamp for CNA Stamp for C

)(

)(

htvhC

hC

hC

htvhC

hC

hC

−−−

−−+N

+N −N

−N

RHSMNA Stamp for CMNA Stamp for C

)(1

0101

htvhC

hC

hC

−−−

−+N

−N

+N −N i RHS

)(11

0101

htihL

hL

−−−−

−+N

−N

+N −N i RHS

MNA Stamp for LMNA Stamp for L

Note that: Stamps for C or L depend on the discretizationmethod used!

Page 56: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 56

A Circuit ExampleA Circuit Example

Vin

R

CiC

0

21

iV L iL

[ ]

[ ] [ ]2 0 2 0

1

1 1

c C CCi t v t v th

C Cv t v t v t v th h

( ) ( ) ( )

( ) ( ) ( ) ( )

= − −

= − − = − − −

( )( ) LL

di tv t Ldt

=

[ ]L LLv t v t i t i th1 2( ) ( ) ( ) ( 1)− = − −

branch L

branch Vin

0 1 2 3 4 RHS

0

1

2

3

4

Ch

0

1-1

Ch

Ch

0

0

0

0

-1

-1

-1

1

1

( )C

C v t hh

− −

( )C

C v t hh

inV

( )L

L i t hh

− −Lh

iL iV

1 CR h

⎛ ⎞+⎜ ⎟⎝ ⎠

11R

1R

1R

Page 57: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 57

Assignment 4Assignment 4• Derive the stamps for C and L using the

Trapezoidal Rule (both in MNA).

Page 58: Lecture 7. Element Stamping - SJTU

2010-9-27 Lecture 7 slide 58

Classical PapersClassical Papers1. G.D. Hachtel, R.K. Brayton and F.G. Gustavson, “The sparse

tableau approach to network analysis and design,” IEEE Trans. Circuit Theory, vol.CT-18, Jan. 1971, pp. 101-119.

2. C.W. Ho, A.E. Ruehli and P.A. Brennan, “The modified nodal approach to network analysis”, IEEE Trans. Circuits and Systems, CAS-22, June 1975, pp. 504-509


Recommended