# Defining Voltage Controlled Oscillator in *SmartSpice*

1. Introduction

One of the methods to define a Voltage Controlled Oscillator (VCO) in a SPICE simulation is to make use of a voltage-controlled voltage source (E element). A typical VCO expression makes use of a sinusoidal function as shown in Formula 1.

When expression (1) is applied, it is easy to assume that the frequency of VCO is proportional to the absolute value of control voltage. Sometimes, however, simulations return unexpected results when Vcontrol is an inconstant function of time. An example is shown in Figure 1. The control voltage in this example is a piecewise linear function, and sinusoidal voltage in Figure 1(a) is the corresponding VCO.

Figure 1. An example of VCO frequency

controlled by piecewise linear voltage

The “E” element syntax can be found in the
examples shown in the * SmartSpice* User’s Manual.

This result is unexpected since Figure 1(a) is not symmetrical to Figure 1b. Intuitively, one expects the frequency in Figure 1(a) to reduce gradually after t = 50ns, but the simulation result in Figure 1(a) is correct. The rest of this article will show why the result in Figure 1a is correct, and how to use the SmartSpice E element to achieve an expected VCO response.

2. Problem Diagnosis

In order to explain the behavior of the VCO shown in Figure 1a, we rewrite Equation 1 in a more general form for a given time-varied control voltage V(t):

The frequency in Equation 2 is not Kv(t), but rather is calculated based on the cyclic numbers at time t as shown in Equation 3:

By definition, angular velocity or frequency at t can be calculated using:

Equation 4 gives the true frequency of a VCO defined by Equation 2. Obviously, KV(t) in Equation 2 is not always equal to the actual frequency, and it equals the frequency only if V(t) is a constant with respect to time. By applying Equation 4 to the control voltage displayed in Figure 1b, we find that the frequency of the VCO defined by Equation 1 is

The result in Equation 5 is plotted in Figure 2. This
plot indicates a dramatic drop in frequency at t = 50 ns that continues
to decrease after 50 ns. From t = 56.25 ns the frequency increases along
with the absolute value of f(t) increases. This proves the * SmartSpice*
simulation result shown in Figure 1a.

Figure 2. VCO frequency varies with time.

**3. A New Approach**

For a time-variant control voltage in Figure 1 (b), using Equation 1 in E element definition does not result in a symmetrical frequency distribution over time. To achieve this, we construct function w(t) in Equation 6, so that the frequency of y(t) is always equal to the absolute value of a control voltage.

Clearly, w(t) must satisfy the following relation,

where v(t) is the control voltage, and k is a coefficient used to convert voltage to frequency. Equation 7 is a linear differential equation of the first order, and its solution is

Here, the initial condition is arbitrarily assumed in order to achieve a simpler form. Plugging Equation 8 into Equation 6, we obtain

Equation 9 is the sinusoidal function with a frequency of kv(t). The result in Equation 9 can be directly used to define a VCO, and the frequency of this VCO is proportional to the value of control voltage.

**4. Implementation in SmartSpice**

* SmartSpice* features the numerical integration
function necessary in order to implement Equation 9. This function is
denoted as integral(x) or s(x). Considering k is a large number, we may
neglect 1 in Equation 9, and write Equation 9 in

**format:**

*SmartSpice*Applying Formula 10 to the problem in Figure 1 obtains a correct result (Figure 3). The frequency is proportional to absolute value of control voltage.

Figure 4 is an similar example that uses a pulse control voltage. The input deck is listed in appendix.

**5. Summary**

A conventional ** SmartSpice** VCO definition
sin(k*Vcontrol*t) may generate an unexpected VCO frequency if the control
voltage varies with respect to time. A general method is available for
the use of E element to define a VCO that results in a frequency that
is proportional to the absolute value of a control voltage:

In ** SmartSpice** it will be vol = sin(k.s(v(t)))
.

**6. Appendix**

**A. Input deck for
the example in Figure 1.**

VCO DEMO

.OPTIONS post accurate

.options RMAX=2

Evco 2 0 vol='0.5+0.5*sin(6.28*1e8*V(1)*time)'

Vcontrol 1 0 pwl (0 0.5v 50n 2.5V 100n 0.5v)

R 1 0 10MEG

.TRAN .1n 100n

.END

**B. Input deck for
the example in Figure 3.**

VCO DEMO

.OPTIONS post accurate

.options RMAX=2

Evco 2 0 vol='0.5+0.5*sin(6.28*1e8*sv(1)+1)'

Vcontrol 1 0 pwl (0 0.5v 50n 2.5V 100n 0.5v)

R 1 0 10MEG

.TRAN .1n 100n

.END

**C. Input deck for
the example in Figure 4.**

VCO DEMO

.OPTIONS post accurate

Evco 2 0 vol='0.5+0.5*sin(6.28*1e8*sv(1)+1)'

Vcontrol 1 0 pulse (0 2v 0 25n 25n 0 50n)

R 1 0 10MEG

.TRAN .1n 100n

.END