Why global variables have a .vi extension?

Hello

By cleaning up a code the other day, it occurred to me that, although Global Variables and Virtual Instruments are separate entities with distinct roles in the LabVIEW environment, they share the same file extension .vi. It seems much more logical to attribute a single extension as we already controls, menus, classes, etc.

Can someone explain why he made this way?

Thank you!

It's just historic (they have been around since LabVIEW 3). Global is a VI file type, it's just that the editor of LabVIEW you can't see his chart. If we had it to do again, I think that we would not only have implemented their differently (i.e., anything other than a façade of VI to set global data), but we probably would have given them as a single file type.

Tags: NI Software

Similar Questions

  • global variables for the XML plugin problem

    Hello world

    recently I started working on a dialog box SOUTH, where the user can load the *.xml files in DIAdem.So much my code for the button looks like this:

    ....

    Call the FileNameGet ('ALL', 'FileRead","*.xml")
    Call DataFileLoad (FileDlgName, "XML_Plugin", "Load")

    ....

    And I must say that it works very well! I am able to load all listed in the devices file. BUT when I tried a number of loading devices, I used a global variable, that I defined in the vbscript file that I load the SOUTH since, I've noticed that global variables, I've defined with GlobalDim are not defined in the vbs.:mansurprised of XML_Pluging:

    Then I started to experiment and so far without success, no matter where I define global variables, in my plugin *.xml all not defined! The native commands even and DIAdem functrions does not work. If I run the script in tiara, it shows no errors, but when I use the plugin to open a file, then it gives an error. For example, MsgBox is not allowed.

    I used the plugin example for *.xml, which was published on the Web site of NOR, and I made a few changes. But overall I have it has not corrupted and I kept the same structure:

    Void ReadStore (File)

    Dim XmlFile: xmlFile = File.Info.FullPath
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'open the file '.
    OpenXMLFile xmlFile

    End Sub

    Void OpenXMLFile (xmlFile)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Open MS - Xml Parser
    'Create the ActiveX object for the Microsoft XML parser.
    Dim XDoc: set xDoc = CreateObject ("MSXML2. DOMDocument.3.0")

    "Try to load the XML document
    If xDoc.Load (xmlFile) = False Then
    "Failed to load the document XML.
    RaiseError ' unable to load XML document!
    End If

    protected originalLocale: originalLocale = Getlocalte
    "SetLocale" en - us ".

    "The XML document loaded successfully!
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    '----------------------------------------------
    "Read the header information.
    '----------------------------------------------

    Here, I have read some values of the header and then I loop on all devices present in the file!

    So basically I have two subroutines and that's all.

    SetLocale originalLocale

    End Sub

    So what I am doing wrong? Why global variables and other functions do not work. Is it because there is xml code in the script this way or it's a version problem?

    I use DIAdem 10.2. If I use global variables in other vbscripts, I use to draw curves for example I have no problem. Now I'm no *.xml code and no subroutines.

    I'd appreciate any solution that will make my *.xml plugin to work.

    Hi fscommand.

    It is expected all behavior.  Use XML, as all VBScript DataPlugins, runs in a separate VBScript host of the DIAdem VBScript host.  DIAdem VBScript host adds all global variables green and Red controls global to host Microsoft VBScript standard.  Use VBScript host has its own special abilities (file object, root object), but there is NO access to Globals green or red blanket orders in the reception of DIAdem VBScript.  Your SUDialog runs in a third host VBScript, which is separated from the other two and the other two are not capabilities (command SUDialog callback functions), but the SUDialog VBScript host and VBScript tiara share all global variables green and Red orders overall.

    Normally all blue VBScript commands are allowed in all 3 VBScripts hosts, but in the case of the DataPlugins MsgBox and InputBox functions were especially restrained because the dialogues could cause a lot of trouble with the DataFinder.  In fact, they have been allowed to 9.1 tiara which was the latest version of tiara for the DataFinder appear.

    So, why do you want to pass information between the XML use and tiara?  If you want to use to share information with DIAdem, then you should just expose every piece of information as a new property in the data portal, which can read and use the code VBScript DIAdem.  The path of the XML file is already available inside the use of XML.  What other information in the call VBScript DIAdem do you need to share with the use?

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • A global variable is adjustable, and a Boolean value in LV3.1.1?

    A global variable is adjustable, and a Boolean value in LV3.1.1? I can do in LV 8.0, but 3.1.1 I need because of instrument gives me the penalty.

    All suggestions from users for a long time?

    Well, I'm a long time user, but that will come back some time.

    A global variable is basically a VI without a block diagram, so you should be able to place a Boolean control on the global variable just as you would place a digital command. Boolean values are treated differently at the time, but it probably won't affect what you do. The prices you say you tried, you can't put a Boolean value controlling this? I honestly don't remember not that is the case, but if this is the case, you can still use the functional overall construction, which is what we did before global variables have been introduced.

  • Why LabVIEW example projects using Global Variables?

    I'm puzzled.  I've been pretty good programmers LabVIEW talks (including some who work for the OR) and came away with the impression that Global Variables should, as a general rule, be avoided, with functional Global Variables (alias VI Globals) generally preferred for "local memory".

    I have studied some of the example distributed with LabVIEW, 2012 and 2013, in particular the proposed acquisition in real time and am struck by the use of Global Variables, where I'd be inclined to use instead a FGV.  For examples, to stop all the loops on the RT target, the overall "All the RT loop Stop" is defined; 'Constants' of configuration (such as timeouts, Streme network names, the names of the journal folder) are kept as Globals; Streme network endpoints are stored in Globals.

    [Note - there is a weird spelling of the second word of the network Streme, above - when I tried to post with the correct spelling, I got an error message saying this word is 'not allowed in this community".]  I apologize for the offense, but I must confess that I do not understand what the problem with the help of the spelling of this word...]

    Why use Globals in these cases, rather than write a bunch of VIGs to hold these data?  Note that almost all these Globals are 'Read' essentially (written once when a resource is acquired, for example) or "Read Only" (treated as if they were a constant).  Indeed, read-only variables can be written as a Subvi with only an output terminal, acting as a (visible, due to the icon) constant.

    I can see advantages to this approach.  On the one hand, VIGs can have error bounds who run the data flow (I just spotted a bug "data flow" in code, I am developing that is based on this model, to read configuration data to an XML file in a world and in the same VI, Global wiring to a "use - me" terminal, but with no guarantee that I'll read the overall after I write it).

    It is, I suppose, a matter of 'speed' - perhaps Global Variables are 'faster' than VIGs (especially if the VIG 'sits' on an error line).  My thought, however, is that this difference is likely to be trivial, especially as these VIGs (or Globals) tend to become "occasional" calls (with the exception of the indicator 'all the loop Stop' which is called once per line).

    Are there other arguments or considerations that make a Variable global to a better choice than a VIG?  Is there a reason that LabVIEW developers put in these start-up of projects LabVIEW?

    BS

    I have to ask, how do you use functional Global Variables?  Like just a Get and Set?  If so, you can use a global variable.

    Yes, globals are faster and use much less overhead.  At the summits of CLA in recent years, we talked about using globals.  The most common use is for Write-Once-Read Many and writing-never-Read Many with configuration data.  It's a good idea to use globals with the constants that can change on you.  It turns out that the world will have the same performance as a constant in this case.  This is done so that you don't have 1 place to edit the 'constant '.

    The rule on "Globals are evil" actually goes back several years when NEITHER had the huge "people of the country are bad" vendata.  But NEITHER explains well how to do things properly.  So I found people, instead of using local variables, using the value property node.  It's even worse because the property causes thread swaps and kills your performance.  It wasn't until I shouted to people to use wires and shift registers I have seen improvements in the way in which people wrote their code.  So people are always riffling in the use of globals and decided to use FGVs with the EEG and fixed rather cases.  But this does not solve the problem of the conditions of race with critical data and you cause an additional burden.

    So from my experience, I use globals all the time for configuration data.  Yes, you must be careful about the race conditions.  But as long as you understand that it is a common and useful practice.

    I would not use a global variable for data that are constantly changing (use registers to offset or Action motor) and/or processes that have critical sections of code (use a motor of Action).

    NOTE: I use the definition of Mercer to FGV (a Get/Set only) and motor Action (many cases which specifically affect the data).

  • Using global variables in a device custom

    Hello world

    I have problems with the passing of data through my device customized using global variables. I want to allow a user to select a RIO device address when you set up the system definition file. This is recorded in a global variable using the hand Page VI. I would later use this RIO device address in RT driver to deploy a bitfile. I can hard-code, but it is much more convenient to use a global.

    When I try to store the address of the global variable, it updates the value temporarily (I confirmed that the structure of the event recognizes the change of value). When I click the node of the tree to define system linked to the Main Page VI and then click on it again, the hand Page VI runs again. I wrote the code to repopulate the address of device of RIO with the last value stored in the global variable, but it is empty. I've included the VI global variables in my build, so I can't imagine why it can reset this value.

    Any help would be appreciated!

    Thank you

    Mitch

    Have you tried to use the custom device properties to store this value instead of GVs?

    Configuration VI, you can set this property, and if I'm not mistaken, you can read these properties on the RT driver.

  • Functional Global Variables: an indicator can be used instead of a shift register?

    It is a simple question, but I can't find an answer to it. The model agreed to a functional Global Variable is to use an uninitialized as in this example shift register:

    ('Référence IN' and ' Reference to "is actually a pile of references.) There is also a "Se Refnum" case, which comes the straight through the tunnels shift register.

    My question is, why can't we do store the indicator data? It is much simpler to use a shift register (IMHO a non obvious way to store global data!):

    The case "Se Refnum" does absolutely nothing. Other functions such as erasure of data can be implemented just as easily. The advantage of the FGV to help avoid race conditions is maintained because you always use the VI to access the data.

    JonP says:


    Not so much, the Inidicator can happily live outside the case structure, together and Clear would be just assign different values.

    If you have only a case structure, the indicator could not live outside of it.  In order to maintain the indicator data, your design requires that it is not written in for a case of Get.  If you have an exterior structure deal that decides on 'Get' or 'set or clear' and (in the case of "Set or clear") contains the terminal of the indicator and a classiquee case that decides on 'Set' or 'clear '.  However, I would consider this a design below using the standard template of the FGV.

    The difficulty with retrieving the value if you want to do a read operation / writing change. But LV provides many ways to retrieve data from an indicator (one you don't mention is the 'Value' property), do you mean that's all "incorrect"?

    Yes (I mean that they are all incorrect).

    You could hack your way around the design to work with a single structure of matter and the terminal of the indicator being outside using a method to read the value of the indicator and through a tunnel to the structure of the case through wiring for the tunnel of writing indicator in the case of 'Get '.  However, who will require a local Variable or value of property node.  As I said, these (I only mentioned the local Variable originally) are not good choices for performance and scalability.  If you are not aware of the functional differences between the terminals, local Variables and nodes of property value, refer to this article (obviously advantages/disadvantages such as redraw objects on the front panel are not relevant here).

    I guess you could say that indicators should only be written, but it is difficult to be pure!

    No, it's not, just use the classic design of the FGV!

  • Global variable control and simulation

    Hello!

    I have a probem with the export data of the Simulation loop in the graphic form.

    I have created a global variable, but in the façade is not updated or exported the data necessary, but in the file as a global variable do?

    I would like to gather (gathering) all the data after the simulation data file as Excel (trace the export data to Excel or save the spreadsheet file) as well as the image of terminal.

    Please find attached my files - someone has an idea or a solution?

    There must be some easy trick

    Thank you!

    Vasco

    (1) why are you doing this problem much more complex it must be using a global variable and another loop like that?

    (2) why you son of path of the VI in the picture? You try to crush the VI on disc with the image?

    (3) be careful not to ignore the output error.

    The code shown in the attached screenshot works very well. I'll take Bravo if it helped you.

  • Is it possible to replace occurrences of a global variable massively while also setting up the components of connector?

    I work through some of my old code now, looking to increase the performance where I can. Here's my situation:

    1. I used Global Variables to spread a few constants in my screws, instead of a proper typedefed cluster.

    2. execution does not have an extension, but no matter when I save the project, I would say 50 to 60 percent of the economy/compling time is spent on the screw of 300 or more with global variables. I suspect it has to do with the link between the overhead associated with the global.

    3. Ideally, I would like to replace this:

    With something like this:

    While also putting the connector of this pane:

    To do this:

    What is the VI server is capable of? You can assume that the VI in question have very predictable names, matching the regular expression:

    subname[0-9]^3
    

    Is it still worth it to replace?

    I don't know what you mean by compile time.  One of my big projects LabVIEW RT, which has about a thousand of screws, a lot of VIGs (FGVs), engines of the Action, even a few Globals and variable shared.  In my case, the thing that seems to "slow down" the compilation the most is the links to the report generation tool (I use Excel workbooks for 'drive' of experience and also save the data a bit).  If I do a building together, to build this routine and about 6 'support' routines (data analysis, utility Configuration, etc.), it may take a minute, but I can't find this excessive nor a charge (compared to the facility to isolate/encapsulate features in screws as FGVs).  So I guess I don't understand the "real problem"...

    Bob Schor

  • Cannot use Global Variable in the Structure of the event

    I'm using LabVIEW 2009.

    In my LabView project, I have a global Boolean variable called EStop. I can read and write the global variable. If I double click on the global variable, it takes me to EStop.vi which includes a text button. EStop.vi is part of my project.

    In one of my report, I have a Structure of the event. If I go to one of the event handlers in this case Structure and right click and select Add event, I get a list of possible events. But this list does not EStop or an EStop events.

    I would like to add an event to EStop case: changed value.

    Why I can not add to a case of events events that include events on Global Variables as value changed?

    How can I add EStop: event changed my structure of the event value.


  • How to access a global variable that is common between the different baskets project library

    My project consist of several libraries, after generation the library project packed for each library, I find it cannot share data in a global variable between different packaged project library file. For example: packed project library #1 contains VI variables global wirte 'position' and give it a value '400 '. Library #2 present another VI project try to read this global variable, but he gave reading of is NULL not "400". Why has this happened? Is it possible to solve, welcome any help, I wll appreciate for this!

    If you understand what is happening here...

    When you build a PPL, it takes in the .lvlib and also all the dependencies of the .lvlib.

    In your case, when you generate the Test Task.lvlib in a .lvlibp, she also pulls on a copy of the DataProcess.lvlib:GlobalsVariable.vi because it's addictive to read GlobalVar.vi.

    When your application runs, you end up with two copies of GlobalsVariable.vi in memory:

    DataProcess.lvlibp:GlobalsVariable.vi

    AND

    Test Task.lvlibp:: GlobalsVariable.vi (I don't know how PPLs namespace dependencies... If there is still the DataProcess.lvlibp)

    Because they are different screws (i.e. in a different namespace), they have their own memory and that's why you can't access the data.

    Your Test Task.lvlibp calls the version of GlobalsVariable.vi, he pulled the dependencies.

    To solve this problem - you must ensure that Task.lvlibp of Test calls the version of GlobalsVariable.vi of the DataProcess.lvlibp - you'll need to replace all instances with the version of the PPL. Of course, if you run DataProcess in the development environment, then it will always be bad namespaced, hence the suggestion to put your global variable VI in is own PPL that you then use in the process of data and Test tasks.

  • Digital control system, using limits of entry of data with global variables

    Hello!

    I have a Subvi with several digital control sliders. These control framerate, the pixel clock and exposure of a camera and their change in max/min/increment whenever one of them is changed - they are interdependent and get their information from the camera continuously during execution.

    I'm trying to remote control this VI, but during the passage of a value using global variables, it doesn't "stick".

    Example:

    The value for exposure is 237,48 Ms. different values are constrained to the nearest value. So if I pick 240,00 ms at the Subvi, he should know that this is not a valid value and change to Mrs. 237,48.

    But it is not do and I don't know why. When I enter the values manually, it works fine.

    Any suggestions?

    The limits on the controls that apply when their control from the front and is not passing values via the connector pane.

    You should use something like "line and force" within the VI to validate the values are within the range (maybe constrain data or return an error).

  • formula with the global variable node

    Hello

    I'm tring using node formula with global variables as an entry and exit.

    but this is where I see the SW hangs forever.

    Either way, I am a novice to the labview.

    Can some give me advice why this is happening?

    Thank you in advance,

    Do

    As smercurio mentioned, if you described what you wanted to do, we could show you things that can be done using LabVIEW.

    For example, loops For may not be not necessary if you are trying to extract or manipulate data in tables.

    It is good that you have a job, but it would be better to learn the power behind LabVIEW.  Who knows, you can actually walk away from C code...

  • With the help of semaphore with a Global Variable - correct use?

    Hi all

    I looked in the use of global variables and in my case, it seemed with the help of a semaphore is the appropriate solution.

    In my case, I use a global variable to store the State of the system. Asynchronous two with screw environment (same VI) will follow two COM ports to see if they get a ' login:' command prompt. If the COM port is associated with Alpha, Charlie, or Echo, it increments by 1, and if it is associated with the Bravo, Delta, or Foxtrot, is incremented by 2 GV. If the GV is 3, the rest of the code will run. In this case, it must be a port COM A, C or E; the other should be B, D or F.

    A VI parent is called inside a loop. He works for the first loop. He never adds up to 3 on the second loop, however. I can't understand why. Please let me know if my code is a poor use of semaphores, or if there is debugging I can try.

    I'm still relatively new to LV, so I'm sorry if my screws are difficult to read. I created this in LV2011.

    Thanks for any help!

    CelerityEDS wrote:

    The output of my time looping (wait GV = 3) goes to the structure of the case on the bottom right (clear SGS, PasswordEntry, etc.), so the GV get indeed consulted by the upper case structure right.

    ??

    Your right upper case structure does not run until your time ends in a loop.  The while loop does not stop until the total is equal to 3.  Where can increment you the world besides structures case you cannot yet?

    Have you tried in your point culminating execution of the VI in order to see how they are actually running?

    Another problem that I see.  Assuming that your first while the loop is going to end.  In the structures of your case, you lock the semaphore.  But you can never unlock the semaphore unless you have the right combination of conditions that allow you to get to the case that unlocks the semaphore.  The conditions are based on data that are read before the start of the case of structure, which means that data will not be read and changed until it all ends.  You have the timeout of your lock semaphore connected on one of the cases, but your semaphore lock can never timeout because you do not have a value on his entry time-out.  I think you have a situation where you can lock a semaphore, then arrive at a situation where you can not unlock, then wind locking up of your cold code.

    I don't really think that you need a semaphore at all.  I think you can protect reading and writing functional your overall using a global variable, i.e. the motor action.  Overall, I think you need to rethink the architecture of your code.

  • Impossible to go from baseline of connection via functional Global Variable

    Hello

    I'm working on a project of producer/consumer based, which some parties have access to a MySQL database. After the connection to the database, I want to store the reference to the connection inside of a functional global variable. Then other parts of the project that need to use it can only read in the functional global variable.

    For some reason, the reference of the connection is not valid once it has been read functional global variable. It works fine if I have the reference directly from the connection to the request for enforcement VI wiring.

    I have attached a few screws that show the problem, but you will not be able to run them unless you have a database to connect to and hack you the query a little so he selects in your tables.

    SQL_whole_thing works very well. It connects to the database, returns information he requested by the query, and then disconnects. No problem.

    But if I run DB_Connect.vi (which stores the reference to 'DatabaseID_FGV' FGV), follow-up of SQL_Query.vi (which reads to the FGV reference), then I get an error saying that the reference is not valid.

    Anyone has an idea why this happens?

    Thank you

    Christian.

    PS: You'll need DBID_FGVActions.ctl and database_connectioninfo.ctl, also attached

    Your referance on the SR's "outdated" when implementing this way.  Essentially, this means that data in memory to this referance has changed because the referance was stored.  Just because you have changed the data at this location.  This prevents you from spend a refeance for the "old data" and crashing the calling application since the referance Rassi contains assumptions that are more adequate data.

    Consider upgrading this FGV powered Action.  This would be encapulate all the Actions you want to do to the database (connect, disconnect, fecth, writing etc.) and maintain the current referance on the AEs shift register.  Ben establishes a great deal for just this type of functional encapsulation in his famous nugget.  A must read for every programmer

  • How can Global variables can be shared in Subvi?

    I have a question about global variables. not found an answer in the Forum.

    I want to share a few global variables in the different Subvi: starting Subvi first hand.

    define variables, then in second vi, use these variables.

    In my test, if I run LabVIEW, everything is ok. If building an exe, the first sub - VI

    cannot be exited. If the output, the value of global variabels is deleted.  I don't know why?

    Can I use like this? Please help me.

    Thank you.

    attached is my main application. For the release of sub - VI, just call FP. Close.

    The way I underrstand problem:

    There is a main VI (main.vi) that will successively two different screws through a VI reference.

    Let's call them A.i and B.vi. The two access to the same global variable.

    The main VI does not have the global variable.

    At first is short, then closes. B later runs and is expected to access the global variable with the data left by an earlier. I haven't explored it, but I guess that once A ends, the global variable also leaves in memory, forgetting everything

    My suggestion is to place an instance of the global variable in the main VI, forcing them to remain in memory as long as the main VI is running. Apparenlty, this action solved the problem.

    mmm2006 wrote:

    Can I update a global variable in main vi? There are a lot of adjustment, and I don't want to display them.

    I guess it will be sufficient to place the global variable in the main VI to keep in memory. There is no need to read or view its content. Another solution might be to specify the global variable as 'start VI "? I have not tried.

    These are just speculation, because I almost never use globals so my experience is limited. I probably would have A.i write the data to a file B.vi later access, for example.

Maybe you are looking for