Signal Generation in LabVIEW Overview LabVIEW 8 offers a multitude of signal generation options to meet your signal processing needs. This article describes the different methods of generating signals including express, array-based, waveform, and point-by-point VIs. Table of Contents 1. Express VIs 2. Wave, Pattern, and Noise VIs 3. Waveform Datatype Signal Generation 4. Point-by-Point Signal Generation Express VIs Express VIs encompass the most common functions out of the more than 400 analysis and signal processing functions that LabVIEW offers. The Simulate Signal Express VI can generate signals of the following types: Sine Square Triangle Sawtooth DC Noise* *In addition to the signal, you have the option to add noise Examples of the noise types that you can add include the following: Uniform white noise Gaussian white noise Periodic random noise Gamma noise Poisson noise Binomial noise Bernoulli noise MLS sequence Inverse f noise Simulate Signal Express VI
When you place a Simulate Signal Express VI on the block diagram, you will be prompted to configure the signal as shown in the figure below. You can specify the frequency, phase, amplitude, offset, samples per second, number of samples, and number of cycles. The Simulate Signal Express VI can also be configured to simulate a Data Acquisition (DAQ) device by enabling Simulate acquisition timing. By enabling this option, the Simulate Signal VI simulates an acquisition rate comparable to an acquisition rate common to DAQ devices. This allows you to test and evaluate your VI without having physical DAQ equipment in place. Once your program has been simulated and tested in software, simply replace the Express VI with the appropriate DAQmx code. Figure 1. Simulate Signal Express VI icon and configuration prompt.
Wave, Pattern, and Noise VIs In LabVIEW 8, the signal processing palette contains twenty-one Wave and Pattern VIs including Basic Function Generator (sine, triangle, sawtooth, square, and arbitrary wave), Sine, Impulse, Ramp, Sinc, Pulse and Chirp Patterns, Gaussian, Uniform White Noise, and Period Random Noise. The complete list is shown below. It is important to note that these VIs only output the amplitude of the signal as a one-dimensional array and do not include timing information. These VIs are best used when the timing information is not need such as if the signal generated was to be generated in hardware. For detailed information on the inputs and outputs of each of the Signal Generation VIs, reference the on-line LabVIEW 8 help files for Signal Generation. Wave VIs Arbitrary Wave Sawtooth Wave Signal Generator by Duration Sine Wave Square Wave Triangle Wave Pattern VIs Chirp Pattern Impulse Pattern Pulse Pattern Ramp Pattern Sinc Pattern Sine Pattern Noise VIs Bernoulli Noise Binary MLS Binomial Noise Gamma Noise Gaussian White Noise Periodic Random Noise Poisson Noise Tones and Noise Uniform White Noise
The Pattern and Wave generation VIs may initially appear be identical, but upon closer examination there is a subtle difference between the two. Wave VIs can keep track of the phase information of the signal between each call of the VI, while signal generation VIs cannot. The Wave VIs have a "phase in" input that specifies the initial phase in degrees of the generated waveform. Wave VIs also have a "phase out" output that indicates the phase of the next sample of the generated waveform. In addition, a reset phase input specifies whether the phase of the first sample generated when the Wave VI is called is the phase specified in the phase in input or the phase available in the phase out output when the VI last executed. A TRUE value for reset phase sets the initial phase to phase in. A FALSE value, for reset phase, sets the initial phase to the value of phase out when the VI last executed. When you set the reset phase value to FALSE, this allows for continuous sampling simulation. Another important distinction between wave and pattern VIs is that wave VIs use a frequency input that is normalized to units of cycles per sample. The only pattern VI that uses normalized units is the Chirp Pattern VI. You must use normalized units of cycles per sample with the following Signal Generation VIs: Arbitrary Wave Sawtooth Wave Signal Generator by Duration Sine Wave Square Wave Triangle Wave Chirp Pattern Waveform Datatype Signal Generation In addition to array-based signal generation functions such as the pattern and wave generation VIs, VIs that utilize the waveform datatype are also available. The waveform datatype, unique to LabVIEW, combines important sampling and timing information along with the signal data into a single datatype. This increases ease of access to important information and simplifies the integration with analysis functions and data acquisition products. Using the waveform data type gives the maximum level of integration between data acquisition functions and analysis functions. The waveform data type includes information about the acquired or generated signal: a timestamp, t0, marking the beginning of the acquisition, a sampling period, dt, that marks the spacing between each data point, and a 1-D array containing the data points. To constitute a waveform, all data points are equidistant in time, as opposed to varying sampling intervals. This is particularly useful for applications where a generated and an
acquired signal need to be correlated and it is beneficial to have the same sampling characteristics. In addition, these waveform datatype functions have built-in error detection for under-sampling. This helps avoid situations where a signal is generated with a low sampling frequency with respect to the number of samples for a specific amount of time, as determined by the Nyquist Theorem. The functions incorporating the waveform datatype are very powerful for applications and tests where arbitrary waveforms need to be generated and they are particularly powerful when combined with National Instruments signal generation hardware such as arbitrary function generators, analog output, and multifunction data acquisition cards. The signal generation functions utilizing the waveform datatype include: Basic Function Generator (sine, triangle, sawtooth, and square) Tones and Noise Waveform Formula Waveform Sine Waveform Square Waveform Triangle Waveform Sawtooth Waveform Basic Multitone Basic Multitone with Amplitudes Multitone Generator Uniform White Noise Waveform Gaussian White Noise Waveform Periodic Random Noise Waveform Inverse f Noise Waveform Gamma Noise Waveform Poisson Noise Waveform Binomial Noise Waveform Bernouilli Noise Waveform MLS Sequence Waveform Simulate Signal Express VI Simulate Arbitrary Signal Express VI Point-by-Point Signal Generation In addition to array-based and waveform-based signal generation, LabVIEW also provides point-by-point signal generation. Point-by-point analysis functions are optimized for continuous, real-time analysis without the hassles of start-up data loss, reinitialization, or potential interruption problems. The LabVIEW point-by-point signal generation functions fit seamlessly into this model, providing basic function generator options (sine, triangle, sawtooth, and square waves) as well as Gaussian white noise, uniform white noise and periodic random noise.
As opposed to array-based operations, the point-by-point functions allow for the inputanalysis-output process to occur continuously, in real-time. This functionality allows for the efficient incorporation of the point-by-point VIs into NI real-time hardware such as the CompactRIO programmable automation controller or real-time PXI family of controllers. Figure 2. Point-by-point sine wave generation VI.