11.1.10.4. HighLevelElement¶
This module implements high level elements built on top of Spice elements.
-
class
PySpice.Spice.HighLevelElement.AcLine(netlist, name, node_plus, node_minus, rms_voltage=230, frequency=50)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SinusoidalVoltageSource
-
class
PySpice.Spice.HighLevelElement.AmplitudeModulatedCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.AmplitudeModulatedMixinThis class implements a amplitude modulated waveform current source.
See
AmplitudeModulatedMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.AmplitudeModulatedMixin(offset, amplitude, modulating_frequency, carrier_frequency, signal_delay)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a Amplitude Modulated source.
Name
Parameter
Default Value
Units
Vo
offset
V, A
Va
amplitude
V, A
Mf
modulating frequency
Hz
Fc
carrier frequency
1 / Tstop
Hz
Td
signal delay
s
Spice Syntax:
AM(VA VO MF FC TD)
The shape of the waveform is described by the following equation:
\[V(t) = V_a (V_o + \sin (2\pi M_f\,t)) \sin (2\pi F_c\,t)\]
-
class
PySpice.Spice.HighLevelElement.AmplitudeModulatedVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.AmplitudeModulatedMixinThis class implements a amplitude modulated waveform voltage source.
See
AmplitudeModulatedMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc[source]¶ Bases:
object-
AS_UNIT(value, none=False)¶
-
-
class
PySpice.Spice.HighLevelElement.ExponentialCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.ExponentialMixinThis class implements a exponential waveform current source.
See
ExponentialMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.ExponentialMixin(initial_value, pulsed_value, rise_delay_time=0.0, rise_time_constant=None, fall_delay_time=None, fall_time_constant=None)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a Exponential waveform.
Nomenclature:
Name
Parameter
Default Value
Units
V1
Initial value
V, A
V2
pulsed value
V, A
Td1
rise delay time
0.0
sec
tau1
rise time constant
Tstep
sec
Td2
fall delay time
Td1+Tstep
sec
tau2
fall time constant
Tstep
sec
Spice Syntax:
EXP ( V1 V2 TD1 TAU1 TD2 TAU2 )
The shape of the waveform is described by the following formula:
Let V21 = V2 - V1 and V12 = V1 - V2.
\[\begin{split}V(t) = \begin{cases} V_1 & \text{if}\ 0 \leq t < T_{d1}, \\ V_1 + V_{21} ( 1 − e^{-\frac{t-T_{d1}}{\tau_1}} ) & \text{if}\ T_{d1} \leq t < T_{d2}, \\ V_1 + V_{21} ( 1 − e^{-\frac{t-T_{d1}}{\tau_1}} ) + V_{12} ( 1 − e^{-\frac{t-T_{d2}}{\tau_2}} ) & \text{if}\ T_{d2} \leq t < T_{stop} \end{cases}\end{split}\]
-
class
PySpice.Spice.HighLevelElement.ExponentialVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.ExponentialMixinThis class implements a exponential waveform voltage source.
See
ExponentialMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.PieceWiseLinearCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.PieceWiseLinearMixinThis class implements a piece wise linear waveform current source.
See
PieceWiseLinearMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.PieceWiseLinearMixin(values, repeat_time=None, delay_time=None, dc=None)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a Piece-Wise Linear waveform.
Spice Syntax:
PWL( T1 V1 <T2 V2 T3 V3 T4 V4 ... > ) <r=value> <td=value>
Each pair of values (Ti , Vi) specifies that the value of the source is Vi (in Volts or Amps) at time = Ti . The value of the source at intermediate values of time is determined by using linear interpolation on the input values. The parameter r determines a repeat time point. If r is not given, the whole sequence of values (Ti , Vi ) is issued once, then the output stays at its final value. If r = 0, the whole sequence from time = 0 to time = Tn is repeated forever. If r = 10ns, the sequence between 10ns and 50ns is repeated forever. the r value has to be one of the time points T1 to Tn of the PWL sequence. If td is given, the whole PWL sequence is delayed by a delay time time = td. The current source still needs to be patched, td and r are not yet available.
values should be given as a list of (Time, Value)-tuples, e.g.:
PieceWiseLinearVoltageSource( circuit, 'pwl1', '1', '0', values=[(0, 0), (10@u_ms, 0), (11@u_ms, 5@u_V), (20@u_ms, 5@u_V)], )
-
class
PySpice.Spice.HighLevelElement.PieceWiseLinearVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.PieceWiseLinearMixinThis class implements a piece wise linear waveform voltage source.
See
PieceWiseLinearMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.PulseCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.PulseMixinThis class implements a pulse waveform current source.
See
PulseMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.PulseMixin(initial_value, pulsed_value, pulse_width, period, delay_time=0, rise_time=0, fall_time=0, phase=None, dc_offset=0)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a pulse waveform.
Nomenclature:
Name
Parameter
Default Value
Units
V1
initial value
V, A
V2
pulsed value
V, A
Td
delay time
0.0
sec
Tr
rise time
Tstep
sec
Tf
fall time
Tstep
sec
Pw
pulse width
Tstop
sec
Period
period
Tstop
sec
Phase
phase
0.0
sec
Phase is only possible when XSPICE is enabled
Spice Syntax:
PULSE ( V1 V2 Td Tr Tf Pw Period Phase )
A single pulse so specified is described by the following table:
Time
Value
0
V1
Td
V1
Td+Tr
V2
Td+Tr+Pw
V2
Td+Tr+Pw+Tf
V1
Tstop
V1
Note: default value in Spice for rise and fall time is the simulation transient step, pulse width and period is the simulation stop time.
Public Attributes:
delay_timefall_timeinitial_valueperiodphasepulse_widthpulsed_valuerise_time-
property
frequency¶
-
property
-
class
PySpice.Spice.HighLevelElement.PulseVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.PulseMixinThis class implements a pulse waveform voltage source.
See
PulseMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.RandomCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.RandomMixinThis class implements a random waveform current source.
See
RandomMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.RandomMixin(random_type, duration=0, time_delay=0, parameter1=1, parameter2=0)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a Random Voltage source.
The TRRANDOM option yields statistically distributed voltage values, derived from the ngspice random number generator. These values may be used in the transient simulation directly within a circuit, e.g. for generating a specific noise voltage, but especially they may be used in the control of behavioral sources (B, E, G sources, voltage controllable A sources, capacitors, inductors, or resistors) to simulate the circuit dependence on statistically varying device parameters. A Monte-Carlo simulation may thus be handled in a single simulation run.
Spice Syntax:
TRRANDOM( TYPE TS <TD <PARAM1 <PARAM2> > >)
TYPE determines the random variates generated: 1 is uniformly distributed, 2 Gaussian, 3 exponential, 4 Poisson. TS is the duration of an individual voltage value. TD is a time delay with 0 V output before the random voltage values start up. PARAM1 and PARAM2 depend on the type selected.
Type
Parameter 1
Default
Parameter 2
Default
uniform
range
1
offset
0
gaussian
standard dev.
1
mean
0
exponential
mean
1
offset
0
poisson
lambda
1
offset
0
-
class
PySpice.Spice.HighLevelElement.RandomVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.RandomMixinThis class implements a random waveform voltage source.
See
RandomMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.SingleFrequencyFMCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.SingleFrequencyFMMixinThis class implements a single frequency FM waveform current source.
See
SingleFrequencyFMMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.SingleFrequencyFMMixin(offset, amplitude, carrier_frequency, modulation_index, signal_frequency)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a Single-Frequency FM waveform.
Spice Syntax:
SFFM (VO VA FC MDI FS )
Name
Parameter
Default Value
Units
Vo
offset
V, A
Va
amplitude
V, A
Fc
carrier frequency
1 / Tstop
Hz
Mdi
modulation index
Fs
signal frequency
1 / Tstop
Hz
The shape of the waveform is described by the following equation:
\[V(t) = V_o + V_a \sin (2\pi F_c\, t + M_{di} \sin (2\pi F_s\,t))\]
-
class
PySpice.Spice.HighLevelElement.SingleFrequencyFMVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.SingleFrequencyFMMixinThis class implements a single frequency FM waveform voltage source.
See
SingleFrequencyFMMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.SinusoidalCurrentSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.CurrentSource,PySpice.Spice.HighLevelElement.CurrentSourceMixinAbc,PySpice.Spice.HighLevelElement.SinusoidalMixinThis class implements a sinusoidal waveform current source.
See
SinusoidalMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-
-
class
PySpice.Spice.HighLevelElement.SinusoidalMixin(dc_offset=0, ac_magnitude=1, offset=0, amplitude=1, frequency=50, delay=0, damping_factor=0)[source]¶ Bases:
PySpice.Spice.HighLevelElement.SourceMixinAbcThis class implements a sinusoidal waveform.
Name
Parameter
Default Value
Units
Vo
offset
V, A
Va
amplitude
V, A
f
frequency
1 / TStop
Hz
Td
delay
0.0
sec
Df
damping factor
0.01
1/sec
The shape of the waveform is described by the following formula:
\[\begin{split}V(t) = \begin{cases} V_o & \text{if}\ 0 \leq t < T_d, \\ V_o + V_a e^{-D_f(t-T_d)} \sin\left(2\pi f (t-T_d)\right) & \text{if}\ T_d \leq t < T_{stop}. \end{cases}\end{split}\]Spice syntax:
SIN ( Voffset Vamplitude Freq Tdelay DampingFactor )
Public Attributes:
ac_magnitudeamplitudedamping_factordc_offsetdelayfrequencyoffset-
property
period¶
-
property
rms_voltage¶
-
property
-
class
PySpice.Spice.HighLevelElement.SinusoidalVoltageSource(netlist, name, node_plus, node_minus, *args, **kwargs)[source]¶ Bases:
PySpice.Spice.BasicElement.VoltageSource,PySpice.Spice.HighLevelElement.VoltageSourceMixinAbc,PySpice.Spice.HighLevelElement.SinusoidalMixinThis class implements a sinusoidal waveform voltage source.
See
SinusoidalMixinfor documentation.-
format_spice_parameters()¶ Return the formatted list of parameters.
-