How do I create a current sink with increasing frequency over time. Please see image
The image I attached here was just for example. Actually, I want to create a current sink that can sink current with frequency sweeping from 20KHz to 50kHz over a period. Initially, the pulse should start with 20KHz then gradually increase to 50KHz with a step of 1KHz
In this case, the easiest way is to make use of the current limitation capability of a voltage controlled switch.
- a voltage controlled switch with model SW
- model definition ".model SW SW(Ilimit=0.1)" e.g. for a 0.1A current sink
- a control voltage. E.g. with a B source (symbol BV). Define "V=sin(time*(fstart+(fend-fstart)*time/tspan/2)*2*PI)"
- at last, define your parameters with e.g. ".param fstart=20k fend=50k tspan=10m"
This example generates a 0A/0.1A current sink with continuously increasing frequency from 20kHz to 50kHz within 10ms.
I have attached my LTspice sim file here for your reference. I have created a sink model as you suggested.
But for the voltage-controlled switch if I try to change the current limit to 100A from 0.1A it does not work. Current limits at 1A only. How do I change it to 100A? ".model SW SW(Ilimit=100)"
also, what is tspan? can I adjust this to 100m or 1000m?
Can I adjust the rise time and fall time of the current pulse?
The default on-resistance of the switch model is 1 Ohm. Therefore, you see max. 1A with your 1V source.
Just add a "ron" parameter to the model definition.
You can make use of the smooth transition parameter "negative vh" to influence rise and fall times. But this is not linear. Let me know f you need an exact linear rise and fall behavior, an other method has to be used then.
The extended model definition could look like this in your case:
.model MYSW SW(Ilimit=10 ron=1m vh=-1)