LTSpice

From Steak Wiki
Jump to navigationJump to search

LTSpice is a popular simulation package. The successor to LTSpice is qspice, also programmed by the same developer. https://hackaday.com/2023/08/25/qspice-picks-up-where-ltspice-left-us/

Getting Started

General Notes

0 is a gnd in the netlist. That means you can go to: view - spice netlist, and the path items will be 0 V001 or some variation thereof. The netlists are text files, and easily readable. Spice (LTSpice) overall, seems to be a program that one person can understand, which is a benefit, since time is limited.

AoE uses ICAP/4 Spice. It runs about $3,500 for the base software. There is a free demo for schematics under 20 parts. The X chapters, has a section of spice, but it's not in the 3rd edition. They also list, MicroCap 9, MMICAD, and PSpice. There are some Spice book recommendations in the spice section, and in other sections (e.g. the Power, Regulation, and Control, or Amplifiers). This is all in the appendix.

Spice is only a partially useful tool. It's not to be trusted. Actual systems in the world are more complex than our models, so we can't truly simulate a circuit. But that doesn't mean there isn't some value in the models.

Tips/Techniques

Amp Hour Podcast Interview with the Programmer

https://theamphour.com/196-an-interview-with-mike-engelhardt-spice-simulator-synteresis/

Simulating a delay

https://www.youtube.com/watch?v=-aQ77YI7inI A competent user of LTSpice. A good video to show usage and a reasonable circuit as well (the circuit is essentially simulating a 555 timer from discrete (well op amps) components).

Guaranteed to Work on Linux (TM)

For 32 bit linux, use LTSpice XVII (which I have running on Devuan/Debian 12).

Stepping Parameters

beginning, end, interval. E.g. test a capacitor from 2nf to 10nf in 2nf steps.

Exporting Data for a Spreadsheet Graph

Sine Wave Example Graph. An expert in graphs will be able to predict how data will render in a given form of graph. I'm still working on guessing Logarithmic data from Linear data.
how to export waveform data, as in traditional spice? - right click on the graph and
choose file - export data as text.

the data requires a step of processing. you can use sed if you need to automate it
but i used mousepad, and a search and replace, copying the empty (some unicode type space)
character so it's easy to import into libreoffice calc (slow) or gnumeric (better).
you might want to either A) limit the amount of data by zooming into an area or
B) use head -n 1000 to limit the lines of output. I had 24,000 lies which was a bit
much (graphing that much data is slow). See the image example.
of course, this allows you to change the visualization used with the data. in this day
and age, you have to be good with graphs as well. there is no reason not to be.

The .op Function

LTSpice is its own spice. Given that each spice program is slightly different, there are some quirks with trying to get functionality from one to translate to another.


If you add .op, it will output a .op.raw file, which will tell you the voltages of everything. it opens in LTSpice. I'm not sure what encoding it is, (haven't checked yet) as emacs or mousepad has trouble with it. (I'm following the spice textbook i listed above). the .raw is a waveform file for LTSpice. This is different from PSpice, where the .op command will be output into the 'overall' spice output file (according to the textbook).

See Also