提问人:Vibhore Jain 提问时间:11/15/2019 更新时间:11/18/2019 访问量:316
模拟后自动退出ngspice
Automatically quitting ngspice after simulation
问:
我正在从事一个自动化项目,该项目要求我在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或杀死它,因为模拟时间是可变的。
答:
0赞
Vibhore Jain
11/18/2019
#1
所以我找到了使用控制循环系统地退出 ngspice 的方法。在 test_circuit.circ 文件中,我在 .control 部分添加了 quit 语句,仅此而已!
.control
set filetype=ascii
run
wrdata temp_file abs(v(A_1)-v(B_1))
quit
.endc
评论