Which of the following is closest to the value of Numeric Value Out following execution of the VI?
Timestamp is in seconds, so A.
Ans : A, 1 Sec
Due to time stamp in seconds
The correct answer is A because between Enqueue Element and Dequeue Element the function will spend 1 second.
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
Answer is :A
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.
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
@ 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!
Actually, the 1 second is the difference in time between the Enqueues. The Dequeues will happen immediately after the data in enqueued.
Indeed, the timestamp is taken from first Loop with "Enqueue" inside and ... Timing of Dequeue is not relevant in that context. Thanks!
Apologies for the basic query, but what does this arrow symbol before the Numeric subtract in the dequeue element loop stand for ?
It is a Feedback Node. Feedback Nodes remember the value from the previous iteration of the loop.
Hope this helps
Thanks @SercoSteveB, i had thought so initially but unsure of how the initialize terminal was missing from the icon ?
Also , as a good programming practice, itn't a shift register more suitable than a feedback node ?
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.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.