rtype.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:vadouvan 作者: vadouvan 项目源码 文件源码
def _stamp_port(n, port, context):
    """
    Stamp a port in the MNA matrix by adding KVL and KCL equations to the
    kvl_equations and kcl_equations lists in the context dictionary.
    """
    an = context["a"][n]
    bn = context["b"][n]
    node_voltages = context["node_voltages"]
    kvl_equations = context["kvl_equations"]
    kcl_equations = context["kcl_equations"]

    node1, node2 = port["nodes"]
    v1 = node_voltages[node1]
    v2 = node_voltages[node2]
    port_voltage = (an + bn) / 2
    kvl_equation = sympy.Eq(port_voltage, v2 - v1)
    kvl_equations.append(kvl_equation)

    port_current = (an - bn) / (2 * context["port_resistances"][n])
    context["kcl_equations"][node1] += -port_current
    context["kcl_equations"][node2] += port_current
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号