我正在从事一个自动化项目,该项目需要我在 ngspice 中进行模拟,在 .txt 文件中获取数据并退出 ngspice。我有以下代码来调用 ngspice:
import sys
import os
def invoke_ngspice():
os.system(r"C:\Users\MyPC\Desktop\GUI\ngspice\bin\ngspice_con.exe C:\Users\MyPC\Desktop\GUI\ngspice\bin\test_circuit.circ")
os.system(r"quit")
在调用上述函数进行模拟并完美保存部分时,我无法退出,因为 ngspice 持有执行。有没有干净地退出ngspice?我不想每次都在 ngspice 命令窗口中手动输入 quit 或杀死它,因为模拟时间是可变的。