LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating cluster values, is there a better way?

For cases like yours I prefer to use a typedefed cluster and and For loop with a shift register to update the cluster. The nice thing about my approach is that it is very easy to extend. Here is a screen shot of how it looks.

 

Loop Cluster Update.PNG



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
Message 11 of 29
(1,840 Views)
Sorry, I don't have LV9 on this machine, but looking at the code, you should be using a shift register in your For Loop to build the array of paths, otherwise, it is only the last value that is making it in.  This is a bug, but I am not convinced that it should throw a runtime error.
0 Kudos
Message 12 of 29
(1,831 Views)

Darin.K wrote:
Sorry, I don't have LV9 on this machine, but looking at the code, you should be using a shift register in your For Loop to build the array of paths, otherwise, it is only the last value that is making it in.  This is a bug, but I am not convinced that it should throw a runtime error.

 

I replaced the tunnel with a shift register, it still throws up the runtime error.

 

I guess there may not be a better way...Smiley Sad

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 13 of 29
(1,824 Views)

Mark Yedinak wrote:

For cases like yours I prefer to use a typedefed cluster and and For loop with a shift register to update the cluster. The nice thing about my approach is that it is very easy to extend. Here is a screen shot of how it looks.

 

Loop Cluster Update.PNG


Smiley Sad I'm not worthy... I do not understand what I am looking at here?

========================
=== Engineer Ambiguously ===
========================
Message 14 of 29
(1,823 Views)
Before you give up, check the cluster order for your clusters.  Using this technique assumes that Master Log and Timers are at the end.
0 Kudos
Message 15 of 29
(1,805 Views)

Sorry about that.

 

User Events and User Event Data are two typedefed clusters. In this case they are related in that I can have specific Event data tied to my user defined events. What the code is doing is registering the user events and picking up the data associated with them. It is using associated data for each event. However, this is not what is is important to you. What you really are interested in is that the User Event cluster is wired to the shift register of the For loop. Internally the case structure is controlling which element of the cluster is getting updated each iteration. The shift register keeps the value of the cluster current since the old value is wired into the Bundle by Name. The only element that will be changed is the one currently getting wired. All others retain their current value.

 

this approach is very easy to maintain and extend. Simply update the cluster tyepdef,  add a new case in the case statement for the new element and wire the appropriate value.



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
Message 16 of 29
(1,801 Views)

There is an input to the flatten/unflatten functions for prepending the array or string size, what if you wire a false boolean constant to both of these terminals?

 

2009-11-25_133128.png

 

Also, I've not seen you post this yet...what version of LabVIEW are you using?

 

I will try to track down the AE assigned to this forum thread to have them file necessary CARs.

 

-Bob

Message Edited by B O B on 11-25-2009 01:35 PM
Message 17 of 29
(1,798 Views)
I did not have your subVIs but I stripped it down and this works just fine for me.
Message 18 of 29
(1,775 Views)

I believe the issue lies with the cluster size setting on the array to cluster function:

 

2009-11-25_140233.png

Right-click and select cluster size, then set this to 15 for your VI.  Let us know if this works!

 

-Bob

Message 19 of 29
(1,769 Views)

B O B wrote:

I believe the issue lies with the cluster size setting on the array to cluster function:

 

2009-11-25_140233.png

Right-click and select cluster size, then set this to 15 for your VI.  Let us know if this works!

 

-Bob


I believe what you are saying is correct. I did want to reiterate though that the approach I suggested above is immune to this. This is why it is a very flexible and extendable way of doing this.



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
Message 20 of 29
(1,749 Views)