alexlabview (9)

Upload: sesha-giri-maruboina

Post on 06-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 AlexLabView (9)

    1/16

    1

    Prepared by:

    Alessandro DeOliveira

    Southern Polytechnic State UniverDecember 4, 2008

    Measurement and Analysis Instrumentation Control

    Professor: Pamela Frinzi

  • 8/3/2019 AlexLabView (9)

    2/16

    2

    TABLE OF CONTENTSTABLE OF CONTENTSTABLE OF CONTENTSTABLE OF CONTENTS

    SECTION ___________________ PAGE NUMBER

    1 INTRODUCTION 3

    2 OPERATING INSTRUCTIONS 4

    2.1 GETTING STARTED 4

    2.1 FIGURE 1: MEASUREMENT AND ANALYSIS 4

    2.1 FIGURE 2: MEASUREMENT AND ANALYSIS 3

    2.1 FIGURE 3: FILTER RESPONSE WINDOW 6

    3 ERROR HANDLING 7

    3.1 FIGURE 4: FUNCTION GENERATOR ERROR MESSAGE 7

    3.1 FIGURE 5: DIGITAL MULTIMETER ERROR MESSAGE 7

    4 CIRCUIT CONSTRUCTION 8

    4.1 FIGURE 6: PSPICE SCHEMATIC 8

    4.1 FIGURE 7: FREQUENCY RESPONSE COMPARISON 9

    5 THE PROGRAM 10

    5.1 PROGRAM FUNCTIONS 10-12

    5.2 FIGURE 8: MAIN VI BLOCK DIAGRAM 13

    5.2 SUB VI 14

    5.2 FIGURE 9: SUB VI BLOCK DIAGRAM 14

    6 STATE DIAGRAM 15

    6.1 FIGURE 10: STATE DIAGRAM 15

    7 CONCLUSION 16

  • 8/3/2019 AlexLabView (9)

    3/16

    3

    Introduction

    The purpose of this project is to merge Labview programming skills and GPIBinstrumentation control into one computer-aided testing system. The CAT system should

    measure the maximum gain and its frequency. It should also show the half power points

    and their frequencies. All of these values should appear on the analysis front panel. Theinstruments used are the DMM (digital multimeter), a voltage supply and the FGEN

    (function generator.)

    The user interface should have two front panels. The measurement and analysis

    front panels. The user interface permits the student to input values determined by the

    front panel. The measurement front panel displays measurements of frequency and gain

    in real time on a table. There is also a stop measurement feature that allows the user tostop the program. There is also an error reporting mechanism.

    Figure of our Circuit:

    Circuit attached to Multi-meter and functiongenerator (below)

  • 8/3/2019 AlexLabView (9)

    4/16

    4

    2) Operating Instructions

    2.1) Getting started

    The user can open the project.vi by clicking its icon. Once you open the VI, you will see the front

    panel of the filter analysis program as shown below in figure 1. On the front panel, this VI iscreated with consideration of measuring real time, voltage and real time frequency.

    FIGURE 1: MEASUREMENT AND ANALYSIS WINDOW

    Number of data points: is the data the user wants to plot on the graph. The default value of # of

    data points is 100.

    Start frequency: is the frequency the user wants at the low end of the plot. The default start

    frequency is set at 100 HZ.

    End frequency: is the frequency the user wants at the high end of plot. The default end frequency

    is set at 10000KHZ.

    Vin knob: is the input voltage the user wants to put in the circuit. You can increase and decrease

    by holding the knob and rotating to a desire input voltage value.

  • 8/3/2019 AlexLabView (9)

    5/16

    5

    Progress of simulation: is the indicator that shows where states of the plot during running

    the VI. The progress indicates how many percent of the plot is completed in the RUNmode.

    Stop simulation: is the button that stops the simulation at any point of time. If you press

    the stops button while the execution taking place, the VI returns to its originalappearance.

    For this particular VI, we used a digital multi-meter and a function Generator. A digital

    multi-meter is used to read the output of the circuit being tasted, while the function

    generator (FGEN) is used to measure the test circuits output.

    Step 1: Insert number of data by clicking the arrow up or down on text box while the,

    mouse cursor is in the hand symbol choosing from the tools palette. If the tool palette is

    not visible on the front panel, select show tool palette from the Windows pull-down menuto display the Palette. To type number in the text box, select the hand symbol from the

    Tool Palette and click on the area or use up or down to a desired number.

    Step 2: set the input voltage to a desired value raying from 0.00 to 2.50 by rotating the

    knob either clockwise or counter clockwise direction while the mouse is in the finger

    symbol.

    FIGURE 2: MEASUREMENT AND ANALYSIS WINDOW

  • 8/3/2019 AlexLabView (9)

    6/16

    6

    Step 3: In the front panel, there are list of operating toolbars. Go to the first toolbar

    which is an arrow pointing to the right. Click it to run the VI. Click on the ON button. Assoon as the progress of simulation indicator reaches its maximum value, you will see the

    actual plot appears on the screen depend up on the measurement you are taking as shown

    in Figure 3.

    FIGURE 3: FILTER RESPONSE WINDOW

  • 8/3/2019 AlexLabView (9)

    7/16

    7

    3) Error Handling

    3.1) ERROR MESSAGES

    Figures 4 and 5 show the messages displayed when connectivity is lost with the function

    generator or digital multimeter. When there are errors communicating with either instrument,

    these error messages will be displayed. The proper action to take would be to insure that the

    instruments are powered up, and that the GPIB interface cables are properly secured to the correct

    ports.

    FIGURE 4: FUNCTION GENERATOR ERROR MESSAGE

    FIGURE 5: DIGITAL MULTIMETER ERROR MESSAGE

  • 8/3/2019 AlexLabView (9)

    8/16

    8

    4) CIRCUIT CONSTRUCTION

    The purpose of this program is to evaluate the performance of a band-pass active filter. Figure 6

    shows a Pspice schematic of the active filter used to show typical values. The filter requires veryclose tolerances to build because it has a very narrow band that it allows to pass. The bandwidth

    varied between 75 and 250 Hz, depending on the number of data points used in the simulation.

    To be sure the resistance values were very close, a DMM was used to measure and tune-in

    resistance values. In one case four resistors took the place of one to bring actual resistance values

    as close to the theoretical values as possible. Mylar capacitors were used instead of ceramic

    because ceramics tend to oscillate and cause distortion in some situations.

    FIGURE 6: PSPICE SCHEMATIC

    Figure 7 shows the Pspice evaluation of this circuit compared with the values obtained

    from simulation done in lab with this Lab View program. The peaks and cutoff points ofboth simulation and test graphs seem to be very similar, which is encouraging.

  • 8/3/2019 AlexLabView (9)

    9/16

    9

    FIGURE 7: LAB FREQUENCY AND PSPICE RESPONSE COMPARISON

  • 8/3/2019 AlexLabView (9)

    10/16

    10

    5) The Program

    5.1 LabVIEW Programming Functions

    1. GPIB Read: This function reads the bytes of information provide by an

    instrument at a particular string. This is used to retrieve data such asvoltage from an instrument.

    2. GPIB Write: This function allows the program to send a string of data toan instrument based on a particular instruments address. The string tells

    the instrument what operations to perform and how to perform them.

    3. Formula Node: This is a function that evaluates mathematical expressions

    and formulas. The inputs and outputs are given by creating a node on its

    frame.

    4. Time Delay: This is a timer that will keep the operations from proceeding

    to the next step until the preset delay in seconds is reached.

    5. Two Dialog Button: This is used to create a pop-up message with two

    buttons that lets the user pick something like continue or abort.

    6. Stop: This function will completely stop the program if its determining

    condition is met.

    7. Feedback Node: A node place on the border of a For Loop in order tosend previously formed values or date back to the program

    8

  • 8/3/2019 AlexLabView (9)

    11/16

    11

    8. Build Array: Concatenates multiple arrays or appends elements to an n-

    dimensional array.

    9. Evaluate Formula String: Interprets a string as a numeric calculation and

    determines the result.

    10. Transpose 2D Array: Rotates an array so that date will go from a 2x3

    matrix to a 3x2 matrix.

    11. Logarithm Base 10: Compute the log in base 10 of a number.

    12. Array Min Max: This function gives the values of the minimum and

    maximum values of an array along with their index locations.

    13. Index Array: This function takes an array and an index value and gives

    the value at that index.

    14. Number to Decimal String: This function converts a number into adecimal string.

  • 8/3/2019 AlexLabView (9)

    12/16

    12

    15. Number to Fractional String: This function converts a number into a

    fractional string.

    16. Reverse 1D Array: This will completely flip the data in the array.

    17. Threshold 1D Array: This function finds a value in the array that is

    closest to the threshold value. This must be used with increasing values.A negative slope will cause inaccurate data.

    18. Sequence Structure: This function allow the user to set up a sequence ofevents to occur where one must finish before the other will begin.

    19. Case Structure: The program does one thing if true and another if false.

    20. Build XY Graph: This is a subVI that will take x and y data to create agraph.

    21. GPIB Report: This function will take an error with the GPIB system and

    gives a informing message.

  • 8/3/2019 AlexLabView (9)

    13/16

    13

    Main VI

    Figure 8 shows the layout of the block diagram. The program is centered around a forloop with the number of iterations being the number of data points to take. A sequence

    structure takes care of the GPIB functions within the for loop. From these sequence

    structures we get the output voltage. A formula node takes the start frequency, endfrequency, number of iterations, and current iteration. This node outputs the frequency to

    measure. This formula is shown below.

    f(meas) = f(start)*[f(end)/f(start)]^{N/[N(total) - 1]}

    Another formula node calculates the percentage of completion of the for loop, and

    converts the output voltage into a usable gain in decibels. These formulas are shownbelow.

    Percent Complete = (iteration number*100)/total iterations

    Decibels = 20log10(Vout/Vin)

    FIGURE 8: MAIN VI BLOCK DIAGRAM

  • 8/3/2019 AlexLabView (9)

    14/16

    14

    Sub VI

    The challenging part of this exercise was creating the SubVI that calculates bandwidth,f1, f2, and min/max gain. This SubVI can be found in the top-right corner of the main

    VI. Just like we learned in lab 2. The main VI outputs gain and frequency which becomes

    the inputs for the SubVI. The other action this SubVI is responsible for is creating thegraphical output of the filter response. Figure 9 shows the block diagram of the SubVI.

    FIGURE 9: SUBVI

    In order to get max frequency, a min/max array was used on the gain array. The min/maxnot only gives me max gain, but also the index at which the max gain occurs. This index

    can be input into the interpolate 1D array to find the frequency where max gain occurs.

    In the event that the circuit shows no gain, an error message will pop up informing theuser. This is accomplished using a case structure.

    The same basic method is used to find f1. 3 is subtracted from the max gain to figure out

    what the 3 dB point is. Next, threshold 1D array is used to figure out at which indexthis value occurs. This is an estimation because an infinite number of points is not used

    to created the gain array. Once this index is found, interpolate is used again to get the y

    value from the frequency array using the previous index.

    To get f2, the index value of f1 is added to 2, and input back into another threshold 1D

    array. This gives the next time that the gain reaches the 3dB point. This index is inputinto an interpolate 1d array using the frequency array. The output value is f2.

    Bandwidth is calculated by subtracting f1 from f2.

  • 8/3/2019 AlexLabView (9)

    15/16

    15

    6) State DiagramThe state diagram shows the data flow of the program. Due to the nature of GPIB, most

    of the data flow had to be sequenced. The program executes in a certain order for the

    instrumentation control to be able to interface with the instrumentation. The default state

    is shadowed and the other states to make it evident where the flow should begin.

    FIGURE 10: STATE DIAGRAM

  • 8/3/2019 AlexLabView (9)

    16/16

    16

    7) Conclusion:

    This CAT system provides an excellent method for testing the characteristics of a

    band pass filter. The only problem encountered was during the simulation. The ceramic

    disc capacitors that we used at first didnt produce valid values for our gain. So we

    replaced the ceramic with DIP Mica cap. After the replacement of the capacitors our

    values became valid. Over all it was a successful program. It met all the criteria.