Languages

CommunityCategory: XMODELModeling a variable-frequency oscillator with arbitrary periodic waveform

XMODEL

Modeling a variable-frequency oscillator with arbitrary periodic waveform

SA Support Team Staff 2019-05-02

For a RF system, I need to model a sine-wave oscillator of which frequency varies with an external input. In general, is it possible to model a variable-frequency oscillator with an arbitrary periodic waveform?

1 Answers
Best Answer
SA Support Team Staff 2019-05-02

Yes, there is a simple way of modeling a variable-frequency oscillator with an arbitrary periodic waveform using an 'integ_mod' primitive. With its default parameter values, the 'integ_mod' primitive produces an output which is a time-integral of the input signal modulo 1. For more details on this primitive, please refer to the XMODEL Reference Manual.

Therefore, if the input signal has the value of the desired frequency, the output of this 'integ_mod' primitive would produce a periodic signal linearly sweeping from 0 to 1 at that frequency. You can then turn it into an arbitrary periodic waveform by feeding this signal to a function that describes the desired periodic waveform over the range of 0~1.

For instance, a variable-frequency oscillator model that produces a triangular waveform would be:

where the 'pwl_func' primitive is describing a shape of the periodic waveform as a piecewise-linear waveform connecting three points (0, 0), (0.5, 1), and (1, 0). The simulated waveforms when the input 'freq' is at 10M are shown below. The output of the 'integ_mod' primitive (named 'base') is a linearly varying signal repeating the range of 0~1 and the following 'pwl_func' primitive produces the described triangular waveform at the 10MHz frequency.

Similarly, a variable-frequency oscillator model that produces a sinusoidal waveform would be:

where the function of sin(2πx) expressed by the 'scale' and 'sin_func' primitives is applied to the 'base' signal in order to produce a periodic sinusoidal waveform. The simulated waveforms with the input 'freq' at 10M are shown below.