LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In Place structure bundle/unbundle behaviour

Hi all,

I have noticed unexpected behaviour of the in place structure at edit time.  This VI illustrates the behaviour I see.  Essentially, if you add items into the cluster above the element being unbundled in the structure, the structure changes the element it is operating on.  This is not seen with the while loop.  This is causing me a headache, but is it a bug, or expected? Does anyone agree this is a bug?

Kind regards,

Michael.

Download All
0 Kudos
Message 1 of 11
(2,998 Views)

I don't think this a bug. You are defining the cluster on the run so to speak and the inplace structure is always using the nth element of the cluster. What you may want to try is using a typedef for your cluster. It is rarely a good idea to programmatically define structures simply because there is very little way for users down the line to know the cluster content other than by position within the cluster.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 11
(2,981 Views)

Hi Mark,

I wouid usually use a typedef, but in this case i dont want to. The cluster is the data running through a state machine and it changes frequently.  This cluster is never passed into subvis and all elements are named.  I think this is a special case where this is OK.  Why should the inplace structure use the Nth when the while loop does not? that be the question...

Thanks for the interest,

Michael

0 Kudos
Message 3 of 11
(2,967 Views)

I happen to think this is a bug.  I also happen to think that it is very easily avoided and the effort to "fix" it is not worth it.

 

You do not have to TypeDef, you could simply create a constant to feed into the middle of your Bundle Node.  This should avoid the "bug", and you can bundle your values by name this way which I think looks better.  Relying on Cluster ordering is a recipe for disaster.

 

I usually Bundle and Unbundle (by location) for one purpose: to perform common math operations on multiple values.  Everything else is Bundled/Unbundled by Name.

Message 4 of 11
(2,959 Views)

Yes I agree.  I always name cluster elements.  I also see how this can be avoided, its just not nice...

Thanks

0 Kudos
Message 5 of 11
(2,957 Views)

NI please say this is a bug and fix it.  I was just bitten by this and my code did not break because the data type of the Nth-1 item was the same as the Nth item.

 

I use the unbundle and bundle to modify a value in the cluster based on the name of the data which is how clusters work.  I then do the same operation on the same data in the IPE structure.

 

If you make the bundle grow by one, and add an item to it, the VI will be runable, but the two operations are no longer the same because the IPE is now modifying different data.

 

Attached is my exampe saved in 2013 (not SP1).

0 Kudos
Message 6 of 11
(2,861 Views)

I'm not seeing what the OP saw in 2013  (OP sourced in 2011)

 

The fix should be moot for current versions of LabVIEW since the optimizer recognizes the unbundle repace element bundle and acts in-place without the IPE.

 

e.g this snip is faster than the equivallent IPE in versions where the optomizer has been trained (2011-to current) since the IPE adds two sync boundaries that really are not needed

!2.png

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(2,836 Views)

I'm not seeing what the OP saw in 2013  (OP sourced in 2011)

 

The fix should be moot for current versions of LabVIEW since the optimizer recognizes the unbundle repace element bundle and acts in-place without the IPE.

 

e.g this snip is faster than the equivallent IPE in versions where the optomizer has been trained (2011-to current) since the IPE adds two sync boundaries that really are not needed

!2.png

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 11
(2,836 Views)

I opened the OP VI in 2013 (again no SP1 yet) and it behaves as described the bottom IPE turns into str instead of num.

 

So are you saying that I should never use the IPE for unblundle / bundle operations in 2011 and newer?  Not that I used it much to begin with but still.

 

Even so I am still under the opinion that this is a bug.  The unbunble in an IPE should stick to the name of the element the user picked, not the Nth item in the list that was selected.

0 Kudos
Message 9 of 11
(2,820 Views)

Based on the example Hooovahh attached I agree that this is a bug. I believe it is being caused by the lack of typedefs and way that bundle works vs bundle by name. The main reason I feel it is a bug is the inconsistency between the unbundle by name and the IPE structure node. Filed as CAR 458466.

 

Regards,

 

Jeff Peacock 

 

Product Support Engineer | LabVIEW R&D | National Instruments 

0 Kudos
Message 10 of 11
(2,812 Views)