1
\$\begingroup\$

For circuit simulations I have mostly been using LTpice, where the netlist is generated automatically with a Python script I wrote and run using the following Python command: subprocess.run([ltspice_executable, -b, my_netlist])(1).

The voltages of my circuit are extracted by reading the generated raw files using the Python package: ltspice.

Now I have to move to Ngspice (@Related question with no answers here). My LTspice netlist only contains resistors inductors and capacitors so it could basically run in Ngspice with no problem whatsoever.

I would like to know if there is a similar Python command to the one I use in LTspice (expression(1)) to run Ngspice from my Python script and extract my voltages?

ocrdu
9,34123 gold badges33 silver badges43 bronze badges
asked Mar 2, 2021 at 9:28
\$\endgroup\$
3
  • 1
    \$\begingroup\$ According to the manual (16.8) it says -b is batch mode. I haven't used it, but you're welcome to try. \$\endgroup\$ Commented Mar 2, 2021 at 10:19
  • \$\begingroup\$ @aconcernedcitizen will check it out. Thank you! \$\endgroup\$ Commented Mar 2, 2021 at 11:33
  • \$\begingroup\$ @aconcernedcitizen It worked very well thank you again !! \$\endgroup\$ Commented Mar 2, 2021 at 13:16

1 Answer 1

1
\$\begingroup\$

Following @aconcernedcitizen's comment, the command to be used in order to run Ngspice in batch mode from python is the following: subprocess.run([path_to_ngspice_executable,'-r','rawfile.raw','-b','-i',my_netlist]).

Where rawfile.raw here will contain all the voltages distributions and is supposed to be read to extract the voltage distribution. For LTspice the ltspice python package see here, whereas for Ngspice raw files I am still trying to figure it out...

answered Mar 2, 2021 at 13:19
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.