Ahkab 介绍
类似于spice命令行电路仿真软件,使用python开发,可以对电路进行数值计算分析和符号计算分析。其符号分析系统目前只提供小信号分析方法,另外数值计算分析除了提供spice提供的直流分析、交流分析、暂态分析等功能外,还提供额外的零极点分析。
示例代码:
from ahkab import new_ac, run from ahkab.circuit import Circuit from ahkab.plotting import plot_results # calls matplotlib for you import numpy as np # Define the circuit cir = Circuit('Butterworth 1kHz band-pass filter') cir.add_vsource('V1', 'n1', cir.gnd, dc_value=0., ac_value=1.) cir.add_resistor('R1', 'n1', 'n2', 50.) cir.add_inductor('L1', 'n2', 'n3', 0.245894) cir.add_capacitor('C1', 'n3', 'n4', 1.03013e-07) cir.add_inductor('L2', 'n4', cir.gnd, 9.83652e-05) cir.add_capacitor('C2', 'n4', cir.gnd, 0.000257513) cir.add_inductor('L3', 'n4', 'n5', 0.795775) cir.add_capacitor('C3', 'n5', 'n6', 3.1831e-08) cir.add_inductor('L4', 'n6', cir.gnd, 9.83652e-05) cir.add_capacitor('C4', 'n6', cir.gnd, 0.000257513) cir.add_capacitor('C5', 'n7', 'n8', 1.03013e-07) cir.add_inductor('L5', 'n6', 'n7', 0.245894) cir.add_resistor('R2', 'n8', cir.gnd, 50.) # Define the analysis ac1 = new_ac(.97e3, 1.03e3, 1e2, x0=None) # run it res = run(cir, ac1) # plot the results plot_results('5th order 1kHz Butterworth filter', [('|Vn8|',"")], res['ac'], outfilename='bpf_transfer_fn.png')
输出:
Ahkab 官网
https://pypi.python.org/pypi/ahkab/0.13
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。