Scheme for Linear System Analysis

Scheme has a well-designed intrinsic tower of numeric types, including complex numbers. C does not, and an industry has grown around creating applications (like linear circuit simulators) to implement tasks easy in the more powerful Scheme language.

High Q Oscillators are notoriously difficult to analyze using Spice because of the long simulation times required. In Scheme however, we can simulate and model in the frequency domain, dynamically computing linear-system equivalents for non-linear elements.

For those familiar with Spice, or with tools which can output spice format, spice2scm can translate Spice format circuit files to scheme.
pll.scm is the Scheme program which analyzes a 36.MHz to 76.MHz voltage-controlled oscillator and the phase-locked loop frequency synthesizer where it is used. This file takes less than 1 second to run in SCM.
The first two graphs are to check that the varactor control circuit doesn't interact with the oscillator in the frequency range of operation.
scm -lpll.scm

 Mag (db)  __________________________________________________________________
        50|-                                                                 |
          |                                                                  |
        40|-                                                                 |
          |                                                                  |
        30|-                                                                 |
          |                                                        *         |
        20|-                                                                 |
          |                                                       *          |
        10|-                                                        *        |
          |                                                      *   ****    |
         0|-----------------------------------------------------*------------|
          |                                                    *             |
       -10|-                                                  *              |
          |                                                  *               |
       -20|-*****************************************       *                |
          |                                          ***   *                 |
       -30|-                                            * *                  |
          |                                                                  |
       -40|-                                             *                   |
          |_:____.____:____.____:____.____:____.____:____.____:____.____:____|
 log(w)     5        5.5        6        6.5        7        7.5        8
                              Varactor Control -> v_tank

 Mag (dbV) __________________________________________________________________
          |                                                                  |
          |                                                                  |
     -23.5|-                                                                 |
          | *                                                                |
          | **                                                               |
       -24|-  **                                                             |
          |     **                                                           |
          |       ***                                                        |
     -24.5|-        **                                                       |
          |           ***                                                    |
          |              ***                                                 |
       -25|-                **                                               |
          |                   ****                                           |
          |                       ****                                       |
     -25.5|-                          *****                                  |
          |                                ****                              |
          |                                    *******                       |
       -26|-                                         ********                |
          |                                                  *****           |
          |________:____.____:____.____:____.____:____.____:____.____:_______|
    log(w)       7.7875     7.8      7.8125    7.825     7.8375     7.85
                               V_d -> Node 1

Self resonant C = 1.8pF (for L = 220nH) @ 250MHz
Varactor c_0 = 107pF

Next, the (open-loop) oscillator transfer function is examined at its high, mid, and low points of its frequency range. The loaded Q at these frequencies is also computed.

