Trouble using CSV voltage source, or expressions in Voltage source

I'm trying to stimulate a circuit by applying a signal which repeatedly does this:

  1. Output sine wave (square would suffice), -1v to +1v, 50Hz for 5 cycles
  2. Output rectified sine wave (square would suffice), 0v to 1v, 50Hz for 5 cycles

I tried using the CSV voltage source to implement this with PWS-generated square waves, but it seems it just DC at +1v with the following used as the value:


I also tried using the following with a voltage source, but it just output 0v:

if( t>0.1, sin( 2 * pi * 50 ), max( sin( 2 * pi * 50),0 ) )

what am I doing wrong? Thanks

by Jodes
March 23, 2014


i) You haven't posted a public or unlisted circuit so no-one can see what you might have done wrong.

Using the CL CSV source and pasting your CVS list into it does not appear to work: you just get a steady 1V out as you already found however, your CVS list works OK when pasted into an ideal voltage source using a PWS() function;

I don't know why the CL CSV source doesn't work.

You probably should raise a BUG REPORT about it as described in:

ii) The reason your if() statement didn't work is that your arbitrary source expressions are missing the "T" for time. Hence they are stuck at a multiple of 2*pi and so the sine is always zero.

To make a time varying sinusoid, the expression should be of the form:




by signality
March 23, 2014

Thanks again @Signality.

The PWS function within the ideal voltage source component worked.

I will investigate your suggestions on the other methods at some point soon and report back. (Although I must point out that when using the sine functions, I used lower case T rather than upper case, which perhaps was not recognised as the time variable?)

by Jodes
March 24, 2014


CL, unlike spice, is case sensitive so an expression like:


will work but


will not.

As I said earlier, your circuit is private, so I based my comment on the missing 'T' in your sine sources on the text you quoted:

"f( t>0.1, sin( 2 * pi * 50 ), max( sin( 2 * pi * 50),0 ) )"

which has no time parameter in it.


by signality
March 24, 2014

Hi folks,

I was facing the same problem with the "non-working" CSV Voltage source. In fact, there is something very important: 1 instruction per line !! Here is the corrected version:

by scharpen
March 24, 2015

Oups !!! It is a 1year old message. I saw 2014, but read 2015... Pfff... getting old ;-)

by scharpen
March 24, 2015

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.