martin_g Posted April 12, 2012 Report Share Posted April 12, 2012 Hi All, 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 Quote Link to comment
jcarmody Posted April 12, 2012 Report Share Posted April 12, 2012 One small change and you're there. Quote Link to comment
todd Posted April 12, 2012 Report Share Posted April 12, 2012 That's what I thought, but the fourth iteration of the loop outputs the left side of the Increment, which is at 3 for the "100%" case. I don't like the Enable terminal, in this case. Quote Link to comment
ShaunR Posted April 12, 2012 Report Share Posted April 12, 2012 (edited) The enable terminal will prevent the FEEDBACK VALUE (FV) being propegated not prevent the action of the +1 as it does in your top scenario. So,after initialisation (FV=0) you get an output of 1 since 0+1 =1. 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 April 12, 2012 by ShaunR Quote Link to comment
Francois Normandin Posted April 12, 2012 Report Share Posted April 12, 2012 You can change the feedback node direction and wire the output of the node instead of the output of "+1". That would be the equivalent to the case structure. 1 Quote Link to comment
todd Posted April 12, 2012 Report Share Posted April 12, 2012 That still doesn't work for the case where Status Array is all 1's. On the fourth (and last) iteration, the output of the increment is 4, but the output of the feedback node is 3. Quote Link to comment
martin_g Posted April 12, 2012 Author Report Share Posted April 12, 2012 OK, thanks for all of your input, I'll stick to using the shift register, and look for another use to try out Feedback Nodes! Cheers, Martin Quote Link to comment
asbo Posted April 12, 2012 Report Share Posted April 12, 2012 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. Quote Link to comment
Darin Posted April 12, 2012 Report Share Posted April 12, 2012 Feedback Nodes have amazing potential that NI needs to unleash. The first step is to get this excellent idea implemented. http://forums.ni.com/t5/LabVIEW-Idea-Exchange/An-output-terminal-for-feedback-nodes-that-mirrors-the/idi-p/927458 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). Quote Link to comment
Aristos Queue Posted April 13, 2012 Report Share Posted April 13, 2012 If you like the Enable terminal, there's a feature coming in LV 2012 to solve the tunnel output consistency problem. Take a look at the Upgrade Notes when you get your upgrade later this year. Quote Link to comment
mje Posted April 15, 2012 Report Share Posted April 15, 2012 Yeah, I'm late to the game on this one. <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. Quote Link to comment
crelf Posted April 15, 2012 Report Share Posted April 15, 2012 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. Agreed. Quote Link to comment
Aristos Queue Posted April 15, 2012 Report Share Posted April 15, 2012 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. 1) In pipelining, particularly common in FPGA, they're critical. Of course, those are configured for feedforward, not feedback. 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. Quote Link to comment
Yair Posted April 15, 2012 Report Share Posted April 15, 2012 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). Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.