lec20

advertisement
Steady-State Methods
UCB EE219A Oct 31 2002
Joel Phillips, Cadence Berkeley Labs
Thanks to: K. Kundert
1
Steady-State Methods: Goals
• Understand alternative way of analyzing
differential equations
- Faster
- Application-Specific
• “Tie together” several numerical themes
- Circuit theory
- Solution of ODEs/DAEs
- Newton methods
- Iterative solvers & preconditioning
2
Today
• Review material from last time
• In-depth look at time-domain methods for
periodic steady-state problem
- Matrix-implicit implementation
- Analysis
• Quick survey of more advanced techniques
- Small-signal, RF noise analysis
- Oscillators
- Multi-frequency steady-state, envelope
3
Review: AC Small-Signal
dx
 f ( x)  udc  uac e jt
dt
• Find DC operating point
• Linearize around operating point
• Solve the AC analysis equation

f 
 jI 
 x( )  uac
x xdc 

4
x  xdc  xac
Simple Nonlinear Steady-State Problems
• Compute harmonic distortion* in the amplifier
• Compute conversion gain in the mixer
• Compute noise with large-signal bias
1 2
2 2  1
5
IVP Approach
• Apply source
• Solve IVP (Trap, Euler, etc.)
• Wait till steady state is reached
• Fourier-transform the output
6
Problems with IVP
•
Speed -- Especially with multiple periodic inputs
Sim Time ~ Fmax / Fmin
•
Accuracy
- Steady-state not reached, a-periodicity errors, aliasing errors,
interpolation errors
7
Periodic Steady-State Computation
• Apply a sinusoid or other periodic input signal
• Directly solve for the periodic response
- Time-domain solution over one “fundamental” period
- Or spectrum: Fourier coefficients at fundamental +
harmonics
• Need to solve a boundary value problem (BVP)
dx
 f ( x, u , t )
dt
8
x(0)  x(T )
Note on PBCs
• If solution to DAE is unique, then solution on one
period determines solution for all time
- Both the shooting method and spectral interval
methods (harmonic balance) use this fact
• From knowledge of solution at one timepoint,
can easily construction solution over entire
period by solving IVP
- We will exploit this in the shooting method
9
Enforcing PBCs
• Approach 1: Build BCs in basis function
- Example: Fourier series satisfy periodic boundary
conditions


k 1
k 0
x(t )   ak sin k 0t   bk cos k0t
• Approach 2: Write extra equations
- PBC x(0)  x(T )
10
PSS Algorithm #1: Harmonic Balance
• Periodic solution can be expressed in terms of
Fourier series with fundamental frequency  0
• Pick
N
x(t )   ck eik0t
k  N
ck  c k
• Spectral derivatives
N
dx
  ik 0ck eik0t
dt k  N
11
(real solutions please!)
Harmonic Balance: Equation Formation
•
•
dx
F ( x )   f ( x, t )
Enforce F ( x)  u
dt
Pseudo-spectral approach: force F ( x)  u at
selected timepoints
- Uniformly spaced to compute derivatives via FFT
12
Equation Structure
• BVP becomes
•
 f ( x1 , t1 ) 

2 2 
f (x ,t ) 
dx
-1

F ( x)   f ( x, t ) F (i ) F 

dt

M M 
 f ( x , t )
k k
Jacobian with g k  f ( x , t ) / x

- K
 g1


 
g

2

 F-
J  i 0 F-1 




 


 
g
K

 
M
13
Equation Solution
•
We need to solve Jx  b

- K
 g1


 
g

2

 F-
J  i 0 F-1 




 


 
g
K

 
M
14
•
These matrices are dense in either Fourier- or real- space
 LU factorization is bad news
•
•
•
•
They are potentially very large
Yet a matrix-vector product can be done fast
Ideal candidate for iterative solution methods (GMRES!)
Good preconditioners are necessary, but hard to construct
Algorithm #2: “Finite Difference”
• Given the same derivative discretization for IVP
(Gear, trapezoidal, etc.)
• Step 1: Write all the discretized circuit equations
for the whole period
x x
1 1
1
 f ( x , t ) u
