The Daily CLAD

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

Re: CLAD2017 - Fundamentals - What is the time?

SercoSteveB
Active Participant

Which of the following is closest to the value of Numeric Value Out following execution of the VI?

 

QueuesDelay.png

 

 

a) 1

b) 3

c) 1000

d) 3000

Comments
crossrulz
Knight of NI

Timestamp is in seconds, so A.


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

Ans : A, 1 Sec

Happy to Wire
jeeva89
Member

A

Due to time stamp in seconds

Tsjabrantes
Member

 

The correct answer is A because between Enqueue Element and Dequeue Element the function will spend 1 second.

Smiley Happy

Tarciso Junior
+55 (11) 996-282-103
Skype: Tarciso.junior2
Email: Tsjabrantes@gmail.com
http://br.linkedin.com/pub/tarciso-junior/23/a83/463
nik35324
Member

A

A.Bernau
Member

A

I was thinking about race conditions. But as the Enqueue Element waits forever for Element (timeout is -1) and we send 3 elements and we wait for 3 elements there are no race conditions. And yes time is in seconds. So answer is A

Murali_Chennai
Member

Answer is :AAnswer is :A

Muralidharan Dasarathan
Tiger5hark
Member

I'm still a bit new to LabVIEW. What's tying the two loops together? More specifically, why does the second loop adhere to the Wait Until Next ms Multiple present in the first loop? Do all loops wait until all other loops finish their current iteration prior to starting its next iteration? Thanks.

SercoSteveB
Active Participant

Hi Tiger5hark

 

Both loops run at the same time (pseudo parallel).  The top Loop is putting values onto a queue, the lower Loop waits forever for a new element on the queue and then takes that element off of the queue.  The lower Loop is adhering to the top Loop as it is waiting for the top Loop to add a new element on each iteration

 

Hope this helps as a start

 

Steve

A.Bernau
Member

@ Tsjabrantes: As far as I understand the difference of 1 second is not between Enqueue and Dequeue. It is the difference between Dequeue (final iteration n) and Dequeue (one iteration bevor final iteration n-1). The Dequeue takes place immediately after Enqueue (significant less than a second). Sorry for my English. @All: In case I am wrong please correct me, Thanks!

crossrulz
Knight of NI

A.Bernau,

Actually, the 1 second is the difference in time between the Enqueues.  The Dequeues will happen immediately after the data in enqueued.


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
A.Bernau
Member

Indeed, the timestamp is taken from first Loop with "Enqueue" inside and ... Timing of Dequeue is not relevant in that context. Thanks!

SSMISHRA
Member

Apologies for the basic query, but what does this arrow symbol before the Numeric subtract in the dequeue element loop stand for ?

 

SercoSteveB
Active Participant

Hi SSMISHRA

 

It is a Feedback Node. Feedback Nodes remember the value from the previous iteration of the loop.

 

Hope this helps

 

Steve

SSMISHRA
Member

Thanks @SercoSteveB, i had thought so initially but unsure of how the initialize terminal was missing from the icon ? 

image.png

Also , as a good programming practice, itn't a shift register more suitable than a feedback node ? 

 

 

crossrulz
Knight of NI

SSMISHRA,

Right-click on the Feedback Node.  There is an option to "Move Initializer One Loop Out".

 

Feedback Nodes and Shift Registers actually use the same code in the compiler.  So at the point, it is preference.  I find myself using feedback nodes a lot more for comparisons to previous looks like in this situation since it is just a lot cleaner.


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
SercoSteveB
Active Participant

Hi SSMISHRA

 

Yep, what crossrulz said.  I was "go Shift Registers yay!" for years and Feedback Nodes didn't really get a look in.  I cannot explain why, I knew the functionality with Feedback Nodes was the same, using Shift Registers just seemed to fit better in my mind. 

 

There are times when Shift Registers are the cleaner way to go. For maintaining the current state within a State Machine architecture for example. 

 

It pretty much comes down to your preference/personal choice balanced as always with what is going to be best for the next person that picks up your code (maintainability).

 

Steve

alhebu
Member

Where do I get the arrow?

SercoSteveB
Active Participant

Hi alhebu,  It is called a Feedback Node, it lives in the Structures palette (but remember everything is just a Quick Drop away).. 

istan0227
Member

A