电力系统仿真软件python_Ahkab首页、文档和下载 - 电路仿真软件 - OSCHINA - 中文开源技术交流社区...

类似于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')

输出:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值