Da q Tutorial

download Da q Tutorial

of 10

Transcript of Da q Tutorial

  • 7/24/2019 Da q Tutorial

    1/10

    MEEN 364

    Vijay8/30/2001

    1

    Introduction to Data Acquisition using LabVIEW

    I. Introduction

    A systemis a group of physical components assembled to perform a specific function. A

    system may be electrical, mechanical, hydraulic, pneumatic, thermal or a combination of

    any of these systems.

    Information either sent to or taken from a system is usually called a signal. A signal is

    any physical quantity or a piece of information that varies with time, space or any other

    variables. Systems act on signals to modify and/or to produce newer signals.

    Signal in Signal out

    Most of the signals encountered in the science and engineering are analogin nature. That

    is the signals are functions of a continuous variable, such as time or space, and usuallytake on values in a continuous range. Such signals may be processed directly by

    appropriate analog systems. In such a case we say the signal has been processed in analog

    form.

    Analog input signal Analog output signal

    Signals, which are defined at discrete time instants, are called discrete-time signals. Byselecting values of analog signals at discrete time instants, or in other words by sampling

    the analog signals we arrive at discrete-time signals. The following figure shows the

    difference between continuous and discrete-time signals.

    Analog

    System

    System

  • 7/24/2019 Da q Tutorial

    2/10

    MEEN 364

    Vijay8/30/2001

    2

    A discrete-time system is a device or algorithm that operates on discrete-time signals,called the input or the excitation, to produce another discrete time signal called the outputor the response of the system.

    Input signal Output Signal

    (Discrete) (Discrete)

    A control system, as the name suggests is a system in which some physical quantity is

    controlled by regulating an input. A control system is a combination of amplifiers,transducers/sensors, and actuators, which collectively act on a process/system to maintain

    some condition at a required value. Control system comprises of different systems and

    signals as shown in the figure. Most of the control systems operate on the feedback basis,as shown, and are called closed loop control systems.

    Discrete-

    time System

  • 7/24/2019 Da q Tutorial

    3/10

    MEEN 364

    Vijay8/30/2001

    3

    In the early days control systems were mostly analog in nature, since most of the real

    world signals and systems are analog in nature. These systems were bulky, complex and

    cumbersome both to design and to maintain. However with the development of digitaltechnology and the invention of Integrated circuits, the design of control systems became

    easy and economical. Presently most control systems are microprocessor controlled,

    primarily because of tremendous advancements in data handling capabilities.

    Many applications also need a fast and even real-time decision-making with regard to the

    control input. This requires a large amount of processing power and also high

    computational speeds. The advent of Integrated chips and computers have provided avery convenient solution to this. Since these require information to be present in the

    digital form for processing, the measured or sensed signal has to be converted to a digital

    form before a computer can process it. This necessitates the use of Analog to Digitalconverters (ADCs). An ADC samples the analog signal at a specified rate and converts it

    into digital information. This can be processed by the computer.

    Analog signal Digital signal(From sensors)

    The result of the above processing is still going to be in the digital form and henceunsuitable unless we convert it back to analog form. The Digital to Analog Converters

    (DACs) perform this function. They interpolate the digital information to give an analogsignal. This actuating signal can be given as a control input to the system under interest.

    Digital Analog

    Information Signal

    ADC Computer

    Computer DAC System

  • 7/24/2019 Da q Tutorial

    4/10

    MEEN 364

    Vijay8/30/2001

    4

    Hence the use of ADCs and DACs can provide the advantage of using the processing

    power of computers and ICs on real world systems which are mostly analog in nature.

    The control system architecture can therefore be schematically represented as below

    ADCs and DACs present on the Data Acquisition board can be used for the purpose ofinterfacing the analog domain with the digital domain. The computers in MEEN364 lab

    are equipped with National Instruments PCI6024 Data Acquisition Boards. These

    boards are designed to perform A/D and D/A conversion using 12-bit resolution. It has 8differential analog input channels and two 12-bit analog output channels. A channel is a

    term used to mean either an input or an output line. The input to the DAQ board is an

    analog signal and so is the output. The process of collecting data using the analog inputchannels is called Analog Input,and the process of getting signal out is called AnalogOuput.Both these tasks can be performed using LabVIEW.

    II. Analog Input Using LabVIEW

    Finding the Data Acquisition VIs in LabVIEW

    TheFunctionsData Acquisitionpalette contains six subpalettes that contain the different

    classes of DAQ VIs. The DAQ VIs are classified as follows:

    Analog Input VIs

    Analog Output VIs

    Digital I/O VIs

    Counter VIs Calibration and Configuration VIs

  • 7/24/2019 Da q Tutorial

    5/10

    MEEN 364

    Vijay8/30/2001

    5

    Signal Conditioning VIs

    Figure 5-1 shows an example of a DAQ subpalette that contains all of the available levels

    of DAQ VIs.

    VI Parameter Conventions

    In each LabVIEW DAQ VI front panel or Context Help window, the appearance of thecontrol and indicator labels denotes the importance of that parameter. Control and

    indicator names shown in bold are required and must be wired to a node on the block

    diagram for your application to run. Parameter names that appear in plain text areoptional and are not necessary for your program to run. You rarely need to use the

    parameters with labels in square brackets ([ ]). Remember that these conventions apply

    only to the information in the Context Helpwindow and on the front panel. Default input

    values appear in parentheses to the right of the parameter names. Figure 5-3 illustratesthese Context Helpwindow parameter conventions for the AI Read One Scan VI. As the

    window text for this VI indicates, you must wire the device (if you are not using channel

    names), channels, error in, and iteration input parameters and the waveform data and

    error out output parameters. To pass error information from one VI to another, connect

    the error out cluster of the current VI to the error in cluster of the next VI. The

    coupling &input config, input limits, output units, and number of AMUX boardsinput parameters are optional.

  • 7/24/2019 Da q Tutorial

    6/10

    MEEN 364

    Vijay8/30/2001

    6

    The Waveform Control

    LabVIEW represents a waveform with the waveform control parameter by default. A 1D

    array of waveform controls represents multiple waveforms. The VIs, functions, and frontpanel objects you use to build VIs that acquire, analyze, and display analog

    measurements accept or return waveform data by default. The waveform control contains

    data associated with a single waveform, including data values and timing information.The waveform control passes the waveform components to the VIs and functions you use

    to build measurement applications. Use the waveform VIs and functions to extract and

    edit the components of the waveform.

    Waveform Control Components

    The waveform control is a special cluster of components that includes time-domain,

    uniformly sampled waveform information only. Use the waveform functions to accessand manipulate individual components.

    Start Time (t0 )The start time is the start time of the first point in the waveform. Use the start time to

    synchronize plots on a multi-plot waveform graph or to determine delays betweenwaveforms. This value is not used by the Analog Output VIs.

    Delta t (dt)

    Delta t is the time between successive data points in the waveform. This value is not used

    by the Analog Output VIs.

    Waveform Data (Y)

    The waveform data is a 1D array of double-precision numbers that represents thewaveform. Generally, the number of data values in the array corresponds directly to the

    number of scans taken from a data acquisition device. Refer to the Using the Waveform

    Controlsection for more information about acquiring and generating waveform data.

  • 7/24/2019 Da q Tutorial

    7/10

    MEEN 364

    Vijay8/30/2001

    7

    Using the Waveform Control

    There are a number of LabVIEW VIs and primitives that accept, operate on, and/or return

    waveforms. In addition, you can connect the waveform control wires directly to many

    LabVIEW controls, including the graph, chart, numeric, and numeric array controls.The block diagram in Figure 5-5 acquires a waveform from a channel on a data

    acquisition device, sends it through a Butterworth filter, and plots the resulting waveform

    on a graph.

    The AI Acquire Waveform VI takes a number of samples from a channel at a specified

    scan rate at a particular time. The VI returns a waveform. The probe displays the

    components of the waveform, which includes the time the acquisition, began (t0), the

    time between successive data points (dt), and the data of a waveform acquired with eachscan (Y). The Waveform FIR Filter VI accepts the array of waveforms and automatically

    filters the data (Y) of each waveform. The waveform graph then plots and displays the

    waveform. The waveform control can also be used with single point acquisitions asshown in Figure 5-6. The AI Sample Channel VI takes a single sample from a channel

    and returns a single-point waveform. The waveform contains the value read from thechannel and the time the channel was read. The chart and the temperature controls acceptthe waveform and display its data. The Get Waveform Components function is used to

    extract the start time from the waveform.

  • 7/24/2019 Da q Tutorial

    8/10

  • 7/24/2019 Da q Tutorial

    9/10

    MEEN 364

    Vijay8/30/2001

    9

    control a certain component, such as the dtcomponent, create a front panel control and

    wire it to the appropriate component in the Build Waveform function.

    Channel Number Addressing

    You can address your channels by channel numbers in the channelsparameter. Thechannelscan be an array of strings or a scalar string control. If you have a channelsarray,

    you can use one channel entry per array element, specify the entire list in a single

    element, or use any combination of these two methods. For instance, if your channels are0, 1, and 2, you can specify a list of channels in a single element by separating the

    individual channels by commasfor example, 0, 1, 2. Or you can specify the range by

    separating the first and last channels with a colonfor example, 0:2.

    Limit Settings

    Limit settings are the maximum and minimum values of the analog signal(s) you aremeasuring or generating. The pair of limit setting values can be unique for each analog

    input or output channel. For analog input applications, the limit setting values must be

    within the range for the device. Each pair of limit setting values forms a cluster. Analogoutput limits have a third member, the reference source. For simplicity, LabVIEW refers

    to limit settings as a pair of values. LabVIEW uses an array of these clusters to assign

    limits to the channels in your channelstring array.

  • 7/24/2019 Da q Tutorial

    10/10

    MEEN 364

    Vijay8/30/2001

    10

    Resolution

    The number of represent an analog signal determines the resolution of the ADC. You can

    compare the resolution on a DAQ device to the marks on a ruler. The more marks you

    have, the more precise your measurements. Similarly, the higher the resolution, the

    higher the number of divisions into which your system can break down the ADC range,and therefore, the smaller the detectable change. A 3-bit ADC divides the range into 8

    divisions. A binary or digital code between 000 and 111 represents each division. The

    ADC translates each measurement of the analog signal to one of the digital divisions.Figure 6-4 shows a sine wave digital image as obtained by a 3-bit ADC. Clearly, the

    digital signal does not represent the original signal adequately, because the converter has

    too few digital divisions to represent the varying voltages of the analog signal. Byincreasing the resolution to 16 bits, however, the ADCs number of divisions increases

    from 8 to 65,536 (2 ^16). The ADC now can obtain an extremely accurate representation

    of the analog signal.

    Device Range

    Range refers to the minimum and maximum analog signal levels that the ADC can

    digitize. Many DAQ devices feature selectable ranges, so you can match the ADC rangeto that of the signal to take best advantage of the available resolution.

    Signal Limit Settings

    Limit settings are the maximum and minimum values of the signal you are measuring. A

    more precise limit setting allows the ADC to use more digital divisions to represent the

    signal. Using a 3-bit ADC and a device range setting of 0.00 to 10.00 V, With alimitsettingof0 to 10 V, theADC uses only four of the eight divisions in the conversion.

    But using a limit setting of 0 to 5 V, the ADC now has access to all eight digital

    divisions. This makes the digital representation of the signal more accurate.