Design of a Virtual Function Generator for Signal Generation

A virtual function generator was designed by developing a code by LabVIEW. Signals with the same amplitude and frequency supplied from a real function generator and the virtual function generator were sent to a real oscilloscope to measure the quantities. The signals from the virtual one were generated at analog output channel of a National Instruments (NI) multifunction data acquisition device. Amplitude and time quantities of the signals from both generators were compared with each other. The results from the virtual generator were highly in compatible with those of the real one. It was concluded that the designed virtual function generator could be used to supply the signals especially in low frequencies.


Introduction
Virtual instrumentation combines with a computer, software and a wide variety of measurement and control hardware. User defined instruments can be created with it [1]. Processes in a virtual instrument are performed by software functions whereas they are done by microprocessor in a real instrument.
LabVIEW is a software which is used to design the virtual instrument. It has a graphical programming language. A code is developed by the software functions (icons) instead of the lines of text [2].
A virtual function generator which is a type of the virtual instruments can be designed by using LabVIEW software. The virtual function generator is used to supply signals in sinus, triangle, square and sawtooth shape with different frequencies and amplitudes like a real function generator.
Peak to peak voltage, amplitude, frequency, rise time, fall time and width quantities of the signals supplied from the developed virtual generator can be obtained from an oscilloscope. Peak to peak voltage is a difference between maximum and minimum voltage values of a signal. Amplitude is a difference between high and low voltages (states). The high and low states are the most positive and negative states [3]. Frequency is the number of signals per unit time. Rise time is the time it takes for the pulse to rise from 10 to 90% of its full amplitude. Fall time is the time it takes for the pulse to fall from 90 to 10% of its full amplitude [4]. Width is the width of the signal in terms of second.
Bogdan explained how the signals were generated by a DAQ (Data Acquisition) device [5]. The use of data acquisition device and LabVIEW to implement a signal wave generator was presented by the author [6]. Rob et al. designed a virtual signal generator by LabVIEW [7].
In this paper, a virtual function generator was designed by developing a code. The signals in different frequencies and amplitudes supplied from the real and virtual function generators were displayed in the oscilloscope. Measurement quantities obtained from the oscilloscope were compared with each other.

Material and Methods
LabVIEW has two windows named as front panel and block diagram which are seen in Figure 1. Front panel is an interface between user and the virtual instrument. Controls and indicators of the virtual instrument take part in this panel. Block diagram is a window that the code is written for the virtual instrument. The code is formed by making connections between the functions used in the block diagram. A GW Instek 2204 model digital oscilloscope, a Thurlby Thandar TG230 function generator (real function generator), a NI USB-6008 multifunction data acquisition device, an NI GPIB-USB-HS [GPIB (General Purpose Interface) Controller for Hi-Speed USB] and developed virtual function generator were used in this study.
In the virtual function generator, controls were developed for selecting signal type, amplitude, frequency and offset values. The 6008 was utilized as hardware of the designed virtual instrument. In order to stop and start the oscilloscope by the developed code, the GPIB connection was used.
Circuit scheme for the measurements is shown in Figure 2. As can be seen in the scheme, sinus, square and triangle signals supplied from the virtual function generator were generated at analog output (AO) channel of the 6008 since the signals were continuous with changing amplitude. Same type signal shapes were supplied from the real and virtual function generators. The signals supplied from both generators were sent to the CH 1 (Channel 1) and CH 2 (Channel 2) inputs of the oscilloscope. In this way, both signals were displayed simultaneously. Amplitude and frequency values of the signals were set via amplitude and frequency knob of both generators. The real function generator has a display to show amplitude and frequency quantities. Two methods were employed in this study. The first one was constant amplitude and different frequency. In this method, amplitudes of the signals were kept constant to 2 V. Signal frequencies of 10 and 50 Hz were supplied. The second method was constant frequency and different amplitude. Frequency of the signals was kept steady on 20 Hz. Amplitudes were adjusted to 1 and 5 V respectively because analog output voltage range of the 6008 is from 0 to 5 V. The 6008 is unable to generate analog signals with high frequency due to the fact that it has maximum update rate of 150 Hz [9]. For this reason, maximum signal frequency was increased to 50 Hz. Peak to peak voltage, amplitude, frequency, rise time, fall time and width quantities were obtained from the oscilloscope. Each measurement was repeated five times for each amplitude and frequency values. All results were recorded after the oscilloscope was stopped. In the following tables, averages of the measurements are given with their errors.

Sinus Signal
Sinus signal images obtained from the oscilloscope are shown in Figure 3 for the voltage/division and time/division of 2 V/div. and 25 ms/div. settings, respectively. Results using first and second methods are given in Tables 1 and 2.

Square Signal
Signal images are compared in Figure 4 for 2 V/div. and 25 ms/div. settings. Results, which were obtained for the square signal with 2 V amplitude and different frequencies, were compared with each other in Table 3. Obtained results for the signals with 20 Hz frequency and different amplitudes are given in Table 4 as well.

Triangle Signal
For 2 V/div. and 25 ms/div., triangle signal images are seen in Figure 5. Results through both methods are given in Tables  5 and 6.

Discussion
The authors were examined how virtual signal generator was designed by LabVIEW in References 6-8. In this study, differently from these works, the signals from the virtual function generator were displayed in the oscilloscope. Additionally, voltage, frequency and time quantities of the signals from the virtual generator were compared with those of the signals from the real one. The signals in sinus, square and triangle shapes were analyzed in this study. Cosine and sawtooth signal shapes could also be supplied from the designed function generator. As can be seen in Figures 3-5, the signal shapes from both function generators were highly in compatible with each other.
It was seen in Tables 1-6 that measurement quantities of the signals had small differences from each other. One of the primary reasons was that the signals from the real function generator were supplied by integrated circuits whereas the signals from virtual one were generated via software function. In the experiment, analog signals supplied from the real function generator were directly sent to the oscilloscope.
However the signals from the virtual one were forwarded to the oscilloscope through the 6008 in order to reconstruct them by its digital to analog converter (DAC, 12 bit) for generating analog signals at its analog output (AO) [10]. In the DAC, each binary number is converted to analog voltage by multiplying its resolution (step size). The AO signals are continuous in time with quantized amplitude [11]. The resolution of the DAC is an important feature that affects the voltage values of the signals. In addition, AO update rate of the 6008 is software-timed [12]. The software controls the rate at which data were generated [13]. The time between consecutive samples in the signals are determined by the software time which affects the time quantities (such as frequency, rise time) of the signals. Since the real function generator didn't have these properties, small differences have been acquired in the results.

Conclusion
It was concluded from the all results above that designed virtual function generator can be used properly to supply the low frequency signals in a measurement platform.