The phase shift introduced by the digital inverter's hysteresis is modeled according to the method of:


 Mag (db)  __________________________________________________________________
        15|-                                                                 |
          |                                                                  |
          |                                                                  |
        10|-                           *                                     |
          |                           ***                                    |
          |                          *   *                                   |
         5|-                        **   *                                   |
          |                         *     *                                  |
          |                        *       *                                 |
         0|-----------------------*---------*--------------------------------|
          |                      *           *                               |
          |                    **             *                              |
        -5|-                 ***               **                            |
          |                ***                   **                          |
          |             ***                       ****                       |
       -10|-        ****                             ***                     |
          |     *****                                   ***                  |
          | ****                                           *****             |
       -15|-                                                   **            |
          |______:_____._____:_____._____:_____._____:_____._____:_____._____:
   log(w)       7.84        7.86        7.88        7.9         7.92

   Phase   __________________________________________________________________
       -75|-                                                                 |
          |                                                                  |
      -100|-                                                                 |
          | **************                                                   |
      -125|-             *********                                           |
          |                      ***                                         |
      -150|-                        *                                        |
          |                          *                                       |
      -175|-                          *                                      |
          |                           *                                      |
      -200|-                                                                 |
          |                            *                                     |
      -225|-                           *                                     |
          |                             *                                    |
      -250|-                             *                                   |
          |                              **                                  |
      -275|-                              ***                                |
          |                                  ******                          |
      -300|-                                      ***************            |
          |______:_____._____:_____._____:_____._____:_____._____:_____._____:
   log(w)       7.84        7.86        7.88        7.9         7.92
                              Oscillator Bode plot (cf= 75MHz)
              mv209 @ 12V -> 8.6pF; L= 220nH (X= 104), C= 20pF, Q= 74
              v_tank = 2.5V @ 75.0MHz; hysteresis phase-shift is -1.1 degrees
              v_tank = 2.5V @ 75.0MHz; hysteresis correction is -13kHz
              Loaded Q = 59


 Mag (db)  __________________________________________________________________
       7.5|-                           *                                     |
          |                           ***                                    |
         5|-                         **  *                                   |
          |                          *   *                                   |
       2.5|-                        *     *                                  |
          |                        **     **                                 |
         0|-----------------------*--------*---------------------------------|
          |                      **         *                                |
      -2.5|-                    **           *                               |
          |                    **             **                             |
        -5|-                  **               **                            |
          |                 **                  **                           |
      -7.5|-              ***                     **                         |
          |             ***                        **                        |
       -10|-         ****                            **                      |
          |        ***                                 **                    |
     -12.5|-   ****                                      ***                 |
          | ****                                            ***              |
       -15|-                                                   **            |
          |___:_____._____:_____._____:_____._____:_____._____:_____._____:__|
 log(w)      7.74        7.76        7.78        7.8         7.82        7.84

   Phase   __________________________________________________________________
      -100|-******************                                               |
          |                   ****                                           |
      -120|-                      **                                         |
          |                         *                                        |
      -140|-                         *                                       |
          |                           *                                      |
      -160|-                          *                                      |
          |                            *                                     |
      -180|-                                                                 |
          |                            *                                     |
      -200|-                            *                                    |
          |                             *                                    |
      -220|-                             *                                   |
          |                              *                                   |
      -240|-                              *                                  |
          |                                **                                |
      -260|-                                 ****                            |
          |                                      *********                   |
      -280|-                                              *******            |
          |___:_____._____:_____._____:_____._____:_____._____:_____._____:__|
 log(w)      7.74        7.76        7.78        7.8         7.82        7.84
                              Oscillator Bode plot (cf= 61MHz)
              mv209 @ 6.0V -> 16pF; L= 220nH (X= 84), C= 31pF, Q= 59
              v_tank = 2.2V @ 60.5MHz; hysteresis phase-shift is -1.3 degrees
              v_tank = 2.2V @ 60.5MHz; hysteresis correction is -11kHz
              Loaded Q = 59


 Mag (db)  __________________________________________________________________
          |                           *                                      |
         0|-------------------------**-**------------------------------------|
          |                        **   *                                    |
        -2|-                       *     **                                  |
          |                       *       **                                 |
        -4|-                     *         *                                 |
          |                     *           *                                |
        -6|-                   *             *                               |
          |                   *               *                              |
        -8|-                **                 *                             |
          |               **                    **                           |
       -10|-             **                      **                          |
          |            **                         **                         |
       -12|-         **                             ***                      |
          |        **                                 **                     |
       -14|-   ****                                     **                   |
          | ****                                          **                 |
       -16|-*                                               ***              |
          |                                                   ***            |
          |______:_____._____:_____._____:_____._____:_____._____:_____._____:
   log(w)       7.52        7.54        7.56        7.58        7.6

   Phase   __________________________________________________________________
       -60|-*******                                                          |
          |        *********                                                 |
       -80|-               *****                                             |
          |                     **                                           |
      -100|-                      *                                          |
          |                        *                                         |
      -120|-                        *                                        |
          |                          *                                       |
      -140|-                         **                                      |
          |                           *                                      |
      -160|-                           *                                     |
          |                            **                                    |
      -180|-                            *                                    |
          |                              **                                  |
      -200|-                              ***                                |
          |                                 ***                              |
      -220|-                                   *****                         |
          |                                        *************             |
      -240|-                                                   **            |
          |______:_____._____:_____._____:_____._____:_____._____:_____._____:
   log(w)       7.52        7.54        7.56        7.58        7.6
                              Oscillator Bode plot (cf= 36MHz)
              mv209 @ 0.50V -> 89pF; L= 220nH (X= 50), C= 89pF, Q= 35
              v_tank = 0.93V @ 36.2MHz; hysteresis phase-shift is -3.1 degrees
              v_tank = 0.93V @ 36.2MHz; hysteresis correction is -37kHz
              Loaded Q = 27

