01-21-2021 06:59 AM
Hi,
I'm wondering which way to wire data through multiple frames of a Flat Sequence is better. The top option is to just wire frame after frame, the bottom one is to 'exit' the sequence and reenter it later. The code shown is trivially simple, but imagine there are many variables being worked on in that sequence frame by frame, but some of the variables are only used closer to the beginning and then closer to the end of the sequence, as shown.
Solved! Go to Solution.
01-21-2021 07:09 AM
Hi Vitek,
@VitekStepien wrote:
I'm wondering which way to wire data through multiple frames of a Flat Sequence is better.
The best option is to not use a sequence frame at all…
01-21-2021 08:50 AM
Most of us here will agree with GerdW. Whatever you were planning to put in those frames is FAR better off in a subVI and wiring their error terminals to sequence them. Or, build a proper state machine so you have even more control.
It would be best if you tell us what you're trying to achieve so we can suggest the best architecture to implement.
01-21-2021 09:57 AM
Haha I kinda expected the "Never use a sequence dude" answer 🙂 I know it's suboptimal, honestly I'm mostly using it to visually organize the code, not to achieve a specific functionality.
Answering your question, I'm using it in a subvi that executes one step of 4th order Runge Kutta on a set of 3 ODE's, on arrays of values. See the snippet below:
I realize that from dataflow standpoint, I probably don't need the Flat Sequence at all - my question is more conceptual than practical.
01-21-2021 10:06 AM
If it is for "organizing code" then why not use
Structures -> Decorations -> Flat Frame
01-21-2021 10:08 AM
Well, the sequence structure forces LabVIEW to execute in a sub-optimal fashion, so there's a reason behind the advice. Use the Flat Frame decoration to separate your code visually.
01-21-2021 10:09 AM
@Frozen wrote:
If it is for "organizing code" then why not use
Structures -> Decorations -> Flat Frame
Dang, you beat me to it.
01-21-2021 10:09 AM
Frozen, that would certainly work. Does using Sequence automatically slow down the code or in any other way "harm" the performance? In my code there is really nothing that could cause variable race or ambiguity in the output values.
01-21-2021 10:12 AM - edited 01-21-2021 10:12 AM
Forcing your code to execute using a sequence structure is like forcing your car to fire its spark plugs at your discretion. Best to leave the engine to do things the way it needs to - for both cases.
01-21-2021 10:14 AM
Bill, that makes sense. I guess my original question will remain unanswered, since Sequences are a taboo topic, but I appreciate your responses.
Thanks,
Vitek