-
Notifications
You must be signed in to change notification settings - Fork 20
Transient sources
SpicePy handles the following transient sources:
- PWL: piecewise linear waveform
- PULSE: pulsed waveform
- SIN: damped sinusoidal waveform
- EXP: exponential waveform
Each waveform can be associated to an independent voltage generator or an independent current generator.
The PWL waveform can be defined using the following syntax:
pwl(T1 Val1 T2 Val2 <T3 Val3 T4 Val4 ...>)
where:
-
Tx
is a time instant (x=1, 2, 3, ...
) -
Valx
is the value of the function at timeTx
(x=1, 2, 3, ...
)
At leat two time-value pairs (T1-Val1
and T2-Val2
) must be provided. The other pairs are optional. Below T1
the value is set to Val1
and above T2
the value is set to Val2
.
The following generator in a netlist:
V1 1 0 pwl(0 1 10e-3 4 40e-3 4 60e-3 0.5 100e-3 0.5)
defines the voltage between nodes 1 and 0 in the figure below.
The PULSE waveform can be defined using the following syntax:
pulse(Val1 Val2 <Td Tr Tf Pw Period>)
where:
-
Val1
is the low value -
Val2
is the high value -
Td
is rise time delay (s) (optional. Default is zero) -
Tr
rise time (s) (optional. Default is time-step) -
Tf
fall time (s) (optional. Default istd1 + time_step
) -
Pw
pulse width (s) (default is the end of the simulation) -
Period
period of the waveform (s) (default is the end of the simulation)
The waveform value is:
-
Val1
fort < Td
- linear ramp from
Val1
toVal2
forTd < t < Td + Tr
-
Val2
forTd + Tr < t < Td + Tr + Pw
- linear ramp from
Val2
toVal1
forTd + Tr + Pw < t < Td + Tr + Pw + Tf
-
Val2
forTd + Tr + Pw + Tf < t < (Period - Td + Tr + Pw + Tf)
The following generator in a netlist:
I2 3 4 pulse(1 5 10e-3 2e-3 5e-3 20e-3 40e-3)
defines the current from nodes 3 to 4 in the figure below.
The SIN waveform can be defined using the following syntax:
sin(V0 Va <freq Td Df Phase>)
where:
-
V0
is the offset -
Va
is the amplitude -
freq
is the frequency (Hz) (optional. Default is 1/tstop) -
Td
is the delay (s) -
Df
is the damping factor (1/s) -
Phase
is the phase (deg)
The waveform value is :
-
Vo + Va * sin(Phase)
fort < Td
-
Vo + Va * sin(2 * PI * freq * (t - Td) + Phase) * exp(-(t - Td) * Df)
fort < Td
fort > Td
The following generator in a netlist:
V3 A B sin(0 1 10e-3 4 40e-3 4 60e-3 0.5 100e-3 0.5)
defines the voltage between nodes A and B in the figure below.
The EXP waveform can be defined using the following syntax:
exp(Val1 Val2 <Td1 tau1 Td2 tau2>)
where:
-
Val1
: initial value -
Val2
: peak value -
Td1
: rise time delay (s) -
tau1
: rise time constant (s) -
Td2
: fall time delay (s) -
tau2
: fall time constant (s)
The waveform value is:
-
Val1
fort < Td1
- from
Val1
toVal2
with exponential decay (time constanttau1
) forTd1 < t < Td2
(ifTd2 < 5*T1
the voltage reachesV(Td2) < Val2
) - from
Val2
toVal1
with exponential decay (time constanttau2
) fort > Td2
(ifV(Td2) < V2
the exponential decay is fromV(Td2)
toVal1
)
The following generator in a netlist:
I4 C D sin(-3 4 10e-3 2e-3 50e-3 10e-3)
defines the current from nodes C to B in the figure below.