Maker Pro
Maker Pro

[LTspice] PWL that loops forever?

C

Chaos Master

Jan 1, 1970
0
I want to make a PWL voltage source that loops forever, as in:

0s -> 0v
1s -> 2v
2s -> 4v
3s -> 10v
4s -> 4v
and repeat 10v and 4v, forever.

Is there any 'hidden' option for the voltage sources do that?
 
J

Jim Thompson

Jan 1, 1970
0
I want to make a PWL voltage source that loops forever, as in:

0s -> 0v
1s -> 2v
2s -> 4v
3s -> 10v
4s -> 4v
and repeat 10v and 4v, forever.

Is there any 'hidden' option for the voltage sources do that?

REPEAT ?:) (If Mikey is following the PSpice "standard", which I
think he is.)

...Jim Thompson
 
M

Mike Engelhardt

Jan 1, 1970
0
Chaos,
I want to make a PWL voltage source that loops forever, as in:

0s -> 0v
1s -> 2v
2s -> 4v
3s -> 10v
4s -> 4v
and repeat 10v and 4v, forever.

Is there any 'hidden' option for the voltage sources do that?

*
V1 1 0 pwl repeat forever 0,0 1,2 2,4 3,10 4,4 endrepeat
..tran 100 100 0 10m
..probe
..end

--Mike
 
C

Chaos Master

Jan 1, 1970
0
I found ancient runes from Mike Engelhardt[[email protected]] in the floor of
sci.electronics.cad:

Mike,
*
V1 1 0 pwl repeat forever 0,0 1,2 2,4 3,10 4,4 endrepeat
.tran 100 100 0 10m
.probe
.end

Thanks for the help. Could you add this to help, please?
 
P

pat dot lawler att verizon dott nneett

Jan 1, 1970
0
A recent post asked for help making a repeating waveform in LTSpice.
This reminded me of a solution I saw in the newsletter 'Analog
Update', published by Analog Design Tools in April 1987.
The general solution involved feeding a custom waveform into a
transmission line, and looping the output of the transmission line
back to the input. The repeat interval is set by the transmission
line delay time.
This method has an advantage that you can combine any number & kind
of voltage sources to create the final waveform. You don't have to
plot the waveform point by point.

Note - even though this uses a transmission line, it's not restricted
to high frequency waveforms (this isn't reality - it's simulation).

For those who have LTSPICE, here's a schematic:
---------------
Version 4
SHEET 1 880 728
WIRE -576 304 -576 256
WIRE -576 256 -544 256
WIRE -448 256 -416 256
WIRE -416 256 -416 304
WIRE -352 320 -352 352
WIRE -224 288 -224 336
WIRE -272 272 -272 336
WIRE -448 224 -352 224
WIRE -352 224 -352 240
WIRE -352 224 -272 224
WIRE -224 208 -224 192
WIRE -224 192 -576 192
WIRE -672 224 -576 224
WIRE -672 256 -672 224
WIRE -672 368 -672 336
WIRE -784 368 -784 320
WIRE -784 240 -784 224
WIRE -784 224 -672 224
WIRE -576 192 -576 224
WIRE -576 224 -544 224
WIRE -224 192 -112 192
WIRE -1104 464 -1104 448
WIRE -832 368 -832 304
WIRE -1104 272 -1104 256
WIRE -1104 256 -864 256
WIRE -64 288 -64 336
WIRE -112 272 -112 336
WIRE -112 224 -112 192
WIRE 32 208 -64 208
WIRE -1104 368 -1104 352
WIRE -864 256 -832 256
FLAG -576 304 0
FLAG -416 304 0
FLAG -352 352 0
FLAG -224 336 0
FLAG -272 336 0
FLAG -672 368 0
FLAG -784 368 0
FLAG -1104 464 0
FLAG -832 368 0
FLAG -64 336 0
FLAG -112 336 0
FLAG -864 256 input
FLAG 32 208 output
SYMBOL tline -496 240 R0
WINDOW 0 -24 40 Left 0
WINDOW 3 -54 72 Left 0
WINDOW 123 -37 99 Left 0
SYMATTR InstName T1
SYMATTR Value Td=50m
SYMATTR Value2 Z0=50
SYMBOL res -368 224 R0
SYMATTR InstName R2
SYMATTR Value 50
SYMBOL g -224 192 R0
WINDOW 0 34 40 Left 0
WINDOW 3 34 73 Left 0
SYMATTR InstName G2
SYMATTR Value 40m
SYMBOL res -688 240 R0
SYMATTR InstName R1
SYMATTR Value 50
SYMBOL g -784 224 R0
WINDOW 0 36 43 Left 0
WINDOW 3 34 72 Left 0
SYMATTR InstName G1
SYMATTR Value 40m
SYMBOL voltage -1104 256 R0
WINDOW 0 -34 4 Left 0
WINDOW 3 -247 -70 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PWL(0 0 500u 10 1m 100 3m 80 4000u 250 6000u 0)
SYMBOL e -64 192 R0
WINDOW 0 36 40 Left 0
WINDOW 3 39 66 Left 0
SYMATTR InstName E1
SYMATTR Value 1
SYMBOL voltage -1104 352 M0
WINDOW 3 24 104 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 100 100 5m 0 0 1)
SYMATTR InstName V2
TEXT -1168 72 Left 0 !.tran 0 200m 0 10u
TEXT -1120 144 Center 0 ;Sample\narbitrary\nwaveform
TEXT -552 104 Left 0 ;Waveform repeater
LINE Normal -832 128 -864 160
LINE Normal -64 128 -832 128
LINE Normal -32 160 -64 128
---------------
 
