LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cluster addition bug

LV 7.0 - serious cluster bug - when using addition primitives on the output of an unbundle by name, the data from the primitive seems to "travel back" to the unbundle node, so any other unbundling of the same element results in a wrong value.
 
The example shows +1 nodes, but this also happens with regular addition and substraction nodes. Multiply seems unaffected.
 
Can anybody check this in 7.1 and 8?

___________________
Try to take over the world!
Message 1 of 23
(3,461 Views)
I've confirmed the same thing happens in 7.1.

Interesting behavior, though easily bypassed by just using wires rather than unbundling the same element more than once, though I'm sure you knew that given your experience in LabVIEW. Still, quite an interesting oddity.
0 Kudos
Message 2 of 23
(3,450 Views)

@smercurio_fc wrote:

easily bypassed by just using wires rather than unbundling the same element more than once,

Unfortunately, I had to conclude that this really was the source of the missing data in my code before I could come up with this solution (something which took close to an hour). Smiley Mad

Also, I hope I haven't done this anywhere else where it went unnoticed.


___________________
Try to take over the world!
Message 3 of 23
(3,446 Views)
Works as expected in 8.  Buggy in 7.1

Looks like its time to upgrade. Robot wink
0 Kudos
Message 4 of 23
(3,458 Views)
Yes, its fixed in 8.0. 🙂
 
Still one wonders why anyone would use such a weird construct. 😮
 
(Maybe LabVIEW should not even allow unbundling the same item more than once in a single unbundle node).
  • If we unbundle the value exactly once (as any reasonable programmer would do), the error does not occur (A).
  • If we get rid of that unecessary local variable (as any...), the error does not occur (B).

Message Edited by altenbach on 05-30-2006 09:04 AM

Message 5 of 23
(3,441 Views)


@altenbach wrote:
 
Still one wonders why anyone would use such a weird construct. 😮
 
(Maybe LabVIEW should not even allow unbundling the same item more than once in a single unbundle node).


This specific construct was obviously just an example. The original was a much more complex version which included typedef clusters, LV2 globals and queues and did other things entirely.

Initially I thought the source of the problem might be the typedef, but I eventually managed to narrow it down to a single VI. The local was put there specifically to cause the problem. Smiley Surprised

The main reason for doing this is that some reasonable programmers would prefer letting LV do a +1 calculation twice in order to get a cleaner diagram. Specifically, this was an incrementing counter which was compared against another value and then wired into the F input of a select primitive. Since both the comparison and the incrementing needed +1 I performed it twice.

I see no reason why LV shouldn't allow unbundling the same element twice - when using a large cluster you might wish to get the same element in more than one place on the screen and I prefer to avoid having wires cross each other.


___________________
Try to take over the world!
Message 6 of 23
(3,427 Views)
I just thought I'd mention that the VI Analyzer has a test called "Bundling Duplicate Names" that will detect if you have Bundle By Name or Unbundle By Name functions on your diagram that are bundling/unbundling identical items.  The main purpose of this test is to flag cases where you have a cluster containing identically-named items that you are bundling/unbundling (since chances are high you may not be getting/setting the item you need).  But this test could also be helpful in detecting cases where you're unbundling the same value more than once...in my opinion (which may be different than yours), a value should only be unbundled once, and then the wire branched appropriately if needed in more than one spot...if nothing else, to avoid the bug discussed in this thread.  🙂
 
-D
0 Kudos
Message 7 of 23
(3,419 Views)

Agreed. Similarly, bundling the same value multiple times is just a cause for confusion. Anyone take a guess what the value of the cluster will be here (... and will it still be the same result in the newest LabVIEW version 20 years from now?). 😉

 

Message Edited by altenbach on 05-30-2006 09:49 AM

Message 8 of 23
(3,416 Views)
It seems like you're being ganged up on, tst.Smiley Very Happy

In any event, I agree with tst's comments and would point out that we separate the example that shows the incorrect behavior from the applicability or practicality of such an example. I think we all agree that as shown it's not practical, but that wasn't the point of the example. As I noted in my first reply, you can obviously use wires instead of the duplicate unblundle, and I know tst knows this. However, that wasn't what tst was trying to show.

Also, at the risk of belaboring the issue, I agree with tst in that on occasion I have found it more convenient to use another unbundle with the same element being unbundled purely for aesthetic wiring reasons.

Message Edited by smercurio_fc on 05-30-2006 11:54 AM

0 Kudos
Message 9 of 23
(3,409 Views)


@altenbach wrote:

Similarly, bundling the same value multiple times is just a cause for confusion.


Now you're just being unfair. There is a great difference between reading multiple times and writing multiple times. I see absolutely nothing wrong in unbundling the value multiple times for readability's sake, as long as the programmers make sure they selected the correct element.

Thank you, smercurio, for protecting the innocent users walking through the jungle of the web. Smiley Very Happy


___________________
Try to take over the world!
Message 10 of 23
(3,398 Views)