LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How is the block diagramm executed?

Hi,
 
 
i want to know how is the block diagramm executed? From ´left to rght or from top to down?
Can anybody help me?
 
thank you for the answer.
 
HRC
0 Kudos
Message 1 of 7
(4,442 Views)
Yes, the execution of the block diagram is supposed to be left to right, top to bottom.  However, it is very important that you control the flow of execution, and not LabVIEW.  It's poor practice to rely on LabVIEW to take care of the flow of execution alone.

Use error in and out on VIs, and proper sequencing (not advocating the use of sequence structures however) to control the flow.  It is better to be absolutely sure how LabVIEW executes, in case you accidentally move something around on your block diagram... you don't want that to affect how your program runs.
0 Kudos
Message 2 of 7
(4,437 Views)
"Yes, the execution of the block diagram is supposed to be left to right, top to bottom"
 
i have to take a little exception to this.... you really have no idea how LV is going to compile the code if you dont employ dataflow.... the top down , left to right is purely ( i suspect)  because thats how we in the western world read/write etc...
 
this is one of those subjects that all beginners have a difficult time grasping , there needs to be much more communication regarding dataflow etc...
 
Dan
Message 3 of 7
(4,430 Views)

The block diagram executes only by the order of the nodes. If two objects on the diagram have a wire connecting them, the object the wire is coming out of will "execute" first and only once it has finished execution, the resulting data will "travel" through the wire to the other object. In general, the big rule of data flow is "A piece of code will execute only once all of its inputs have recieved data". You can't control when it will start executing, because that's done by the scheduler, but you can determine the order of execution.

Now, if two pieces of code are not connected at all, they will execute in parallel. If you want to see the actual execution, turn on Highlight Execution (the light bulb button). This will run the VI in "slow motion" and allow you to see the data flow through the wires.

It is considered good practice to order a diagram in a left-to-right, up-to-down fashion because it makes it readable, but that does not determine the order of execution.


___________________
Try to take over the world!
Message 4 of 7
(4,427 Views)
I stand corrected...  I had the idea that in addition to what tst mentioned (also referenced from the manual "A block diagram node executes when all it's inputs are available"), it did in fact execute from left to right, top to bottom.  I could have sworn to have seen that behaviour while watching a vi execute with highlight execution on.  And not just because of the set up of my block diagram...  Guess it was just coincidence, or I was seeing things...  Sorry.
Message 5 of 7
(4,417 Views)

Ditto Dan and tst.

See attached.

Follow tst's siggestion and watch this code in execution highlighting mode.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 7
(4,415 Views)

Hi Novatron,

The patterns you observed are secondary to the data flow paradym. This part of the behaviour is subject to change from LV version to LV version. In fact hyperthreading has thrown even more complications into the mix. So, the first and universal rule is data flow. After that the behaviour depends on the flavor of LV you are using.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(4,405 Views)