Labview

[[File:Labview-logo.png|thumb|By Source, Fair use, [[1]]]

**Laboratory Virtual Instrument Engineering Workbench** (**LabVIEW**) is a system-design platform and development environment for a visual programming language from National Instruments.

The graphical language is named "G"; not to be confused with G-code. Originally released for the Apple Macintosh in 1986, LabVIEW is commonly used for data acquisition, instrument control, and industrial automation on a variety of operating systems (OSs), including Microsoft Windows, various versions of Unix, Linux, and macOS. The latest version of LabVIEW is 2016, released in August 2016.

Labview is one of the languages used to program FRC robots

## Dataflow programming

The programming language used in LabVIEW, named G, is a dataflow programming language. Execution is determined by the structure of a graphical block diagram (the LabVIEW-source code) on which the programmer connects different function-nodes by drawing wires. These wires propagate variables and any node can execute as soon as all its input data become available. Since this might be the case for multiple nodes simultaneously, G can execute inherently in parallel. Multi-processing and multi-threading hardware is exploited automatically by the built-in scheduler, which multiplexes multiple OS threads over the nodes ready for execution.

## Graphical programming

LabVIEW integrates the creation of user interfaces (termed front panels) into the development cycle. LabVIEW programs-subroutines are termed virtual instruments (VIs). Each VI has three components: a block diagram, a front panel, and a connector panel. The last is used to represent the VI in the block diagrams of other, calling VIs. The front panel is built using controls and indicators. Controls are inputs: they allow a user to supply information to the VI. Indicators are outputs: they indicate, or display, the results based on the inputs given to the VI. The back panel, which is a block diagram, contains the graphical source code. All of the objects placed on the front panel will appear on the back panel as terminals. The back panel also contains structures and functions which perform operations on controls and supply data to indicators. The structures and functions are found on the Functions palette and can be placed on the back panel. Collectively controls, indicators, structures, and functions will be referred to as nodes. Nodes are connected to one another using wires, e.g., two controls and an indicator can be wired to the addition function so that the indicator displays the sum of the two controls. Thus a virtual instrument can be run as either a program, with the front panel serving as a user interface, or, when dropped as a node onto the block diagram, the front panel defines the inputs and outputs for the node through the connector pane. This implies each VI can be easily tested before being embedded as a subroutine into a larger program.

The graphical approach also allows nonprogrammers to build programs by dragging and dropping virtual representations of lab equipment with which they are already familiar. The LabVIEW programming environment, with the included examples and documentation, makes it simple to create small applications. This is a benefit on one side, but there is also a certain danger of underestimating the expertise needed for high-quality G programming. For complex algorithms or large-scale code, it is important that a programmer possess an extensive knowledge of the special LabVIEW syntax and the topology of its memory management. The most advanced LabVIEW development systems offer the ability to build stand-alone applications. Furthermore, it is possible to create distributed applications, which communicate by a client–server model, and are thus easier to implement due to the inherently parallel nature of G.

## For Use in FRC

National Instruments has partnered with FIRST and created a number of Labview libraries to interface with instruments commonly used by FRC teams (ex: Motors, Pneumatics, Digital Switches).

 Coding your first robot in Labview

To install Labview, the same steps are followed as when Installing the National Instruments Update Suite

## Benefits

### Interfacing to devices

LabVIEW includes extensive support for interfacing to devices, instruments, cameras, and other devices. Users interface to hardware by either writing direct bus commands (USB, GPIB, Serial) or using high-level, device-specific, drivers that provide native LabVIEW function nodes for controlling the device.

LabVIEW includes built-in support for NI hardware platforms such as CompactDAQ and CompactRIO, with a large number of device-specific blocks for such hardware, the *Measurement and Automation eXplorer* (MAX) and *Virtual Instrument Software Architecture* (VISA) toolsets.

National Instruments makes thousands of device drivers available for download on the NI Instrument Driver Network (IDNet).

### Code compiling

LabVIEW includes a compiler that produces native code for the CPU platform. This aids performance. The graphical code is translated into executable machine code by interpreting the syntax and by compiling. The LabVIEW syntax is strictly enforced during the editing process and compiled into the executable machine code when requested to run or upon saving. In the latter case, the executable and the source code are merged into a single file. The executable runs with the help of the LabVIEW run-time engine, which contains some precompiled code to perform common tasks that are defined by the G language. The run-time engine reduces compiling time and provides a consistent interface to various operating systems, graphic systems, hardware components, etc. The run-time environment makes the code portable across platforms. Generally, LabVIEW code can be slower than equivalent compiled C code, although the differences often lie more with program optimization than inherent execution speed.Template:Citation needed

### Large libraries

Many libraries with a large number of functions for data acquisition, signal generation, mathematics, statistics, signal conditioning, analysis, etc., along with numerous for functions such as integration, filters, and other specialized abilities usually associated with data capture from hardware sensors is enormous. In addition, LabVIEW includes a text-based programming component named MathScript with added functions for signal processing, analysis, and mathematics. MathScript can be integrated with graphical programming using *script nodes* and uses a syntax that is compatible generally with MATLAB.

## Criticism

LabVIEW is a proprietary product of National Instruments. Unlike common programming languages such as C++ or Fortran, LabVIEW is not managed or specified by a third party standards committee such as American National Standards Institute (ANSI), Institute of Electrical and Electronics Engineers (IEEE), International Organization for Standardization (ISO), etc.

### Dataflow programming model

Due to its thorough adoption of a data-flow programming model, as opposed to the sequential ordering of arbitrary commands like most other (usually text-based) languages, a barrier occurs for many people who attempt to apply already-learned principles from other programming approaches to LabVIEW. The inherent parallel nature of the execution of LabVIEW code is a perennial source of confusion among those accustomed to other approaches. Thus, most opinions tend to be highly polarised, with people being either very fond of it or very hostile to it.Template:Citation needed

### Licensing

Building a stand-alone application with LabVIEW requires the Application Builder component which is included with the Professional Development System but requires a separate purchase if using the Base Package or Full Development System.

### Run-time environment

Compiled executables produced by version 6.0 and later of the Application Builder are not truly standalone in that they also require the LabVIEW run-time engine be installed on any target computer which runs the application. The use of standard controls requires a run-time library for any language. All major operating systems supply the libraries needed for common languages such as C, but no operating system supplies the run-time needed for LabVIEW. It must be installed specifically by an administrator or user. This can cause problems if an application is distributed to a user who is prepared to run the application, but lacks the inclination or permission to install added files on the host system before running the executable.

### Parallel execution and race conditions

The G language includes constructs for creating multiple execution threads. Like with any language that targets non-deterministic operating systems such as Windows, Mac OS, and Linux, parallel execution of multiple threads can lead to the possibility of race conditions. Although the G language greatly simplifies both the programming and thread management on multi-core and multi-processor systems, the G developer must still guard against race conditions; for which there are several functions and techniques available for doing so. Programming with the LabVIEW field-programmable gate array (FPGA) module results in true parallel implementation on FPGA targets.Template:Citation needed

### Performance

LabVIEW tends to produce applications that are slower than hand coded native languages such as C, although high performance can be achieved when using multi-core machines or dedicated toolkits for specific operations. LabVIEW makes multi-core programming much simpler than many other languages, due to its implicit parallelism and automatic thread management.

### Light weight applications

Very small applications still have to start the runtime environment which is a large and slow task. This tends to restrict LabVIEW to monolithic applications. Examples of this might be tiny programs
to grab a single value from some hardware that can be used in a scripting language - the overheads of
the runtime environment render this approach impractical with LabVIEW.Template:Citation needed

### Timing system

LabVIEW uses the January 1, 1904 epoch as its *zero* time. Other programs that use the January 1, 1904 epoch are Apple Inc.'s classic Mac OS, Palm OS, and Microsoft Excel (optionally).

### Non-textual

G language being non-textual, software tools such as versioning, side-by-side (or diff) comparison, and version code change tracking cannot be applied in the same manner as for textual programming languages. There is some additional tool to make comparison and merge of code with source code control (versionning) like subversion, CVS, Perforce.

### Not forward compatible

A VI generated in a newer version of LabVIEW cannot be opened in an older version, not even for viewing. The "Save for Previous Version" feature can be a partial  solution, if a developer knows up-front that this would be needed.

### No zoom function

There is no ability to zoom in to (or enlarge) a VI which will be hard to see on a large, high-resolution monitor, although this feature is under development Template:As of.

Taken from [2]

1. ↑ NI Instrument Driver Network
2. ↑ Template:Cite web
3. ↑ Template:Cite news
4. ↑ Template:Cite news
5. ↑ Why Dataflow Programming Languages are Ideal for Programming Parallel Hardware
6. ↑ Template:Cite web
7. ↑ http://thinkinging.com/2007/06/17/top-5-bad-excuses-for-not-using-source-code-control/
8. ↑ http://www.ni.com/white-paper/4114/en/
9. ↑ http://www.ni.com/tutorial/14304/en/
10. ↑ Template:Cite web
11. ↑ Template:Cite web
12. ↑ Template:Cite web