03-17-2022 04:09 AM
Hello, i have a problem with this VI. I want to make the 2 subVIs happen one after another in the while loop: when the first one has finished the second one starts, and when it ends the loop starts again. I tried to come up with a solution with a case structure, making the second subVI as a condition for the result of the first one, but it doesnt really work: the second subVI only runs for a couple of seconds when the condition is respected, but since the first subVI runs from start , it stops running after a seconds. What could i do to make the two VIs run sequentially as i said?
Thank you
Solved! Go to Solution.
03-17-2022 05:23 AM
If your VIs have error cluster terminals wire them to set the order you want. If not, you can use a Flat Sequence Structure.
03-17-2022 05:41 AM
Hi,
@LucianM wrote:
If not, you can use a Flat Sequence Structure.
In that case you should rather make those subVIs to use errorIO to enable simple DATAFLOW…
03-17-2022 06:02 AM
03-17-2022 06:58 AM
I managed to do it with a flat sequence, gonna also try with the error i/o dataflow and see what fits my case more.
My only problem now is that i have all of this in a while loop to make it run repeatedly, but it just doesnt happen (only runs one time), any idea why?
03-17-2022 07:33 AM
Hi
I think the problem is, that the second loop has a false constant wired to its stop condition. It runs endlessly.
If you make it a true constant it should work.
03-17-2022 07:51 AM
problem is, if i make it a true constant, the first subVI will start running again instantly, during the time the second subVI still runs, which i dont want to
03-17-2022 08:00 AM
No, this is not true! VIs are executed one after the other. Use Highlight Execution to see better what's happening:
03-17-2022 08:50 AM
@domcorrado wrote:
I managed to do it with a flat sequence, gonna also try with the error i/o dataflow and see what fits my case more.
My only problem now is that i have all of this in a while loop to make it run repeatedly, but it just doesnt happen (only runs one time), any idea why?
Having now seen your code I would suggest that you learn about state machines. With a state machine architecture you can accomplish this task with a single loop - no need for getting stuck inside of inner loops or finding ways to program around that. I've attached what that could look like with your example.