EDN logo


Design Ideas: July 6, 1995

Behavioral Spice model emulates VCO

Dr Bashir Al-Hashimi,
Staffordshire University, Stafford, UK


A behavioral model treats a circuit as a black box, which you can describe using an equation or table. Listing 1 is a Microsim PSpice behavioral model that simulates the operation of a voltage-controlled oscillator (VCO). The output signal of a VCO is VO=Aβsin(2ãfOt), where A is the amplitude, t is the time variable, and fO is the output frequency. This frequency is fO=fC+KV, where fC is the center frequency, K is the sensitivity of the VCO in Hz/V, and V is the control-input signal.

Listing 1--VCO behavioral model
.SUBCKT VCO 1 2 PARAMS:A=1, Fc=1, K=1

E 2 0 VALUE={A*SIN(6.283*TIME*(Fc+K*V(1,0)))

.ENDS VCO

The model expresses these equations using a VALUE description of a voltage-controlled voltage source. Note that the parameter TIME in the model represents the PSpice internal sweep variable used in transient analysis. To simplify use of the model, describe it as a parameterized subcircuit called VCO, whose input is at node 1 and whose output is at node 2. Describe the model function using the three parameters A, fC, and K. You must give the subcircuit parameters initial values to satisfy the .SUBCKT statement requirement. In this example, I arbitrarily set them to one; you'll change them to the required values when the program calls the subcircuit.

To use the model to simulate a VCO circuit, specify the parameters A, fC, and K. For example, if A=2V, fC=10 kHz, K=5 kHz/V, and the input control voltage ranges from +1 to 1V, the output frequency changes from 15 to 5 kHz, as Fig 1 shows. Listing 2 gives the PSpice netlist of the VCO circuit. (DI ##1726)

Listing 2--VCO-circuit PSpice netlist
.LIB C:\PSPICE\MODELS ;VCO model location

V 1 0 PULSE(-1 1 0 10ns 10ns 0.5ms 1ms) ;control input signal

.TRAN 0.01m 2ms 0m 0.01m ;transient analysis range

X 1 2 VCO PARAMS:A=1, Fc=10K,K=5K ;call VCO subcircuit

.PROBE V(1),V(2) ;graphic input & output signals

.END ;end of netlist





| EDN Access | feedback | subscribe to EDN! |
| design features | design ideas | columnist |


Copyright © 1995 EDN Magazine. EDN is a registered trademark of Reed Properties Inc, used under license.