Thanks. Just tried that, but all I get then is a constant 10kHz with a rising 0-1V amplitude (as expected). I'm puzzled as to why the original version gives exactly twice the expected frequency.
Edit:
Removing the factor of 2 from the original version gives the wanted 0-10kHz, but is mathematically incorrect.
I've tried reducing the maximum step time for the sim, but that doesn't fix the anomaly.
Thanks Mike. Tried that, but...... that results unexpectedly in a constant 10kHz. What's going on??? I'm getting the impression that a BV prefers fixed parameters to variables in its expression, but surely it's meant to accept any formula you throw at it?
Edit:
Tried the second suggestion in post #5, but again the frequency is not swept.
You are right, the "time" variable must be in the expression.
For B1, the expression V=sin(2*pi*5000*time^2) does what you want. It starts at near zero frequency, and is making 10kHz at the end of the second. I dont understand why 5000 instead of 10000, either, but it likely has something to do with "time" effectively being squared, either if it comes from V(a) or is put directly into the argument of the sin() function.
Can you explain? It looks to me that coincidentally, idt(V(a) just happens to be one half of time^2 at time=1s. Why is this any better than just 0.5*time^2 ?
My V(a) plots well behaved. Why do you need to integrate it? If you integrate it, it makes a very different V(b).
It gets weirder. With v(a) ramped from 0 to 1 over 1 sec, followed by v(a) = 1 for 1 sec, a 2 sec sim gives a 0-20kHz sweep followed by a 10kHz sine, with the frequency suddenly halving at the 1 sec point ???
Edit:
Weirder still. Changing V(a) to ramp from 0.5 to 1 over the first 1 sec gives a 5kHz (expected) to 15kHz (unexpected) frequency sweep, followed by 10kHz from 1 sec onwards.
Can you explain? It looks to me that coincidentally, idt(V(a) just happens to be one half of time^2 at time=1s. Why is this any better than just 0.5*time^2 ?
Because the time computation should occur after each time slice (idt()) and then fed to the remainder of the equation.
That's what idt() will do. At least that's the way I understand it.
This also means that "maxtimestep" will have an influence on the results. It should be set to something less than the shortest period. The period of 20khz is about 50us, so I'd set that value to maybe 1us to get good results but not slow down the sim too much.
It gets weirder. With v(a) ramped from 0 to 1 over 1 sec, followed by v(a) = 1 for 1 sec, a 2 sec sim gives a 0-20kHz sweep followed by a 10kHz sine, with the frequency suddenly halving at the 1 sec point ??? View attachment 113129
Edit:
Weirder still. Changing V(a) to ramp from 0.5 to 1 over the first 1 sec gives a 5kHz (expected) to 15kHz (unexpected) frequency sweep, followed by 10kHz from 1 sec onwards.
The param thing was just to simplify the BV expression while I was experimenting with it.
I extended the sim time from 1 sec to 2 secs so that, from time 1s to 2s, v(a) stays at 1V. That results in LTS correctly identifying the sine frequency from 1s onwards.
I agree the max timestep seems to be the root of the anomaly. I used 1uS for the post #13 sim. If you set maxtimestep progressively >2uS you start to see changes in the sine envelope. Set it at 50uS, for example, and you create a nice noise generator!
It's beginning to look as though any BV expression which is a time function of something which is itself a time function will give unpredictable results.
The param thing was just to simplify the BV expression while I was experimenting with it.
I extended the sim time from 1 sec to 2 secs so that, from time 1s to 2s, v(a) stays at 1V. That results in LTS correctly identifying the sine frequency from 1s onwards.
I agree the max timestep seems to be the root of the anomaly. I used 1uS for the post #13 sim. If you set maxtimestep progressively >2uS you start to see changes in the sine envelope. Set it at 50uS, for example, and you create a nice noise generator!
It's beginning to look as though any BV expression which is a time function of something which is itself a time function will give unpredictable results.
Yes...the maxtimestep will have an effect. And...yes..you need to use idt() function in the expression or the anomaly (which really isn't an anomaly) will continue.
The attached sim should be self explanatory but V1 adjust the amplitude, V2 adjusts the frequency and rate of change (via rise time).
The output frequency will change based on the rise time set in V2.
Thanks. I was aware of the modulate device, but was experimenting with the standard BV one with a view to building a model which could be ported to Pspice if necessary. Do you know if Pspice has a native modulate device, or is that proprietary to LT?