LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Functional Global Variable

Solved!
Go to solution

I’m using an FVG in to VI’s: main_1.vi and main_2.vi which is running at the same time.

As a normal FVG, the FVG will be seen from both main’s.

Is there any way to change this, so you can use the same FVG to store different data for main_1 and main_2, or do I have to rename FVG to FVG_1 (used in main_1) and FVG_2 (used in main_2).

My FVG have a structure like this:

 

https://decibel.ni.com/content/docs/DOC-2143

 

0 Kudos
Message 1 of 7
(3,406 Views)
Solution
Accepted by topic author Michael.Koppelgaard

A few possibilities.

 

1.  Call them different names like you suggested.

2.  Make sure the two main VI's are in different projects.  A Main VI only exists within the project's domain.

3.  Modify the FGV to add another input such as a numeric where you can wire in a one or a two.  Have the FGV keep an array of data, and will update whichever element is appropriate based on the wire number you put in.  Of course everytime you use the FGV in main1, you'll have to make sure you wire in a 1.   Everytime you use it in Main2, you'll have to wire in a 2.

Message 2 of 7
(3,403 Views)

Thank you for your reply.
So I can use all 3 ways. Number 2 seem seem easiest.

I think I will use that 🙂

0 Kudos
Message 3 of 7
(3,390 Views)

4. If you are only calling this VI in a single place in both of your VIs, then make the FGV reentrant (preallocated).  Then each call of the FGV will have its own memory space.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(3,389 Views)

 I don't now about a single place. Eg. I have this vi - I call a lot of times to keep track of time.

0 Kudos
Message 5 of 7
(3,315 Views)

@Michael.Koppelgaard wrote:

 I don't now about a single place. Eg. I have this vi - I call a lot of times to keep track of time.


Then the reentrant idea won't work for you.  I just had to throw it out there for completeness sake.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(3,285 Views)

In your Get case, you don't need to branch the blue value to send it out through separate tunnels to wire to nCall.  You just need to wire it from the right hand shift register.

0 Kudos
Message 7 of 7
(3,270 Views)