# Help with LTspice

Discussion in 'Electronic Design' started by viking, Sep 16, 2007.

1. ### vikingGuest

Probably everyone but me knows how to do this but how do you step the
frequency of an AC source while doing a transient analysis, for
example perform a transient analysis at 1MHz steps from 1 to 10MHz.
Thanks
Rob

2. ### Helmut SennewaldGuest

----- Original Message -----
From: "viking" <>
Newsgroups: sci.electronics.design
Sent: Sunday, September 16, 2007 1:19 PM
Subject: Help with LTspice

Hello Rob,

What means "steps"?
What's the type of the signal? (sine?)

Three chances with .TRAN
------------------------
One simulation run: continuous frequency sweep
One simulation run: stepped frequency 1Mhz, 2MHz, ..
Multiple simulation runs: .step command

If you simply want the frequency response of
a linear system, the .AC comamnd should be used.

Can you tell more what you try to simulate?
It will help to give the right answer.

Best regards,
Helmut

LTspice user group
http://tech.groups.yahoo.com/group/LTspice/

3. ### vikingGuest

Hello Helmut,
Sorry not giving full details.
I have .tran 0.01 and an Sine source AC 1
I want to run multiple simulations (plotted on the same graph) for
either a given list of frequencies or continous sweep.
I've tried every combination of syntax using the .STEP comand without
success (usually get syntax error).
For eqample the simple set-up below:-

Version 4
SHEET 1 880 680
WIRE 128 160 128 112
WIRE 128 272 128 240
FLAG 128 272 0
FLAG 128 112 OUT
SYMBOL voltage 128 144 R0
WINDOW 3 73 57 Left 0
WINDOW 123 24 132 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value SINE(0 0.01 1000000)
SYMATTR Value2 AC 1
TEXT -2 506 Left 0 !.tran 0.01

So this gives the result for 1MHz, but how to have it repeat the run
for 2MHz..etc, plotted on the same graph.

Thanks
Rob

4. ### Helmut SennewaldGuest

Hello Rob,

The curly braces {} are needed for values
defined in .step commands.

I have made two sweeper examples for you.

Best regards,
Helmut

Maybe the news reader breaks long TEXT-lines.

TEXT ....
,,,,

TEXT ....,,,,

Stepepd sweep, Test1.asc
------------------------

Version 4
SHEET 1 880 680
WIRE 128 112 128 64
WIRE 416 112 128 112
WIRE 544 112 496 112
WIRE 608 112 544 112
WIRE 544 144 544 112
WIRE 128 160 128 112
WIRE 128 272 128 240
WIRE 544 272 544 208
FLAG 128 272 0
FLAG 128 64 OUT
FLAG 544 272 0
FLAG 608 112 filt
IOPIN 608 112 Out
SYMBOL voltage 128 144 R0
WINDOW 3 73 57 Left 0
WINDOW 123 24 132 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 0.01 {freq1})
SYMATTR Value2 AC 1
SYMATTR InstName V1
SYMBOL res 400 128 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 1k
SYMBOL cap 528 144 R0
SYMATTR InstName C1
SYMATTR Value 100p
TEXT 8 -72 Left 0 !.tran 100u
TEXT 16 -192 Left 0 !.step param freq1 1e6 5e6 2e6
TEXT 8 -40 Left 0 !.options plotwinsize=0
TEXT 16 -160 Left 0 ;.step param freq1 list 1e6 2e6 5e6 10e6

Continuous sweep, Test2.asc
---------------------------

Version 4
SHEET 1 916 680
WIRE -208 -128 -224 -128
WIRE -224 -96 -224 -128
WIRE -224 16 -224 -16
WIRE 224 80 192 80
WIRE 224 112 224 80
WIRE 224 112 112 112
WIRE 272 112 224 112
WIRE 400 112 352 112
WIRE 464 112 400 112
WIRE -224 128 -256 128
WIRE 112 144 112 112
WIRE 400 144 400 112
WIRE 64 160 -80 160
WIRE 64 240 64 208
WIRE 112 240 112 224
WIRE 400 240 400 208
FLAG 192 80 in
FLAG 400 240 0
FLAG 464 112 filt
IOPIN 464 112 Out
FLAG 64 240 0
FLAG 112 240 0
FLAG -224 16 0
FLAG -208 -128 vfmod
FLAG -256 128 vfmod
SYMBOL res 256 128 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 1k
SYMBOL cap 384 144 R0
SYMATTR InstName C1
SYMATTR Value 100p
SYMBOL SpecialFunctions\\modulate -224 128 R0
WINDOW 123 -101 123 Left 0
SYMATTR Value2 space=1 mark=10e6
SYMATTR InstName A1
SYMBOL e 112 128 R0
SYMATTR InstName E1
SYMATTR Value 0.01
SYMBOL voltage -224 -112 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PWL(0 0.1 1m 1)
TEXT 8 -72 Left 0 !.tran 1m
TEXT 16 -192 Left 0 !.param fstart=1e6 fstop=5e6 TSWEEP=100u
TEXT 8 -40 Left 0 !.options plotwinsize=0
TEXT 16 -160 Left 0 ;.step param freq1 list 1e6 2e6 5e6 10e6
TEXT 160 192 Left 0 ;gain