Next, the VCO frequency versus its control voltage and its slope are computed.
    Mhz    __________________________________________________________________
        80|-                                                                 |
          |                                                                  |
        75|-                                                        **       |
          |                                                   **** *         |
        70|-                                            ** ***               |
          |                                       * ****                     |
        65|-                                  ****                           |
          |                               * **                               |
        60|-                          ****                                   |
          |                       * **                                       |
        55|-                   ***                                           |
          |                * **                                              |
        50|-             **                                                  |
          |           ***                                                    |
        45|-       * *                                                       |
          |      **                                                          |
        40|-   **                                                            |
          |   *                                                              |
        35|-*                                                                |
          |_________:____.____:____.____:____.____:____.____:____.____:______|
       V            2         4         6         8         10        12

   Mhz/V   __________________________________________________________________
       6.5|-*                                                                |
          |  *                                                               |
         6|-  *                                                              |
          |     *                                                            |
       5.5|-     *                                                           |
          |       *                                                          |
         5|-       *                                                         |
          |         **                                                       |
       4.5|-          * *                                                    |
          |              **                                                  |
         4|-               **                                                |
          |                  **                                              |
       3.5|-                    ***                                          |
          |                        ***                                       |
         3|-                           ****                                  |
          |                                *** **                            |
       2.5|-                                     *****                       |
          |                                            ****** *              |
         2|-                                                   *****         |
          |________:____.____:____.____:____.____:____.____:____.____:_______|
       V           2         4         6         8         10        12

A model of the LM6365 op-amp was constructed to match the graphs on its data sheet:
 Mag (db)  __________________________________________________________________
       120|-                                                                 |
          |                                                                  |
       100|-                                                                 |
          | ***********                                                      |
        80|-          ******                                                 |
          |                 *****                                            |
        60|-                     *****                                       |
          |                           *****                                  |
        40|-                               *****                             |
          |                                     *****                        |
        20|-                                         ****                    |
          |                                             ****                 |
         0|------------------------------------------------***---------------|
          |                                                   **             |
       -20|-                                                    **           |
          |                                                       **         |
       -40|-                                                       **        |
          |                                                          **      |
       -60|-                                                           *     |
          |_:____.____:____.____:____.____:____.____:____.____:____.____:____|
 log(w)     3         4         5         6         7         8         9

   Phase   __________________________________________________________________
          |                                                                  |
          |                                                                  |
         0|------------------------------------------------------------------|
          | *****                                                            |
          |      ***                                                         |
       -50|-        ***                                                      |
          |           ****                                                   |
          |               ****************                                   |
      -100|-                              **********                         |
          |                                         ***                      |
          |                                            **                    |
      -150|-                                            ***                  |
          |                                               **                 |
          |                                                ***               |
      -200|-                                                 **              |
          |                                                   ***            |
          |                                                     ***          |
      -250|-                                                       ****      |
          |                                                           **     |
          |_:____.____:____.____:____.____:____.____:____.____:____.____:____|
 log(w)     3         4         5         6         7         8         9
LM6365 Open Loop Frequency Response

 Mag (db)  __________________________________________________________________
       120|-                                                                 |
          |                                                                  |
       100|-                                                                 |
          |                                                                  |
        80|-                                                                 |
          |                                                                  |
        60|-                                                                 |
          | **                                                               |
        40|- ***********                                                     |
          |            **********                                            |
        20|-                     ********                                    |
          |                              ******                              |
         0|------------------------------------*****-------------------------|
          |                                         ****                     |
       -20|-                                           *****                 |
          |                                                ****              |
       -40|-                                                  ****           |
          |                                                       ****       |
       -60|-                                                          **     |
          |_:____.____:____.____:____.____:____.____:____.____:____.____:____|
 log(w)     6        6.5        7        7.5        8        8.5        9

   Phase   __________________________________________________________________
       -80|-                                                                 |
          | ********                                                         |
      -100|-       **********                                                |
          |                  *****                                           |
      -120|-                      ***                                        |
          |                          **                                      |
      -140|-                           ***                                   |
          |                              ***                                 |
      -160|-                               **                                |
          |                                  **                              |
      -180|-                                   **                            |
          |                                      **                          |
      -200|-                                      ***                        |
          |                                         **                       |
      -220|-                                          **                     |
          |                                             ***                  |
      -240|-                                               ***               |
          |                                                   *****          |
      -260|-                                                       *****     |
          |_:____.____:____.____:____.____:____.____:____.____:____.____:____|
 log(w)     6        6.5        7        7.5        8        8.5        9
LM6365 Open Loop Frequency Response

Finally, Bode plots of the PLL's behavior are plotted at each end of the VCO's frequency range.
                     +\
                     | \  U106 LM6365
                     |  \
              GND o--| + \
