LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FGV running parallel with different values.

I need to use mutiple functional global variables in the same VI. So is there a way to label each fgv, so that i set the value of 1 fgv at one place and get it another place, then in the same vi, use another fgv in parallel where i set different values and get these different values at another place. How can I achieve this, that is same FGV running parallel with different values. 

0 Kudos
Message 1 of 7
(2,184 Views)

How do you want to identify the different variables? Will they all be of the same data type? There is a current value table library that may give you want you want, see the link below. You could also design a simpler one yourself, using a variant attribute table. 

 

https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-Current-Value-Table-CVT-Library/ta-p/35142...

Message 2 of 7
(2,180 Views)

yeah the 3 values are velocity, acceleration and direction of motor. So I need to have mutiple motors in the same VI, but Iam using a FGV that inputs 3 values velocity, direction and acceleration and also the string value for the case structure. 2 cases, set value and get value. This fgv has 3 outputs also velocity, acceleration and direction. Since there are mutilple motors I need to set for motor 1 velocity, acceleration and direction in the fgv and then get it somewhere else. Under motor1 then there will be motor2 with different values to velocity, acceleration and direction. But unless I am able to label the fgv as 1 and 2, I will be writing different values to the same fgv. 

0 Kudos
Message 3 of 7
(2,175 Views)

Use one FGV for all motors, but have the data stored as an array.  One of the inputs will be a motor number that will index out what set of data you are reading, or tell the FGV which element of the array is to be modified when writing data to it.

 

As long as the FGV does not take a long time to do what it needs to (and Get/Set FGV's never do), you should not see any problem with using that one FGV in numerous places.

Message 4 of 7
(2,169 Views)

@RavensFan wrote:

Use one FGV for all motors, but have the data stored as an array.  One of the inputs will be a motor number that will index out what set of data you are reading, or tell the FGV which element of the array is to be modified when writing data to it.

 

As long as the FGV does not take a long time to do what it needs to (and Get/Set FGV's never do), you should not see any problem with using that one FGV in numerous places.


Or, use LVOOP. This is a perfect example of using classes. Define a motor class and then create an instance of the class for each motor. Then the data for each motor is contained in that instance and you minimize the chance of changing a motor's values inadvertently via a FGV.



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
0 Kudos
Message 5 of 7
(2,151 Views)

I am trying to use the array method as RavensFan said. But I want in a way the number of motors are unknown, so that every time I add a new motor, I want to add the values to the existing array, that is increment the array automatically. I am trying to figure out how. Kindly do help me. Thanking You. 

0 Kudos
Message 6 of 7
(2,112 Views)

Then your FGV need an "Add motor" function that adds to the array (and effectively turns it into an AE if you wan't to be technical).

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(2,109 Views)