VIMIA312 Measurement laboratory 3, Measurement 2 Implementation of an automated measurement system (BME-MIT, updated: 26/08/2014 – Tamás Krébesz - krebesz@mit.bme.hu) Introduction The purpose of the measurement is to learn how to handle and remote control measuring instruments using LabVIEW data-flow type graphical programming language. During the laboratory the students have to determine and record the transfer function and some parameters (-3dB and -20dB points) of a four-pole in an automated manner. The four-pole is the circuit model of an analog channel used for signal (information) transmission. The channel model is available at every workplace. The analysis of the effects caused by the channel on the transmitted signal and the understanding of the sources of those effects are also part of present laboratory experiment. References, reading material [1] Hainzmann J.: Amplification and its measurement, 2008., Downloadable pdf from the homepage of the course [2] BME MIT - LabView basics, 2008., Downloadable pdf from the homepage of the course [3] LabViewQuickRef.pdf, Downloadable pdf from the homepage of the course Preparing for the measurement 1. Read the reference materials! 2. Read and consider the measurement tasks from this document! 3. Respond to the Test questions (which can be found at the end of this document)! Instruments and tools Oscilloscope Function generator Digital multimeter PC Measurement panel Special SW Special supplements Agilent 54622A Agilent 33220A Agilent 34401A NEC TM600 Channel model, BME-ML2-5 LabVIEW 2013, so-rand3.vi RS232 extension cable with DB9 terminals 1 VIMIA312 Measurement laboratory 3, Measurement 2 On the remote controlled measuring instruments in a nutshell Remote controlled measuring instruments offer at least one physical interface through which the user gets access to all (or some of) the functions of the instrument without using the buttons or knobs of the instrument front user panel. The functions can be reached by using a controller device, in most cases a PC, connected to the instruments via the interface for remote control. The controller device sends special control commands to the measuring instruments according to the specific function to be reached. The interface can be: • GPIB (General Purpose Interface Bus) • LAN/LXI • USB • RS-232, etc. During the measurement the instruments are controlled via a GPIB bus using a PC as controller device to send commands. For example such a command can force the instrument to measure voltage, and send the measured voltage value back to the PC for further processing. The specific LabVIEW elements, i.e. the drivers for accessing the measuring instruments in remote mode may be downloaded from the web page of the company who manufactured the instruments. Another way: it may be found in the driver repository of LabVIEW. The drivers that are necessary for the measurement tasks are available for the students in LabVIEW (since they have already been installed). The drivers have to be used during programming in the same way as any other LabVIEW elements. Using drivers mean passing the parameters for the instrument via the specific driver. No need to build up an entire command sequence or deal with low-level instrument programming since these are handled by the driver elements installed inside LabVIEW. (Note: those who are interested in SCPI programming do not hesitate to open an instrument manual.) Every instrument control flow built up according to the following scheme: 1. 2. 3. 4. Initialization (setting the GPIB address of the instrument) – init Configuration (setting measurement ranges, output impedance, etc.) – config Action (measuring a value, e.g. voltage, transmit a pre-defined waveform) – action Close (terminate the SW connection between the instrument and control device) – close Channel model The sketch of the "channel model" measurement panel can be seen in Fig. 1 inside the yellow colored frame. The circuit implements a low-pass filter. The parameters of the filter can be slightly modified by changing the values of the elements Cj and Rj using jumpers. The highest excitation voltage should not exceed 5 Veff (5 VRMS) at the input of the channel model. Analysis of eye-diagram (eye-pattern) The eye-diagram is used in the analysis of the distortion on digital signals. In this analysis, it is assumed that a digital baseband signal is transferred. From now on, we consider a baseband signal with two states: let the low-level correspond to Bit0 while high-level correspond to Bit1. To analyze the distortion of the signal (in case of baseband transmission the analysis is done at the input of the receiver, i.e., at the output of the channel), it does not suffice to examine only the transfer of a single bit 0 and a single bit 1. The reason is the following: when the transfer rate is 2 VIMIA312 Measurement laboratory 3, Measurement 2 close to the maximal transfer rate, the change of the signal level (from low to high or the reverse) has effect through several bits of the signal, fortunately in a decreasing manner (decaying). Thus the actual value of the signal in a bit position depends on the values of the neighboring bits. This implies that the distortion analysis should investigate the value of the signal on the receiver side in several combinations (patterns). PC_RXD 1 2 IN 6 C1 SGND GND R2 C2 NOISE IN Cj 4 9 OUT Rj PC_TXD 3 5 L1 R1 R3 R4 GND Low-pass filter channel model Figure 1. Sketch of the analog channel model Figure 2. shows how the waveforms, that are representing the bits, are distorted when the data rate is close to the maximal available data rate. The distortion here is presented and drawn for every single isolated bits. In reality the voltage levels have to be summed up at every time instant. It can be seen that due to the distortion introduced by the channel, the shape of the waveforms changed, (the square waveform at the input of the channel becomes a sinc-like waveform at the output) the waveform becomes “wider” in the time domain as they are spread. The reason is the following: the channel model behaves as a lowpass filter. The high-frequency components of the square waveform appears at the input of the channel model are significantly attenuated (filtered) therefore the shape of the waveform becomes distorted. The waveform widens (spread) in the time domain since the high-frequency components that assured the steep level change of the signal have disappeared and so the decay time increased. Figure 2. The effect of the channel on the series of square-waves representing bits, at the output of the channel assuming isolated bits 3 VIMIA312 Measurement laboratory 3, Measurement 2 On the other hand the data rate remains the same (no reason why it should have been changed, as it is an independent parameter from these effects) therefore the following bit arrives to the receiver “as scheduled” where the previous bit has not decayed yet. As a consequence their voltages are summed which deteriorate the proper restoration of the bits from the received waveform. In other words not only the present but also the previous bits have effect on the decision during the restoration of the presently received bit. Analysis is usually performed using a random bit sequence, or with a special bit sequence constructed in such a way that it contains those bit patterns that are expected to be the most unfavorable (worst case scenario). When displaying an eye-diagram, all basic signals (waveforms corresponding to a single Bit0 or Bit1) are drawn one on the other one in a single plot, synchronized to the timing signal of the data. This time function corresponding to a single bit duration resembles the shape of the human eye (see Figure 3), which explains the origin of the name of the diagram. Figure 3. The eye-diagram Besides the distortions that arise from the finite bandwidth and the frequency dependent transfer rate of the channel, the effects caused by the channel noise also appears on the eye-diagram. The size of the empty region inside the eye-diagram shows whether the correct decoding is possible or not. The values of the amplitude and timing spares should be available for decoding the signal correctly (Figure 4). The ”vertical gap" of the eye describes the amplitude spare, and the "wideness" of the eye describes the available time. We remark that the eye-diagram only yields qualitative information about the reliability of the signal transfer. Decoding of the signal is performed by a simple threshold comparison somewhere near the middle of the bit window. Figure 4. Analysis of the eye-diagram 4 VIMIA312 Measurement laboratory 3, Measurement 2 Measurement tasks 1.Contruction of eye-diagram • Feed a suitable signal (see next point) for the eye-diagram analysis to the input of the channel model, and examine the eye-diagram at the output of the channel. • To draw the waveforms in one plot, use the ”infinite persistence” display mode of the digital oscilloscope. • To generate the input signal, you should use the so-rand3 application (D:\alaplabor\ml3\02_LabView\so-rand3.vi) that is a LabVIEW based application to send quasi-random characters to the serial port of the PC. The Front Panel of the software is shown in Fig. 5. Figure 5. The Front Panel of the LabVIEW-based application used to send quasirandom characters to the serial port of the PC The asynchronous transfer via the RS232 serial port uses fix valued START ("0") and STOP ("1") bits to frame the characters transferred, therefore only those bit positions can be used for the eye-diagram that are in the middle of the character (frame). For accessing the square waveform representing the characters generated by so-rand2.vi use the PC_TXD and SGND (signal ground) signal lines shown by Fig. 1. It is possible to examine the effect of the channel on this waveform if the waveform is fed into the channel input. Analyze the channel output and make conclusions based on the waveforms measured at the channel output. 5 VIMIA312 Measurement laboratory 3, Measurement 2 • Construct the eye-diagram using the rates of 4800, 9600 and 12800 Baud. Evaluate the eye-diagrams and determine the openness of the eye-diagram by drawing a rectangle with largest area possible into the eye-diagram (use cursors as edges of the rectangle)! 2. Measuring voltage with a LabVIEW controlled multimeter Applied instrument for voltage measurements: We measure the alternating voltage using Agilent 34401A digital multimeter. When measuring the alternating voltage (ACV) (front panel: ACV button) the instrument measures real effective value (root mean square, RMS). In this case, the input is AC connected, and only the alternating signal component is measured by the multimeter. The voltage to be measured should be attached to the sockets with captions LO and HI. Make sure that the Terminals button is switched off. (If the Terminals button is switched on, then the measurement unit is connected to the inputs on the back side of the device instead of the inputs on the front panel.) The multimeter is connected to the PC through a GPIB instrument bus and a USB/GPIB interface. The LabVIEW software is able to control the instrument by means of appropriate drivers. Remote control of Agilent 34401A; LabVIEW drivrs used Start the LabVIEW 8.5.1 programme with the corresponding icon on the desktop, and open the "Agilent 34401 Read Single Measurement.vi" application that can be found in the directory " D:\alaplabor\ml3\01_02_LabView ". • Examine carefully the main functions of the VI units on the diagram. Hint: use Ctrl+h to open Context Help and read the descriptions of the driver elements (also referred to as VIs). The control of the device is performed by the following VI units of the block diagram: Agilent 34401.lvlib: Initialize.vi.: Initialization of the device. The physical port where the device can be reached must be selected in the Control unit of the Front Panel corresponding to this VI. The GBIP address of the multimeter is usually 22, so the address GPIB0::22::INSTR has to be selected in the drop down menu. (If the multimeter is switched off or it is not connected to the PC, then this address is not listed. If you turn on the multimeter later, the Refresh button has to be used to refresh the list of the possible addresses.) The VISA resource name input has to be connected to each of the VI instrument controller units below. In order to perform this in an elegant way, each VI unit has a VISA resource out output, through which they can be cascaded into a chain as shown in the example. The error in and error out inputs and outputs should also be cascaded the same way, so that only one Indicator is needed for the visualization of a potential error. Agilent 34401.lvlib: Configure Measurement.vi. The basic settings of the device should be given here. The Function input selects the quantity to be measured, AC Voltage – 1 should be selected in the drop down menu of the Front Panel. Let us keep the Auto Range automatic measurement range selection allowed (Enable). 6 VIMIA312 Measurement laboratory 3, Measurement 2 Agilent 34401.lvlib: Read (Single Point).vi. This VI performs the measurement. The drop down menu on the Block Diagram should be left in the Single Point state. If we want to perform more than one measurements, then this VI has to looped in some way (FOR, WHILE, etc.). Agilent 34401.lvlib: Close.vi. Closes the connection with the device. The above instrument driver VI-s can be found in the Instrument I/O/Instrument Drivers subpalette of the Functions palette. (Reminder: the Functions palette can be invoked by rightclicking on the Block Diagram.) Specific measurement tasks: • Generate a sine wave having 1 kHz frequency and 2 Vpp amplitude using the function generator applying manual control (on the front panel of the instrument). • Measure the output signal of the function generator by using oscilloscope! • Use Agilent 34401 Read Single Measurement.vi to measure the signal level of the generator by remote controlling the multimeter. Compare the result with the settings of the function generator. 3. Generating a sine wave with function generator in the LabVIEW environment 3.1 Generating a sine wave with constant frequency To generate the signal, we use the Agilent 33220A function generator. • Open the "Agilent 33220A Sine Output.vi" application that can be found in "D:\alaplabor\ml3\02_LabView" directory. Examine carefully the VI units on the Block Diagram that control the device. These are very similar to those that were used to remote control the multimeter, and the Context Help offers additional help. The VISA Session corresponding to the function generator is usually GPIB0::10::INSTR. • Set the corresponding values of the Front Panel so that the device outputs a sine wave with 1 kHz frecuency and 2 Vpp amplitude. Check the generated signal using the oscilloscope. the 33220A function generator outputs the signal value very precisely, so we accept this value. The output load-impedance of the generator must be correctly set. To do this, the config output impedance.vi element should be inserted into the Block Diagram to set the generator output impedance (Functions / Instrument I/O / Instrument Drivers / AG 33XXX FGen / Configure palette). 3.2 Generating a sine wave with changing frecuency • Modify the Block Diagram such that the frequency of the signal generated by the function generator take each of the following values, one after the other: 1 kHz, 1.5 kHz, 2 kHz, 2.5 kHz, 3 kHz. Each of these signals should appear at the output for 1 second. 7 VIMIA312 Measurement laboratory 3, Measurement 2 To accomplish this task, you can use a FOR loop (Functions paletta/Programming/ Structures). The block that "calculates" the frequency and the Config Waveform.vi unit that determines the parameters of the generated sine wave have to be placed inside the FOR loop. The units that determine non-changing parameters of the generator (e.g. amplitude) can remain outside the FOR loop. It is very important to place a timer element inside the FOR loop, so that the changes of the signal do not happen immediately. The timer unit can be selected from the Programming/Functions/Timing palette. This can be, for instance, the Wait (ms) unit , which waits the milliseconds given at its input. This must be placed inside the FOR loop, and it shouldn’t be connected with any other elements. • Check the results using the oscilloscope! 4. Constructing a measurement system for determining the magnitude response Re-use and modify the program codes of previous tasks and integrate them into a single program to construct a virtual instrument controlled by LabVIEW which automatically measures the magnitude response of the analog channel model, and determine the upper cutoff frequency! The final goal is the automated measurement of the magnitude response of the channel model and the determination of its characterizing parameters. 4.1 Constructing the basic version of the measurement system (co-operative instruments) • The basic version of the instrument should measure the absolute value of the amplification in the frequency range of 500 Hz-15000Hz. Use the Agilent 33220A waveform generator and the Agilent 34401A multimeter for the measurement! Hint: Assure that the multimeter not be able to measure the transient of the generator, i.e., the generator has to be settled first. In our specific case no transient measurement would occur since the operation of the multimeter is “slower” compared to that of the generator, nevertheless the potential critical situations have to be handled and avoided. To determine the amplification value, both the input and the output values has to be known, their ratio gives the amplification. To measure these automatically, one would need a second multimeter or a remote control device to switch between the measurement points. None of these devices are available at any of the workplaces, but the 33220A function generator outputs the signal value very precisely, so we accept this value. As before, the output load-impedance of the generator must be correctly set. To do this, the config output impedance.vi element should be inserted into the Block Diagram to set the generator output impedance (Functions / Instrument I/O / Instrument Drivers / AG 33XXX FGen / Configure palette). • The virtual front panel of the instrument should have the following setting blocks: Start Frequency, Frequency Step, Number of Steps Signal Amplitude (in RMS), Signal Offset • The virtual front panel of the instrument should have the following indicators: Measured AC Voltage (RMS), Current Frequency, Amplification Note: To display the actual values, the indicators have to be placed inside the FOR loop. • Check if the basic version of the measurement system works correctly by analyzing the channel model. Perform the analysis with the following settings: Start Frequency: 500 Hz, Frequency Step 1 kHz, number of points: 10, voltage of the input signal: 3 Veff . 8 VIMIA312 Measurement laboratory 3, Measurement 2 4.2 Extending the functions of the measurement system Extend the basic version with blocks processing the measurement results: • The instrument should plot the results for the first 10 measurement points in a table (array). The quantities to be plotted are: frequency, direct value of amplification, value of amplification in dB. • Plot the magnitude response on the virtual front panel in form of the traditional Bodediagram. (Don’t forget that the transfer function (amplification) must be depicted in dB, and the frequency on the horizontal axis has a logarithmic scale.) Naturally, the scaling of the axis and the unit values have to be shown on the axis. • Provide a possibility to export the measurement results into a file. (Programming / File I/O / Write To Spreadsheet File.vi) • The instrument should indicate the frequency on which the amplification drops below -3 dB. (Hint: use the Array / Threshold 1-D Array tool from the Functions palette!) • The instrument should indicate the frequency on which the amplification drops below -20 dB. • Analyze the channel model! Check if the extended version of the measurement system works correctly by analyzing the channel model. In the analysis, consider 500 Hz to be the middle of the band. (The middle of the band is used as a reference where the amplification is 1, i.e. 0dB) Save the picture of the front panel in the measurement report after each analysis. The front panel of the instrument should be user friendly and attractive. Settings that are rarely used (e.g. VISA address) can be hidden. You should also indicate the name of the instrument and the names of the students constructing the instrument on the front panel. 9 VIMIA312 Measurement laboratory 3, Measurement 2 Test questions 1. What is the definition of dB? 2. Consider an amplifier. We drive a signal to its input with 0,5 Veff magnitude and with a center frequency. We measure 10 Veff on the output. What is the amplification in dB? 3. Consider the amplifier of the previous question. Assuming constant input signal amplitude, what is the voltage that is measured • with the upper cutoff frequency of the amplifier for -3dB? • with the lower cutoff frequency of the amplifier for -3dB? 4. On the input of a 34401A type mulitimeter, we drive a sine wave with 2 Vpp magnitude, +1 V offset voltage and 600 Hz frequency. • What is the value shown by the multimeter in AC V mode (VAC indicator)? • What is the value shown by the multimeter in DC V mode (VDC indicator)? 5. How are the axis of the Bode-diagram scaled? 6. Given a black-box. When the input excitation was Ug=1V the following frequency dependent voltage values were measured at the output: U1(f=100Hz)=0.01V; U2(f=500Hz)=0.1V; U3(f=5kHz)=0.707V. What kind of filter is realized in the black-box and what is the cut-off frequency? What kind of cut-off frequency can be determined in this case? Plot the transfer function! 7. What components are contained in the spectrum of a symmetric square signal with frequency f1? 8. What can be used for an eye-diagram? 9. What does it mean if the eye-diagram is "wide"? 10