From     R104        |    >-----+---o To VCO
Phase o--/\/\---+----| - /      |
Comp.     723   |    |  /       |
                |    | /        |
                |    +/         |
                |        C100   |
          C101 _|_   +----||----+
         330pF ---   |  22.0pF  |
                |    |          |
                |    |          |
                |    |   R103   |
                +----+---/\/\---+
                        1.00k

Mean VCO-gain (/2) is 1.80MHz/V (11.3M rad/sec/Volt)

phase-detector-gain is 1.16V/rad
U106 contributes 0.6 degrees Phase Error (296pSec @ 33Mhz)

natural-frequency is 874kHz; damping-coefficient is 0.906
Reference suppression is -61.4db at 33MHz

 Mag (db)  __________________________________________________________________
        20|-                                                                 |
          |                                                                  |
        10|-                                                                 |
          |                                                                  |
         0|-*******************----------------------------------------------|
          |                   ****                                           |
       -10|-                     ***                                         |
          |                        **                                        |
       -20|-                         **                                      |
          |                           **                                     |
       -30|-                           **                                    |
          |                              **                                  |
       -40|-                              **                                 |
          |                                **                                |
       -50|-                                **                               |
          |                                   **   *                         |
       -60|-                                   **  **                        |
          |                                      **                          |
       -70|-                                        *                        |
          |__:____.____:____.____:____.____:____.____:____.____:____.____:___|
 log(w)      4         5         6         7         8         9         10

   Phase   __________________________________________________________________
         0|---------****************************-----------------------------|
          |                                    *****                         |
       -40|-                                                                 |
          |                                                                  |
       -80|-                                                                 |
          |                                                                  |
      -120|-                                                                 |
          |                                                                  |
      -160|-                                                                 |
          |                                                                  |
      -200|-                                                                 |
          |                                         *                        |
      -240|-                                                                 |
          |                                                                  |
      -280|-                                                                 |
          |                                                                  |
      -320|-                                                                 |
          |                                                                  |
      -360|-********                                                         |
          |__:____.____:____.____:____.____:____.____:____.____:____.____:___|
 log(w)      4         5         6         7         8         9         10

 Mag (db)  __________________________________________________________________
        20|-                                    :                            |
          |                                     :                            |
        10|-                                    :                            |
          |                                     :                            |
         0|-*-----------------------------------*----------------------------|
          |                                     *                            |
       -10|-                                    *                            |
          |                                     *                            |
       -20|-                                    *                            |
          |                                     *                            |
       -30|-                                    *                            |
          |                                     *                            |
       -40|-                                    *                            |
          |                                    *:                            |
       -50|-                                   *:                            |
          |                                   **:                            |
       -60|-               *                  **:                            |
          |                                   **:                            |
       -70|-               *                    :                            |
          |_______:____.____:____.____:____.____:____.____:____.____:________|
    Phase        -300      -200      -100       0        100       200
                              Closed-loop PLL phase response
Zero at 482kHz; Crossover at 872kHz; pole at 7.2MHz

 Mag (db)  __________________________________________________________________
          |                                                                  |
       120|-                                                                 |
          |                                                                  |
       100|-                                                                 |
          |                                                                  |
        80|-                                                                 |
          |                                                                  |
        60|-                                                                 |
          | ****                                                             |
        40|-   ******                                                        |
          |          *****                                                   |
        20|-             ******                                              |
          |                    *****                                         |
         0|-------------------------*****------------------------------------|
          |                             ******                               |
       -20|-                                  *****                          |
          |                                       ******                     |
       -40|-                                            *****                |
          |                                                  ***             |
          |________:____.____:____.____:____.____:____.____:____.____:_______|
    log(w)         5        5.5        6        6.5        7        7.5

   Phase   __________________________________________________________________
         2|-                                                                 |
          |                                                                  |
         1|-                                                                 |
          |                                                                  |
         0|-*******************----------------------------------------------|
          |                    *********                                     |
        -1|-                            *****                                |
          |                                  ***                             |
        -2|-                                    ***                          |
          |                                       ***                        |
        -3|-                                        ***                      |
          |                                           ***                    |
        -4|-                                            **                   |
          |                                               **                 |
        -5|-                                               **                |
          |                                                 **               |
        -6|-                                                 **              |
          |                                                   *              |
        -7|-                                                   *             |
          |________:____.____:____.____:____.____:____.____:____.____:_______|
    log(w)         5        5.5        6        6.5        7        7.5
               Open-loop PLL phase response around crossover 872kHz

