I'm trying to create a VCO using an NFV source. I've defined the NFV source as:
and I then use a .define statement to define the FSweep variable as:
.define FSweep (1Meg * t + 1000)
When I run transient analysis for .01s, the frequency of the sine source seems to be erratic and high when it should steadily increase from 1kHz to 11kHz, but when I set FSweep to a constant number, it works as I expect. How do I get this to work correctly?
The VCO you created was actually our first draft for a VCO macro also and with the results we experienced we had to really look into the mathematics of it. The reason for the discrepancy is that the frequency of a sine wave is actually the derivative of the sine argument (hence the integrator we have in the VCO macro) so if the expression is as follows:
sin(arg) = sin(2*PI*v*t)
f=d(arg)/dt = 2*PI*(v+t*dv/dt)
where v is also a time based equation.
f=2*PI*(v+t*dv/dt) is the actual frequency being produced but
f=2*PI*v is the theoretical frequency we want.
That is why, when the input is a constant, it will work fine since t*dv/dt goes to 0.
The best method for solving this is to use the VCO macro that comes with Micro-Cap. If you are intent on creating your own VCO, the derivative factor must be taken into account to produce a working model.