The Daily CLAD

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

CLAD2017 - Fundamentals - What is the time?

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

Combined.png

Comments
Knight of NI

Timestamp is in seconds, so A.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

Ans : A, 1 Sec

Happy to Wire
Member

A

Due to time stamp in seconds

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
Member

A

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

Member

Capture.JPGAnswer is :A

Muralidharan Dasarathan
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.

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

Combined.png

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!

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.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

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

Member

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

 

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

Combined.png

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 ? 

 

 

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.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
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

Combined.png