-
Notifications
You must be signed in to change notification settings - Fork 22
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:
-
Txis a time instant (x=1, 2, 3, ...) -
Valxis 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:
-
Val1is the low value -
Val2is the high value -
Tdis rise time delay (s) (optional. Default is zero) -
Trrise time (s) (optional. Default is time-step) -
Tffall time (s) (optional. Default istd1 + time_step) -
Pwpulse width (s) (default is the end of the simulation) -
Periodperiod of the waveform (s) (default is the end of the simulation)
The waveform value is:
-
Val1fort < Td - linear ramp from
Val1toVal2forTd < t < Td + Tr -
Val2forTd + Tr < t < Td + Tr + Pw - linear ramp from
Val2toVal1forTd + Tr + Pw < t < Td + Tr + Pw + Tf -
Val2forTd + 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:
-
V0is the offset -
Vais the amplitude -
freqis the frequency (Hz) (optional. Default is 1/tstop) -
Tdis the delay (s) -
Dfis the damping factor (1/s) -
Phaseis 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 < Tdfort > 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:
-
Val1fort < Td1 - from
Val1toVal2with exponential decay (time constanttau1) forTd1 < t < Td2(ifTd2 < 5*T1the voltage reachesV(Td2) < Val2) - from
Val2toVal1with exponential decay (time constanttau2) fort > Td2(ifV(Td2) < V2the 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.