Electronic – LTSpice Transient Analysis – How to specify the number of data points per step

ltspicesimulation

I performed a 1us duration transient analysis on a basic inverting op-amp circuit with the resistor value Rx sweeping from 846 Ohms to 1385 Ohms. When I export the data to a text file (File -> Export data as text), the resulting text file has multiple data points for each "step". As an example, for Rx = 848, LTSpice creates 3 data points at 0s, 819ns, and 1us (See Figure 2).

Parsing this text file in excel is a bit annoying but not impossible, I just need to extract every 4th element. However, the problem is that LTSpice generates more data points for some "steps". In Figure 3, for Rx = 1.38k, LTSpice generates 4 data points instead of 3. Now data parsing in excel becomes annoying because sometimes I need to extract every 5th element, while other times I need to extract every 6th element.

So my question is: Is there a way to specify the number of data points created in each step?

Figure 1:

enter image description here

Figure 2:

enter image description here

Figure 3:

enter image description here

Best Answer

In general, SPICE uses an adaptive step-size in transient simulations to minimize simulation time while maintaining accuracy. When circuit variables (node voltages, for example) are changing rapidly, it will take shorter time steps, and when circuit variables are changing slowly, it will take longer time steps.

You can specify a "maximum timestep" in case you want to override the built-in algorithm (either because you find the built-in algorithm doesn't give accurate results or to produce denser points for plotting). In your case, specifying a maximum of maybe 0.1 or 0.2 us would likely result in this timestep being used for all your simulation runs, at the cost of longer simulation times. Specify this in the "Edit Simulation Command" dialog.

Alternatively, you could post-process the results to interpolate output values on whatever time intervals you want, or simply do an x vs y plot in Excel instead of the standard y vs category plot.