h
1
x x
2 2
2
 f ( x , t ) u
h
n 1
n
x x
n 1 n 1
n 1
 f ( x , t ) u
h
2
15
0
1
Algorithm #2: “Finite Difference”
• Step 2: Write the PBC equation
x x
1 1
1
 f ( x , t ) u
h1
1
0
tM  t0  T
x 2  x1
2 2
2
 f ( x , t ) u
h2
x
16
M
x
hM
M 1
x(t M )  x(t 0  T )  x(t 0 )
 f ( x , t ) u
M
M
M
Algorithm #2: “Finite Difference”
• Step 2: Write the PBC equation
t
M
 t T
x x
h1
1
17
x(t )  x(t  T )  x(t )
M
0
M
0
 f (x ,u ,t )
1
1 1
0
Algorithm #2: “Finite Difference”
• Step 3: Solve them
- With N circuit equations, M timepoints, system has
O(MN) unknowns
- Big system!
• Recall: Newton method for IVP at timestep n,
iteration k
 x n1,k  x n f n1,k n1  n1,k 1
n 1,k

(
x
,
t
)
x


r
 h

x
n1


18
Newton for PSS-FD
• Step 2: Write the equations w/ PBC
x1  x M
 f ( x1 , t1 )  u1
h1
 x1  x M f ( x1, t1 ) 
1


x


r
( x)
 h

x 
1

x 2  x1
 f ( x 2 , t 2 ) u 2
h2
 x 2  x1 f ( x 2 , t 2 ) 
2


x


r
( x)
 h

x
 1


x M  x M 1
 f ( x M , t M ) u M
hM
19
PBC

 x M  x M 1 f ( x M , t M ) 
M


x


r
( x)


h1
x


Algorithm #2: “Finite Difference”
• Jacobian structure
f n1,k n1 n1 

Gn   ( x
,u ,t )
 x

 I / h1  G1
  I /h
2

J



20
PBC
x(t M 1 )  x(t 0 )
 I / h1
I / h2  G2
 I / h3

 I / hM




I / hM  GM 
Similar Concept, Distinctive Computations
• AC

f 
 jI 
 x( )  uac
x xdc 

Gk  f ( x k , t k ) / x
• PSS-HB

- K
 G1


 
G

2

 F-
J  i 0 F-1 




 

G M 
K  

• PSS-FD
 I/h1
- I/h
2
J 



21
I/h 2

- I/h M
- I/h1  G1

 

G2
-


 

I/h M  
G M 
Algorithm #2: “Finite Difference”
• Linear system solution
- With N circuit equations, M timepoints, system has
O(MN) unknowns
- Big system!
• Will use iterative methods
- GMRES in particular
• Efficient?
- How many iterations?
- Cost of each iteration? (matrix-vector product?)
22
GMRES Convergence Analysis
•
Phillips’ rule of preconditioner analysis:
- Real life is always worse than an example you can solve
analytically
•
Simplified PSS-FD matrices
- Consider linear case
- Consider one variable
- Constant timestep
1 / h  g
  1/ h 1/ h  g
J 
 I /h



23
 I /h 





 I / h I / h  g
Eigenvalues of PSS-FD Matrix
•
Eigenvalues tend to unit circle as h0
- Very bad for GMRES!!!!
- Need a preconditioner!
g
h
24
PSS-FD Solution Procedure
• Viewpoint 1: Preconditioning
PJx  Pb,
P  L-1
- Hard to invert/factor entire matrix
- Can invert lower-triangular piece fairly easily
I/h1  G1
 - I/h
I/h 2  G 2
2

L



25

- I/h M
- I/h1 
0
0 0


U 





0
0






I/h M  G M 
J  LU
GMRES with FD System
•
Need to solve system with PJ  I  L-1U
0
 D1
