LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy boolean states and colors to a cluster of booleans from a global of an array of these clusters

Solved!
Go to solution

Hello community,

 

I have been using LabVIEW for a long time, and I have to admit I am stumped.

 

I have a crude model of a VI that displays the states of 16 boards of varying DUT positions that I represent with a single cluster of booleans, and the cluster will show the DUT states of the selected board.

 

When the user selects a slot, the boolean cluster shows:

  • the number of DUTs the board type can have
    • booleans are either visible or invisible for available DUT positions
  • the state of each DUT in that slot previously selected
    • Boolean ON (selected) or OFF (not selected)
  •  The presence of a DUT occupying that position
    • the ON OFF colors are different for DUT positions with a DUT occupying the position or not

I use a global with an array of 16 of these clusters to hold the selections and states of each slot in a persistent state that can be recalled at will.

I am trying to make it to when a user selects that slot and sets if the DUT positions are available, occupied and selected, those settings are saved in the global array so when the user selects that slot again, it will remember and update the cluster of all the states the last time the slot was selected.

 

I am able to do this with a property node with Colors[4] and Values successfully enough (as I showed in the VI), but am unable to do this with a global array of these clusters. The issue is using a property node for an array of globals as I can't seem to link a property node to the elements in that global array.

 

Am I going about this wrong? What is the best way to have persistent states of each slot's controls, using a single cluster on the main VI?

 

James V

Download All
0 Kudos
Message 1 of 8
(1,303 Views)
Solution
Accepted by topic author jgvarner57

My first though it to have an Array of Status (Enum) for each and then an array of Color box (circle) that shows the status by converting the state to a color.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 8
(1,260 Views)

Yamaeda,

 

I see where you are going, and it looks like I was trying to be too creative to the point where it became impractical. The states of each button is either available, occupied and selected. I can simply do that with three global arrays of these states.

 

Thank you for that voice of sanity.

 

James V

Message 3 of 8
(1,214 Views)

@jgvarner57 wrote:

I am able to do this with a property node with Colors[4] and Values successfully enough (as I showed in the VI), but am unable to do this with a global array of these clusters. The issue is using a property node for an array of globals as I can't seem to link a property node to the elements in that global array.

 

All elements of an array share the same properties. Instead of a cluster of LEDs, you could use a 2D array of colorboxes.

Now the color is the value instead of a property and you can any colors you want!

 

Your IPE is pointless. A simple "replace array subset" would do exactly the same. the IPE is only useful if you are interested in the old value too.

Message 4 of 8
(1,182 Views)

The IPE is designed to alter an array in its current memory location. Otherwise, the computer will make a copy of the array into a working register, edits the array then copies the array over the original memory location. This requires a lot of clock cycles and memory allocation. My main program runs at 50Hz and if I was constantly handling large arrays when I only need to change an element it would waste a lot of resources and was bogging the program down. Again, this was a crude dummy program to represent my larger program, where I am handling 100s of thousands of elements of data stored in arrays where I had to use IPE for efficiency.

jgvarner57_0-1693521324701.png

 

I ended up using a 100X3 array of booleans (which was part of an array of clusters of all the front panel states), and I use the second column to show whether the DUT was present, and just change the first of the four colors of the control (the only color that was different) based on the boolean value I pull from the array. That seemed a lot more efficient.

jgvarner57_0-1693522061306.png

 

 

James V

 

0 Kudos
Message 5 of 8
(1,166 Views)

@jgvarner57 wrote:

The IPE is designed to alter an array in its current memory location. Otherwise, the computer will make a copy of the array into a working register, edits the array then copies the array over the original memory location. .


"replace array subset" operates fully in-place. Guaranteed.

 

altenbach_0-1693523370281.png

 

(Of course if the array element is a cluster that can have variable size (e.g. contains an array that can vary in length), no version can be in-place, despite the IPE name. The compiler knows what to do!)

 

0 Kudos
Message 6 of 8
(1,151 Views)

"Again, this was a crude dummy program to represent my larger program, where I am handling 100s of thousands of elements of data stored in arrays where I had to use IPE for efficiency."

 

There is a loooooot more going on with this project's array reads and writes than just this. You are correct, if this was all I was doing the 'replace array subset' would be more than sufficient. However, the Main loop is using this IPE for about 400 different and simultaneous reads and writes going on at once at 50 Hz. Frankly this also saves screen space over using a bunch of replace arrays elements and index array functions while also being easier to comprehend.

 

James V

0 Kudos
Message 7 of 8
(1,143 Views)

@jgvarner57 wrote:

Frankly this also saves screen space over using a bunch of replace arrays elements and index array functions while also being easier to comprehend.


 

Yes, as I said the IPE is useful if you are also interested in the current element, i.e. before replacement, saving you an index array. 😄

Message 8 of 8
(1,120 Views)