CSV power source and constant power source

Would it be possible to have constant and CSV sources that simulate the behaviour of a fixed power generator? It would be useful to replicate the load that is requested by circuits like constant current LED drivers, electronic speed controllers, and in general any DC/DC converter with a fixed output voltage/current.

Here is a circuit to evaluate the effects of a supercapacitor on a 12V car battery, to mitigate the current spikes coming from an intermittent load; I'm using the CSV current source to simulate the load but it would be more accurate to use constant power CSV source, since the demand is actually better represented by an amount of power rather than a current.


by germano2239
March 10, 2021

Hi @germano2239,

Look at this example using a Behavioral Current Source defined as 100 / V():

This works to maintain a constant 100 W power consumption in the load element over a wide range of voltages.

Note that it's possible that something like this can easily cause convergence problems in the simulator. Divide-by-zero potential is high, and you can experience this if you extend the range of the DC Sweep simulation here to go from -10 to 10, for example.

You may be able to extend this technique to effectively make a "CSV power source" by replacing the 100 in the numerator with an expression like V(V2.nA), where V2 is a CSV voltage source.

by mrobbins
March 10, 2021

Hi Mike, I've created a copy of the circuit to test your suggestion:


Strangely it seems to work only when the current sign is the opposite of what I need, ie when it's pushing current back to the battery instead of sinking it; I've tried many different methods to invert the current with no luck:

-minus sign in formula of the current source

-minus sign directly in CSV values

-rotating the current source

The simulation always get stuck at 0.9% and the graph data is not meaningful.

Your example though seems to work with both positive and negative power values, so I'm a bit lost. Could you please give it a look? Thanks

by germano2239
March 11, 2021

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.