rtype.py 文件源码

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

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

    node1, node2, node3, node4 = vcvs["nodes"]
    v1 = node_voltages[node1]
    v2 = node_voltages[node2]
    v3 = node_voltages[node3]
    v4 = node_voltages[node4]
    gain = vcvs.get("gain", sympy.Symbol("A"))

    kvl_equation = sympy.Eq(gain * (v2 - v1), v4 - v3)
    kvl_equations.append(kvl_equation)

    current = vcvs_currents[n]
    kcl_equations[node3] += -current
    kcl_equations[node4] += current
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号