CZ_OpenSpice/Server/spice/sim_ngspice.py

18 lines
439 B
Python
Raw Normal View History

2021-01-20 12:01:46 +00:00
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
from PySpice.Spice.NgSpice.Shared import NgSpiceShared
def Simulation_Spice(spice_str):
ngspice = NgSpiceShared.new_instance()
try:
ngspice.load_circuit(spice_str)
ngspice.run()
plot_names = ngspice.plot_names
return plot_names
except:
return False
def Waveform_Keys(waveforms):
return waveforms