L
D2
2,1
L



•
•
26
0

L M,M-1
0 


0 
D M 
- I/h1 
0 0
0 0 
0 

U 




0
0 

We will use iterative method (GMRES).
- Can combined preconditioner and matrix product!
- Must exploit structure for efficiency!
Must compute
- Products with U
- Solves with L
Exploiting Structure in Px  (I  L-1U)x
• Step 1: Compute
U1 
0 0
0 0  0 

U 





0
0


• Step 2: Compute
0
 D1
L
2,1 D 2

L



27
0

L M,M-1
y  Ux
 x1 
x 
x 2
  
x 
 M
 U1x M 
 0 

y
  
 0 


z  L-1y
0 


0 
D M 
for each k  1, M :
solve D k zk  L k,k -1y k -1
PSS-FD Solution Procedure
• Viewpoint 2: Compressed System
- If we knew the last point/first point, we can easily
obtain all the rest of the points by a forwardsubstitution
Jx  b
 I / h1  G1
  I /h
2

J



28
 I / h1
I / h2  G2
 I / h3

 I / hM




I / hM  GM 
Compressed FD System Structure
• Need to solve system with
0
 D1
L
2,1 D 2

L



0

L M,M-1
X1 
0 0
0 0  X 
2
L1U  
  


0 X M 

29
0 


0 
D M 
PJ  I  L-1U
- I/h1 
0 0
0 0 
0 

U 





0
0


X1 
I 0
0 I 

X
2 
I  L1U  

 


0 I  X M 

Compressed FD System Structure
• Need to solve system with
PJ  I  L-1U
X1 
I 0
0 I 

X
2

PJ  I  L1U  

 



0
I

X

M
0
- X1   I 0

I 0

0 I  - X  0 I 
0
2


( PJ ) 1  

0

 




1 
0
(I

X
)
0
I



M
30
Apply GMRES to
I  X M!!
Compressed GMRES Products (I  X M ) xr
• Step 1: Compute
U1 
0 0
0 0  0 

U 





0
0


• Step 2: Compute
y  Ux
0
0
x 

x 
 r
 U1x r 
 0 

y
  
 0 


z  L-1y
for each k  1, M :
0
 D1
L
2,1 D 2

L



31
0

L M,M-1
0 


0 
D M 
solve D k zk  L k,k -1y k -1
Extract product as z M
Final PSS-FD Procedure
• Form equations
• For each Newton iteration
- Compute residual
- Compute Jacobian matrices
- Solve PSS-FD Jacobian equation
• Preconditioned by L: Using GMRES, solve compressed
matrix equation
• Find update on whole interval by forward substitution
(application of
L-1 )
- Update solution waveform on interval
32
Compressed System Analysis
• GMRES convergence?
- With N equations, M timesteps, have reduced system
size from MN to N. Nice!
- What is eigenvalue distribution? Must consider N  1
for a meaningful analysis.
• What about the nonlinear part of the solution?
Can we apply a similar trick?
33
Recall: Note on PBCs
• If solution to DAE is unique, then solution on one
period determines solution for all time
• From knowledge of solution at one timepoint,
can easily construction solution over entire
period by solving IVP
- We will exploit this in the shooting method
34
Shooting Procedure
x(T)
x(0)
x(0)
0
• Guess x(0)
• Integrate to get x(T)
• Update x(0) to correct residual
- How? Newton!
35
T
Transition Function
•
•
Define transition function s.t x(T)   (x(0))
Physical interpretation: integrate forward in time with x(0)
as initial condition
 (x 2 )
 (x1 )
x2
x1
0
•
36
T
Periodicity condition is x(0)   (x(0))
Transition Function Example
• Consider linear system
dx
 Ax
dt
• Recall from theory of (homogeneous) linear
ODEs
x(t )  e x(0)
At
  ( x)  e AT x
37
Shooting Method Updates
• Periodicity condition is x(0)   (x(0))
• Want to solve this equation via Newton
r  x (0)   ( x (0))
k
•
k
k


 I    x k (0)  r k

