LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does Labview create a .vi for each global variables?

Hello,
 
I wrote an Labview application which use several global variables (almost 30 variables). All the variables are of variable type "single process". For each of these variables, Labview creates a vi.
For example, for the variable "_TS.Measures.channes", Labview creates a vi named "TS_'_TS.Measures.channels'.vi". Which means, I have almost 30 "name of variable".vi files: this is confusing!Smiley Tongue
 
All my VI are inside library (.llb). When I try to put the VI of a global variable in a library, Labview can't find them anymore.
 
May be can somebody explain me, why LabVIEW does create these VI and how is it possible to put them in a library.
 
Cheers,
Risotto
0 Kudos
Message 1 of 11
(4,556 Views)

That is the way Globals work in LabVIEW.  Use a cluster to create multiple variables within on Global VI.

Matt

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 2 of 11
(4,536 Views)

Hi Risoto,

You do not have to have a seperate "VI" for each global variable - when you create a global, you can put any number of control/indicators on its front panel (and add or delete more later), and of any mix of data type.

When you drop a global onto the block diagram, if there are multiple items on its front panel then you select the value you wish to read/write by clicking on the global terminal/icon and select the particular variable from the pop up list.

Tip: If you ever feel the need to rearrange the order of the items in the global's pop up list - select "Set Tabbing Order..." in the global VI's window menu (it's under the "Edit" menu in LV 7.0).

Advise: Try not to use globals as an easy alternative to passing variable values - personaly, I only ever use globals for setting "global constants".

Mark.

Message 3 of 11
(4,532 Views)

Hi Matt,

There is no need to use a cluster to have multiple variables on a global - although, if you wanted to access all/several of the variables without the use of multiple copies of the global terminal, then you could use a cluster data type to acheive effect.

I will most often use a single "Global Data.vi" VI with all my globals on the one panel, some values are simple numerics/strings, and some may be arrays or clusters.

I would not bundle items (cluster) on the global just for the sake of it - I would only bundle data items together if there was a logical connection/relation of the items.

Mark.

0 Kudos
Message 4 of 11
(4,523 Views)

Saving a global variable into a .llb is not a problem if you do it immediately.

Otherwise, if you move the global, the link between the global and the calling vi may be lost, and the global will appear with a black border and a check mark. Right clicking the broken global and browsing from the select... popup menu to the proper global folder restablish the link and the vi functionnality.

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 5 of 11
(4,524 Views)
Hi Chilly and Risotto,
 
I think that this is where the problem arises...
 
If you create new VIs/Globals and save them directly to a .llb library, the files in the library don't appear to be given file extensions (i.e. name.vi) - then if you drag/cut them out of the llb library they are essentially untyped files.
 
If you then try to drag/paste these untyped files back into a llb library, the system won't accept them.
 
The llb library will accept them if you add a ".vi" file extension - but that unfortunately breaks the "linkage by name" to the original parent VI.
 
Even though you can drag/paste the files back to the llb after adding a .vi extension - once they are in the llb it doesn't let you remove the file extension to enable the correct linking by name.
 
How to get around this problem: Make sure that the VIs/Globals are firstly stored as "filename.vi" (with the .vi extension) before then storing the project in a llb libray.
 
Hope that explains the problem, and provides a fix - let me know.
 
Mark.
 
P.S. The advantages of using llb files are questionable - yes, they save file space, but they have a largely flat structure which isn't always ideal for a project. The file/disk space saving can probably be better acomplished by using a "ZIP file".
0 Kudos
Message 6 of 11
(4,501 Views)


@Risotto wrote:
All the variables are of variable type "single process".

Do you mean the new Shared Variable in LabVIEW 8? You mention the type is "single process", which is one of the shared variable modes of operation.



Ed

Message Edited by Ed Dickens on 05-10-2006 01:02 PM



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 7 of 11
(4,477 Views)
Hi everyone,

I would like to show up the difference between teh "old school" global variables and the new LabVIEW 8 feature "shared variable".
Global variables could have been used to interact between several VIs without having any dependencies between them. For more
information how to create multiple global variables in one file please have a look to the following KnowledgeBase

http://digital.ni.com/public.nsf/websearch/2AAB8A82601E30AE86256C5D00529759?OpenDocument

The disadvantage of global variables was that they couldn't be used for networking interaction. You've been fixed to one computer.
With LabVIEW 8 there came the new "shared variable" that solve the disadvantage. You now can create variables that can be
puplished over the network! If you create a new variable in the project explorer than you will get a vi in the view. If you are using
30 variables you will have 30 VIs as you've seen it. But do you have recognized that there is only one library in the project explorer
and in the windows explorer as well? LabVIEW collects all shared variables in this one library so that is only a kind of view you get
confused of.
Please have a look on the following tutorial.

http://zone.ni.com/devzone/conceptd.nsf/webmain/5b4c3cc1b2ad10ba862570f2007569ef

If you have any questions please do not hesitate to post them here.

Best regards,

Carsten Sprung
Application Engineer
National Instruments Germany
Message 8 of 11
(4,450 Views)

 

Message Edited by Risotto on 05-11-2006 07:37 AM

0 Kudos
Message 9 of 11
(4,440 Views)

Hi everybody,

Thank you for your answers, I get a lot of informations.

Yes, I use the new shared variables in LabVIEW8, which I am using like sort of global constants. Now I am understanding what guys are telling me all this about global variables in LabVIEW7.1. Sorry, I forgot to say I was using LabvVIEW8.Smiley Indifferent

I will have a look on the tutorial too.
But yet one point about the library collecting all the shared variables in the windows explorer and in the project explorer: When I create a shared variable in my LabVIEW project - for example "test1" as double/single process - the variable doesn't appear in my file directory, but it appears in the project explorer in a library (.lvlib).
When I drag/paste my shared variable on the block diagramm of my VI, then a file "Math_test1.vi" appears in my file directory. There is no extra .llb created to contain my shared variable vi.
If I drag/paste the file "Math_test1.vi" in the Math.llb (see picture), then the file is moved in the llb and disapeared from the directory.
If I created another shared variable "test2" as double/single process and put it on the VI, then LabVIEW creates2 files in the directory: "Math_test1.vi" and "Math_test2.vi". So that I get 2 vi for the "test1" variable now (one in the llb and one in the directory).Smiley Sad

I use several library in the project explorer. But the  library in the project explorer seems to create file with other extension (.lvlib) than the sdtandard LabVIEW library (.llb).

Cheers,
Risotto

0 Kudos
Message 10 of 11
(4,439 Views)