7
\$\begingroup\$

http://www.linear.com/solutions/1815

The above web-page explains how to export the waveform data to a text file. You basically run the LTspice simulation, clicking on the waveform window, go to File>>Export, chose the variable to be exported and then specify the filename (usually a .txt is convenient). I am looking for a spice directive (or any other command) to automate this process.

I can run the spice file through LTspice using the command line. However, to export the waveform data, I still need to access the GUI. This is botching up my plan to use a python script to simulate the circuit for varying parameters. Any insights are appreciated.

\$\endgroup\$
  • 2
    \$\begingroup\$ I haven't used LTspice much but looking at the docs .WAVE might be worth a look, then maybe you could read that using Python. \$\endgroup\$ – PeterJ Aug 10 '14 at 6:11
3
\$\begingroup\$

I don't think you can generate a txt format directly from the ltspice command line. I recently looked into this and I came across an old discussion which includes the primary author of LTSpice and indicates (at least as of 2003) 1) you can't export text directly from the command line, 2) the binary format is intentionally "secret", 3) there is a separate executable available to do a translation. ( http://www.electronicspoint.com/threads/pspice-global-parameters-time-and-temperature.25088/ note that although the link says pspice, ltspice is also discussed)

So I think the best option is a two step process. 1) run the simulation from command line to generate binary data output 2) run the conversion utility from the command line to generate txt format

You can get the conversion utility "ltsputil" from the yahoo LTspice users group (https://groups.yahoo.com/neo/groups/LTspice/files/%20Util/ltsputil/) and its usage seems to be fairly well documented but with no guarantee it is 100% correct in output or that it won't break in future LTSpice.

I didn't try it yet but may in the near future. Please let me know if you have success with it.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I tried ltsputil.exe -x example.raw dete.txt & ltsputil.exe -c example.raw dete.txt. The former doesn't work, the later just gives me the same file as example.raw but with the name dete.txt (just like copy-paste). \$\endgroup\$ – Shashank Sawant Aug 11 '14 at 7:09
  • \$\begingroup\$ You need to include an a with the -c as in: 'ltsputil.exe -ca example.raw dete.txt' . I also included the o to force overwrite of the existing file so it would be 'ltsputil.exe -cao example.raw dete.txt' That generates a text file for me but it will require some post processing. It would have been nice to get a csv out of it but the values are listed by trace in a single column. \$\endgroup\$ – mbyrne Aug 12 '14 at 19:25
  • \$\begingroup\$ Yeah that worked. Thanks! I still have to figure out which simulations the data represents, but it's an excellent starting point. \$\endgroup\$ – Shashank Sawant Aug 12 '14 at 22:58
6
\$\begingroup\$

I'm sorry to necromance, but you can run LTspice with:

scad3.exe -ascii -b netlist.net

And it'll give you an ascii file output. You can combine this with the .save directive to get convenient output.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Not sure you mean necromance but I'm willing to be taught. \$\endgroup\$ – Andy aka Sep 26 '15 at 15:07
  • \$\begingroup\$ Necromance because the question is over a year old \$\endgroup\$ – Matthew Sainsbury Sep 26 '15 at 15:22
  • \$\begingroup\$ Ah I see - get up to date is my advise LOL \$\endgroup\$ – Andy aka Sep 26 '15 at 15:38
  • \$\begingroup\$ @Matthew Sainsbury please elaborate your answer where to add "scad3.exe -ascii -b netlist.net" \$\endgroup\$ – m_snaeem Apr 22 '17 at 12:11

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.