Electronics

Arbitrary waveform generator waveform creation using equations

[ad_1]

An arbitrary waveform generator (AWG) is a powerful and flexible signal source capable of generating any wave shape within the bandwidth and amplitude range of the generator. Populating an AWG with precise and accurate waveforms can be a major challenge. Every AWG supplier offers tools, like waveform creation software, to make this task easier. Waveform creation software generally offers several techniques for generating waveform files for the AWG. These methods usually include a basic function generator mode, including standard waveforms like sine, square, and triangular waves with user entered parameters like amplitude, offset, and frequency. Additional waveforms may also be offered in the form of a library of application signals. They may also offer methods to transfer acquired waveforms from oscilloscopes, digitizers, or other signal acquisition systems. These methods may include direct connection to an instrument or transfer of data via ASCII files. All suppliers also offer the ability to create waveforms using equations or formulas. Creating waveforms by equation is the most precise method of waveform creation. It generates waveform samples based on the analytical expression of voltage versus time. Equations offer great flexibility providing a wide range of waveforms available with high accuracy. This article provides examples of waveform creation techniques for AWGs using equations.

Advantages of equation entry

Using equations to describe a signal waveform should take you back to your circuit analysis I days. Consider a basic analytical waveform description:

V(t)=Va*sin (2*π*f*T+j)+Vo

The sine wave, V(t), is completely described by this equation. Va controls its peak amplitude, Vo controls the amplitude offset, f controls the frequency, and j controls the phase. When an equation like this is used with an AWG, the output waveform generated is limited by the digital nature of the instrument. Achievable voltage levels are restricted to the granularity of the digital-to-analog (DAC) converter resolution. A common amplitude resolution for AWGs is 16 bits. A 16-bit AWG can resolve 216 or 65536 discrete levels theoretically. On a one-volt full scale range, the step size is about 15mV. The practical resolution limit is constrained primarily by the output noise level of the AWG.

Equation entry and editing in AWG software varies by supplier but they all have a common thread, and the functionality of software from all suppliers is similar. They are all based on a set of defined math functions and operators.

Operators, functions, and constants

Waveform creation software supports basic math operations like addition, subtraction, multiplication, division, and exponentiation. They also offer basic math functions. Trigonometric functions, exponents, roots, logarithms, and unit steps among others. Numerical constants and special constants, like π, are recognized. The key waveform independent variables are usually time or samples, sometimes either. Multiple dependent variables are defined allowing for chained operations. All of these operators are used in combination to define the desired waveform.

Creating waveforms

Waveform creation generally begins with defining the time scale of the waveform. This may be done by setting a sample rate and number of samples in the waveform. Some older AWGs may have restrictions on the number of samples used such as the number of samples must be even or a factor of “n” samples. The sample rate will define the bandwidth of the signal, the Nyquist criteria limits the bandwidth to one half the sample rate.

The maximum amplitude range of the AWG output is fixed by the available output amplifier range or ranges while the minimum amplitude is limited by the amplitude resolution of the AWG.

Waveform creation based on time

As an example, let’s create a waveform simulating an ultrasonic range finder operating at 40 kHz. The range finder transmits a 40-kHz sinewave carrier amplitude modulated by a Lorentzian pulse. This is followed by a reflected echo some time afterward at a lower amplitude. The entire waveform also includes interfering broadband noise.

In this first example, the AWG in Teledyne LeCroy’s MauiStudio is used. The AWG used in this article inherits the sample rate and record length from the oscilloscope settings, 20 mega samples per second (MS/s) and 500 ms per division (5 ms total duration) respectively. This represents a waveform memory length of 100,000 samples. In other software, the record length and sample rate might have to be set manually. Similarly, the amplitude range (150 mV) and offset (0 V) are set in the generator field amplitude and offset fields.

The waveform can be created in sections, in this example the carrier and the modulating envelope can be created separately and combined later. Start with generating the 40 kHz carrier. The general equation to produce the sine carrier as we have seen is:

