From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Clusters of Indicators

Solved!
Go to solution

Hi everyone,

 

In my program, I have an array of clusters with controls and an array of clusters with indicators.  I have created property nodes for each array which updates the number of columns.  Each column represents a channel that is being monitored on a scanning DMM.    My program is working as I want except for the array of indicators.

 

I have a sub VI which checks the value measured by the DMM and determines if the device measured by the channel has complied or not.  In a cluster of indicators, I have three indicators: one for the current measured, one for the time elapsed and a boolean which indicates if the device has reached a limit.  The problem is that on the display, I don't see the any values entered in any of these indicators?  I am newish to using arrays of clusters and what not.  Can someone please help me see what I am missing?

 

I have attached my subVI (LabVIEW 2015).  I know that nothing is wired into the elapsed time indicator.  I will get to that in a bit.

 

Thank you.

0 Kudos
Message 1 of 8
(3,074 Views)
Solution
Accepted by topic author _natalie_

Which indicators aren't you seeing any values on? The Channels Output indicator shows correctly it seems. The Display Output will always have zero elements in the array because you start out with zero and then use the Replace Array Subset VI to add elements. This won't work because if your array is size zero, there are no elements to replace. You can either use an Initialize Array (at the beginning to match the size of the Channels array) or use a different method of editing the array.

 

Edit: I just noticed you're not taking advantage of a very helpful tool with For loops: Auto-Indexing. Here's a short thing about those. You can get rid of your shift registers and array manipulating nodes.

 

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 8
(3,072 Views)

Thank you!  It was that I was using replace and not insert.  Happy it was a simple fix 🙂  

0 Kudos
Message 3 of 8
(3,069 Views)

Here's what it looks like with auto-indexing. I suggest you get used to doing it this way because it is much simpler, easier to read, and actually gives a performance boost because you aren't storing the data in memory through each iteration.

Auto-index.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 4 of 8
(3,061 Views)

Oh wow, that really makes it easier to look at and debug!  I will certainly start using this method.  Thanks again 🙂

0 Kudos
Message 5 of 8
(3,045 Views)

Also note that your cluster value modification are still overly complicated.

 

For example to set the Channel boolean to false, keeping everything else the same, all you need to do is as follows (bottom of picture):

 

 

 

0 Kudos
Message 6 of 8
(3,037 Views)

Further simplifiying:

 

  • Note that you have a lot of loop invariant code, for example the range checking is always done on the same data so you only need to do that once before the loop (unless your code has a bug and you actually want to also index on the measurement array, so modify as needed and move it back in the loop ;)).
  • There is a primitive to do range checking.

 

Here's how it could look like... (Please verify correct operation, of course. I cannot test)

 

 

0 Kudos
Message 7 of 8
(3,023 Views)

Thank you 🙂  I didn't realize I could do that.

0 Kudos
Message 8 of 8
(3,018 Views)