LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dataflow and unbundle and bundle inside state machine

Hi,

I have read some materials about LV programming and good programming style, but I have one question. Which code on the picture is more correct in respect to dataflow performance etc.

with end bundle.pngwithout end bundle.png

I am always new in LV

0 Kudos
Message 1 of 9
(3,960 Views)

You only have one part circled. What should we compare it to?

0 Kudos
Message 2 of 9
(3,957 Views)

I would like to know, whether the bundling (or missing bundling) at the end (circled) of the diagram has some influence on the dataflow.

0 Kudos
Message 3 of 9
(3,954 Views)

Well, if any of the cluster elements change, you need to re-bundle if you want to continue with the changed values. If they don't, you don't.

The important question is if any of the subVIs change the values of any of the cluster elements? We cannot tell from a picture!

 

The requirements are given by the functionality you need. I don't see what your concern is with dataflow. The case cannot finish until everything in it has completed.

 

Of course you only need to unbundle what is used in the case, and re-bundle what actually changed. For example the "outputs" elements does not need to be unbundled..bundled at all. For the rest we don't have sufficient information to decide.

Message 4 of 9
(3,925 Views)

I see I was confused by the amount of information I read. Now it is clear and it would be nice if the moderator could delete this stupid question.

0 Kudos
Message 5 of 9
(3,895 Views)

Dear Charlie,

 

As it has been posted before, you only need to Bundle the data that has been changed inside your case structure. The only additional consideration for performance is that if you have any arays inside the data cluster, make sure you do not increase the array size (add new elements) in every iteration. This will cause the code to allocate a larger chunk of memory every iteration, and as you can imagine, this is quite a performance drain, especially when the array gets bigger in time. 

 

Kind regards:

 

Andrew Valko

NI Hungary

 

 

Andrew Valko
National Instruments Hungary
Message 6 of 9
(3,893 Views)

Thank you for answer. Maybe, I can use this thread to help me with another question which I am not sure about.

Imagine, I have an object e.g. Tree and this object has an atribute the real reference to the tree control on top VI FP. Many functions (VIs) working with this object (the reference) exist. E.g. clear tree, add new items, etc. All these functions using the reference via Property Node. Where should the reference be closed ? In every function (VI) after it performs its task or in the end of whole app in topVI ?

0 Kudos
Message 7 of 9
(3,872 Views)

@charlie87 wrote:

Imagine, I have an object e.g. Tree and this object has an atribute the real reference to the tree control on top VI FP. Many functions (VIs) working with this object (the reference) exist. E.g. clear tree, add new items, etc. All these functions using the reference via Property Node. Where should the reference be closed ? In every function (VI) after it performs its task or in the end of whole app in topVI ?


If you make a explicit reference (right-click on the tree, create->reference), you don't need to close the reference at all.  It is bounded to the VI.  If you dynamically find that reference, then you need to close it when you are done manipulating it.  In general, VIs that have references passed in should have the same reference being passed out.  This helps a lot with trying to keep you wiring clean.

 

And just for additional reading:Closing References in LabVIEW


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(3,857 Views)

Hi,

 

I can see there are 3 aspects of my opinion.

 

1. If you see a reference or the output change while coming out of a subVI, then bundling it again is must (If you dont bundle, then it is a bug).

2. If the reference or the output never changes while coming out of a subVI, bundling is not needed (In case if you bundle, that doesnt hurt with respect to functionality).

3. Having said the point 2, in case you see this unnecessary bundling happening in a loop several times, it affects the memory (buffer allocation) for sure. Anything that is a hurdle can always be avoided.

 

Regards,

Muthuraman S

Regards,
Muthuraman
0 Kudos
Message 9 of 9
(3,842 Views)