LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I WANT TO UPDATE 1 CLUSTER OF DATA

To keep my speed up, I want to put all my data in a cluster that I hope will stay in RAM memory.  Then in the first several loops (sequenced) of the program, I want to read my DA cards and update the data in the cluster.  Then in following sequenced loops, I would read this updated data from the cluster and use it in my various displays and in actually running specificed tests and saving the data in test data files.  I am getting good at bundling and unbundling and replace array subset.
What happens, is in the first loop, it will send the data from the control data cluster, no only to my sub VI for processing, but to the next sequence loop  (before it is modified by the first sub VI) that has the next sub VI.
 
I have tried using 2 clusters in each VI, sending data to an input cluster, processing and sending it to an output cluster, which would then be sent to the next sub VI (with processed data).
But after say 20 sub VIs I am afraid that scheme will either overload RAM memory or slow my program down.
So I think I need a way to have just one cluster that "everyone" accesses for either inputting new DA readings or outputting to various displays and test operations.  So far I have not found that secret that forces the sub VI to process data and update the cluster before the cluster data is passed to the next sub VI.
 
I am sure it is simple, but I haven't been able to figure it out.
 
Dogface
0 Kudos
Message 1 of 7
(3,239 Views)

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.

0 Kudos
Message 2 of 7
(3,234 Views)

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 7
(3,226 Views)

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(3,226 Views)

  Dogface

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 7
(3,227 Views)

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.

 

- tbob

Inventor of the WORM Global
Message 6 of 7
(3,224 Views)

Nice catch tbob!  I overlooked the "sequenced" part when I was reading the question and was thinking in terms of making copies of data.

0 Kudos
Message 7 of 7
(3,215 Views)