At the present I have a voltage source in the kicad schematic:
VPULSE y1=-12 y2=12 td=10m tr=2u tf=2u tw=500u per=1m np=30 ac=0
Before and after the pulses, the output is at -12V.
Is there a way to output 0V before and after the pulses (during the td=10m time and after np=30 has been finished) but still have the pulses go between -12V and +12V?
I have looked at the ch. 4 of the ngspice manual, but it is not immediately obvious to me. Hopefully someone has already done it or knows how to!
But I don’t figure out how to specify the repeat and delay (r=, td=) parameters in kicad?
There is a “code” tab in the simulation model editor, and I can write them there, but nothing happens when I simulate, and the next time I look in the code tab they are gone…
Holger beat me by a few minutes by posting while I was reading the ngSpice manual. The “r” value adds a repeat parameter.
4.1.4
Piece-Wise Linear
General form:
PWL ( T1 V1 < T2 V2 T3 V3 T4 V4 … >) <r = value > < td = value >
Examples:
VCLOCK 7 5 PWL (0 -7 10 NS -7 11 NS -3 17 NS -3 18 NS -7 50 NS -7) + r =0 td =15 NS
Each pair of values (T i , V i ) specifies that the value of the source is V i (in Volts or Amps)
at time = T i . 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 set to -1 or is not given, the whole sequence of values (T i , V i ) is issued once
only, 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 the value of td. Please note that for now r and td are available only with the voltage source, not with the current source.
I did attempt to write some 10-12 pulses into the PWL manually, and it works. Is just somewhat tedious. Do you know where I can find the details about reading them from a file?
Another option is to use two sources and an “ideal” switch. Never tried it myself but I’m quite sure there are some simple primitives you can combine to generate a complex test signal. It also makes it more visual, which is also a bonus.