The Daily CLAD

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

Re: The Dataflow Paradigm #8

SercoSteveB
Active Participant

 

Assuming an initial value of Numeric Value of 0; what is Numeric Value Out following execution of the VI?

 

 

 

 DataFlow #8.jpg

 

 

 

a)      3

b)      4

c)       5

d)      6

 

Comments
SercoSteveB
Active Participant

Answer: C

At run-time

The loop will continue to iterate until the value read from the 'value read' property is equal to 4.

The While loop will iterate 5 times, with the Iteration count terminal ranging from 0 to 4 as shown in column 1 of the table below.  For every iteration of the loop; the value of the Iteration count terminal is incremented by one and passed to the 'value write' property of the Property Node as shown in column 2.  Also for every iteration of the loop; the 'value read' property of the Property Node is passed to the Equal? node as shown in column 3.

Iteration Count terminal value

Property Node write value

Property Node read value

0

1

0

1

2

1

2

3

2

3

4

3

4

5

4

The key to this question is that property nodes execute top to bottom; i.e. the 'value read' is executed before the 'value write'.  From the table; when the 'value read' propery is equel to 4 (required to stop the loop), the 'value write' value is 5 and it is this value which is passed to Numeric Value Out via the standard output tunnel.

ashwinilele
Member

its nice

treeky que

Musale
Member

Capture.PNG

Hello Steve,

when i am toggling the boolean button from false to true  the True operation is n't happening and the loop is continuously running.

Can u explain me y?

SercoSteveB
Active Participant

Hi Musale

The LabVIEW Dataflow Paradigm dictates that; before anything (loops, subVIs nodes, etc. etc.) can execute a value must be present on all wired inputs (Input Tunnels and Shift Registers for While Loops). 

Here when the VI runs the value of Boolean 2 is read, along with the Constant (value 5), and passed to the While Loop inputs.  Having recieved all wired inputs, the loop can execute. 

Thought #1

It looks like the While Loop boolean input tunnel should read the current value of Boolean 2 on each iteration of the loop but it doesn't; it reads the value passed to the input tunnel which allowed the loop to execute in the first place (the value of Boolean 2 when the VI was run). 

Thought #2

If you want something to happen multiple times within a VI you must contain it within a looping structure, here the Boolean Control is outside of the While Loop so its value will only be read once. 

Things to Try#1

If you run the VI with Highlight Execution enabled you can see when the values are read.  I would suggest first run the VI with Boolean 2 set to FALSE, you will see that no matter what you do to Boolean 2 after execution enteres the while loop the value of the control is no longer read. Then do the same with Boolean 2 set to TRUE.

Hope this helps.

Steve

ps3fer
Member

download the examples please 

SercoSteveB
Active Participant

Hi ps3fer.  I am slightly confused, which examples?

ps3fer
Member

thanks SercoSteveB.

the exercises that have posted, can  download for analysis , I am newbie

crossrulz
Knight of NI

This one you will have to build up on your own.  Some of the newer ones are snippets.  Snippets are png files that LabVIEW can turn into code for you.  You will just need to copy the image to your computer and then drag the file onto your block diagram.


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) 5

ashwinilele
Member

C

Data flow in property node top to bottom.

sharmi2208
Member

from the figure the property nide reads the increamented value.

Then how will this output come?

crossrulz
Knight of NI

sharmi2208 wrote:                     

from the figure the property nide reads the increamented value.

Then how will this output come?                   

The important thing here is the order of operations of the property node.  The properties are written to/read from in order from top to bottom.  So on the 5th iteration, the read will put out the 4 and then the 5 will be written.


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
chan1989
Member

Tricky question. 5 as it is.

ersmt444
Member

Image broken

skian
Member

C