5. ### Jim ThompsonGuest

[snip]

AC is NOT the same as SINE.

You can't run a .AC simultaneously with a .TRAN

...Jim Thompson

6. ### vikingGuest

Hello Helmut
Thanks for that. The first example is the sort of thing I'm after.
But the example you give crashes the application when run!
I modified it at got the following to work:-

Version 4
SHEET 1 880 680
WIRE 128 112 128 64
WIRE 416 112 128 112
WIRE 544 112 496 112
WIRE 608 112 544 112
WIRE 544 144 544 112
WIRE 128 160 128 112
WIRE 128 272 128 240
WIRE 544 272 544 208
FLAG 128 272 0
FLAG 128 64 OUT
FLAG 544 272 0
FLAG 608 112 filt
IOPIN 608 112 Out
SYMBOL voltage 128 144 R0
WINDOW 3 73 57 Left 0
WINDOW 123 24 132 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 0.01 {freq1} 0 0 0 100)
SYMATTR Value2 AC 1
SYMATTR InstName V1
SYMBOL res 400 128 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 100k
SYMBOL cap 528 144 R0
SYMATTR InstName C1
SYMATTR Value 10n
TEXT 224 16 Left 0 !.tran 0.01
TEXT 216 -16 Left 0 !.step param freq1 list 1000 2000 3000

But you only have to change some parameters slightly for it to fall
over, for example .trans 0.1 or add some more fequencies or use 1e6

Rob

7. ### vikingGuest

Hello Helmut, thakns for that.
The first example is what I'm after, but it crashes when run. I
modified it to that shown below and it now runs:-

Version 4
SHEET 1 880 680
WIRE 128 112 128 64
WIRE 416 112 128 112
WIRE 544 112 496 112
WIRE 608 112 544 112
WIRE 544 144 544 112
WIRE 128 160 128 112
WIRE 128 272 128 240
WIRE 544 272 544 208
FLAG 128 272 0
FLAG 128 64 OUT
FLAG 544 272 0
FLAG 608 112 filt
IOPIN 608 112 Out
SYMBOL voltage 128 144 R0
WINDOW 3 73 57 Left 0
WINDOW 123 24 132 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 0.01 {freq1} 0 0 0 100)
SYMATTR Value2 AC 1
SYMATTR InstName V1
SYMBOL res 400 128 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 100k
SYMBOL cap 528 144 R0
SYMATTR InstName C1
SYMATTR Value 10n
TEXT 224 16 Left 0 !.tran 0.01
TEXT 216 -16 Left 0 !.step param freq1 list 1000 2000 3000

But you only have to change a parameter slightly for it to crash, for
example .tran 0.1 or add some more frequency steps.

Rob

8. ### Helmut SennewaldGuest

Hello Rob,

I had reported a similar problem with another circuit
I am sure there will be a fix latest until tomorrow.
Sorry for this problem with the version 2.21m.
I will reply as soon as a new version is available.
If you need a previous version (e.g. 2.21f) of
I will mail it to you. It's 2MB in a zip-file.

http://tech.groups.yahoo.com/group/LTspice/files/

Best regards,
Helmut

9. ### vikingGuest

Hello Helmut,
Thanks for taking the time to help. I will wait for the fix to come
out.
I will not be able to get back to the project I was using it on untill
next week.
Thanks again.
Rob

10. ### Helmut SennewaldGuest

Hello Helmut,
Hello Rob

This bug is fixed now.

Btw, are you aware that this bug has been fixed on Sunday?

Best regards,
Helmut

11. ### vikingGuest

Hello Helmut,