Hi guys, does any one know how LTSpice decides on the order of 2 step commands?
For example:
.step param A list 1 2
.step param B list 3 4
When you run, which is the outer loop and which one is the inner loop?
I.e. do we get:
Sim 1: A=1 B=3
Sim 2: A=1 B=4
Sim 3: A=2 B=3
Sim 4: A=2 B=4
- OR -
Sim 1: A=1 B=3
Sim 2: A=2 B=3
Sim 3: A=1 B=4
Sim 4: A=2 B=4
Is there a way to force an order?
Thanks!
- Sandro
For example:
.step param A list 1 2
.step param B list 3 4
When you run, which is the outer loop and which one is the inner loop?
I.e. do we get:
Sim 1: A=1 B=3
Sim 2: A=1 B=4
Sim 3: A=2 B=3
Sim 4: A=2 B=4
- OR -
Sim 1: A=1 B=3
Sim 2: A=2 B=3
Sim 3: A=1 B=4
Sim 4: A=2 B=4
Is there a way to force an order?
Thanks!
- Sandro
Good question. This may be one for the LTspice group (now at groups.io).
My WAG would be: Whatever comes first in the file is run first.
My WAG would be: Whatever comes first in the file is run first.
Hi Sgrossklass, do you have a link to the LTSpice group forum so I can post the question?
Thanks!
Thanks!
Found the answer in the group...
"You can make nested .step loops up to 3 levels.
It's important to have all .step commands in one text box
to get control about its order of execution."
So as long it is in the same text box, it will follow the order you write it in. Therefore, for:
.step param A list 1 2
.step param B list 3 4
It will be:
Sim 1: A=1 B=3
Sim 2: A=2 B=3
Sim 3: A=1 B=4
Sim 4: A=2 B=4
A bit counter intuitive if you ask me, since for loops work the other way, but it is what it is.
- Sandro
"You can make nested .step loops up to 3 levels.
It's important to have all .step commands in one text box
to get control about its order of execution."
So as long it is in the same text box, it will follow the order you write it in. Therefore, for:
.step param A list 1 2
.step param B list 3 4
It will be:
Sim 1: A=1 B=3
Sim 2: A=2 B=3
Sim 3: A=1 B=4
Sim 4: A=2 B=4
A bit counter intuitive if you ask me, since for loops work the other way, but it is what it is.
- Sandro
Last edited:
Yes, but why?
Sandro, this is interesting and new to me. But I am curious as to why this might be important. For example, the sim where A=2, B=4 will give the same result and plots regardless of whether it is sim 1 or sim 4. What is the situation where the order of execution needs to be controlled?
Is there a way to force an order?
Found the answer in the group...
Sandro, this is interesting and new to me. But I am curious as to why this might be important. For example, the sim where A=2, B=4 will give the same result and plots regardless of whether it is sim 1 or sim 4. What is the situation where the order of execution needs to be controlled?
Hi Ludus,
Loop gain simulations (Tian and Middlebrook) require 2 consecutive simulations.
Therefore, if you want to run Loop Gain under different conditions, you need to arrange the simulation order such that the 2 loop gain sims run before the condition changes.
Using my example, you want A to be the loop gain sims and B be changing condition (e.g. changing a cap value).
Best, Sandro
Loop gain simulations (Tian and Middlebrook) require 2 consecutive simulations.
Therefore, if you want to run Loop Gain under different conditions, you need to arrange the simulation order such that the 2 loop gain sims run before the condition changes.
Using my example, you want A to be the loop gain sims and B be changing condition (e.g. changing a cap value).
Best, Sandro
Hi Ludus,
Loop gain simulations (Tian and Middlebrook) require 2 consecutive simulations.
Therefore, if you want to run Loop Gain under different conditions, you need to arrange the simulation order such that the 2 loop gain sims run before the condition changes.
Excellent! I think in the dim and distant past I had wondered if there was a way to automate loop gain sims with different conditions, and had come to the conclusion that I simply had to do them separately. So thanks for showing me a way to circumvent this issue. I can now get more than one loop gain plot on the same chart.
- Home
- Design & Build
- Software Tools
- Nested simulation loop in LTSpice