The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: The Dataflow Paradigm #6

SercoSteveB
Active Participant

What are the values in Numeric Value Out 1 and Numeric Value Out 2 following execution of the VI?

 Daily CLAD #16 Dataflow #6.png

 

 

a)      Numeric Value Out 1=18, Numeric Value Out 2=4

b)      Numeric Value Out 1=20, Numeric Value Out 2=4

c)       Numeric Value Out 1=22, Numeric Value Out 2=4

d)      Numeric Value Out 1=26, Numeric Value Out 2=4

Comments
SercoSteveB
Active Participant

Answer: C

Remembering the dataflow paradigm: 'A block diagram node executes when it receives all required inputs. When a node executes, it produces output data and passes the data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram.'

At run-time:

For Loops are block diagram nodes and must obey the dataflow paradigm.  As the lower loop passes data to the upper loop (through the standard output tunnel), the lower loop must complete before the upper loop can begin executing.  The value in the shift register of the lower loop for each of the 3 iterations of the loop are shown

Iteration      Shift Register Value

1               1+0=1

2               1+1=2

3               2+2=4

On completion of the lower loop (after 3 iterations) the shift register value (4) is passed to the output tunnel of the lower loop and to the Numeric Value Out 2 indicator.

Following completion of the lower loop, the upper loop has all required inputs and can execute.  The value in the shift register of the upper loop for each of the 5 iterations of the loop are shown

Iteration      Shift Register Value

1               2+4=6

2               6+4=10              

3               10+4=14

4               14+4=18

5               18+4=22

On completion of the upper loop (after 5 iterations) the shift register value (22) is passed to the Numeric Value Out 1 Indicator and the VI completes.

mini09
Active Participant

Steve here the two loops are given how come the lower loop runs first? how thw values are passed between the different loop without local variable?

SercoSteveB
Active Participant

Remembering the dataflow paradigm: 'A block diagram node executes when it receives all required inputs. When a node executes, it produces output data and passes the data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram.'

This is true for structures (For Loops included).  The bottom loop has an output tunnel (on the top boundary) which is wired to an input tunnel of the upper loop (on the bottom boundary), for the top loop to execute data must be available at this point (and all other inputs).  As data is only made available on the outputs of a node or structure, once execution of the node or structure is complete, the lower loop must complete before passing data to the upper loop which can then execute.

mini09
Active Participant

that`s great explanation Mr.Steve...

praveenkumarnagarajan
Member

what if tunnel is not closed between two loops ( if the array value id passed from loop 2 to 1)....

what would be the process will take then

crossrulz
Knight of NI

praveenkumarnagarajan wrote:


                       

what if tunnel is not closed between two loops ( if the array value id passed from loop 2 to 1)....

I have no clue what you mean by this.  Can you explain your question a little more?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
praveenkumarnagarajan
Member

if the data tranferered from loop 2 to 1 , as arrayhow will the first loop will get execute thats my question . and please suggest me a book for learning LabVIEW...

crossrulz
Knight of NI

praveenkumarnagarajan wrote:


                       

if the data tranferered from loop 2 to 1 , as arrayhow will the first loop will get execute thats my question . and please suggest me a book for learning LabVIEW...


                   

Oh, so if you autoindexed the output on the second loop.  If the first loop was also autoindexed, then you would have some fun figuring out what values were being indexed and then also know that the first loop would only iterate 3 times (smallest of N or the size of the smallest autoindexed array).  If the first loop did not have autoindexing, then you would be adding to an array.  Your shift register would also have to hold an array or you will get a broken run arrow.

I recommend just building these VIs and use the highlight execution to see how it works.

I started reading Effective LabVIEW Programming.  I haven't made it far, but it seems like it contains a lot of good information.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
SOM19
Member

C

ashwinilele
Member

C

MustafaJama50
Member

Thanks steve

Andreas.Bernau
Member

C

Rithucyril
Member

c

ersmt444
Member

Image broken

Akhil_shah
Member

But in labview I got the answer 9 and 4. Please explain.

_Bryan
Active Participant

@SercoSteveB But in labview I got the answer 9 and 4. Please explain.

 


You did not recreate the program properly.  You auto indexed the value from the lower loop to the upper loop is my best guess.  This is why you should include your code when you have a question.  Then we could tell you for sure what is different.

Akhil_shah
Member

Please refer my code and suggest me where I have done mistake
Presentation1.png

 

crossrulz
Knight of NI

You should not be autoindexing on the tunnels between the two loops.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
NishaV
Member

A

crossrulz
Knight of NI

C


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
skian
Member

C