X1=sin(2*π*f*T)

 The dependent variable, X1, is defined by the sine function with an argument of 2π times the desired frequency (f) and the independent variable, time (T) in this case. For the desired 40 kHz frequency it becomes more specifically:

X1=sin(2*π*40k*T)

The generated trace is shown in Figure 1 and includes a horizontally expanded view so the sinusoidal waveshape is clearly visible. The amplitude is 150 mV peak with zero offset.

Figure 1 Using equations to generate the 40 kHz carrier in a 5 ms time window with a sample rate of 20 MS/s. Source: Arthur Pini

The second step in generating this waveform is to create the Lorentzian pulse envelope for the transmitted pulse. The general equation for the Lorentzian pulse is:

X2=1/(1+((T-TD)/TW)^2)

 TD is the delay time of the pulse from zero and TW is the half-width at half of the maximum amplitude (hwhm). For a delay time of 1 ms and a half-width at half maximum of 100 ms the equation is:

X2=1/(1+((T-1m)/0.1m)^2)

The resulting pulse is shown in Figure 2:

Figure 2 The Lorentzian pulse generated with a 1 ms delay and a half-width at half maximum of 0.1 ms. The peak amplitude is 150 mV and a 0 V baseline. Source: Arthur Pini

The envelope of the waveform has to include the echo pulse later in time and lower in amplitude. The same basic equation is used to create the echo, but the time delay is increased to 3.5 ms and the amplitude is reduced by a factor of 0.04 (about -28 dB). The delay of 2.5 ms from the transmitted pulse represents a distance of about 0.43 meters between the range finder and the target. This rescaled Lorentzian pulse is added to the previous equation. The addition of the echo to the transmitted pulse results in an equation:

X2=1/(1+((T-1 m)/0.1m) ^2) + (0.04) * 1/(1+((T-3.5m)/0.1m)^2)

The result is shown in Figure 3.

Figure 3 The ultrasound signal envelope containing both the transmitted pulse and the delayed and attenuated echo. Source: Arthur Pini

The next step is to multiply the modulation envelope and the carrier to create the modulated waveform consisting of the 40 kHz transmitted pulse and the attenuated echo:

X1=sin(2*π*40k*T)X2=1/(1+((T-1m)/0.1m)^2)+ (0.04)* 1/(1+((T-3.5m)/0.1m)^2)X3=X1*X2

The signal is comprised of three dependent variables X1 through X3. The AWG only executes the last variable, X3, but that equation references the other two variables. Figure 4 shows the waveform.

Figure 4 The 300 mV, 40 kHz sine burst with its 12-mV time delayed echo signal. Source: Arthur Pini

The last step in creating this simulation is to add uncorrelated white Gaussian noise. The AWG equation editor includes uniform and Gaussian noise generators but those generate the same noise pattern for each repetition of the waveform and are therefore correlated with the waveform. However, the AWG in MauiStudio includes an independent noise source with a user set amplitude. Figure 5 shows the final waveform including the uncorrelated noise with an amplitude of 15 mV, entered as 300 milli-divisions.

Figure 5 The completed simulation of the ultrasound range finder signal including independent noise. The noise amplitude control is highlighted by the blue box. Source: Arthur Pini

This signal can be used for simulating the ultrasound range finder for a fixed target range. Multiple acquisitions can be averaged to reduce the noise component improving the measured signal-to-noise ratio.

Waveform creation based on samples

Waveform equations can be based on samples, for a given clock period the number of samples in an interval represents a fixed time interval. Computing in samples has advantages in AWGs that have limits on the number of samples in a waveform as the sample count is explicitly shown. The calculations are similar to time-based equations except that sample-based equations use reciprocal functions (x=1/T). Let’s look at the same application in a sample-based waveform creation software. This example is based on Spectrum Instrumentation’s SBench6 software. This software supports their AWG and digitizer product lines. The calculation is based on four function generator equations as shown in Figure 6.

Figure 6 Creating the ultrasound rangefinder waveform using sample-based calculations. Source: Arthur Pini

