Controlled Triangle Wave Oscillator

This function is a controlled triangle/ramp wave oscillator with parameterizable values of low and high peak output and rise time duty cycle. It takes an input voltage or current value. This value is used as the independent variable in the piecewise linear curve described by the coordinate points of the cntl_array and freq_array pairs. From the curve, a frequency value is determined, and the oscillator will output a triangle wave at that frequency. From the above, it is easy to see that array sizes of 2 for both the cntl_array and the freq_array will yield a linear variation of the frequency with respect to the control input. Any sizes greater than 2 will yield a piecewise linear transfer characteristic. For more detail, refer to the description of the piecewise linear controlled source, which uses a similar method to derive an output value given a control input.

Alternatively to the pair of parameters cntl_array and freq_array it is possible to determine the frequency of the VCO using the pair of parameters FC and KF.

Port Table

Description Direction Default Type Allowed Types Vector Vector Bounds Null Allowed
Input IN v v,vd,i,id,vnam NO   NO
Output OUT v v,vd,i,id NO   NO

Parameter Table

Name Description Data Type Default Value Limits Vector Vector Bounds Null Allowed
cntl_array control in array Real 0.0   YES 2 / - NO
freq_array frequency array Real 1.0e3 0 / - YES 2 / - NO
FC center Frequency Real 1.0e6   NO   YES
KF frequency sensitivity in Hz/Volt Real 1.0e5   NO   YES
out_low output low value Real -1.0   NO   YES
out_high output high value Real 1.0   NO   YES
duty_cycle rise time duty cycle Real 0.5 1e-6 / 0.999999 NO   YES

Error Messages

TRIANGLE: Error allocating triangle block storage

Generic storage allocation error.

TRIANGLE: Extrapolated Minimum Frequency Set to le-16 Hz

This error occurs whenever the controlling input value is such that the output frequency ordinarily would be set to a negative value. Consequently, the output frequency has been clamped to a near-zero value.

TRIANGLE: Size of control array different than frequency array

This error message normally occurs whenever the controlling input array and the frequency array are different sizes.

Example

ain 1 2 rampl
  
.model rampl triangle(cntl_array = [-1 0 5 6]
+                     freq_array=[10 10 1000 1000] 
+                     out.low = -5.0 out.high = 5.0 duty.cycle = 0.9)

See also

XSPICE Devices
XSPICE Code Models