The electronics industry’s strong emphasis on data acquisition prompts us to look carefully at tools that could make this task easier and simpler. That’s why we reviewed ComponentWorks Version 1.0 by National Instruments (NI), one of many add-on tool sets available for Visual Basic.
ComponentWorks is a collection of object linking and embedding (OLE) controls and dynamic link libraries (DLLs) for acquiring, analyzing and displaying data within Microsoft’s Visual Basic 4.0. It includes software, a manual, and an extensive online reference for specific information about the properties, methods and events of the OLE controls and the routines of the DLLs.
But first, let’s look at Visual Basic. Since its introduction, Visual Basic has become one of the most popular ways to create Windows applications quickly and easily. Not only is it simple to use, Visual Basic also is powerful enough to create elaborate programs that can rival almost anything that hard-core C++ programmers can put together.
Visual Basic contains the power necessary to build complex applications, yet it is relatively easy and simple to learn.1 Visual Basic 4.0 lets you take advantage of the more powerful program constructs such as classes, reusable elements and system- level Application Programming Interface calls.
Three versions of Visual Basic 4.0 are available: Standard Edition, Professional Edition and Enterprise Edition. Visual Basic Standard Edition is the primary version, with full support for 32-bit programming. Visual Basic Professional Edition has the additional capabilities of creating OLE automation servers and compiling 16-bit applications for Windows 3.1.
Visual Basic Enterprise Edition is the most advanced of the trio. It supports team development, code profiling, remote automation and source control for remote data access.2
The combined resources of Visual Basic 4.0 and ComponentWorks control National Instruments’ data acquisition boards (DAQs) as well as the common IEEE 488 instruments. The ComponentWorks package contains:
DAQ controls—32-bit OLE controls for analog and digital I/O using National Instruments’ DAQ boards.
User interface controls—32-bit OLE controls for data display, including graphs and strip charts, sliders, thermometers, tanks, knobs, gauges, meters, LEDs and switches.
An Analysis Library—32-bit OLE controls, including functions for statistics, advanced signal processing, windowing, filtering, curve fitting, vector and matrix algebra routines, probability and array manipulation. The number of controls included in the Analysis Library depends upon the level of the package purchased: Base System, Standard Development System or Full Development System.
Instrument drivers—32-bit DLLs for controlling common GPIB instruments, included only with the full Development System.
Although the ComponentWorks’ OLE controls and DLLs are designed for Visual Basic 4.0, they also can be used with many other applications that support OLE controls and DLLs, such as Visual C++, Access and Delphi. ComponentWorks does not function as a stand-alone package.
System Requirements
To install and use ComponentWorks, a 33-MHz 80486 or higher PC is required (a 66-MHz 80486 is recommended) with:
Microsoft Windows 95 operating system (Windows NT soon).
VGA (or higher) resolution video card.
32-bit OLE custom control container such as Visual Basic 4.0 (32-bit version).
NI-DAQ 4.8.5 or later for Windows 95 (to use DAQ controls).
8 MB of memory.
5 MB of free hard disk space.
Microsoft-compatible mouse.
Installation
For this software review, the test installation computer was a 66-MHz 80486 with 30 MB of memory and a 370-MB hard disk drive. The operating system was Windows 95 and the 32-bit version of Visual Basic 4.0 was used to evaluate ComponentWorks.
The installation of ComponentWorks was accomplished easily, typical of all Windows 95 installations. If Visual Basic was opened prior to the installation, ComponentWorks will add/added its controls to the Visual Basic toolbox (Figure 1). These added controls are divided into three groups:
Interface controls consisting of graphs, strip charts, sliders, thermometers, tanks, knobs, gauges, meters, LEDs and switches.
DAQ controls for National Instruments’ DAQ products, including DIO, AI and AO.
An Analysis Library whose components are dependent upon the level of the system purchased.
A National Instruments’ AT-MIO16E-2 board served as an example of control of hardware from ComponentWorks. Communications between ComponentWorks and the board were achieved by selecting the DAQ control and going into the view menu to select properties. Once in the properties sheet, the General tab and then the device were selected.
Figure 2 shows the AI Control Properties Window. The procedure was rather simple, but as in all cases using different computers, some difficulty was encountered. Initially, the software could not find the board, but with a little more effort it appeared.
Documentation
The users guide was quite comprehensive. The exercises were simple and easy to follow. As we progressed through the chapters of the guide, the exercises became progressively more complex. Each example provided information on designing the form, developing the Visual Basic code and testing the completed program. With only a minimum knowledge of Visual Basic, you could develop a fairly complex application quickly.
ComponentWorks’ online help files contained detailed information on each control and its associated properties, events and methods. These files along with Visual Basic’s object browser were a valuable resource for the first-time user.
Analysis Library
The Analysis Library was quite extensive and consisted of three libraries. The Base Library contained array and complex number operations as well as statistics and vector and matrix algebra (Table 1). The DSP Library housed signal-generation, advanced array and complex number operations, common signal-processing functions for both the time and the frequency domain, filtering, windowing and curve fitting (Table 2). The Advanced Library had statistical functions, probability distributions, interpolation, and advanced vector and matrix algebra (Table 3).
Although all of the controls and functions were not tested, those that were used were straightforward and behaved as expected.
Sample Application
Our application of ComponentWorks demonstrated a simple spectrum analyzer using the DSP Analysis Library and cursors on the graphs. If a DAQ board was not available, the program was simulated with the Data Source switch. The screen for the application is shown in Figure 3.
With this application, a Hamming window was applied to a waveform time history and the result was sent to an auto power spectrum function and then graphed. The code for performing the analysis is shown in Figure 4.
This was a good example of the capabilities that ComponentWorks offered. The graphs could be adjusted for displaying different data waveforms by going into the Graph Control properties.
Figure 5 shows the cursor properties and other properties involved with graphs. ComponentWorks controlled the style, cursors, axes and formats. This allowed a clean waveform display. A grid in the background could be turned on or off. Using the cursor on the waveform graph, the maximum and minimum points could be marked.
In this example, placing the cursors on the voltage waveform determined the amplitude. When the cursors were used on the power spectrum graph, they read the associated frequency.
To get the DSP Analysis Library functions, you had to go into the Virtual Basic object browser select the Analysis Library. The function could then be selected from the Methods and Properties list. The paste button was then pressed to capture the line of code, so you could insert the function at the location you selected on the form. This was done quickly and simply.
Summary
The combination of Visual Basic and ComponentWorks made designing and programming data acquisition, analysis and display applications quite simple. With a rudimentary knowledge of Visual Basic, learning to use ComponentWorks was quick and uncomplicated. Very complex applications were produced quickly and easily.
Many inexpensive tool kits are available for Visual Basic. As one solution to your data acquisition needs, we recommend you consider ComponentWorks and Visual Basic.
References
1. Wang, W., Visual Basic for Windows for Dummies, IDG Books Worldwide, Foster City, CA, 1996.
2. Halvorson, M., “Learn Visual Basic Now,” Microsoft Press, Redmond, WA, 1996.
Disclaimer
This article was written by the authors as private individuals and not in conjunction with JPL.
About the Author
Edmund C. Baroth, Ph.D., conceived, developed and is the Technical Manager of the Measurement Technology Center, part of the Measurement, Test and Engineering Support Section of the Jet Propulsion Laboratory. He holds a bachelor’s degree in mechanical engineering from City College of New York, and master’s and doctorate degrees in mechanical engineering from the University of California, Berkeley. Dr. Baroth has received five NASA Certificates of Recognition and a NASA Group Achievement Award, has produced two patents and has one pending, and has been a faculty member at California State University. Jet Propulsion Laboratory, 4800 Oak Grove Dr., Mail Stop 125-177, Pasadena, CA 91109, (818) 354-8339. e-mail: [email protected]
Table 1
Array Operations 1-D and 2-D Operations Multidimensional Array Operations
Complex Operations Complex Numbers Multidimensional Array Operations
Statistics Basics Vector and Matrix Algebra
Table 2
Signal Generation
Array Operations 1-D Array Operations Multidimensional Array Operations
Complex Operations Complex Numbers
Signal Processing Frequency Domain Time Domain
IIR Digital Filters
FIR Digital Filters
Windows
Measurement
Curve Fitting
Table 3
Statistics Basics Probability Distributions
Interpolation
Vector and Matrix Algebra
Figure 4.
Private Sub AnalyseAndGraph(WaveformData() As
Double, sampleinterval As Double)
Dim freqinterval As Double
Dim SpectrumData As Double
WaveformGraph.PlotY WaveformData
HamWin WaveformData
AutoPowerSpectrum WaveformData,
sampleinterval, SpectrumData, freqinterval
SpectrumGraph.PlotY SpectrumData, 0,
freqinterval
End Sub
Copyright 1997 Nelson Publishing Inc.
April 1997