コード例 #1
0
ファイル: test_circuit.py プロジェクト: dreyfert/pycircuit
def test_current_probing_wo_branch():
    """Test current probing with a current divider circuit without current probe"""

    s = sympy.Symbol("s")

    R1, C2, R3 = sympy.symbols("R1", "C2", "R3")

    cir = create_current_divider(R1, R3, C2)

    res = AC(cir, toolkit=symbolic).solve(s, complexfreq=True)

    assert_equal(sympy.simplify(res.i("I1.plus")), (2 + C2 * R3 * s) / (1 + C2 * R3 * s))

    assert_equal(sympy.simplify(res.i("C2.plus")), s * R3 * C2 / (1 + s * R3 * C2))
コード例 #2
0
def test_current_probing_wo_branch():
    """Test current probing with a current divider circuit without current probe"""

    s = sympy.Symbol('s')

    R1, C2, R3 = sympy.symbols(('R1', 'C2', 'R3'))

    cir = create_current_divider(R1,R3,C2)

    res = AC(cir, toolkit=symbolic).solve(s, complexfreq=True)
    
    assert_equal(sympy.simplify(res.i('I1.plus')), (2 + C2*R3*s)/(1 + C2*R3*s))

    assert_equal(sympy.simplify(res.i('C2.plus')), s*R3*C2 / (1 + s*R3*C2))
コード例 #3
0
ファイル: test_circuit.py プロジェクト: dreyfert/pycircuit
def test_current_probing():
    """Test current probing with a current divider circuit"""
    pycircuit.circuit.circuit.default_toolkit = symbolic

    s = sympy.Symbol("s")

    R1, R3, C2 = sympy.symbols("R1", "R3", "C2")

    cir = create_current_divider(R1, R3, C2)

    cir = cir.save_current("I1.plus")

    assert cir.get_terminal_branch("I1.plus") != None

    res = AC(cir, toolkit=symbolic).solve(s, complexfreq=True)

    assert_equal(sympy.simplify(res.i("I1.plus")), (2 + C2 * R3 * s) / (1 + C2 * R3 * s))

    assert_equal(sympy.simplify(res.i("C2.plus")), s * R3 * C2 / (1 + s * R3 * C2))
コード例 #4
0
def test_current_probing():
    """Test current probing with a current divider circuit"""
    pycircuit.circuit.circuit.default_toolkit = symbolic
    
    s = sympy.Symbol('s')

    R1, R3, C2 = sympy.symbols(('R1', 'R3', 'C2'))

    cir = create_current_divider(R1,R3,C2)
    
    cir = cir.save_current('I1.plus')
    
    assert cir.get_terminal_branch('I1.plus') is not None
    
    res = AC(cir, toolkit=symbolic).solve(s, complexfreq=True)

    assert_equal(sympy.simplify(res.i('I1.plus')), (2 + C2*R3*s)/(1 + C2*R3*s))

    assert_equal(sympy.simplify(res.i('C2.plus')), s*R3*C2 / (1 + s*R3*C2))