Python Forum
Connection LTspice-Python with PyLTSpice
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connection LTspice-Python with PyLTSpice
#1
Hello everybody,

Does anyone have experience with integrating LTspice circuitry into Python, i.e. primarily .asc files?

Does anyone happen to know what's wrong with the following code? For example, how can you output the voltage at the output of the circuit?

import pyltspice
circuit = pyltspice.Circuit.from_file("test12Vtransistor.asc")
circuit.set_analysis_type("tran")
circuit.set_time_range(0, 10ms) # 10ms Simulationsdauer
circuit.set_step_size(1ms) # 1ms Schrittweite
circuit.simulate()
time = circuit.get_time()

import matplotlib.pyplot as plt

plt.plot(time, voltage)
plt.xlabel("Zeit (ms)")
plt.ylabel("Spannung (V)")
plt.title("Simulationsergebnisse")
plt.grid(True)
plt.show()
I am a beginner with Python and until now I have many problems to understand how to realize that.

Thanks for your help!!!
Larz60+ write Feb-05-2024, 02:48 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Tags have been added for you on this post. Please use BBCode tags on future posts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I don't know what is wrong (Python and SQL connection) shereen 3 371 Apr-01-2024, 08:56 AM
Last Post: Pedroski55
  No Internet connection when running a Python script basil_555 8 663 Mar-11-2024, 11:02 AM
Last Post: snippsat
  Virtual Env changing mysql connection string in python Fredesetes 0 383 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  connection python and SQL dawid294 4 680 Dec-12-2023, 08:22 AM
Last Post: Pedroski55
  Networking Issues - Python GUI client and server connection always freezes Veritas_Vos_Liberabit24 0 741 Mar-21-2023, 03:18 AM
Last Post: Veritas_Vos_Liberabit24
  Python MYSQL connection does not work after 1h idle zazas321 9 6,841 Oct-07-2021, 12:02 PM
Last Post: ndc85430
  Serial connection connection issue Joni_Engr 15 8,100 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  How can I make a plot representing connection relationship with python matplotlib? Berlintofind 1 1,966 May-08-2020, 09:27 PM
Last Post: jefsummers
  Connection DATABASE to Python MenThoLLt 3 2,442 Jan-17-2020, 10:35 PM
Last Post: DT2000
  Python Aspentech IP.21 connection MarcoWedel 0 1,988 Dec-17-2019, 10:02 PM
Last Post: MarcoWedel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020