Posted 12 April 2012 - 09:14 AM
After struggling on my recent CLD-R with feedback nodes, I've decided to try using them in some projects. I've got stuck on my first trial however!
I've tried replacing a fairly common conditional incremental count within a For Loop, that I would usually do with a shift register, but I just can't get the correct result with a Feedback Node. Code is attached, is this a correct usage case for a Feedback node?
In the current configuration, when count value returned from the Shift Register is zero, the count returned from the same code using a Feedback node is 1. I've tried other configurations, but still get incorrect results.
Feedback Nodes.vi 32.54K 34 downloads
Posted 12 April 2012 - 11:36 AM
So the feedback node is behaving as expected, however your shift register example is not equivelent.
Below is how the feedback node behaves in your example.(I agree with Todd-the enable terminal is not a good usage for this scenario).
Edited by ShaunR, 12 April 2012 - 11:43 AM.
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!
Posted 12 April 2012 - 06:15 PM
Posted 12 April 2012 - 07:09 PM
This would solve this problem (the need to handle the last iteration as a special case), and also eliminate the need to wire the output of the FN through all frames of a Case Structure.
I have been lured many times by the siren song of the feedback node in this instance, so close, so very close, yet in the end, denied!
I like using them to build up dictionaries using variant attributes. Nice tight loop from variant out to variant in. Of course this is only after LV10 when they fixed an annoying bug which affected the combination of variants and feedback nodes (like they went out of their way to target two of my favorite things).
Posted 15 April 2012 - 01:14 PM
<meme>I don't always use feedback nodes, but when I do, it's only when I don't need the output outside the scope of a loop.</meme>
No seriously, I don't see what feedback nodes bring to the table versus shift registers when you need to use the output outside of a loop. I would consider it if altenbach's idea made it in, but I still don't like them as much as shift registers because they break data flow insomuch as the initializer terminal (and would be final value terminal) isn't visibly linked to the actual feedback node. I find this can lead to confusion in all but the smallest loops.
I use them all the time on the top level of a VI for static data, but if it's in a loop, more often than not I use SRs.
Posted 15 April 2012 - 02:33 PM
I think this is a bad example usage of the feedback node. I would just use Add Array Elements and call it a day. Or if you feel like being complicated, keep the equality comparison and use the Boolean to (0, 1) node and iterative sum that.
Posted 15 April 2012 - 03:31 PM
1) In pipelining, particularly common in FPGA, they're critical. Of course, those are configured for feedforward, not feedback.
No seriously, I don't see what feedback nodes bring to the table versus shift registers when you need to use the output outside of a loop.
2) I'm told (and anecdotally find to be true) that electrical engineers are used to reading the feedback notation in other schematics. They read them much easier than the shift registers.
Posted 15 April 2012 - 06:05 PM
Of course this is only after LV10 when they fixed an annoying bug which affected the combination of variants and feedback nodes (like they went out of their way to target two of my favorite things).
Ugh, don't remind me of that. I based a low-level widely used component on this combination and I stress tested it before I started writing the relevant application to make sure it performs well, and it did. Fast forward to a couple of months later, when I test the app and lo and behold, this performs really badly. For a while, I thought that maybe my original tests were flawed (or worse, imagined). It took some debugging to understand that the bug only manifests itself with a particular combination which wasn't there when I ran the tests (I think it was if you use the initializer terminal to globally initialize the variant, so I ended up initializing it using a first call and select primitive).