VI

From LabVIEW Wiki
Jump to: navigation, search

The VI, or Virtual Instrument, is the basic building block of programs written in the G Language. It is similar to a function or subroutine in other programming languages. It includes the Front Panel (containing Controls and Indicators), the Block Diagram (containing Control Terminals, Wires, and Structures and various other GObject nodes), the VI's Icon and its Connector Pane (as well as compiled executable code which is hidden behind the scenes).

The term Virtual Instrument is a play off of the fact that LabVIEW applications are designed for writing software that simulates the functionality of instruments -- rather than being a physical instrument on a laboratory bench, they are virtual and exist in software.

The VI File Format

VIs are saved as *.vi files in a proprietary binary format defined by National Instruments, the makers of LabVIEW. By default, a VI contains two kinds of code: the graphical source code that you edit and a compiled version of this code that LabVIEW uses to run the VI.

The graphical source code includes the:

The compiled version includes the:

When you edit the source code of the VI, LabVIEW automatically recompiles the VI to reflect your changes in the compiled version of the code. LabVIEW also automatically recompiles all VIs that call the changed VI, resulting in unsaved changes to the calling VIs. If the calling VIs are stored in source code control, these pending unsaved changes force you to check out the VIs when you update their subVIs.

To avoid this problem, Starting in LabVIEW 2010, LabVIEW allows you to separate compiled code from the graphical source code of a VI, thereby creating source-only VIs. After you separate the compiled code from a VI, LabVIEW still compiles the VI when you modify subVIs. However, LabVIEW stores the recompiled version of the code in a compiled object cache rather than in the VI in source code control. Because the VI in source code control does not change, you no longer have to check the VI out of source control when you change subVIs.

See Also