x 
 ( x) x(T )

Need: Sensitivity matrix ( x) 
x
x(0)
• How to compute? Depends on method used for
shooting….
38
Sensitivity Computation
• Given equation for final timepoint, take partial
derivatives
x M  x M 1
 f ( x M , t M ) u M
hM
1
hM
 x M x M 1  f ( x M , t M )
 x(0)  x(0)   x(0)


• Use chain rule
f ( x M , t M ) f ( x M , t M ) x M

x(0)
x(0)
x M
1
hM
39
 f ( x M , t M )  x M
1 x M 1
 I  x(0)  x(0)  h x(0)
M


Sensitivity Computation
• Apply this formula recursively
1
hM
 f ( x k 1, t k )  x k 1
1 x k
 I  x(0)  x(0)  h x(0)
M


• Starting condition is
x 0
x(0)

I
x(0) x(0)
40
Sensitivity Matrix-Vector Product
• GMRES needs matrix-vector product
q  v
for some v
• Compute, starting at
- Convenient:
• At step k, solve
1
hM
 f ( x k 1, t k )  x k 1
1 x k
 I  x(0)  x(0) v  h x(0) v
M


1
hM
41
step
1, proceed to step M
k
x
k
q 
v
q1  v
x(0)
 f ( x k 1, t k )  k 1 1 k
 I  x(0)  q  h q
M


Remarkable Fact: Connection Shooting/FD
for each k  1, M :
0
 D1
L
D2
2,1
L



1
hM
•
42
0

L M,M-1
0 


0 
D M 
solve D k zk  L k,k -1y k -1
Extract product as z M
 f ( x k 1, t k )  k 1 1 k
 I  x(0)  q  h q
M


We have the *same equations* to compute the sensitivity
update. Yet not the same method.
Final PSS-Shooting Procedure
• Form equations
• For each Newton iteration
- Compute residual in periodicity condition
• By integrating IVP forward to find x(T)
- Solve shooting update equation
• Using GMRES, solve sensitivity matrix equation
- Update first time point x(0)
43
Shooting vs. PSS-FD Procedures
• Same linear system is solved
- Same GMRES convergence properties
• Different nonlinear updates
- Different Newton convergence properties
Shooting
•Updates end point only
•Satisfies ODE at every
iteration
•Tries to converge
boundary condition
44
PSS-FD
•Updates entire interval
•Satisfies BC at every
iteration
•Tries to converge ODE
solution
GMRES Convergence Analysis
• Consider linear model problem
• Transition function / matrix:
 ( x)  e AT x  lim h0   e AT
• Eigenvalues of exponential matrix are
exponentials of eigenvalues
• Stability analysis: circuits tend to be designed to
be stable  eigenvalues have negative real
parts  all eigevalues of  are inside unit
circle
45
GMRES convergence
• “Stiff” modes go away immediately
• “Neutrally stable” modes slow convergence
problems
•
dx
With DAEs: C  Ex  u
dt
- Algebraic equations, conservations (e.g. KCL)
- Only dynamic modes show up in matrix
- Resistors do not hold “state”, only capacitors,
inductors, other energy storage elements
46
Irony
•
•
I
Consider transient matrix:  A
h
- Ill-conditioned if stiff  bad for iterative methods
PSS-FD I  
- Stiff modes: eigenvalues with large negative real part
- Map to unity in this procedure
• What made transient hard (esp. iterative
methods) makes PSS problem easy!!
47
Multi-Interval Chebyshev Discretization
Multi-Interval Decomposition
• Low-order where needed, high-order where possible
I
•
48
II
III
IV
V
Refinement strategy: Subintervals
- order increase, in smooth region, III,
- interval decomposition, in sharp-transition region, II.
Relative error of output
Example Convergence Result
100
Uniform high-order
10-1
10-3
uniform 2nd-order
MIC
10-5
10-6
100
500
1000
Total # of time steps or collocation points
High order is more efficient and
MIC (2-16) is more efficient than uniform high order!
49
Linear Periodically Varying Circuits
• Model Frequency-Translating Devices
vin  a sin t
•
vout  vlovin
ab
 cos(1   2 )t  cos(1   2 )t 