M

Mike Engelhardt

Jan 1, 1970
0
Pat,
A recent post asked for help making a repeating waveform in
LTSpice. This reminded me of a solution I saw in the
newsletter 'Analog Update', published by Analog Design Tools
in April 1987. The general solution involved feeding a custom
waveform into a transmission line, and looping the output of
the transmission line back to the input. The repeat interval
is set by the transmission line delay time. This method has
an advantage that you can combine any number & kind
of voltage sources to create the final waveform. You don't
have to plot the waveform point by point.

A variation of this technique that is computationally
lighter weight than using a transmission line is to use
a behavioral delay(though the "repeat for endrepeat"
syntax is the fastest) Appended is your schematic
modified to illustrate the technique.

--Mike

--- snip ---
Version 4
SHEET 1 880 728
WIRE -352 416 -352 448
WIRE -352 528 -352 560
WIRE -352 416 -400 416
WIRE -640 416 -688 416
WIRE -480 416 -528 416
WIRE -528 416 -560 416
WIRE -688 624 -688 608
WIRE -688 432 -688 416
WIRE -688 528 -688 512
FLAG -352 560 0
FLAG -528 416 OUT
FLAG -688 624 0
FLAG -688 416 IN
SYMBOL bv -352 432 R0
SYMATTR InstName B1
SYMATTR Value V=delay(2*V(OUT),50m)
SYMBOL res -544 400 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R1
SYMATTR Value 1K
SYMBOL res -384 400 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R2
SYMATTR Value 1K
SYMBOL voltage -688 416 R0
WINDOW 0 -34 4 Left 0
WINDOW 3 -247 -70 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PWL(0 0 500u 10 1m 100 3m 80 4000u 250 6000u 0)
SYMBOL voltage -688 512 M0
WINDOW 3 24 104 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 100 100 5m 0 0 1)
SYMATTR InstName V2
TEXT -568 632 Left 0 !.tran 0 200m 0 10u
 
M

Mike Engelhardt

Jan 1, 1970
0
Attached is yet a slightly better way of doing this with
a behavioral delay. Whereas the first version has three nodes
in the circuit, this one does it with a single node. Input and
output nodes are now the same node. But now the input
waveform has be be specified as a current.

--Mike

--- snip ---
Version 4
SHEET 1 1892 680
WIRE 720 272 720 224
WIRE 720 144 720 112
WIRE 720 112 864 112
WIRE 976 112 976 160
WIRE 976 240 976 272
WIRE 864 112 976 112
FLAG 720 272 0
FLAG 976 272 0
FLAG 864 112 X
SYMBOL bi 720 224 M180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
WINDOW 123 24 -28 Left 0
SYMATTR InstName B2
SYMATTR Value I=delay(V(x),10m)
SYMATTR Value2 Rpar=1
SYMBOL current 976 240 M180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
SYMATTR InstName I1
SYMATTR Value PWL(0 0 1m 0 2m 1 3m 1 4m 0)
TEXT 1022 290 Left 0 !.tran 0 100m 0 .1m
TEXT 632 -8 Left 0 ;I1 is the input. B2 repeats the patter given by I1 and
TEXT 632 24 Left 0 ;supplies the resistance to readout the current as a voltage.
 
M

Mike Rocket J. Squirrel Elliott

Jan 1, 1970
0
Mike said:
Attached is yet a slightly better way of doing this with
a behavioral delay. Whereas the first version has three nodes
in the circuit, this one does it with a single node. Input and
output nodes are now the same node. But now the input
waveform has be be specified as a current.

--Mike

--- snip ---
Version 4
SHEET 1 1892 680
WIRE 720 272 720 224
WIRE 720 144 720 112
WIRE 720 112 864 112
WIRE 976 112 976 160
WIRE 976 240 976 272
WIRE 864 112 976 112
FLAG 720 272 0
FLAG 976 272 0
FLAG 864 112 X
SYMBOL bi 720 224 M180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
WINDOW 123 24 -28 Left 0
SYMATTR InstName B2
SYMATTR Value I=delay(V(x),10m)
SYMATTR Value2 Rpar=1
SYMBOL current 976 240 M180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
SYMATTR InstName I1
SYMATTR Value PWL(0 0 1m 0 2m 1 3m 1 4m 0)
TEXT 1022 290 Left 0 !.tran 0 100m 0 .1m
TEXT 632 -8 Left 0 ;I1 is the input. B2 repeats the patter given by I1 and
TEXT 632 24 Left 0 ;supplies the resistance to readout the current as a voltage.

To paraphrase Homer Simpson,

SPICE. Is there anything it can't do?
 
Top