11.1.9.1. BasicElement¶
This module implements SPICE circuit elements.
Warning
Some elements are partially implemented.
Warning
The API documentation generated by Sphinx is perfectible for this module. The source code can be more informative.
Note
It would be nice to have a useful and working documentation in the interactive environment.
The element’s parameters are internally implemented using class attributes and descriptors.
There are two types of parameters, positionals which are required and where the order mater, and optional parameters which are passed as keyword arguments.
Parameters are registered with more expressive and longer names than their Spice counterparts. For optional parameters, we can use both Spice and longer name for convenience.
See Ngspice documentation for details.
First letter | Element description |
A | XSPICE code model |
B | Behavioral (arbitrary) source |
C | Capacitor |
D | Diode |
E | Voltage-controlled voltage source (VCVS) |
F | Current-controlled current source (CCCs) |
G | Voltage-controlled current source (VCCS) |
H | Current-controlled voltage source (CCVS) |
I | Current source |
J | Junction field effect transistor (JFET) |
K | Coupled (Mutual) Inductors |
L | Inductor |
M | Metal oxide field effect transistor (MOSFET) |
N | Numerical device for GSS |
O | Lossy transmission line |
P | Coupled multiconductor line (CPL) |
Q | Bipolar junction transistor (BJT) |
R | Resistor |
S | Switch (voltage-controlled) |
T | Lossless transmission line |
U | Uniformly distributed RC line |
V | Voltage source |
W | Switch (current-controlled) |
X | Subcircuit |
Y | Single lossy transmission line (TXL) |
Z | Metal semiconductor field effect transistor (MESFET) |
-
class
PySpice.Spice.BasicElement.
BehavioralCapacitor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a behavioral capacitor.
Spice syntax:
CXXXXXXX n+ n- 'expression' <tc1=value> <tc2=value> CXXXXXXX n+ n- C='expression' <tc1=value> <tc2=value>
Keyword Parameters:
Attributes:
-
capacitance_expression
= None¶
-
tc1
= None¶
-
tc2
= None¶
-
-
class
PySpice.Spice.BasicElement.
BehavioralInductor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a behavioral inductor.
Spice syntax:
LXXXXXXX n+ n- 'expression' <tc1=value> <tc2=value> LXXXXXXX n+ n- L='expression' <tc1=value> <tc2=value>
Keyword Parameters:
Attributes:
-
inductance_expression
= None¶
-
tc1
= None¶
-
tc2
= None¶
-
-
class
PySpice.Spice.BasicElement.
BehavioralResistor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a behavioral resistor.
Spice syntax:
RXXXXXXX n+ n- 'expression' <tc1=value> <tc2=value> Rxxxxxxx n+ n- R='expression' <tc1=value> <tc2=value>
Keyword Parameters:
Attributes:
-
resistance_expression
= None¶
-
tc1
= None¶
-
tc2
= None¶
-
-
class
PySpice.Spice.BasicElement.
BehavioralSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a behavioral source.
Spice syntax:
BXXXXXXX n+ n- <i=expr> <v=expr> <tc1=value> <tc2=value> <temp=value> <dtemp=value>
Keyword Parameters:
current_expression
- alias i
voltage_expression
- alias v
temperature
- alias temp
device_temperature
- alias dtemp
Attributes:
-
current_expression
= None¶
-
device_temperature
= None¶
-
tc1
= None¶
-
tc2
= None¶
-
temperature
= None¶
-
voltage_expression
= None¶
-
class
PySpice.Spice.BasicElement.
BipolarJunctionTransistor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
This class implements a bipolar junction transistor.
Spice syntax:
QXXXXXXX nc nb ne <ns> mname <area=val> <areac=val> <areab=val> <m=val> <off> <ic=vbe,vce> <temp=val> <dtemp=val>
Keyword Parameters:
multiplier
- alias m
temperature
- alias temp
device_temperature
- alias dtemp
Attributes:
-
area
= None¶
-
areab
= None¶
-
areac
= None¶
-
base
¶
-
collector
¶
-
device_temperature
= None¶
-
emitter
¶
-
ic
= None¶
-
model
= None¶
-
multiplier
= None¶
-
off
= False¶
-
substrate
¶
-
temperature
= None¶
-
class
PySpice.Spice.BasicElement.
Capacitor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a capacitor.
Spice syntax:
CXXXXXXX n+ n- <value> <mname> <m=val> <scale=val> <temp=val> <dtemp=val> <ic=init_condition>
Keyword Parameters:
multiplier
- alias m
temperature
- alias temp
device_temperature
- alias dtemp
initial_condition
- alias ic
Attributes:
-
capacitance
= None¶
-
device_temperature
= None¶
-
initial_condition
= None¶
-
model
= None¶
-
multiplier
= None¶
-
scale
= None¶
-
temperature
= None¶
-
class
PySpice.Spice.BasicElement.
CoupledInductor
(name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.AnyPinElement
This class implementss a coupled (mutual) inductors.
Spice syntax:
KXXXXXXX LYYYYYYY LZZZZZZZ value
Keyword Parameters:
Attributes:
-
coupling_factor
= None¶
-
inductor1
= None¶
-
inductor2
= None¶
-
-
class
PySpice.Spice.BasicElement.
CoupledMulticonductorLine
(netlist, name, *nodes, **parameters)[source]¶ Bases:
PySpice.Spice.Netlist.NPinElement
This class implements coupled multiconductor lines.
Spice syntax:
PXXXXXXX NI1 NI2 ... NIX GND1 NO1 NO2 ... NOX GND2 model <len=length>
Attributes:
Note
As opposite to Spice, the model is specified before the nodes so as to act as *args.
-
length
= None¶
-
model
= None¶
-
-
class
PySpice.Spice.BasicElement.
CurrentControlledCurrentSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a linear current-controlled current sources (CCCS).
Spice syntax:
FXXXXXXX n+ n- vname value <m=val>
Keyword Parameters:
multiplier
- alias m
Attributes:
-
current_gain
= None¶
-
multiplier
= None¶
-
source
= None¶
-
class
PySpice.Spice.BasicElement.
CurrentControlledSwitch
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a current controlled switch.
Spice syntax:
WYYYYYYY n+ n- vname model <on> <off>
Keyword Parameters:
Attributes:
-
initial_state
= None¶
-
model
= None¶
-
source
= None¶
-
-
class
PySpice.Spice.BasicElement.
CurrentControlledVoltageSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a linear current-controlled voltage sources (CCVS).
Spice syntax:
HXXXXXXX n+ n- vname value
Keyword Parameters:
Attributes:
-
source
= None¶
-
transresistance
= None¶
-
-
class
PySpice.Spice.BasicElement.
CurrentSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements an independent sources for current.
Spice syntax:
IYYYYYYY n+ n- <<dc> dc/tran value> <ac <acmag <acphase>>> <distof1 <f1mag <f1phase>>> <distof2 <f2mag <f2phase>>>
Keyword Parameters:
Attributes:
-
dc_value
= None¶
-
-
class
PySpice.Spice.BasicElement.
Diode
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
This class implements a junction diode.
Spice syntax:
DXXXXXXX n+ n- mname <area=val> <m=val> <pj=val> <off> <ic=vd> <temp=val> <dtemp=val>
Keyword Parameters:
Attributes:
-
anode
¶
-
area
= None¶
-
cathode
¶
-
device_temperature
= None¶
-
ic
= None¶
-
minus
¶
-
model
= None¶
-
multiplier
= None¶
-
off
= False¶
-
pj
= None¶
-
plus
¶
-
temperature
= None¶
-
-
class
PySpice.Spice.BasicElement.
DipoleElement
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
This class implements a base class for dipole element.
-
minus
¶
-
plus
¶
-
-
class
PySpice.Spice.BasicElement.
GSSElement
[source]¶ Bases:
PySpice.Spice.Netlist.NPinElement
This class implements GSS device.
Warning
Not implemented
-
class
PySpice.Spice.BasicElement.
Inductor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements an inductor.
Spice syntax:
LYYYYYYY n+ n- <value> <mname> <nt=val> <m=val> <scale=val> <temp=val> <dtemp=val> <ic=init_condition>
Keyword Parameters:
multiplier
- alias m
temperature
- alias temp
device_temperature
- alias dtemp
initial_condition
- alias ic
Attributes:
-
device_temperature
= None¶
-
inductance
= None¶
-
initial_condition
= None¶
-
model
= None¶
-
multiplier
= None¶
-
nt
= None¶
-
scale
= None¶
-
temperature
= None¶
-
class
PySpice.Spice.BasicElement.
JfetElement
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
-
drain
¶
-
gate
¶
-
source
¶
-
-
class
PySpice.Spice.BasicElement.
JunctionFieldEffectTransistor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.JfetElement
This class implements a bipolar junction transistor.
Spice syntax:
JXXXXXXX nd ng ns mname <area> <off> <ic=vds,vgs> <temp=t>
Keyword Parameters:
Attributes:
-
area
= None¶
-
ic
= None¶
-
model
= None¶
-
multiplier
= None¶
-
off
= False¶
-
temperature
= None¶
-
-
class
PySpice.Spice.BasicElement.
LosslessTransmissionLine
(name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.TwoPortElement
This class implements a lossless transmission line.
Spice syntax:
TXXXXXXX N1 N2 N3 N4 Z0=VALUE <TD=VALUE> <F=FREQ <NL=NRMLEN>>
where TD or F, NL must be specified.
Keyword Parameters:
impedance
- alias:Z0
time_delay
- alias:TD
frequency
- alias:F
normalized_length
- alias:NL
Attributes:
Note: Either time_delay or frequency must be given.
-
frequency
= None¶
-
impedance
= 50¶
-
normalized_length
= None¶
-
time_delay
= None¶
-
class
PySpice.Spice.BasicElement.
LossyTransmission
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.TwoPortElement
This class implements lossy transmission lines.
Spice syntax:
OXXXXXXX n1 n2 n3 n4 model
Attributes:
Note
As opposite to Spice, the model is specified before the nodes so as to act as *args.
-
model
= None¶
-
-
class
PySpice.Spice.BasicElement.
Mesfet
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.JfetElement
This class implements a Metal Semiconductor Field Effect Transistor.
Spice syntax:
ZXXXXXXX nd ng ns mname <area> <off> <ic=vds,vgs>
Keyword Parameters:
Attributes:
-
area
= None¶
-
ic
= None¶
-
model
= None¶
-
multiplier
= None¶
-
off
= False¶
-
-
class
PySpice.Spice.BasicElement.
Mosfet
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
This class implements a Metal Oxide Field Effect Transistor.
Spice syntax:
MXXXXXXX nd ng ns nb mname <m=val> <l=val> <w=val> + <ad=val> <as=val> <pd=val> <ps=val> <nrd=val> + <nrs=val> <off> <ic=vds,vgs,vbs> <temp=t>
Keyword Parameters:
multiplier
- alias m
length
- alias l
width
- alias w
drain_area
- alias ad
source_area
- alias as
drain_perimeter
- alias pd
source_perimeter
- alias ps
drain_number_square
- alias nrd
source_number_square
- alias nrs
temperature
- alias temp
Attributes:
-
bulk
¶
-
drain
¶
-
drain_area
= None¶
-
drain_number_square
= None¶
-
drain_perimeter
= None¶
-
gate
¶
-
ic
= None¶
-
length
= None¶
-
model
= None¶
-
multiplier
= None¶
-
off
= False¶
-
source
¶
-
source_area
= None¶
-
source_number_square
= None¶
-
source_perimeter
= None¶
-
substrate
¶
-
temperature
= None¶
-
width
= None¶
-
class
PySpice.Spice.BasicElement.
NonLinearCurrentSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a non-linear current sources.
Warning
Partially implemented
Spice syntax:
Gxxx n+ n- value={expr} Gxxx n1 n2 TABLE {expression}=(x0,y0) (x1,y1) (x2,y2) Gxxx n+ n- ( POLY (nd) ) nc1+ nc1- ( nc2+ nc2- ... ) p0 ( p1 ... ) Laplace
Keyword Parameters:
Attributes:
-
transconductance
= None¶
-
-
class
PySpice.Spice.BasicElement.
NonLinearVoltageSource
(name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a non-linear voltage source.
Warning
Partially implemented
Spice syntax:
Exxx n+ n- vol='expr' Exxx n+ n- value={expr} Exxx n1 n2 TABLE {expression}=(x0,y0) (x1,y1) (x2,y2) Exxx n+ n- ( POLY (nd) ) nc1+ nc1- ( nc2+ nc2- ... ) p0 ( p1 ... ) Laplace
Keyword Parameters:
Attributes:
-
class
PySpice.Spice.BasicElement.
Resistor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a resistor.
Spice syntax:
RXXXXXXX n+ n- value <ac=val> <m=val> <scale=val> <temp=val> <dtemp=val> <noisy=0|1>
Keyword Parameters:
Attributes:
-
ac
= None¶
-
device_temperature
= None¶
-
multiplier
= None¶
-
noisy
= None¶
-
resistance
= None¶
-
scale
= None¶
-
temperature
= None¶
-
-
class
PySpice.Spice.BasicElement.
SemiconductorCapacitor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a semiconductor capacitor.
Spice syntax:
CXXXXXXX n+ n- <value> <mname> <l=length> <w=width> <m=val> <scale=val> <temp=val> <dtemp=val> <ic=init_condition>
Keyword Parameters:
length
- alias l
width
- alias w
multiplier
- alias m
temperature
- alias temp
device_temperature
- alias dtemp
initial_condition
- alias ic
Attributes:
-
capacitance
= None¶
-
device_temperature
= None¶
-
initial_condition
= None¶
-
length
= None¶
-
model
= None¶
-
multiplier
= None¶
-
scale
= None¶
-
temperature
= None¶
-
width
= None¶
-
class
PySpice.Spice.BasicElement.
SemiconductorResistor
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements a Semiconductor resistor.
Spice syntax:
RXXXXXXX n+ n- <value> <mname> <l=length> <w=width> <temp=val> <dtemp=val> m=<val> <ac=val> <scale=val> <noisy=0|1>
Keyword Parameters:
length
- alias l
width
- alias w
temperature
- alias temp
device_temperature
- alias dtemp
multiplier
- alias m
Attributes:
-
ac
= None¶
-
device_temperature
= None¶
-
length
= None¶
-
model
= None¶
-
multiplier
= None¶
-
noisy
= None¶
-
resistance
= None¶
-
scale
= None¶
-
temperature
= None¶
-
width
= None¶
-
class
PySpice.Spice.BasicElement.
SingleLossyTransmissionLine
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.TwoPortElement
This class implements single lossy transmission lines.
Spice syntax:
YXXXXXXX N1 0 N2 0 model <len=length>
Attributes:
Note
As opposite to Spice, the model is specified before the nodes so as to act as *args.
-
length
= None¶
-
model
= None¶
-
-
class
PySpice.Spice.BasicElement.
SubCircuitElement
(netlist, name, subcircuit_name, *nodes, **parameters)[source]¶ Bases:
PySpice.Spice.Netlist.NPinElement
This class implements a sub-circuit.
Spice syntax:
XYYYYYY node1 node2 ... subcircuit_name parameter1=value1 ...
Attributes:
Note
As opposite to Spice, the circuit’s name is specified before the nodes so as to act as *args.
-
subcircuit_name
= None¶
-
-
class
PySpice.Spice.BasicElement.
TwoPortElement
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
This class implements a base class for two-port element.
-
input_minus
¶
-
input_plus
¶
-
output_minus
¶
-
output_plus
¶
-
-
class
PySpice.Spice.BasicElement.
UniformDistributedRCLine
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.Netlist.FixedPinElement
This class implements uniform distributed RC lines.
Spice syntax:
UXXXXXXX n1 n2 n3 model l=length <n=number_of_lumps>
Attributes:
length
- alias l length of the RC line in meters
number_of_lumps
- alias n
Note
As opposite to Spice, the model is specified before the nodes so as to act as *args.
-
capacitance_node
¶
-
input
¶
-
length
= None¶
-
model
= None¶
-
number_of_lumps
= None¶
-
output
¶
-
class
PySpice.Spice.BasicElement.
VoltageControlledCurrentSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.TwoPortElement
This class implements a linear voltage-controlled current sources (VCCS).
Spice syntax:
Gxxx n+ n- nc+ nc- value <m=val>
Keyword Parameters:
multiplier
- alias m
Attributes:
-
multiplier
= None¶
-
transconductance
= None¶
-
class
PySpice.Spice.BasicElement.
VoltageControlledSwitch
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.TwoPortElement
This class implements a voltage controlled switch.
Spice syntax:
SXXXXXXX n+ n- nc+ nc- model <on> <off>
Keyword Parameters:
Attributes:
-
initial_state
= None¶
-
model
= None¶
-
-
class
PySpice.Spice.BasicElement.
VoltageControlledVoltageSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.TwoPortElement
This class implements a linear voltage-controlled voltage sources (VCVS).
Spice syntax:
EXXXXXXX n+ n- nc+ nc- value
Keyword Parameters:
Attributes:
-
voltage_gain
= None¶
-
-
class
PySpice.Spice.BasicElement.
VoltageSource
(netlist, name, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.DipoleElement
This class implements an independent sources for voltage.
Spice syntax:
VXXXXXXX n+ n- <<dc> dc/tran value> <ac <acmag <acphase>>> <distof1 <f1mag <f1phase>>> <distof2 <f2mag <f2phase>>>
Keyword Parameters:
Attributes:
-
dc_value
= None¶
-
-
class
PySpice.Spice.BasicElement.
XSpiceElement
(netlist, name, *nodes, **parameters)[source]¶ Bases:
PySpice.Spice.Netlist.NPinElement
This class implements a sub-circuit.
Spice syntax:
AXXXXXXX <%v ,%i ,%vd ,%id ,%g,%gd ,%h,%hd , or %d> + <[> <~><%v ,%i ,%vd ,%id ,%g,%gd ,%h,%hd , or %d> + <NIN1 or +NIN1 -NIN1 or "null"> + <~>...< NIN2 .. <]> > + <%v ,%i ,%vd ,%id ,%g,%gd ,%h,%hd ,%d or %vnam > + <[> <~><%v ,%i ,%vd ,%id ,%g,%gd ,%h,%hd , or %d>< NOUT1 or +NOUT1 -NOUT1 > + <~>...< NOUT2 .. <]>> + MODELNAME . MODEL MODELNAME MODELTYPE + <( PARAMNAME1 = <[> VAL1 <VAL2 ... <]>> PARAMNAME2 ..>)>
Attributes:
Note
As opposite to Spice, the model is specified before the nodes so as to act as *args.
Warning
Partially implemented.
-
model
= None¶
-