Data Dependency and the Sequence Structure
Dataflow Execution Order: Wires, Readiness, and Frames
Dataflow execution order determines when operations become eligible to run in a LabVIEW block diagram. You use it whenever one calculation needs another calculation’s result, or an instrument operation must follow an earlier operation. Read the wires and structure boundaries to establish order. A tidy left-to-right layout helps you understand a diagram, but position alone does not schedule its nodes.
Read readiness from the wires
A data dependency exists when a node requires data produced by another node. An ordinary node becomes eligible to execute when all its required inputs are available. Its downstream consumers must wait for its output.
Suppose two processing nodes feed a combining node. The combining node waits for both results, even if one arrives much earlier. The two producers have no required order relative to each other unless another wire or structure establishes one.
Independent nodes may run concurrently. However, eligibility does not guarantee an immediate start: execution resources, scheduling, and shared resources can delay a ready node.
Add dependencies when order matters
Use an existing result wire when it already expresses the required order. For example, a conversion node naturally follows the node that produces its measurement.
Some operations need ordering without exchanging a numerical result. Compatible error input and output terminals can provide a dependency: wire the first subVI’s error output to the second subVI’s error input. The second subVI then waits for the first subVI to return its error information. Giving both subVIs the same initial error cluster does not create that chain.
This wiring also carries error information. Ordering and error handling are related but distinct: a downstream subVI may skip its normal operation when it receives an error, according to that subVI’s documented behavior. Completion of a command-sending subVI also does not automatically prove that an external device has finished moving or settling.
Use sequence frames deliberately
A sequence structure groups operations into frames with a specified execution order. A Flat Sequence displays its frames side by side. Frame 0 executes before frame 1, and the next frame waits until all work in the preceding frame finishes. Required input data must also be available.
Within a frame, ordinary dataflow rules still apply. Two unwired nodes in the same frame have no imposed mutual order. A Stacked Sequence displays one frame at a time and executes frames in numerical order.
Arrangement | Order established |
|---|---|
Independent nodes outside a sequence | No required mutual order |
Output of A wired to required input of B | B waits for A’s output |
Independent nodes in one frame | No required order within that frame |
A in one frame, B in the next | B waits for the entire earlier frame |
Sequence frames are useful when the required order cannot conveniently be expressed through suitable terminals. Keep their scope narrow: enclosing unrelated work can introduce unnecessary waiting.
Separate order from elapsed time
For an ideal timing calculation, assume fixed node durations, sufficient resources, immediate starts when eligible, and negligible overhead. If all external inputs are available at time zero, a node with upstream producers obeys
Here si is its start time, fi its finish time, and di its duration. A source node starts at zero under these assumptions. Concurrent branches contribute their longest duration to a join, whereas serialized operations contribute a sum.
These calculations describe the stated ideal model, not a guaranteed desktop execution time. To measure an operation, establish start-timer, operation, end-timer order explicitly. The measured interval can also include scheduling delays and timing overhead.
What to remember
- Follow required inputs to determine readiness.
- Independent nodes may overlap; simultaneous starts are not guaranteed.
- Successive frames order all enclosed work, not just selected nodes.
- Execution order alone does not establish an exact duration.
Example: Preserving Overlap in a Calibration Calculation
A LabVIEW application processes a stored calibration dataset. Prepare takes 6.0 ms and supplies inputs to two independent custom subVIs: Correction takes 18.0 ms, and Reference takes 11.0 ms. Combine requires both results and takes 4.0 ms. The original diagram has no sequence structure.
Assume Prepare starts at time zero, all other external inputs are available then, sufficient resources exist for concurrent execution, every eligible node starts immediately, and scheduling and wire-transfer overhead are negligible. Treat the durations as exact for this ideal model.
a) Determine when Correction and Reference become eligible, and explain whether one must wait for the other.
Both subVIs require Prepare’s output. Prepare starts at zero and finishes after its stated duration:
At 6.0 ms, both branches have their required inputs. There is no dependency between them, so neither must wait for the other. Under the stated ideal scheduling assumptions, both start at 6.0 ms. In an actual application, readiness alone would not guarantee identical start times.
b) Calculate when Combine finishes in the original diagram.
Calculate the branch finish times from their common start time. Because the branches run concurrently in this model, their execution durations are not added to each other.
Combine needs both outputs, so it starts at the later finish time and then runs for 4.0 ms:
Combine finishes at 28.0 ms after Prepare starts. Reference finishes earlier, but its result alone cannot make Combine ready.
c) An engineer adds a Flat Sequence after Prepare: frame 0 contains Correction, frame 1 contains Reference, and frame 2 contains Combine. The necessary data wires are retained. Calculate the new finish time and the increase in elapsed time.
Prepare still takes 6.0 ms before either branch can execute. The new frame boundary forces Reference to wait until Correction finishes, even though Reference does not need Correction’s result. Combine then follows both earlier frames.
The increase relative to the original diagram is
The new finish time is 39.0 ms, an increase of 11.0 ms. The original wires already ensured that Combine waited for both inputs; the sequence adds an unnecessary order between the independent branches.
A LabVIEW application must call Configure before Read. Both custom subVIs have compatible error input and output terminals, and Configure produces its error output only after its configuration operation finishes. Assume no errors occur. Currently, the same initial no-error cluster is branched to both subVIs, so there is no dependency between them. Which change guarantees that Read waits for Configure to finish?
A LabVIEW calculation has the dependencies shown below. Setup takes 5.0 ms. After Setup finishes, Measurement takes 14.0 ms and Reference takes 8.0 ms; these branches are independent. Combine requires both branch outputs and takes 3.5 ms.
Assume Setup starts at time zero, all other external inputs are available then, enough resources exist to run independent nodes concurrently, each node starts immediately when eligible, and scheduling and wire-transfer overhead are negligible. Durations are exact for this model. At what time does Combine finish? Answer in milliseconds, to one decimal place.