Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Voltage-Controlled Oscillator (vco)

An oscillator whose frequency follows its control input.

vco

Component reference · 繁體中文

Group: Control · Kind: {"block":"vco","kind":"control"}

When to use it

Use it when a wave must change frequency during the run, for example in a phase-locked loop or a frequency sweep. Use Sine Source when the frequency is fixed.

Pins

Pin Domain Meaning
v signal Control input that sets the frequency
out signal The output wave
theta signal Phase in radians, one full turn

Common parameters

  • f0: Output frequency when the control is zero (Default: required)
  • kv: Frequency change per unit of control (Default: required)
  • fmin: Lowest output frequency (Default: 0)
  • fmax: Highest output frequency (Default: 1e9)
  • shape: Wave shape of the output: sine, square, triangle or sawtooth (Default: sine)

Parameters

Key Unit Default Typical range Description
f0 Hz required Output frequency when the control is zero
kv Hz required Frequency change per unit of control
fmin Hz 0 Lowest output frequency
fmax Hz 1e9 Highest output frequency
shape — sine Wave shape of the output: sine, square, triangle or sawtooth
amplitude — 1 Height of the wave peak
offset — 0 Fixed amount added to the wave
duty — 0.5 Part of the period a square wave is high, between 0 and 1
phase ° 0 Where the wave starts in its cycle

Parameter descriptions are in English in both languages.

Model

The frequency is f = f0 + kvv, held between fmin and fmax. The phase is the integral of the frequency, theta = 2piintegral(f dt), kept in the range 0 to 2pi. Within each step the control input is treated as a straight line from its old value to its new value, and the frequency is integrated exactly along that line. So the phase stays exact for any step length when the control input is piecewise linear. The output is offset + amplitude*shape(theta), and every shape rises through the offset at a phase of 0. Sine is sin(theta). Square is +1 for the first half of the period. Triangle peaks at a quarter period. Sawtooth rises from -1 to +1 and jumps back at half a period. The block has no direct feedthrough, like an integrator, so a loop can close through it. Inside a loop it reads the control input of the previous step.

Common mistakes

  • The solver ends a step on each edge of a square or sawtooth wave, at the time the present frequency predicts. A control input that changes fast within one step moves the edge a little from that time, so keep the step well below the period when the edges drive switches.
  • The gain kv is in hertz per unit of input, not radians per second. A loop designed with a gain in radians per second must be divided by 6.28 first, and the frequency never goes below fmin, so a large negative input stops the phase instead of turning it back.
  • An unconnected control input reads 0, so the oscillator runs at f0 and looks fine. The loop it belongs to is still open.

Problems rules: pin.unconnected

Datasheet and sources

For an IC oscillator such as the 4046, f0 is the centre frequency set by its timing parts at the middle control voltage. The gain kv is the slope of frequency against control voltage, often called VCO gain and given in MHz or kHz per volt, and fmin and fmax are the two ends of that curve.

Example

Open the example with the command file.openExample and the name demo:vco.


Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.