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?
-
\$\begingroup\$ Ever heard of Monte Carlo or stepping features? \$\endgroup\$Andy aka– Andy aka2024年07月06日 09:34:51 +00:00Commented Jul 6, 2024 at 9:34
-
\$\begingroup\$ .step param will do that for you. \$\endgroup\$winny– winny2024年07月06日 10:19:08 +00:00Commented 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\$Kuba hasn't forgotten Monica– Kuba hasn't forgotten Monica2024年07月06日 21:38:25 +00:00Commented 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\$New_User– New_User2024年07月07日 21:12:02 +00:00Commented 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\$New_User– New_User2024年07月07日 21:21:08 +00:00Commented Jul 7, 2024 at 21:21
1 Answer 1
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.
Explore related questions
See similar questions with these tags.