The waveform was created by breaking down into a set of four equations. While the waveform could be created in a single calculation it would be more complex. The same 20 MS/s clock was used. The clock period is 50 ns. 

The first equation, created in the Function trace is the 40 kHz carrier which has a period of 25 ms and a peak amplitude of 150 mV.

Function=0.15*sin(2*π*x/500)

X represents the sample location. The sine period of 25 ms represents 500 clock periods. This count is shown in the denominator of the sine argument. The result of this computation is shown in the upper left trace and is labeled with the equation. The equations shown on the traces are trace labels, the actual equation entry is done in a function generator window similar to the one shown to the left in the figure.

The equation segment in Function_01 describes the transmitted Lorentzian pulse envelope shown in the lower left trace of the figure.

Function_01=(1/(1+((x-20000)/2000)^2))

The 1 ms time delay is marked by an interval of 20,000 clock periods (20,000*50 ps = 1 ms). Similarly, the 100 ms half-width at half maximum requires 2,000 clock periods.

The echo pulse with a 3.5 ms delay is defined in Function_02 shown in the upper right trace.

Function_02=(1/(1+((x-70000)/2000)^2))

The delay element is now 70,000 samples in duration.

The final step is to combine the three elements into the complete waveform. This was done in Function_03 as shown in the function generator window. Function was designated as source sign sig0(x), Function_01 is sig1(x), and Function_02 is sig2(x). These are combined together using the equation:

Function_03=sig0(x)*(sig1(x)+(0.04)*sig2(x))

The completed waveform appears in the lower right window.

The equations are similar to the time-based version and have the same ability to control the instantaneous amplitude, frequency, phase, and amplitude offset of the generated waveforms.

Modulated signal waveforms

Equations can also be used to generate modulated waveforms. Any of a waveform’s parameters, frequency, phase, or amplitude can be modulated as a function of time or samples. Figure 7 shows examples of classic modulated waveforms.

Figure 7 Examples of frequency, phase, amplitude, and mixed modulation mode signals. Source: Arthur Pini

Frequency modulation (FM), shown in the upper left trace, adds to the constant frequency term of the sine wave equation with phase as a function of time as the integral of the desired modulating signal, in this case a cosine wave with a modulation frequency of 400 kHz.

X1=sin(2*π*T*2M + 2*cos(2*π*T*0.4M))

The factor 2, before the cosine wave, is the modulation index of the FM signal, the ratio of the peak frequency deviation to the modulation frequency.

Phase modulation (PM), shown in the upper right trace, adds a phase term equal to the modulating signal, in this case a sine wave, again at a frequency of 400 kHz.

X1=sin(2*π*T*2M + π/2*sin(2*π*T*0.4M))

The factor π/2 is the peak phase deviation.

An amplitude modulated (AM)signal is shown in the lower left trace. 

X1 = sin(2*π*T*2M)*1/2*(1+0.85*cos(2*π*T*0.2M)

In the AM signal, the modulating signal with a full-scale amplitude offset is added to the carrier. The factor 0.85 is the modulation index, the ratio of the peak amplitude variation of the AM signal to that of the unmodulated carrier. The factor of ½ rescales the modulated waveform to the original carrier amplitude.

The signal in the lower right trace is a mixed modulation signal applying both amplitude and frequency modulation.

X1=sin(2*π*T*2M + 2*cos(2*π*T*0.5M)) * (1/2*(1+0.85*cos(2*π*T*0.1M)))

Note that modulation of any of the carrier parameters can be applied simultaneously.

Equation-based waveform creation in AWGs

These examples show the flexibility of equation- or formula-based waveform creation in an AWG. Additional features like linking and looping waveform segments and sequence mode which enables active swapping of waveform segments while the AWG is running further extend the AWGs capabilities.

Arthur Pini is a technical support specialist and electrical engineer with over 50 years of experience in electronics test and measurement.

Related Content

[ad_2]
Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button
Translate »