1. IntroductionLabVIEW is an open development platform that has gained acceptance in many different application areas and industries. Why? At its core, the LabVIEW graphical programming language has enabled thousands of scientists and engineers to develop complex measurement and control applications very quickly and easily. However, the language is only one element of the platform that has powered its acceptance over the past 20 years. There are four key elements that will be explored as critical elements of the LabVIEW development platform:
- Intuitive graphical programming language
- High-level application-specific tools
- Integrated measurement and control-specific capabilities
- Multiple computing targets
2. Intuitive Graphical Programming LanguageAs you can imagine, the LabVIEW language has a tremendous collection of libraries and structures that have been introduced and improved over the past 20 years. The scope of this paper does not permit much detail on all aspects of the graphical programming language and why it works for scientists and engineers. (Refer to the Related Information section at the bottom for more details about LabVIEW). For this paper, we will highlight a few key concepts that set the language apart:
LabVIEW is a development environment based on a graphical programming language. This approach to developing applications significantly reduces the learning curve because graphical representations are a more natural design notation for engineers and scientists than text-based code. You can access the tools and functions through interactive palettes, dialogs, menus, and hundreds of function blocks, known as VIs (virtual instruments). You can drag and drop these VIs onto a diagram to define the behavior of your applications. This point-and-click approach significantly reduces the time it takes to get from initial setup to a final solution.
Figure 1. LabVIEW Block Diagram Example
You define the flow of data and the execution of the application through a concept known as dataflow programming. Data is passed from one VI to the next, eventually defining the execution order and functionality of the entire application. Dataflow is comparable in nature to reading a flow chart. Block diagrams consist of functions, which are represented by icons, wires that connect these icons, and structures that control execution logic. Data flows from one function to the next, and the functions and VIs do not execute until all terminals or wire connections have data available for processing (See Figure 1).
LabVIEW naturally encourages modularity and reuse of code. Users create VIs, or code modules, with a graphical front panel that displays the inputs and outputs of the functional code as graphical controls and indicators. The graphical controls and indicators (knobs, meters, gauges, graph displays, strip charts, etc) represent datatypes for the data passing into and out of the functions. Users can easily plug these VIs into other VIs, allowing for modular, hierarchical code that enables users to gradually build up complex systems one component at a time and reuse common operations as subVIs along the way. There is no limit to the number of layers or subVIs used in an application, so the language scales with the complexity required for the application.
Multithreading and Parallelism
LabVIEW eliminates much of the tedious low-level coding required by traditional languages, such as memory management (variable declarations, etc). LabVIEW also has intuitive graphical structures for common programming structures in text-based languages. For example, while loops and for loops are represented as a box – the code residing graphically within the box is code executed by the loop iterations.
Looking one level deeper into the language, LabVIEW is designed as a parallel language, which means that the graphical language constructs naturally represent the simple concept of parallel execution. This simple concept, however, can be very difficult to implement in text-based languages because they traditionally execute sequentially (line by line). With LabVIEW, users can develop parallel-executing applications simply by placing multiple loop structures into their code. A graphical representation of two independent loops, as shown in Figure 2, executes independently in parallel as well. This feature is an incredibly simple way to represent a very difficult coding challenge. Parallel execution can be critical in automated test systems, where multiple units under test (UUTs) may be tested, in real-time control systems, where time-critical loops are acquiring data and controlling outputs while data is communicated to the host at the same time, or in embedded applications, where multiple types of inputs must be responded to in a deterministic fashion.
Figure 2. The LabVIEW graphical programming language is designed to represent parallel execution
much more intuitively than a sequential text-based language.
When developing parallel-execution applications, the programmer must have tools for setting the priority of different operations. For example, the I/O portion of the program many times is more critical than the user interface. With LabVIEW, users can configure thread priorities at the OS level using intuitive dialogs and settings.
Interactive Execution and Debugging
The LabVIEW language is interactive as well, which means users can easily experiment with different functions in the libraries during development, which is particularly important when programming I/O resources. For example, when configuring a data acquisition (DAQ) operation, users can simply select an acquisition function from the built-in DAQ library and run it independently. This operation will actually retrieve data from the DAQ board in the computer, so the user can inspect the data to see if the operation is appropriate for the program. If so, simply drop the VI into the program and continue. If not, try another VI in the library until you find the right one.
Debugging in LabVIEW is also interactive, featuring all of the common capabilities of traditional programming tools, such as breakpoints, step over/into/out of, and so on. A unique debugging capability of LabVIEW is the ability to visualize data anywhere within the algorithms you develop without degrading the performance of the algorithm or requiring complex programming. For example, if you are developing a complex signal processing algorithm in LabVIEW, you can easily drop graph controls on the front panel and wire them to the data path to view the data at that point in the algorithm. Or, you can connect a control, such as a knob or slide control, to vary input parameter values of the algorithm. This ability to interactively peek and poke at data and parameter values makes debugging much faster and more intuitive in LabVIEW.
3. High-Level Application-Specific Development Tools
The LabVIEW graphical language is an intuitive way for scientists and engineers to develop their measurement and control applications. In addition to being easy to learn and use, the language also delivers the performance needed for advanced applications. The compiled language executes at speeds comparable to traditional compiled text languages.
However, for many applications, there may be higher-level ways to represent a solution (or part of the solution) than using low-level code. LabVIEW has a growing collection of higher-level tools targeted at solving particular types of structures or constructs much faster. With most of these tools, the user can work at a higher conceptual level to develop a solution, which is then converted into the low-level LabVIEW code to deliver all of the openness, flexibility, and performance of the compiled LabVIEW language. These development tools include:
- Control block diagrams – for designing linear, nonlinear, discrete, and continuous control systems. Users can develop them using traditional control concepts such as transfer function blocks, integrators, differentiators, and feedback loops
Figure 3. LabVIEW Simulation Diagram
- State diagram – for defining multiple states and transition logic between them using a graphical state diagram representation
Figure 4. State Diagram
- Formula/script nodes – for implementing complex formulas in text or importing algorithms defined in traditional math tools such as The MathWorks MATLAB® or MATRIXx..
- User interface programming – for managing very complex user interfaces in graphical code using the event structure in LabVIEW. The structure receives information about each user event that can be processed in different panes of the event structure.
By combining these high-level concepts to build specific applications with the flexibility of the LabVIEW language, users get the best of both approaches in one platform.
MATLAB® is a registered trademark of The MathWorks, Inc.
4. Integrated I/O Capabilities
LabVIEW is best known as a data acquisition and instrument control tool. These capabilities are built into the language and are pervasive throughout the environment. The language itself naturally manages continuous, looping data acquisition operations, and delivers significant time savings to developers simply because the tool provides functionality throughout with an engineering and scientific perspective in the areas listed below:
- Plug-in data acquistion devices
- Modular instruments
- Stand-alone instruments (GPIB, RS232, etc)
- Vision/image acquisition
- Motion control
- Signal processing
- Sound and vibration
- Order analysis (rotational machinery analysis)
- Spectral measurements and modulation
- Graphs, strip charts
- Knobs, meters, gauges
- Pumps, valves, pipes
- Thermometers, tanks
Figure 5. LabVIEW Front Panel
The out-of-the-box integration of all of these different types of engineering-specific controls and libraries cannot be underestimated.
5. Multiple Computing Targets
Another advantage to the LabVIEW platform is its open back end that can target a wide variety of computing platforms. The native LabVIEW compiler runs on all popular desktop OSs, such as Windows, Mac OS X, and Linux. LabVIEW also runs on industrial real-time platforms, for applications that require determinism or additional reliability. LabVIEW programs also can be targeted to handheld devices running Windows Mobile, Windows CE, or Palm OS. In addition to the obvious handheld PDA or smart phone devices, these technologies are often found on flat panel displays used in machines or industrial systems. And finally, the LabVIEW embedded family of products convert LabVIEW diagrams into C code for execution on 32-bit microprocessors.
Figure 6. LabVIEW Computing Targets
With this wide array of computing targets, LabVIEW users can choose the right run-time environment for their application, as well as scale up or down as their requirements change.
Please refer to the other papers in this series to learn more about the LabVIEW graphical development platform:
The LabVIEW Platform – Part 1: An Open Platform for Long-Term Continuity
The LabVIEW Platform – Part III: An Integrated Platform for Design, Control, and Test