04-23-2021 10:45 AM
Hi
I have three nested loops in the state machine to control AC power supply voltage, Frequency, and third loop for DC Load current. Each loop runs at least 5 iterations then the state machine moves to the next state. I have made three for loops conditional terminal. I have applied local variables of the stop button to loop conditions. When I press the Stop button and the test is running these loops, it stops only after finishing loops. Is there any way to stop the test immediately?
Regards.
Matharoo
04-23-2021 10:53 AM
(I don't consider a pyramid of FOR loops a state machine and strongly recommend to start over with a more reasonable architecture.)
Still, your problem is caused by dataflow in that your various "stop" local variables in each loop get read first thing and you get one additional iteration on each plane. You need to enforce dataflow so these locals get read only after all code in each loop has executed.
I am not sure why you need local variables. You could place the stop terminal in the innermost loop and wire to all stop conditions from there. Now it can even remain latch action.
04-23-2021 12:22 PM
Hi Altenbach,
Thanks. If I use the stop button in the inner loop then there will be two stop buttons at the front panel. One from the Event structure and one from the Inner Loop. How I can hook both the stop buttons?
Regarding dataflow, You mean I have to put Excel Table vi outside the For loops?
Regards.
Matharoo
04-23-2021 01:06 PM
@Matharoo wrote:
Thanks. If I use the stop button in the inner loop then there will be two stop buttons at the front panel. One from the Event structure and one from the Inner Loop.
Why? That statement makes no sense at all!
@Matharoo wrote:
Regarding dataflow, You mean I have to put Excel Table vi outside the For loops?
No? What does that have anything to do with the discussion?
You attach a broken snippet and mention an event structure that does not exist. If you want more specific help, attach the actual toplevel VI that includes the toplevel while loop and event structure so we get the full picture.
04-23-2021 06:26 PM
Hi Altenbach,
Sorry. Due to the large size of the project file, I am unable to attach it.
That's why I added only the png of Nested loops.
Regards.
Matharoo