LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make array as an Functional global variable

Solved!
Go to solution

Im changing within different excel files for different wind speed MPPT, and i have use case structure to choose between different files with slider , how im gonna use FGV for array, i tried from other forums fgv for array (https://forums.ni.com/t5/LabVIEW/Example-on-how-to-set-an-array-as-a-Global-Variable-LV2/td-p/86531) but when i tried to change excel file from wind speed 5 to 6m/s inside the while , i didn't got change in array outside the while loop.
Thankyou

ss.png

0 Kudos
Message 1 of 9
(464 Views)

From a data flow point of view, your second while loop will not execute until the first one is not stopped. Try to remove the connection between both and run them in parallel. It's a good idea to add a small Wait (ms) into both.

And please attach the whole code instead of a screenshot.

Message 2 of 9
(449 Views)

What Andrey meant to say:  From a data flow point of view, your second while loop will not execute until the first one is not stopped.

 

The "wire" coming out of the first loop doesn't happen until the loop finishes.  The (same) wire going into the second loop doesn't happen until there is data in the wire, and the second loop doesn't run until all its inputs have data.  I call these "The Second Law of Data Flow" and "The First Law of Data Flow". 

 

Bob Schor

Message 3 of 9
(415 Views)

tried to remove while loop connection between them, still doesn't work

also I'm switching between different csv files, so i need constantly it to updates, i need changing values of array continuously for NI VISA write process, now continuous serial communication  already has one overall while loop, but i have observe if there lots of while loop inside while loop some kinda race condition or sometimes inner loops just doesn't work, in my case arrays doesn't get updated,also im sharing csv files, which has order column wise as Volt,Power,Current, number order on the csv files are "different wind speeds"
Screenshot 2025-02-24 102456.png

0 Kudos
Message 4 of 9
(330 Views)

another dummy file i made without ni-visa to test for changing arrays, and tried to implement same logic as before here, i tried to make an overall while for whole vi 

Screenshot 2025-02-24 103325.png

0 Kudos
Message 5 of 9
(325 Views)

I think you mixing some different thing together.

Attached a very basic example of the FG.

The FG Itself  is just trivial getter and setter:

snippet-fg.png

Two loops running parallel:

snippet.png

This is how it works:

fg.gif

Message 6 of 9
(318 Views)
Solution
Accepted by topic author shashankshetty

i have worked with FGV before but for decimals , never tried with arrays, i need continuous changing array as wind speed changes(slider), so fgv needs to update whole array instead of elements of array
Thankyou for the solution

0 Kudos
Message 7 of 9
(311 Views)

thankyou for the solution
is it even applicable for more than one dimension array?
also how can i add while loop inside the fgv itself so i dont to add whiles in other VIs to constantly update, something like while/for loops and shift registers

0 Kudos
Message 8 of 9
(202 Views)

@shashankshetty wrote:

thankyou for the solution
is it even applicable for more than one dimension array?
also how can i add while loop inside the fgv itself so i dont to add whiles in other VIs to constantly update, something like while/for loops and shift registers


Yes you can have multi dimentional FGVs. Then i'd expand it to an Action Engine (AE) and add functions for adding and removing a line or column and such.

Your second sentence makes no sense, the FGV is a data container, it has nothing to do with while loops in other VIs and are often used in loops. Or are you referring to the standard while loop in a FGV? It's just a 1 loop structure to hold the Shift register (which holds the data), the Feedback loop does the same thing, but when you add functionality it might be easier to construct it with a loop.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 9
(187 Views)