11-08-2005 12:44 PM
11-08-2005 12:57 PM
Have you looked at the possibility of using a functional global (LV2 style global) for your implementation? This is basically a subvi with a loop which iterates one time and is set to be non-reentrant. Data is passed from one call of the subvi to the next via an uninitialized shift register. You can put the code inside the loop to either write to your cluster or read from your cluster. This solves the problem of having all of the data in one place. However, if the data is being used in more than one place at any instance in time then there will necessarily be more than one copy in memory.
One suggestion that I would make is that you only pass the data that is required rather than a whole cluster of data. Clusters are nice in that they compact everything but they have their own overhead (it takes extra time to open a cluster) and sometimes tend to lead to extra baggage being carried around throughout the program. For instance, you might have a cluster which has a 100 element array and a boolean. If you never need the 100 element array in a subvi then you should only pass the boolean to the subvi, not the entire cluster.
11-08-2005 01:13 PM
11-08-2005 01:13 PM
11-08-2005 01:13 PM
11-08-2005 01:21 PM
I got bit by the Tab-space bug.
What I wanted to say was that there is no secret to changing a cluster before it is passed on to the next subvi. Dogface, you need to learn what data dependancy does to execution order. All functions, loops, subvi's, etc. will only start to execute only when all of its inputs are present. So by wiring inputs and outputs, you can force the execution flow to be in a certain order. If you wire the cluster to one subvi, and change it there, then wire that output to another subvi, then subvi #2 will not start executing until its input is present. Its input is not present until subvi #1 has finished executing and pushes the cluster out. Many people start programming in LV using the sequence structure to cause execution to happen in a certain order. Once you learn data dependancy, you rarely need to use the sequence structure. Error In and Error Out are good to use for execution flow. If you need more explanation, please ask.
11-08-2005 02:12 PM
Nice catch tbob! I overlooked the "sequenced" part when I was reading the question and was thinking in terms of making copies of data.