0
\$\begingroup\$

I'm new to python. I have a python code to simulate my LTspice model. I need to change the on time in the pulse parameters and I need a large number of simulations for at least 100 different Ton. So I want to add an iterative function in the python code that can change the Ton every 1s within a specific range. Please how can I achieve this?

winny
18.1k6 gold badges53 silver badges74 bronze badges
asked Jul 6, 2024 at 9:07
\$\endgroup\$
6
  • \$\begingroup\$ Ever heard of Monte Carlo or stepping features? \$\endgroup\$ Commented Jul 6, 2024 at 9:34
  • \$\begingroup\$ .step param will do that for you. \$\endgroup\$ Commented Jul 6, 2024 at 10:19
  • 1
    \$\begingroup\$ You can do all of that inside LtSpice. The Python code would have to generate the .asc file and then start LtSpice. \$\endgroup\$ Commented Jul 6, 2024 at 21:38
  • \$\begingroup\$ @Andyaka yes i have heard about Monte Carlo but never used it. I will maje some research on it, thanks. \$\endgroup\$ Commented Jul 7, 2024 at 21:12
  • \$\begingroup\$ @winny Thank you for your response. My supervisor told me to use Python, but I will try your suggestions. I want to add that,I need a lot of values. Can I simulate 100+ steps with .step param? \$\endgroup\$ Commented Jul 7, 2024 at 21:21

1 Answer 1

1
\$\begingroup\$

You can call ltspice from the command line:

XVIIx64.exe -Run -b examplecircuit.asc

So you would need to modify the .asc file and then run it.

You can also run netlist files which are easier to manipulate.

It would probably be best to generate a netlist file and then modify the text in python and then run it.

use .meas statements to generate a text output you can parse.

answered Jul 8, 2024 at 22:02
\$\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.