sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.29k stars 633 forks source link

[Feature] Voltage DC Sweep #776

Closed PedroRodr closed 2 years ago

PedroRodr commented 2 years ago

First of all, thank you for the incredible circuit simulator, it's very useful! My feature request is a voltage DC sweep. I want to analyse the behaviour of a circuit from X (V) to Y (V), with a timestep of Z (ms), and I can't find a way of doing that right now. Sorry if it's a feature that already exists, but I can't find it.

Thanks in advance, Pedro

pfalstad commented 2 years ago

You can use a triangle wave source, like in Circuits->Analog/Digital->Flash ADC

If you want it to go in steps, try using a VCVS like so:

https://tinyurl.com/2yyj8jdy

You can edit the VCVS to see the output function.

floor(mod(t/.01, 10))*.2 + 1

.01 is the timestep in seconds (Z). 10 is the number of steps before it starts over. .2 is the size of each step in volts. 1 is the lowest voltage (X).

PedroRodr commented 2 years ago

Not exactly what I had in mind, but that'll work! Thank you very much for your help!