natural-frequency is 1.6MHz; damping-coefficient is 1.65
Reference suppression is -51db at 33MHz

 Mag (db)  __________________________________________________________________
         0|-*******************----------------------------------------------|
          |                   ***                                            |
       -10|-                     **                                          |
          |                        **                                        |
       -20|-                        **                                       |
          |                           *                                      |
       -30|-                           **       *                            |
          |                             **                                   |
       -40|-                              *                                  |
          |                                **                                |
       -50|-                                *** *                            |
          |                                   ****                           |
       -60|-                                                                 |
          |                                      *                           |
       -70|-                                      *                          |
          |                                       *                          |
       -80|-                                      *                          |
          |                                        *                         |
       -90|-                                       **                        |
          |_________:____.____:____.____:____.____:____.____:____.____:______|
     log(w)         5         6         7         8         9         10

   Phase   __________________________________________________________________
         0|-----*****************************--------------------------------|
          |                                 *****                            |
       -40|-                                                                 |
          |                                                                  |
       -80|-                                                                 |
          |                                                                  |
      -120|-                                                                 |
          |                                                                  |
      -160|-                                                                 |
          |                                                                  |
      -200|-                                                                 |
          |                                      ****                        |
      -240|-                                    *                            |
          |                                                                  |
      -280|-                                                                 |
          |                                                                  |
      -320|-                                                                 |
          |                                                                  |
      -360|-*****                                                            |
          |_________:____.____:____.____:____.____:____.____:____.____:______|
     log(w)         5         6         7         8         9         10

 Mag (db)  __________________________________________________________________
         0|-*-----------------------------------*----------------------------|
          |                                     *                            |
       -10|-                                    *                            |
          |                                     *                            |
       -20|-                                    *                            |
          |                                     *                            |
       -30|-            *                       *                            |
          |                                    *:                            |
       -40|-                                   *:                            |
          |                                    *:                            |
       -50|-                                  **:                            |
          |                *                  * :                            |
       -60|-                                    :                            |
          |                *                    :                            |
       -70|-               *                    :                            |
          |               *                     :                            |
       -80|-              *                     :                            |
          |               *                     :                            |
       -90|-             **                     :                            |
          |_______:____.____:____.____:____.____:____.____:____.____:________|
    Phase        -300      -200      -100       0        100       200
                              Closed-loop PLL phase response
Zero at 482kHz; Crossover at 1.6MHz; pole at 7.2MHz

 Mag (db)  __________________________________________________________________
          |                                                                  |
       120|-                                                                 |
          |                                                                  |
       100|-                                                                 |
          |                                                                  |
        80|-                                                                 |
          |                                                                  |
        60|-                                                                 |
          | ****                                                             |
        40|-    *****                                                        |
          |          *****                                                   |
        20|-              *****                                              |
          |                    *****                                         |
         0|-------------------------*****------------------------------------|
          |                              *****                               |
       -20|-                                  *****                          |
          |                                        *****                     |
       -40|-                                            *****                |
          |                                                  ****            |
          |___:____.____:____.____:____.____:____.____:____.____:____.____:__|
  log(w)      5        5.5        6        6.5        7        7.5        8

   Phase   __________________________________________________________________
         6|-                                                                 |
          |                                                                  |
         4|-                                                                 |
          |                                                                  |
         2|-                                                                 |
          |                                                                  |
         0|-********************---------------------------------------------|
          |                     **********                                   |
        -2|-                             ******                              |
          |                                   ****                           |
        -4|-                                      ****                       |
          |                                          ***                     |
        -6|-                                            **                   |
          |                                               *                  |
        -8|-                                               **                |
          |                                                 **               |
       -10|-                                                 **              |
          |                                                   **             |
       -12|-                                                    *            |
          |___:____.____:____.____:____.____:____.____:____.____:____.____:__|
  log(w)      5        5.5        6        6.5        7        7.5        8
               Open-loop PLL phase response around crossover 1.59MHz

This circuit has behaved as predicted and performed well in production. Although the full frequency range of each oscillator was not tested in production, the PLLs faithfully track frequency modulated reference inputs.

Copyright 1998 Aubrey Jaffer

I am a guest and not a member of the MIT Computer Science and Artificial Intelligence Laboratory.  My actions and comments do not reflect in any way on MIT.
SCM for Engineering
agj @ alum.mit.edu
Go Figure!