2
\$\begingroup\$

Not sure how much is known or published about the back end of CircuitLab, but:

While simulating a different circuit, I noticed very long simulation time. I narrowed the culprit down to the below portion. With a DC sweep on V1 from 0V to 5V and a relatively large step of 0.1V it still takes several minutes:

schematic

simulate this circuit – Schematic created using CircuitLab

Changing the Op Amp or BJT model didn't make a difference.

Simply replacing the BJT with a MOSFET speeds up the same simulation so that it runs in a fraction of a second.

schematic

simulate this circuit

Any ideas what's tripping up CircuitLab? Is it just that the BJT model implementation is more complex than the MOSFET?

(Please no answers telling me to use different software.)

\$\endgroup\$
3
  • \$\begingroup\$ Unfortunately I don't have a great idea, but I did notice that if you significantly increase the base resistance of the BJT (change R_B to be at least 10 Mohm) then the simulation is very quick. Seems consistent with the FET being faster. Did you try asking on the Circuitlab help forums? \$\endgroup\$
    – Halleff
    Commented Jun 10, 2021 at 19:46
  • \$\begingroup\$ What is the need of R3 in the first picture? \$\endgroup\$ Commented Jun 10, 2021 at 19:58
  • 1
    \$\begingroup\$ @Circuitfantasist I guess it's not needed. I was tinkering around with it trying to see what might make a difference, and left it in to make sure it was a fair comparison to the MOSFET circuit. \$\endgroup\$
    – Theodore
    Commented Jun 10, 2021 at 20:10

1 Answer 1

6
\$\begingroup\$

(CircuitLab developer here.) It's much, much faster if you use the Op-Amp model without voltage rails:

schematic

simulate this circuit – Schematic created using CircuitLab

From which I get the following plot in just a few seconds:

enter image description here

This slowdown is noted in the CircuitLab documentation:

If the op-amp will not be asked to saturate its output at voltage rails, using the op-amp component that doesn't have the rails will lead to faster simulation, and generally "behaves better" in terms of circuit convergence.

\$\endgroup\$
2
  • \$\begingroup\$ I can definitely work with this. The rest of the circuit should be keeping the output far from the rails. \$\endgroup\$
    – Theodore
    Commented Jun 10, 2021 at 20:17
  • \$\begingroup\$ Why is it so slow compared to Falstad’s? Even using an LM358 with rails? Try this on CL tinyurl.com/yjd9ubph or this tinyurl.com/yjop4azo \$\endgroup\$
    – D.A.S.
    Commented Jun 12, 2021 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.