08-30-2023 08:50 PM
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:
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
Solved! Go to Solution.
08-31-2023 04:32 AM
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.
08-31-2023 12:59 PM
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
08-31-2023 05:07 PM - edited 08-31-2023 05:09 PM
@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.
08-31-2023 05:37 PM - edited 08-31-2023 05:54 PM
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.
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.
James V
08-31-2023 06:12 PM - edited 08-31-2023 06:13 PM
@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.
(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!)
08-31-2023 06:23 PM
"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
08-31-2023 08:03 PM
@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. 😄