0
\$\begingroup\$

I am using LTspice to simulate voltage measurements from a circuit. I noticed, with exactly the same circuit components, each time I obtain different results. I assume it is due to thermal noise. (is that right?)

Then I wonder is there a way I can set seed to the SPICE simulation so that my results are reproducible.

To provide more detail: I did a Transient analysis. I am running a circuit with amplifiers, multipliers, resistors and capacitance for 200mS. I run the same circuit with nothing changed (I literally quit LTspice, open again, and hit Run button for the same schema), I found the voltage measurements at one node for the two runs are different. They stay the same for the initial ~30mS, then start to have a lag, then go on completely different tracks. Since nothing about the circuit has changed, I suspect it is caused by thermal noise. Please let me know if there could be other reasons.

Many thanks!

\$\endgroup\$
  • \$\begingroup\$ You need to supply more information. What is your circuit? Are you doing a DC or AC simulation? How different are the results? Thermal noise is not likely to be causing your problem but without more information, no one can tell. \$\endgroup\$ – Barry May 16 '17 at 23:28
  • 1
    \$\begingroup\$ AC Spice doesn't model noise sources directly, but it is configurable for solution precision. You can also run afoul of floating point precision. A circuit with multiplier is non-linear, so AC analysis is not meaningful - use a Transient (voltage vs time) analysis. \$\endgroup\$ – glen_geek May 17 '17 at 2:10
  • \$\begingroup\$ @glen_geek Thanks for the suggestion. Transient analysis gives the same observation that two runs give somewhat different results with nothing in the circuit changed. The two runs track for a while then start to have a lag, then go completely un-sync. \$\endgroup\$ – user75006 May 17 '17 at 2:20
  • \$\begingroup\$ In your transient run, under simulate menu, choose edit simulation cmd and set a small value for maximum time step. See if that helps. Many oscillators have trouble starting from nothing (because noise isn't present). \$\endgroup\$ – glen_geek May 17 '17 at 2:40
  • \$\begingroup\$ By any chance, did you move any components, rewire some nodes, but kept plotting the same v(Nxxx)? Because LTspice changes the names of the nodes dynamically, unless they are explicitly named. \$\endgroup\$ – a concerned citizen May 17 '17 at 5:56
1
\$\begingroup\$

LT spice should be consistent from run to run. Thermal noise is not simulated in a normal transient simulation. If your seeing differences from run to run they could most likely be explained from a numerical solver standpoint and differences on rounding, which some circuits can be quite sensitive to.

Another explanation may be that the models you are using have b-sources with a .rand statement in it, but this is unlikely.

If you are using a .rand statement, there isn't a way to set the seed (documented anywhere that I know of). If you need a .rand section to be repeated from run to run, use a PWL source, record the data as a .wav or PWL file and use that to make the runs consistent.

\$\endgroup\$
  • \$\begingroup\$ Thank you very much for explaining. Just one thing: this source link analyses noise. So noise is only simulated in the .noise mode, but not present in the measurements from the .tran mode? \$\endgroup\$ – user75006 May 17 '17 at 21:01
  • \$\begingroup\$ In addition, I don't understand where the randomness of numerical solvers come from; and how LTspice chooses rounding for each run. Why would those factors be random given exactly the same circuit and initial condition? (Please pardon me if the question looks weird; I am new to spice simulation.) \$\endgroup\$ – user75006 May 17 '17 at 21:14
  • \$\begingroup\$ Its not inherent to spice simulations, it is inherent to computing more specifically floating point calculations. theochem.uni-stuttgart.de/~knizia/random_rounding Numerical solvers can be very sensitive depending on the circuit being simulated. Without knowing more about your circuit and simulation I can only speculate and generalize \$\endgroup\$ – Voltage Spike May 17 '17 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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