2
vlo  b sin  2t
Assume devices is near-linear with respect to data inputs
May be very nonlinear with respect to other inputs
Input
50
Output
Clock
Small-Signal Analysis
• Assume second signal is “small” sinusoid
• Linearize around time-varying operating point
• Solve for transfer functions Input
Output
LO
LO
Input
Output
51
Calculations
q(v( t ))  i (v( t ))  u( t )  0
v
• Let v = vL + vs and u = uL + us
• Let us = 0, find vL, linearize about vL, then apply
us
q(v L (t )  v s (t ))  i (v L (t )  v s (t ))  uL (t )  us (t )  0
• Taylor series expansion about vL
• Let
52
 i (v L ( t ))
d  q(v L ( t ))

v s ( t )  
v s ( t )  us ( t )  0
dt  dv ( t )
 dv ( t )
q(v L ( t ))
i (v L ( t ))
CL 
GL 
dv ( t )
dv ( t )
d
C L (t )v s (t ))  GL (t )v s (t )  us (t )  0
dt
u
Cyclostationary Noise
• Cyclostationary noise is periodically modulated
noise
- Results when circuits have periodic operating points
• Noise is cyclostationary if its autocorrelation is
periodic in t
- Implies variance is periodic in t
- Implies noise is correlated in frequency
• Cyclostationarity generalizes to non-periodic
variations
- In particular, multiple periodicities
53
Origins of Cyclostationary Noise
Modulated
noise source
Modulated
signal path
• Modulated (time-varying) noise sources
- Periodic bias current generating shot noise
- Periodic variation in resistance of channel generating thermal
noise
• Modulated (time-varying) signal path
54
- Modulation of gain by nonlinear devices and periodic operating
point
Cyclostationary Noise vs. Time
Noiseless
vo
Noisy
n
t
Noisy Resistor
& Clocked Switch
• Noise transmitted only when switch is closed
• Noise is shaped in time
55
Modulated Noise Spectrum
Periodic
Modulation
Convolve
f
f
Stationary Noise
Source
Replicate &
Translate
f
Noise Folding
Terms
Sum
Cyclostationary
Noise
-3 -2 -1 0 1 2 3
-3 -2 -1 0 1 2 3
f
56
Time shaping  Frequency correlation
Adjoint Analysis: Circuit Interpretation
For one output configuration, compute TF from all possible inputs
Output 1
Input 1
Output 2
Input 2
Input 3
57
Linearized
Circuit
Output 3
Output 4
Exotic Simulation Creatures
• Oscillator Analyses
• Quasi-periodic analyses
- Steady-State (intermodulation distortion)
- AC, XF (transfer function)
- Noise (in mixer with blocker)
• Envelope methods
58
Two-Frequency Analysis
• Main issue: frequency resolution
Sim Time ~ Fmax / Fmin
• Multi-Freq Harmonic Balance
• Shooting methods (MFT)
59
Mixed Frequency-Time Algorithm
• Sample quasi-periodic waveform at clock
frequency
• Represent “envelope” with Fourier series
• Use time-domain method to resolve “fast”
behavior in each cycle
• Only a few cycles/samples
60
are needed
Envelope Analyses
• Track non-periodic carrier envelope without
tracing all carrier cycles
• RF analog of transient analysis
61
Summary
• Steady-state methods are powerful techniques
for analyzing complicated – yet structured –
phenomena in circuits
• Essential for RF design
•
- Useful in many other contexts!!!
Numerical techniques
- Shooting, HB, Chebyshev-Interval, MFT
- Iterative solutions methods
- Must exploit problem structure to get efficient
algorithms!
62
Download