Esempio n. 1
0
def test_deviceanalysis_viiv():
    """Loopgain of a resistor V-I and a I-V amplifier with a vcvs as gain element"""

    sympy.var('R1 R2 CL A s')

    cir = SubCircuit(toolkit=symbolic)
    cir['A1'] = VCVS(gnd, 'int', 'out', gnd, g = A,toolkit=symbolic)
    cir['R1'] = R('in', 'int', r=R1)
    cir['R2'] = R('int', 'out', r=R2)
    cir['VS'] = VS('in', gnd)

    ana = FeedbackDeviceAnalysis(cir, 'A1', toolkit=symbolic)
    res = ana.solve(s, complexfreq=True)

    assert simplify(res['loopgain'] - (- A * R1 / (R1 + R2))) == 0
Esempio n. 2
0
def test_deviceanalysis_sourcefollower():
    """Loopgain of a source follower"""

    gm,RL,CL,s = sympy.symbols('gm RL CL s')

    cir = SubCircuit(toolkit=symbolic)
    cir['M1'] = VCCS('g', 's', gnd, 's', gm = gm,toolkit=symbolic)
    cir['RL'] = R('s', gnd, r=RL)
    cir['CL'] = C('s', gnd, c=CL)
    cir['VS'] = VS('g', gnd)

    ana = FeedbackDeviceAnalysis(cir, 'M1', toolkit=symbolic)
    res = ana.solve(s, complexfreq=True)

    assert_equal(simplify(res['loopgain']), simplify(- gm / (1/RL + s*CL)))