Circuit elements¶
- class pycircuit.circuit.elements.R(*args, **kvargs)¶
Resistor element
>>> c = SubCircuit() >>> n1=c.add_node('1') >>> c['R'] = R(n1, gnd, r=1e3) >>> c['R'] R('plus','minus',r=1000.0,noisy=True) >>> c.G(numeric.zeros(2)) array([[ 0.001, -0.001], [-0.001, 0.001]]) >>> c = SubCircuit() >>> n2=c.add_node('2') >>> c['R'] = R(n1, n2, r=1e3) >>> c.G(numeric.zeros(2)) array([[ 0.001, -0.001], [-0.001, 0.001]])
- class pycircuit.circuit.elements.C(*args, **kvargs)¶
Capacitor
>>> c = SubCircuit() >>> n1=c.add_node('1') >>> c['C'] = C(n1, gnd, c=1e-12) >>> c.G(numeric.zeros(2)) array([[ 0., 0.], [ 0., 0.]]) >>> c.C(numeric.zeros(2)) array([[ 1.00000000e-12, -1.00000000e-12], [ -1.00000000e-12, 1.00000000e-12]])
- class pycircuit.circuit.elements.L(*args, **kvargs)¶
Inductor
>>> c = SubCircuit() >>> n1=c.add_node('1') >>> c['L'] = L(n1, gnd, L=1e-9) >>> c.G(numeric.zeros(3)) array([[ 0., 0., 1.], [ 0., 0., -1.], [ 1., -1., 0.]]) >>> c.C(numeric.zeros(3)) array([[ 0.0000e+00, 0.0000e+00, 0.0000e+00], [ 0.0000e+00, 0.0000e+00, 0.0000e+00], [ 0.0000e+00, 0.0000e+00, -1.0000e-09]])
- class pycircuit.circuit.elements.VS(*args, **kvargs)¶
Independent DC voltage source
>>> from dcanalysis import DC >>> c = SubCircuit() >>> n1=c.add_node('1') >>> c['vs'] = VS(n1, gnd, v=1.5) >>> c['R'] = R(n1, gnd, r=1e3) >>> DC(c,refnode=gnd).solve().x array([ 1.5 , 0. , -0.0015])
- class pycircuit.circuit.elements.VSin(*args, **kvargs)¶
Independent sinus volatge source
- class pycircuit.circuit.elements.ISin(*args, **kvargs)¶
Independent sinus current source
- class pycircuit.circuit.elements.VPulse(*args, **kvargs)¶
Independent pulse voltage source
- class pycircuit.circuit.elements.VCVS(*args, **kvargs)¶
Voltage controlled voltage source
>>> from dcanalysis import DC >>> c = SubCircuit() >>> n1, n2 =c.add_nodes('1', '2') >>> c['vs'] = VS(n1, gnd, v=1.5) >>> c['vcvs'] = VCVS(n1, gnd, n2, gnd, g=2) >>> c.nodes [Node('1'), Node('2'), Node('gnd', isglobal=True)] >>> c.branches [Branch(Node('1'),Node('gnd', isglobal=True)), Branch(Node('2'),Node('gnd', isglobal=True))] >>> c['vcvs'].G(numeric.zeros(4)) array([[ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 1.], [ 0., 0., 0., 0., -1.], [ 2., -2., -1., 1., 0.]])
- class pycircuit.circuit.elements.SVCVS(*args, **kvargs)¶
Voltage controlled voltage source with frequency dependent transfer
>>> from dcanalysis import DC >>> c = SubCircuit() >>> n1, n2 =c.add_nodes('1', '2') >>> c['vs'] = VS(n1, gnd, v=1.5) >>> c['vcvs'] = VCVS(n1, gnd, n2, gnd, g=2) >>> c.nodes [Node('1'), Node('2'), Node('gnd', isglobal=True)] >>> c.branches [Branch(Node('1'),Node('gnd', isglobal=True)), Branch(Node('2'),Node('gnd', isglobal=True))] >>> c['vcvs'].G(numeric.zeros(4)) array([[ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 1.], [ 0., 0., 0., 0., -1.], [ 2., -2., -1., 1., 0.]])
- class pycircuit.circuit.elements.VCCS(*args, **kvargs)¶
Voltage controlled current source
>>> from dcanalysis import DC >>> c = SubCircuit() >>> n1,n2 = c.add_nodes('1', '2') >>> c['vs'] = VS(n1, gnd, v=1.5) >>> c['vccs'] = VCCS(n1, gnd, n2, gnd, gm=1e-3) >>> c['rl'] = R(n2, gnd, r=1e3) >>> DC(c,refnode=gnd).solve().x array([ 1.5, -1.5, 0. , 0. ])
- class pycircuit.circuit.elements.Nullor¶
From Wikipedia, the free encyclopedia
A nullor is a theoretical two-port network comprised of a nullator at its input and a norator at its output.[1] Nullors represent an ideal amplifier, having infinite current, voltage, transconductance and transimpedance gain.[2] Its transmission parameters are all zero.
- [1] The name “nullor” was introduced by H.J. Carlin
Singular network elements, IEEE Trans. Circuit Theory, March 1965, vol. CT-11, pp. 67-72.
- [2] Verhoeven C J M van Staveren A Monna G L E Kouwenhoven
M H L & Yildiz E (2003). Structured electronic design: negative feedback amplifiers. Boston/Dordrecht/London: Kluwer Academic, �2.2.2 pp. 32-34. ISBN 1402075901.
- class pycircuit.circuit.elements.Gyrator¶
>>> c = SubCircuit() >>> n1=c.add_node('1') >>> n2=c.add_node('2') >>> n3=c.add_node('3') >>> n4=c.add_node('4') >>> c['Gyrator'] = Gyrator(n1, n2, n3, n4, gm=1) >>> c['Gyrator'].G(numeric.zeros(4)) array([[ 0., 0., 1., -1.], [ 0., 0., -1., 1.], [-1., 1., 0., 0.], [ 1., -1., 0., 0.]])
- class pycircuit.circuit.elements.Diode(*args, **kvargs)¶
Nonlinear diode
- class pycircuit.circuit.elements.VCVS_limited(*args, **kvargs)¶
Voltage controlled voltage source with limited output voltage.
The output voltage is limited by a $Than$ function
- class pycircuit.circuit.elements.Idtmod(*args, **kvargs)¶
Modulus integrator
Output voltage is the time integral of input voltage, modulo “modulus”, and an offset.
>>> import pycircuit.circuit._numeric as numeric >>> from pycircuit.circuit.transient import Transient >>> c = SubCircuit() >>> nin, nout = c.add_nodes('in', 'out') >>> c['vin'] = VS(nin, gnd, v=1.0) >>> c['R'] = R(nout, gnd, r=1e3) >>> c['Idtmod'] = Idtmod(nin, gnd, nout, gnd, modulus=1.0) >>> tran = Transient(c, toolkit=numeric) >>> result = tran.solve(tend=1.5, timestep=0.5) >>> result.v(nout).y array([ 0.5, 0. , 0.5])