s-55_3240_lesson_6

41
 A! Aalto University School of Electr ical Engineering S-55.3240 Numerical Methods in Circuit Simulation Lecture 6: Harmonic Balance (Steady-State Analysis) Jarmo Virtanen | Page 1 / 41  |  S-55.324 0 Lecture 6: Harmo nic Balance (Steady-S tate Analysis) Copyright  c 2011 Jar mo Virtan en

Upload: archana-tripathi

Post on 06-Oct-2015

22 views

Category:

Documents


0 download

DESCRIPTION

HBT

TRANSCRIPT

  • A!Aalto UniversitySchool of ElectricalEngineering

    S-55.3240 Numerical Methods in Circuit Simulation

    Lecture 6: Harmonic Balance (Steady-State Analysis)

    Jarmo Virtanen

    |Page 1 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Introduction to Harmonic Balance (Steady-State Analysis)

    Harmonic Balance (HB) is an analysis method that solves thesteady state of a circuit in the frequency domain. It is assumedthat voltages and currents behave like periodic or quasi-periodicwaveforms, i.e.,

    v(t) =N

    i=0

    [

    V C(i) cos(it) + VS(i) sin(it)

    ]

    The fundamental frequencies in the analysis are js, j = 1, ..., m,and is represent all possible mixing frequencies computed usingjs as follows:

    i =m

    j=1

    i,jj , 0 = 0, i = i

    Parameter m is the number of independent excitation frequencies

    |Page 2 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Properties of HB Analysis

    Frequency-domain method: arbitrary frequency-dependentlinear elements can be used directly in the analysis. In RFsimulations, typical linear devices are microstrip/striplineelements, measured scattering parameters, data fromelectromagnetic (EM) simulation, ...

    Due to the periodic or quasi-periodic requirement, theexcitation or response cannot be an arbitrary waveform

    -10k 0 10k 20k 30k 40k 50k 60k

    0.00

    2.12

    4.25

    6.38

    8.50

    Harmonic Balance

    APLAC 8.50 User: AALTO/RAD/CT Mon Jan 31 2011

    U/V

    f/Hz

    0 50 100 150 200

    2.00

    3.62

    5.25

    6.88

    8.50

    Harmonic Balance

    APLAC 8.50 User: AALTO/RAD/CT Mon Jan 31 2011

    U/V

    t/s

    |Page 3 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Properties of HB Analysis

    Harmonic Balance solves the Fourier coefficients, V C s and V Ss,of each node at all frequencies (0, 1, ..., N )

    The total size of the equation is the number of nodes times thenumber of frequencies. Example: 100 nodes and 50 non-zerofrequencies results in matrix size of 100 (1 + 2 50) = 10100

    The matrix equation is structurally diagonally dominant linear circuit: only diagonal blocks, i.e., each frequency can be

    solved independently nonlinear circuit: off-diagonal-blocks are non-zero, and the

    stronger the nonlinearity the larger the influence of theoff-diagonal blocks

    Due to the large matrix size and blockwise structure, iterativesolvers such as GMRES are used to solve the equations. Iterativesolvers are superior to LU-based sparse matrix solvers even formedium-sized circuits

    |Page 4 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    HB Analysis Equations

    Nonlinear circuit equations written in the time domain:

    q(v(t))

    t+ i(v(t)) +

    t

    y(t )v()d is(t) = 0,

    where q(v), i(v), y, and is(t) represent nonlinear charge,

    nonlinear current, admittance (impulse response), and excitationterms, respectively. The unknowns, v(t), are the node voltages.The harmonic balance form of the circuit equations is

    Q(V ) + I(V ) + Y V I s = 0

    where the unknowns in vector V are the DC, cosine and sinecoefficients (V C s and V Ss) of the generalized Fourier series ofeach node. Q and I result from nonlinear dynamic and staticelements, Y is the admittance matrix of linear elements, and I s isthe excitation

    |Page 5 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    HB Analysis Equations

    If the number of nodes in the circuit is K and the number of nonzerofrequencies is N , vector V is

    V =

    V (0)V (1)V (2)

    ...V (N )

    (2N+1)K1

    all unknowns

    , V (0) =

    V C1 (0)

    V C2 (0)...

    V CK (0)

    K1

    DC unknowns

    , V (i) =

    V C1 (i)V C2 (i)

    ...V CK (i)V S1 (i)

    V S2 (i)...

    V SK(i)

    2K1

    non-zero frequencies

    The order of unknowns is DC (all nodes), cosine/sine coefficients of1, ..., cosine/sine coefficients of N

    |Page 6 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Selecting HB Analysis Frequencies

    Single-tone, or 1-tone HB analysis, m = 1:All frequencies are integer multiples of the fundamentalfrequency, i.e., i = i1 = i1. In this case all waveformsare periodic

    Two-tone, or 2-tone HB analysis, m = 2:All mixing frequencies have the form i = i,11 + i,22,fundamental excitation frequencies are 1 and 2. There aremany choices for coefficients i,j . The most common, thediamond and box methods, are listed in the table below

    Method mixing formula N (# frequencies)

    Diamond |i,1| + |i,2| D D(D + 1)

    Box|i,1|

  • A!Aalto UniversitySchool of ElectricalEngineering

    Diamond Frequency Selection, D=4

    i,1 i,2 i order

    0 0 0 0

    1 0 1 10 1 2 1

    2 0 21 21 1 | 1 + 2| 20 2 22 2

    3 0 31 32 1 | 21 + 2| 31 2 | 1 + 22| 30 3 32 3

    4 0 41 43 1 | 31 + 2| 42 2 | 21 + 22| 41 3 | 1 + 32| 40 4 42 4

    The figure below shows allpositive frequencies (i)marked as red dots. Thename diamond comes fromthe 2D shape if negativefrequencies are taken intoaccount (blue dots)

    i,2

    i,1

    |Page 8 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Discrete Fourier Transform (DFT and IDFT)

    The time-domain waveform, v(t), is expressed as

    v(t) =N

    i=0

    [

    V C(i) cos(it) + VS(i) sin(it)

    ]

    In the single-tone case 1T = 2 and i = i1, and equations

    V C(i) =2 (i)

    T

    T

    0

    v(t) cos(it)dt

    V S(i) =2

    T

    T

    0

    v(t) sin(it)dt

    can be used to compute the Fourier coefficients V C and V S . Thefunction (i) is defined as (i = 0) = 1, (i 6= 0) = 0

    |Page 9 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    A more suitable method for numerical computation is to write thedefinition of the Fourier series in matrix form. Taking S timesamples t0, t1, ..., tS1 gives the inverse discrete Fouriertransform, or IDFT,

    v(t0)v(t1)

    ...v(tS1)

    =

    V C(0)V C(1)V S(1)

    ...V C(N )V S(N )

    , where

    =

    1 cos(1t0) sin(1t0) ... cos(N t0) sin(N t0)1 cos(1t1) sin(1t1) ... cos(N t1) sin(N t1)...

    ......

    ......

    1 cos(1tS1) sin(1tS1) ... cos(N tS1) sin(N tS1)

    The DFT (inverse of IDFT) is obtained directly from

    V =

    1v, if S = 2N + 1(

    )1

    v, if S > 2N + 1

    |Page 10 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Instead of the cos / sin form of the Fourier series, we can also usethe complex form

    v(t) =N

    i=0

    [

    V C(i) cos(it) + VS(i) sin(it)

    ]

    =N

    i=0

    [

    Re

    {

    [V C(i) jVS(i)] exp(jit)

    }]

    =N

    i=N

    [V R(i) + jVI (i)] exp(jit)

    whereV C(0) = V R(0)

    V I (0) = V S(0) = 0

    V C(i) = 2VR(i), when i 6= 0

    V S(i) = 2VI (i), when i 6= 0

    Note that V R is an even and V I is an odd function w.r.t. , i.e.,V R(i) = V

    R(i) and VI (i) = V

    I (i) becausev(t) is a real signal

    |Page 11 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Fast Fourier Transform (FFT)

    A computationally effective method to evaluate a one-dimensionalDFT is called fast Fourier transform, or FFT. The original FFTmethod requires that the number of time-domain samples is apower of 2 (means that S must be rounded up to the next powerof 2), the time domain sampling is done with a constant time steph, and the frequencies are equally spaced (i = i1). FFTreduces the computational work from S2 to O(S logS).

    The FFT algorithm gives directly the coefficients of the complexFourier-series, i.e., V R(0), V R(i), and V

    I (i) when thetime-domain values of v(t) are known.

    The FFTW package developed at MIT by Matteo Frigo and StevenG. Johnson transforms arrays of arbitrary size and dimension inO(S logS) time, i.e., does not require that S is a power of 2

    |Page 12 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Analysis (Linear Circuit)

    HB equations for linear circuit simplify to YTOT

    V = I s, i.e.,

    Y (0)Y (1)

    . . .

    Y (N )

    YTOT

    V (0)V (1)

    ...V (N )

    V

    =

    I s(0)I s(1)

    ...I s(N)

    I s

    Here Y () is the admittance matrix of the circuit at angularfrequency . Note, that the equation above is not usually used asis. Instead voltages at all frequencies (0,1, ...,N ) are solvedusing a single-frequency AC-like equation Y ()V() = I s().

    Conversion between v(t) and the complex phasor V C jV S :

    V C jV S v(t) = V Ccos(t) + V Ssin(t)

    Note that the conversion above uses the "peak value+Re" methodv(t) = Re{[V C jV S ] exp(jt)}

    |Page 13 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance: Linear Circuit Example 1

    Solve the waveform v(t), whenj(t) = J0 + J1 cos(1t) + J2 sin(2t),J0 = 0.2A, J1 = 0.3A,J2 = 0.4 A, R = 2, C = 1mF,1 = 10

    3 rad/s, 2 = 3 103 rad/s

    j(t)R C v(t)

    We must solve the nodal equation [(1/R)+ jC ]V () = J()at all frequencies, i.e., = 0,1, and 2.

    Using the conversion JC cos(t) + JS sin(t) JC jJS

    the values for the complex phasor J() are

    J() =

    J0 = 0.2, when = 0J1 = 0.3, when = 1(j)J2 = j0.4, when = 2

    because j(t) = J0 + J1 cos(1t) + J2 sin(2t)

    |Page 14 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance: Linear Circuit Example 1

    Next we solve voltage V

    V (0) =J(0)

    (1/R)= 0.4V

    V (1) =J(1)

    (1/R) + j1C=

    0.3

    0.5 + j= 0.12 j0.24V

    V (2) =J(2)

    (1/R) + j2C=

    j0.4

    0.5 + j3= 0.1297 + j0.02162 V

    The waveform is

    v(t) = {0.4 + 0.12 cos(1t) + 0.24 sin(1t)

    +0.1297 cos(2t) 0.02162 sin(2t)} V

    |Page 15 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance: Linear Circuit Example 1

    This example could have been solved using real arithmetic. Complexor real arithmetic can be used in the linear case, but the nonlinear caserequires that the equation is written in the real form, i.e., separately forV C s and V Ss. Next we write equation Y V = J using V C and V S .Because

    Y = Y R + jY I , V = V C jV S , and J = JC jJS

    we get(Y R + jY I )(V C jV S) = JC jJS ,

    and after separating the real and imaginary parts[

    Y R Y I

    Y I Y R

    ] [

    V C

    V S

    ]

    =

    [

    JC

    JS

    ]

    The real form of the circuit equations of the previous example are[

    (1/R) CC (1/R)

    ] [

    V C()V S()

    ]

    =

    [

    JC()JS()

    ]

    Solving this 2 2 equation gives the same results as the previouscomplex computation

    |Page 16 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance: Linear Circuit Example 2

    Compute the Fourier series coefficients of periodic function

    e(t) =

    {

    sin(1t), when sin(1t) 0,1 = 2000 rad/s0, otherwise

    The exact formula (1T = 2):

    V Cn =2

    T

    T/2

    0

    sin(1t) cos(nt)dt =

    0, n odd2

    (1 n2), n even

    V Sn =2

    T

    T/2

    0

    sin(1t) sin(nt)dt =

    {

    0 ,when n 6= 11/2 ,when n = 1

    Numerically using FFT: number of samples S = 32, time-domainsignal sampled at time points 0, T/32, 2T/32, ..., 31T/32.

    |Page 17 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance: Linear Circuit Example 2

    n V C(exact) V C(FFT) V S(exact) V S(FFT)

    0 0.31831 0.317287 0 01 0 0 0.500 0.5002 0.212207 0.214269 0 04 0.042441 0.044553 0 06 0.018189 0.020386 0 0

    0 500 1m 1.5m 2m

    -0.05

    0.23

    0.50

    0.78

    1.05

    waveform, samples=32

    APLAC Simulator User: AALTO/RAD Circuit Theory Group

    U/V

    t/s

    waveform/fft e(t)

    FFT waveformoscillates att [500, 1m]

    |Page 18 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Equations of Nonlinear Circuit

    Nonlinear HB equations are written as follows:

    F(V ) = Q(V ) + I (V ) + Y V I s = 0, where

    V = unknowns V C , V S at all frequencies 0,1, ...,N = j matrix, multiplies the charge with j currentQ = spectrum of nonlinear charge (nonlinear capacitor)I = spectrum of nonlinear static currentY = admittance matrix of linear elementsI s = excitation If the number of nodes is K and the number of non-zero

    frequencies is N , then the total matrix size is K(2N + 1) The nonlinear equation is written using real arithmetic, i.e.,

    unknowns are both V Cs and V Ss. Why ? The derivative ofF(V ) is not an analytic function of V C jV S , but ananalytic function of V C and V S . Linear equation thederivative is exactly Y (because I = Q = 0)

    |Page 19 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Matrix (Derivative w.r.t. Time)

    Matrix is constructed as follows:

    linear capacitor at single frequency i current of the capacitor is (V C =V C(i), V

    S =V S(i))

    I (i) = Y V =

    [

    0 iCiC 0

    ] [

    V C

    V S

    ]

    =

    [

    0 ii 0

    ]

    [

    CV C

    CV S

    ]

    Q

    =

    [

    0 ii 0

    ] [

    QC

    QS

    ]

    Matrix in case of frequencies 0, 1, and 2 is

    =

    00 1

    1 00 2

    2 0

    ,all other elementsin are zero

    |Page 20 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Nonlinear Current and Charge

    Nonlinear static current is expressed as a Fourier series

    i(v(t)) =N

    i=0

    [

    I C(i) cos(it) + IS(i) sin(it)

    ]

    ,

    where I C , and I S are the cosine, and sine coefficients of i(v(t)),respectively. Single-tone (i = i1) formulas are

    IC(i) =

    2 (i)

    T

    T

    0

    i(v(t)) cos(it)dt

    I S(i) =2

    T

    T

    0

    i(v(t)) sin(it)dt

    The charge coefficients are computed using the same formula,i(v(t)) is replaced with q(v(t)). Multiplication of Q with isdone when the values of the coefficients are known.

    In practice, FFT is used to compute I C and I S i(v(t)) andq(v(t)) are sampled, and the result is Fourier-transformed

    |Page 21 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Solving Nonlinear Equation

    The solution toF(V ) = Q(V ) + I(V ) + Y V I s = 0

    is searched using Newton iteration, i.e.,

    V (i+1) = V (i) (J(i))1 F(V (i)),

    where

    J (i) =F(V )

    V=

    Q(V )

    V+

    I(V )

    V+ Y

    V (i) is the voltage at the ith iteration step or initial guess,

    all derivatives are computed at V = V (i)

    The derivatives of I and Q at all frequencies (k) are computedw.r.t. all frequencies (l), i.e., all combinations of k = 0, 1, ...and l = 0, 1, ... AND cosine/sine coefficients must be taken intoaccount

    |Page 22 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Computing the Derivatives

    Assuming i(v(t)) depends only on one voltage, the derivatives ofI C(k) w.r.t. V

    C(l) and VS(l) are

    I CkV Cl

    =2

    T

    T

    0

    [

    i(v(t))

    v(t)

    ] [

    v(t)

    V Cl

    ]

    cos(kt)dt

    I CkV Sl

    =2

    T

    T

    0

    [

    i(v(t))

    v(t)

    ] [

    v(t)

    V Sl

    ]

    cos(kt)dt

    As v(t)/V Cl = cos(lt) and v(t)/VSl = sin(lt) we get

    I CkV Cl

    =2

    T

    T

    0

    i(v(t))

    v(t)cos(lt) cos(kt)dt

    I CkV Sl

    =2

    T

    T

    0

    i(v(t))

    v(t)sin(lt) cos(kt)dt

    |Page 23 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Applying trigonometric identities for cos() cos() andcos() sin() and using the Fourier series of the derivative(GC and GS), we get the following expressions:

    l 6= k:I CkV Cl

    =1

    2

    [GC(k l) + G

    C(k + l)]

    I CkV Sl

    =1

    2

    [GS(k l) + G

    S(k +l)]

    I SkV Cl

    =1

    2

    [GS(k l) + G

    S(k + l)]

    I SkV Sl

    =1

    2

    [GC(k l) G

    C(k + l)]

    k = 0, l 6= 0:I C

    0

    V Cl=

    1

    2GC(l),

    I C0

    V Sl=

    1

    2GS(l)

    l = 0:I CkV C

    0

    = GC(k),I SkV C

    0

    = GS(k)

    |Page 24 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Computing the Derivatives

    The derivative matrix of i(v(t)) w.r.t. up to the second harmonicis shown below

    1

    2

    2GC0

    GC1

    GS1

    GC2

    GS2

    2GC1

    2GC0+ GC

    2GS

    2GC

    1+ GC

    3GS

    3+ GS

    1

    2GS1

    GS2

    2GC0 GC

    2GS

    3 GS

    1GC

    1 GC

    3

    2GC2

    GC1+ GC

    3GS

    3 GS

    12GC

    0+ GC

    4GS

    4

    2GS2

    GS3+ GS

    1GC

    1 GC

    3GS

    42GC

    0 GC

    4

    The computation ofQ

    Vis done similarly, i.e., the same formulas

    apply if I is replaced by Q and G is replaced by C . The currentof the dynamic (charge) elements are obtained by multiplying theQ and C with .

    |Page 25 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Iteration Algorithm

    1) Set i = 0, initial guess is V (0) (from DC analysis)

    2) Compute linear elements at all harmonic frequencies,linear elements = admittances and excitations

    3) Sample nonlinear elements using V (i) I , G, Q, C

    4) Solve linearized equation

    (J(i))V = F(V (i))

    J(i) =F(V )

    V |V=V (i)

    V (i+1) = V (i) + V

    Use norm reduction if needed, (0, 1]

    5) Check convergence

    If V < 1 and F(V(i+1)) < 2, goto 7)

    6) Set i = i + 1, goto 3)

    7) Solution is V (i+1)

    |Page 26 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Nonlinear Example

    Write HB equations for thecircuit on the right. G = 2 S,C = 0.5 F, 1 = 2 rad/s(single-tone/2 harmonics),j0 = 0.1A, j1 = 0.05 A,i(v1) = (v1)

    2 A,j(t) = j0 + j1 cos(1t)A

    j(t) 1 v1

    1

    G C i(v1)

    2

    Check the equations by computing F(V ). The solution is

    V1 =

    V C1(0)

    V C1(1)

    V S1(1)

    V C1(21)

    V S1(21)

    =

    0.10.05000

    , V2 =

    V C2(0)

    V C2(1)

    V S2(1)

    V C2(21)

    V S2(21)

    =

    5.625m4.0m2.0m312.5312.5

    |Page 27 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Nonlinear Example

    Linear Y-matrix: Y =

    1G

    1G 1C

    11C G

    1G 21C

    121C G

    V =

    V C1 (0)

    V C2 (0)

    V C1 (1)

    V C2 (1)

    V S1 (1)

    V S2 (1)

    V C1 (2)

    V C2 (2)

    V S1 (2)

    V S2 (2)

    Above V C1 (1) means VC1 (1), V

    S1 (2) = V

    S1 (21), ...

    Numerical values: G = 2, 1C = 1, 21C = 2

    |Page 28 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Nonlinear Example

    Source vector I s =

    j00j10000000

    =

    0.10

    0.050000000

    Nonlinear current I (V ):

    i(v1) = v21 , where v1 = V

    C1 (0) + V

    C1 (1) cos(1t)

    Expanding i(v1) = (VC1 (0) + V

    C1 (1) cos(1t))

    2 gives thespectrum of i(v1)Note: the direction of I (V ) is from node to the ground

    |Page 29 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Nonlinear Example

    i(v1) = [VC1 (0) + V

    C1 (1) cos(1t)]

    2

    = [V C1 (0)]2 + (1/2)[V C1 (1)]

    2

    +2V C1 (0)VC1 (1) cos(1t)

    +(1/2)[V C1 (1)]2 cos(21t)

    I(V ) =

    0[V C1 (0)]

    2 + (1/2)[V C1 (1)]2

    02V C1 (0)V

    C1 (1)

    00

    0(1/2)[V C1 (1)]

    2

    00

    =

    011.25m

    010m

    00

    01.25m

    00

    |Page 30 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Nonlinear Example

    F(V ) = Y V + I(V ) I s

    =

    0.111.25m

    0.0510m00

    01.25m

    00

    Y V

    +

    011.25m

    010m

    00

    01.25m

    00

    I (V)

    0.10

    0.05000

    0000

    I s

    = 0

    |Page 31 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    HB Simulations: 1-dB compresssion (1-tone)

    -100 -90 -80 -70 -60 -50 -40 -30 -20 -10

    -80.00

    -63.33

    -46.67

    -30.00

    -13.33

    3.33

    20.00

    20

    21

    22

    23

    24

    25

    26

    1dB compression

    APLAC 8.50 User: AALTO/RAD/CT Mon Jan 31 2011

    Pout

    dBm

    Pin/dBm

    Gain

    dB

    Linear gain Gain

    Pout 1dB

    1dB

    Gain/dB

    Pout/dBm

    1 dB compressionoccurs atPin=25 dBm

    1-dB compression point is defined as the level of the input powerwhen the gain has dropped 1 dB from the gain extrapolated at lowpower levels.

    |Page 32 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    HB Simulations: 3rd order intercept (2-tone)

    -100 -72.5 -45 -17.5 10

    -80.00

    -63.33

    -46.67

    -30.00

    -13.33

    3.33

    20.00

    2-tone simulation: IM3 (2f1-f2)

    APLAC 8.50 User: AALTO/RAD/CT Mon Jan 31 2011

    Pout

    dBm

    Pin/dBm

    Linear[fund] Linear[3rd]

    Pout[fund] Pout[3rd]

    IM3 -->

    IM3 is atPin=12 dBm

    IM3: determine the power level at which the extrapolatedfundamental (f1) and third harmonic (2f1 f2 or f1 2f2)intersect.

    |Page 33 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Oscillator analysis

    An oscillator is an autonomous circuit, no periodic excitation Only DC bias sources connected to the circuit

    Transient analysis of an oscillator Oscillation starts by itself due to noise or unstability Long start-up time long simulation time Suitable for highly nonlinear oscillators

    HB analysis of an oscillator May converge to the DC solution (no periodic excitation!) Either the HB equation needs to be modifed to be solved, or

    apply an artificial excitation The oscillation frequency, i.e, fundamental HB frequency, is

    unknown

    Why use HB instead of transient analysis ? HB is needed for (phase) noise simulations Frequency dependent linear devices (S parameters, ...)

    |Page 34 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Transient and HB simulation of a VCO oscillator

    VCO: fosc=1.23 GHzReaches steady state in 7 periods

    0 3.75n 7.5n 11.25n 15n

    -1.00

    0.25

    1.50

    2.75

    4.00

    vcoBi Oscillator: TRAN/start-up

    APLAC 8.50 User: AALTO/RAD/CT Mon May 10 2010

    u(t)

    V

    t/s

    vtran(outp) vtran(outn)

    0 3n 6n 9n 12n

    -1.00

    0.25

    1.50

    2.75

    4.00

    vcoBi Oscillator: HB waveform

    APLAC 8.50 User: AALTO/RAD/CT Mon May 10 2010

    U/V

    t/s

    HB(outp) HB(outn)

    |Page 35 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    HB Oscillator Analysis in the APLAC Simulator

    HB Oscillator analysis is done using optimization; variables arethe oscillation frequency, fosc, and oscillation amplitude, vosc

    Artificial excitation OscAProbe: voltage source in series witha non-zero resistor is connected to the circuit. Optimizationgoal is to have zero current through the probe element

    Oscillator analysis algorithm

    1) Change optimization variables fosc, vosc

    2) HB analysis (incl. nonlinear iteration)

    3) Compute optimization goal

    4) Terminate optimization if in specs,otherwise goto 1)

    Preliminary step before optimization: Run, for example,transient simulation and extract from the data better initialvalues for fosc and vosc and nodal spectral voltages

    |Page 36 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Initial guess for HB Oscillator analysis1

    Run transient simulation for a predefined interval and storethe voltage waveform data across the OscAProbe element

    Use algorithm named "FFT" or "Zero-crossing" to find betterapproximation of the oscillation frequency and amplitude:

    "FFT": do FFT on the waveform data and search for themaximum peak. Apply parabolic interpolation to improveaccuracy. Location and value of the maximum peak give anapproximation of fosc and vosc

    "Zero-crossing": search for successive zero crossings afterremoving the average from the data. Estimate vosc from themaximum swing and fosc from the distance between zerocrossings

    Optionally inject a short pulse for faster start-up

    Optionally initialize node voltages to the spectral dataobtained from the transient simulation

    1The results shown here were obtained in EU/FP7/ICT/ICESTARS/214911project (http://www.icestars.eu)

    |Page 37 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    HB Divider analysis

    A divider (ratio P) is usually driven by a signal at frequency P f0and the circuit generates the signal at frequency f0. HB divideranalysis is done as follows:

    Use artificial excitation (voltage source in series with anon-zero resistor R0) at frequency f0 to generate a signal atthe lowest harmonics (f0, 2f0, ...)

    The value of the resistor R0 is swept from small (k) tolarge (G) values, i.e., gradually disconnect the artificialelement from the circuit

    The figure on the right shows theresult of the HB simulation of adiv-by-4 circuit. Final value ofR0 = 10G

    0 1n 2n 3n 4n

    -2.50

    -1.25

    0.00

    1.25

    2.50

    Divider by 4 (f0=1G)

    APLAC 8.50 User: AALTO/RAD/CT Mon Jan 31 2011

    t/s

    clk div

    |Page 38 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Harmonic Balance Analysis in the APLAC Simulator

    Supports single- and multi-tone analyses

    Multi-tone analysis: frequency selection methods are diamond,box, and the combination of these, box_and_diamond

    Several FFT algorithms Classical FFT: used in single-tone analysis, samples = 2k

    Multidimensional FFT: used in multi-tone analysis Onedim FFT: single- or multitone frequencies are mapped into one

    dimension, fast, requires much less memory

    Iterative solver: GMRES

    Two approaches in the equation formulation: Piecewise HB: linear elements are "compressed" into one (possibly

    large) linear multi-port, the dimension of the matrix is proportionalto the number of nonlinear device nodes. Supports Classical andMultidimensional FFT

    Nodal HB: the whole equation is solved as is, the equationformulation is matrix-implicit. Supports all FFT algorithms andthreading. Suitable for large circuits

    |Page 39 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Using HB Analysis

    Define tones and harmonics, FFT algorithm, frequency selection

    Prepare TONE m l (DIAMOND | BOX str) HBMODE = (0 | 1)

    + HB_SAMPLING_METHOD = ( TONE1 | MULTIDIM | ONEDIM )

    + NTHREADS = nth

    TONE: m-tone analysis, order of mixing frequencies is l Piecewise HB: HBMODE=0, Nodal HB: HBMODE=1 Number of threads = nth All items above need not be specified, the only obligatory

    parameter that enables HB analysis is TONE m l

    Excitation (Curr or Volt)

    Curr Jg 0 1 DC=2 TONE=[k1,k2,...],exci

    [k1,k2,...]: excitation at frequency k1f1+k2f2 + ...,the source value is complex or real exci

    Example: TONE=1,3 defines the excitation at the first harmonic,value is 3 cos(1t)

    |Page 40 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

  • A!Aalto UniversitySchool of ElectricalEngineering

    Using HB Analysis

    Analysis commands and results

    Analysis command: Analyze HB FC=[f1, f2, ...fm] or use

    Sweep,i.e., Sweep ... HB FC=[f1, f2, ..., fm]

    FC specifies the fundamental analysis frequencies [Hz], allharmonics and mixing products j are computed from theseexcitation frequencies

    Number of frequencies must agree with the definition specifiedin Prepare, m cannot be changed

    Analysis results: Functions Spectrum(), Waveform(), VWf(), IWf(),... Graphics:

    spectrum: Show SPECTRUM Mag(Spectrum(node))

    waveform: Show WAVEFORM VWf(node) All voltages/currents: Print VOLTAGES HB CURRENTS HB

    |Page 41 / 41 | S-55.3240 Lecture 6: Harmonic Balance (Steady-State Analysis)

    Copyright c 2011 Jarmo Virtanen

    Harmonic Balance (Steady-State Analysis)Introduction to Harmonic Balance (Steady-State Analysis)Properties of HB AnalysisHB Analysis Equations

    HB Analysis Frequencies, Fourier Transform and FFTSelecting HB Analysis FrequenciesDiamond Frequency Selection, D=4Discrete Fourier Transform (DFT and IDFT)Fast Fourier Transform (FFT)

    Harmonic Analysis (Linear Circuit)Harmonic Balance: Linear Circuit Example 1Harmonic Balance: Linear Circuit Example 2

    Harmonic Balance Equations of Nonlinear CircuitMatrix (Derivative w.r.t. Time)Nonlinear Current and ChargeSolving Nonlinear EquationComputing the DerivativesHarmonic Balance Iteration AlgorithmHarmonic Balance Nonlinear Example

    HB SimulationsOscillator analysisHB Divider analysis

    Harmonic Balance Analysis in the APLAC SimulatorUsing HB Analysis