NI LabVIEW software is used for a wide variety of applications and industries, which can make it challenging to answer the question: “What is LabVIEW?” I have heard many conflicting opinions and debates over the years, so I thought it would be appropriate to take this opportunity to discuss what LabVIEW is.
LabVIEW is a highly productive development environment for creating custom applications that interact with real-world data or signals in fields such as science and engineering.
The net result of using a tool such as LabVIEW is that higher quality projects can be completed in less time with fewer people involved.
So productivity is the key benefit, but that is a broad and general statement. To understand what this really means, consider the reasons that have attracted engineers and scientists to the product since 1986. At the end of the day, engineers and scientists have a job to do – they have to get something done, they have to show the results of what they did, and they need tools that help them do that. Across different industries, the tools and components they need to succeed vary widely, and it can be a daunting challenge to find and use all these disparate items together. LabVIEW is unique because it makes this wide variety of tools available in a single environment, ensuring that compatibility is as simple as drawing wires between functions.
1. What Makes Up LabVIEW?
LabVIEW itself is a software development environment that contains numerous components, several of which are required for any type of test, measurement, or control application.
Figure 1. LabVIEW contains several valuable components.
To quote one of our software developers, “We write low-level code so you don’t have to.” Our global team of developers continually works on the six areas called out in Figure 1 to free you, the LabVIEW user, up to focus on the bigger problems and tasks you are trying to solve.
G Programming Language
- Intuitive, flowchart-like dataflow programming model
- Shorter learning curve than traditional text-based programming
- Naturally represents data-driven applications with timing and parallelism
The G programming language is central to LabVIEW; so much so that it is often called “LabVIEW programming.” Using it, you can quickly tie together data acquisition, analysis, and logical operations and understand how data is being modified. From a technical standpoint, G is a graphical dataflow language in which nodes (operations or functions) operate on data as soon as it becomes available, rather than in the sequential line-by-line manner that most programming languages employ. You lay out the “flow” of data through the application graphically with wires connecting the output of one node to the input of another.
The practical benefit of the graphical approach is that it puts more focus on data and the operations being performed on that data, and abstracts much of the administrative complexity of computer programming such as memory allocation and language syntax. New programmers typically report shorter learning curves with G than with other programming languages because they can relate G code to flow charts and other familiar visual representations of processes. Seasoned programmers can also take advantage of the productivity gains by working at a higher level of abstraction while still employing advanced programming practices such as object-oriented design, encapsulation, and code profiling.
Figure 2. This block diagram shows shows self-documenting G code.
LabVIEW contains a powerful optimizing compiler that examines your block diagram and directly generates efficient machine code, avoiding the performance penalty associated with interpreted or cross-compiled languages. The compiler can also identify segments of code with no data dependencies (that is, no wires connecting them) and automatically split your application into multiple threads that can run in parallel on multicore processors, yielding significantly faster analysis and more responsive control compared to a single-threaded, sequential application.
With the debugging tools in LabVIEW, you can slow down execution and see the data flow through your diagram, or you can use common tools such as breakpoints and data probes to step through your program node-by-node. The combination of working with higher-level building blocks and improved visibility into your application’s execution results in far less time spent tracking down bugs in your code.
- Support for thousands of hardware devices, including:
- Scientific instruments
- Data acquisition devices
- Motors and actuators
- Familiar programming model for all hardware devices
- Portable code that supports several deployment targets
Typically, integrating different hardware devices can be a major pain point when automating any test, measurement, or control system. Worse yet, not integrating the different hardware pieces leads to the hugely inefficient and error-prone process of manually taking individual measurements and then trying to correlate, process, and tabulate data by hand.
Figure 3. LabVIEW connects to almost any hardware device.
LabVIEW makes the process of integrating hardware much easier by using a consistent programming approach no matter what hardware you are using. The same initialize-configure-read/write-close pattern is repeated for a wide variety of hardware devices, data is always returned in a format compatible with the analysis and reporting functions, and you are not forced to dig into instrument programming manuals to find low-level message and register-based communication protocols unless you specifically need to.
LabVIEW has freely available drivers for thousands of NI and third-party hardware. In the rare case that a LabVIEW driver does not already exist, you have tools to create your own, reuse a DLL or other driver not related to LabVIEW, or use low-level communication mechanisms to operate hardware without a driver. Chances are if the hardware can be connected to a PC, LabVIEW can talk to it.
The cross-platform nature of LabVIEW also allows you to deploy your code to many different computing platforms. In addition to the popular desktop OSs (Windows, Mac, and Linux), LabVIEW can target embedded real-time controllers, ARM microprocessors, and field-programmable gate arrays (FPGAs), so you can quickly prototype and deploy to the most appropriate hardware platform without having to learn new toolchains.
Analysis and Technical Code Libraries
- Libraries of signal processing, analysis, and control algorithms
- Libraries of communication, file I/O, and connectivity
- Library functions that consume data in the same format as the hardware drivers return it
LabVIEW tailors the G programming language to engineering and scientific use by incorporating hundreds of specialized functions and algorithms that are not typically included with general-purpose programming languages.
In addition to the standard programming language constructs, LabVIEW contains functions for:
- String, array, and waveform manipulation
- Signal processing, including filters, windowing, spectral analysis, and transforms
- Mathematical analysis, including curve fitting, statistics, differential equations, linear algebra, and interpolation
- Communication, including high-level communication protocols, HTTP, SMTP, FTP, TCP, UDP, Serial, and Bluetooth
- Report generation, file I/O, and database connectivity
- Add-on packages supplement the core functionality for more specialized disciplines, such as:
o Control design and simulation
o Sound and vibration analysis
o Machine vision and image processing
o RF and communication
With the comprehensive analysis capabilities of LabVIEW, you can perform all the signal processing you need without wasting any time moving data between incompatible tools or resorting to writing your own analysis routines. All of the included functions in LabVIEW work seamlessly with the data you acquire from your hardware so you do not need to worry about converting and passing data. When you do have specific file format or communication protocol needs, LabVIEW can help you get the data into the right format.
UI Components and Reporting Tools
- Interactive controls such as graphs, gauges, and tables to view your acquired data
- Tools to save data to file or databases, or automatically generate reports
Every LabVIEW block diagram also has an associated front panel, which is the user interface of your application. On the front panel you can place generic controls and indicators such as strings, numbers, and buttons or technical controls and indicators such as graphs, charts, tables, thermometers, dials, and scales. All LabVIEW controls and indicators are designed for engineering use, meaning you can enter SI units such as 4M instead of 4,000,000, change the scale of a graph by clicking on it and typing a new end point, export data to tools such as NI DIAdem and Microsoft Excel by right-clicking on it, and so on.
Figure 4. Every LabVIEW block diagram has an associated front panel, such as this signal generation example with custom UI.
Controls and indicators are customizable. You can add them either from a palette of controls on the front panel or by right-clicking on a data wire on the block diagram and selecting “Create Control” or “Create Indicator.”
In addition to displaying data as your application is running, LabVIEW also contains several options for generating reports from your test or acquired data. You can send simple reports directly to a printer or HTML file, programmatically generate Microsoft Office documents, or integrate with NI DIAdem for more advanced reporting. Remote front panels and Web service support allow you to publish data over the Internet with the built-in Web server.
- Harness emerging technologies such as FPGAs, multicore CPUs, and virtualization without painful relearning and additional development effort
- Use common protocols and platforms without getting bogged down by details
Technology advances at a rapid pace and the pressure to keep current and take advantage of state-of-the-art performance is rarely matched with enough time and training to learn and implement emerging technologies. LabVIEW addresses this problem by quickly adopting advances in personal and embedded computing in such a way that you get the new capabilities without having to learn significant new paradigms. Examples of this approach include how LabVIEW is able to automatically generate multithreaded code for execution on multicore processors or program FPGAs to gain the speed and reliability of custom hardware chips without the LabVIEW user needing to learn the underlying details of multithreading or the hardware description languages typically required to use FPGAs.
The same applies to new OSs, networking protocols, and more. LabVIEW moves with the industry and our engineers work diligently to ensure that applications created with LabVIEW are able to easily move with it. If you do not use LabVIEW, the responsibility of moving to a new or updated OS or other computer standard is on you.
Models of Computation
- Simulation syntax, textual math, statecharts, component-level IP (CLIP) nodes, DLL calls, and other models are available for whenever G is not the most natural representation of the solution.
- Incorporate and reuse existing code and IP to minimize development effort
When LabVIEW was first released, G was the only way to define the functionality you needed. Much has changed since then. With LabVIEW, you can now pick the most efficient approach to solve the problem at hand. Examine the following considerations:
o Graphical data flow is the default model of computation for LabVIEW.
o Statecharts provide a higher level of abstraction for state-based applications.
o Simulation diagrams are a familiar way of modeling and analyzing dynamic systems.
o Formula Node puts simple mathematical formulas in line with your G code.
o LabVIEW MathScript is math-oriented, textual programming for LabVIEW that you can use to call .m files without the need for extra software.
o DLL calls, ActiveX/.NET communication, and the inline C node let you reuse existing ANSI C/C++ code and code from other programming languages.
o CLIP and IP integration nodes import FPGA intellectual property so you can use VHDL.
These flexible models of computation allow you to pick the right tool for the particular problem you are trying to solve. In any given application you will likely want to use more than one approach, and LabVIEW is the perfect tool to quickly tie everything together.
2. Benefits of LabVIEW
As Complex As You Need It to Be
One of the reasons LabVIEW makes you successful is its ability to scale to meet the needs of a given application. Picking the right software is all too often a balancing act between ease of use and learning curve on one side and power and flexibility on the other. Simple, fixed-function applications are generally easy to use and can be configured off the shelf, but they rarely meet all of the requirements for real world usage. Full-fledged programming, on the other hand, is powerful and flexible but comes at the cost of increased training and development time.
LabVIEW addresses this problem by providing several ways to accomplish similar tasks, so you can make the trade-off between simplicity and customization yourself on a task-by-task basis.
Figure 5. LabVIEW gives you the freedom to choose between ease of use and low-level flexibility.
- Quick and easy, but limited
- Similar to other fixed-function/configurable, non programming tools
Express VIs are normally the quickest and easiest way to perform a task in LabVIEW. You choose the settings you want for a given operation, such as acquiring from an NI data acquisition (DAQ) device or saving data to a file, from a configuration window with several options and settings. When you click the OK button, LabVIEW configures the underlying code for you and just relies on you defining the flow of data between Express blocks (or Express VIs, as they are called in LabVIEW).
Figure 6. Express VIs provide common functionality with configuration dialog simplicity.
The downside to this simplicity is that you are restricted to the options that are in the configuration dialog. If you have custom requirements, then configuration dialogs are generally not flexible enough to meet your needs. Therefore, this approach is most useful for quick prototypes and simple tasks.
Productive (Abstract) APIs
- High degree of customization
- Require application expertise, but abstract many programming complexities
Figure 7. The TDMS file API exposes only the functionality and not the complexity.
The most common way to program in LabVIEW is using high-level functions that strike a balance between abstracting the unnecessary administrative tasks such as memory management and format conversion, but keep the flexibility of being able to customize almost every aspect of whatever task you need to accomplish.
Most of these APIs implement a specific technology, such as working with the TDMS file format (shown in Figure 7), talking to an instrument (the NI-VISA API), or manipulating and processing waveform data (any of the Wfm functions). Each API gives you full control of the actual process involved but does not require you to deal with all of the intricacies of implementing the minutia of the protocol. These APIs save you time by eliminating the steps that you do not need to define – whether it be calculating the number of bytes to read and byte order for file I/O when all you care about is reading in the previous day’s measurements or implementing all of the intermediate math operations when you need only the fundamental frequency of a waveform.
- Powerful, but require both application and programming expertise and development time
- Similar to C or other multipurpose programming languages/tools
Figure 8. Low-level access gives you complete freedom to implement custom solutions.
When you need to be able to completely define every detail of your task, LabVIEW offers the same low level access as you would get in traditional programming languages. LabVIEW can support any file type or any communication protocol because in the worst-case scenario you can implement them yourself, forming whichever headers or packets you need and sending raw binary data. For example, if your company uses a proprietary file format for which LabVIEW does not have a built-in function, you can use the low-level file I/O VIs to describe exactly how your data should be written to file – right down to the individual bits on the disk if you need to.
3. LabVIEW – More Than Just Software
We have discussed what the LabVIEW product is, but in reality, LabVIEW is more than just what we develop and you install on your computer. LabVIEW has a thriving ecosystem of products, services, and people around it that continue to drive adoption and ensure success.
Figure 9. An ecosystem of products, services, and people make LabVIEW more than just a product.
NI Support and Services
National Instruments stands behind LabVIEW with comprehensive support, training, and certification options. You can contact our applications engineers via phone and e-mail to help you get up and running, troubleshoot issues, and ensure that you are successful with LabVIEW.
Training courses range from the basics of LabVIEW to advanced architectures and managing software engineering processes to ensure that you are best placed to take advantage of the benefits that LabVIEW offers.
Certification allows individuals to provide proof of their capabilities and for organizations to recognize and distinguish expertise among employees and make potential outsourcing decisions.
In addition to NI support and services, there is a substantial community of users and professionals with expertise and products that extend the reach of LabVIEW. The NI Discussion Forums and LAVA are large, active message boards for LabVIEW discussion where developers of varying experience ask questions and help each other out. Another way to interact with other LabVIEW users is through user groups in both physical and virtual meetings where users share presentations, advice, and best practices.
The LabVIEW Tools Network houses code reuse libraries, architectures, and toolkits from NI and third parties to further enhance the capabilities of LabVIEW for specific applications.
When you need extra assistance solving a problem, the National Instruments Alliance Partner program is a worldwide network of more than 600 consultants, system integrators, developers, channel partners, and industry experts who partner with NI to provide complete, high-quality virtual instrumentation solutions to customers.
4. Productivity and Empowerment with LabVIEW
As you can see, there is a lot to LabVIEW. Some people need every component. Others only use some parts. However, everyone who uses LabVIEW is aware of the productivity and empowerment that comes from abstracting unnecessary complexity and being able to focus on the challenge at hand, not the challenges typically associated with creating custom software.
Simon Hogg is a LabVIEW product manager at National Instruments. He holds bachelor’s degrees in electrical engineering and managerial studies from Rice University.