Manual - UO Labs

advertisement
Ch En 475: Introduction to
Instrumentation and Signal Processing
with Labview
Measurement Instrumentation
Rapid, on-line measurement of temperature, pressure, liquid level, flow rate and composition is
extremely important in the chemical process industry. Electronic communication of that information
from the measurement sensors to a computer interface for data analysis and process control is also
essential for safe and effective operation of processes. The two components of a process transducer
to make and transmit properties are shown here:
measured
process
variable
Sensing Element
e
Transmitter
output signal
Transducer
Most industrial analog now has a standard output range of 4 – 20 mA or 1 – 5 VDC.
Some common sensors are shown in the table below. Generally the process variable is not measured
directly but obtained from a relationship between the measurable property and the desired process
variable. For example, RTDs measure resistance but the resistance of the sensing element directly
changes with temperature. Orifice and Venturi flow meters measure a pressure drop across an
obstruction to obtain the velocity from the Bernoulli relation.
Temperature
Flow
Pressure
Level
Thermocouple
Orifice
Bourdon tube
Float
Thermister
Venturi
Diaphragm
Head device
Resistance Temperature Rotameter
Bellows
Electrical conductivity
Detector (RTD)
Turbine
Strain gauge
Vortex-shedding
Piezoelectric
Thermal mass
Piezoresistive
It is important to keep in mind the INPUT and OUTPUT characteristics of the transducer that you are
using to make a measurement. Generally transducers come stamped or marked with a Zero (Z)
value, which is the minimum detectable limit of the sensor, a span (S) which is the range or
difference between the maximum and minimum input limits. The gain (K) for the transducer is given
by
𝐾=
𝑂𝑒𝑑𝑝𝑒𝑑 𝑂𝑒𝑑𝑝𝑒𝑑 π‘Ÿπ‘Žπ‘›π‘”π‘’
=
𝐼𝑛𝑝𝑒𝑑
π‘†π‘π‘Žπ‘›
1|
As most transducers are designed to be linear, the gain represents the slope of a straight line when the
output variable is plotted against the input variable. (Note: Labview uses a scaling factor to convert
from the line signal that it receives to display information in the units of the measured variable. This
scale factor is therefore the reciprocal of the transducer’s gain.) A linear equation can be used to
determine the output, y, from any input variable, x. Thus,
𝑦 = 𝐾(π‘₯ − 𝑍) + 𝑂
where O is an offset or the value of y when the input value is at the lower limit Z. For example,
suppose a temperature transducer has the following specifications: Z = 50ºC, S = 100 ºC (note that
the maximum temperature for which this transducer can be used is 150 ºC) with a standard output of
4 – 20 mA. The gain for this transducer is
𝐾=
20 mA − 4 mA
= 0.16 π‘šπ΄/℃
100℃
and the output from the transducer for a measured temperature, T, would be
𝑦 = 0.16
mA
(𝑇 − 50℃) + 4 mA
℃
Signal Processing
Once an output signal has been transmitted from a sensor as an analog (or digital) signal, the
information needs to be sampled, collected, converted to units of the process variable measured, and
made available to you for further analysis and/or to a controller which can then output a response to
the final control element, most often a control valve. In the past we have had a Bailey central control
system that provided these functions. In the on-line documents for the various projects, you will
likely still see instructions on using the Bailey with the apparatus in the UO Lab. However,
beginning Fall Semester 2010, the UO Lab has been switched to a distributed control system with
individual electronic devices supply the signal to a PC and Labview software provides the signal
processing functions and control output mentioned above. This relationship is illustrated here:
VI
DEVICE
Front Panel
Block
Diagram
A/D
converter
Transducers
Analog Input
Channels, ain
Computer running Labview
2|
Multiple transducers can be used to measure flow, temperature, etc., at various locations within the
process and Labview controls through which channel of the device the data are received and at what
sampling rate for each transducer. Labview then converts the data to the process variable units for
that transducer and allows the user to visualize, analyze, store and manipulate the data collected for
the measured process variables as well as to set up a control loop to provide both open- and closedloop control of the control variable. The projects you will do in ChEn 475 have been interfaced with
Labview for you, but to work effectively with the control and measurement system in the lab, you
should have a good understanding of how the interface and software work.
In Labview, measurements are set up as Virtual Instruments (VI). The user interface consists of a
Block Diagram area and a Front Panel area. You create the user interface that you will see in the
Front Panel window. This window will contain all of the virtual buttons, meters, output displays,
controls, etc., to provide the user with the measured information from the process and control of the
process. The GUI interface in the Front Panel is created by dropping control and display objects
from tool palettes. It is what will be seen when RUN is selected to initiate measurements and
control. As the GUI is created in the Front Panel, icons of the controls and objects dropped into the
interface are also displayed in the Block Diagram window. In addition to creating the user interface,
you must also “tell” Labview where to get signals, how to process them, and where to send that
information in the objects available in the GUI you created. The Block Diagram allows you to make
interconnections between the objects and to define how the signal is treated by the objects.
The remainder of this document is a simple, introductory tutorial illustrating how one can use
Labview to connect two analog transducers for automated measurement of flow and pressure in a
pumped system. It shows the steps of creating the VI, setting up the Front Panel, and making
connections in the Block Diagram. At the end of the tutorial, you will have a working interface to
sample and visualize the pressure and flow rate measurements made in a system pumping water.
Configuring Pressure and Flow Rate Transducers (Analog Inputs) in
Labview
Set Up the Control Loop
LabVIEW allows you to create a graphical user interface that has switches, gauges, and other
devices. You essentially create a program which begins to run when you start it and shut it down
when you stop it. This is accomplished by putting everything in a while loop.
1. Open a new, blank VI in LabVIEW and separate the front panel and block diagram (control T).
2. Right-click on the block diagram and expand the Functions window by clicking on the
to
expand the box.
3. Navigate to Programming>>Structures and click on “While Loop.”
4. Draw a loop on the block diagram. Your window should resemble the one shown here:
3|
5. Add a stop button. You must tell the while loop when to stop.
a. Right-click on the Front Panel.
b. Click on “Buttons”.
c. Select the “Stop Button”.
d. Place the button somewhere on the Front Panel. It will also appear on the block
diagram.
e. Your window should now look like this:
4|
f. Connect the Stop button on the Block diagram to the red circle by placing the cursor
on the center of the right side of the stop button and dragging a line to the red circle.
g. Once finished, your block diagram should look like this:
Configure the Flowrate Sensor
1. Right-click on the block diagram and navigate to Functions>>Express>>Input>>DAQ Assistant.
2. Place the DAQ Assistant inside the while loop on the block diagram, you will see a configuration
box.
a. Choose Acquire Signals>>Analog Input>>Voltage.
5|
b. You will then see a page with the DAQ devices listed.
3. Choose the appropriate device that you want to connect to and expand using the + (plus) sign if
necessary to see a list of channels (e.g. ai0 thru ai7) through which the flow signal can be input.
4. Choose channel ai0 and click “Finish.”
5. You will now have a menu that looks like the following:
6. This window allows you to configure what the analog signal from channel ai0 will do.
7. Change the name of the channel from “Voltage” to “Flowrate.”
a. Right-click on the word “Voltage” and select “Rename.”
b. Change the name to “Flowrate.”
6|
8. The flow meter is made by the McMillian Company (model 13157) which has provided the following
calibration data (Also available at http://uolab.groups.et.byu.net/files/labview/labhints.htm).
Figure 1 Calibration data for the flow meter.
a. The flow meter outputs a voltage.
b. At 5.0 volts, the flowrate is 1.0 L/min. At 0.50 volts, the flowrate is 0.1 L/min. Labview
now needs to be told this information so that the output will read in L/min.
9. Under the “Custom Scaling” box, select “Create New.”
10. You have several options available to calibrate this signal.
a. Linear: Allows you to specify a slope and intercept (gain and offset). The calibration data
shown in Figure 1 are fairly linear so they could be fit to a straight line (in Excel or Mathcad)
and the resulting slope and intercept could be used.
b. Map Ranges: Allows you to input two points for the ranges of input and output. Labview
then assumes a straight line model to obtain the gain. Two of the points in Figure 1 could be
used with this option.
c. Polynomial: Allows you to specify the coefficients in a polynomial. The coefficients are
obtained by fitting the calibration data in Excel or Mathcad.
7|
d. Table: If the calibration data don’t seem to follow either a polynomial or a straight line, a
table of data can be entered. LabView will then interpolate linearly between the table points.
11. Select “Linear” and rename the calibration “Flow Meter – Linear.”
a. Figure 2 contains a linear fit of the calibration data found in Figure 1.
1.2
Flowrate (L/min)
1.0
y = 0.20006x
R² = 0.99999
0.8
0.6
0.4
0.2
0.0
0.00
1.00
2.00
3.00
Voltage (V)
4.00
5.00
6.00
Figure 2 Fit of flowmeter calibration data to a straight line model.
b. In the “Scaling Parameters,” change the slope to 0.20 and the intercept to 0. Note: Labview
is doing the opposite of what the transducer does – the input for Labview is the line signal
(voltage in this case) and the output is the flow rate. The scale factor is therefore the inverse
of the gain that the transducer uses to produce the line signal from the measured variable.
c. In the “Units,” type “L/min” in the “Scaled” box.
d. Click OK. This will return you to DAQ configuration window.
e. Under “Settings” under the “Voltage Input Setup,” change the “Signal Input Range” to
correspond to the min and the max of the calibration curve for the “scaled” output (L/min).
i. Change the Max to 1 and the Min to 0.
ii. Ensure that “L/min” is found in the “Scaled Units” box.
12. Set the timing settings.
a. The timing settings affect how often LabVIEW the read the input from the channel.
b. Select “Continuous Samples” from the “Acquisition Mode” box.
13. Once done, your window should look like this:
8|
14. Click OK.
Configure the Pressure Sensor
1. To configure the pressure sensor, begin in the DAQ window, click on the
button under
“Channel Settings,” and select “Voltage.”
2. Select channel ai1 on the device and click OK. This will cause another channel to appear in the
Channel Settings box.
9|
3. Rename this channel from “Voltage” to Pressure.
4. The pressure sensor is made by Cole Parmer. The label on the sensor indicates the voltage range
to be 1 to 5 volts and the maximum pressure to be 30 psig.
a. This means that at 5 volts, the pressure is 30 psig.
b. Though not explicitly stated, you can assume the pressure is 0 psig at 1 volt.
5. Tell LabVIEW the scaling by selecting “Create New” under the “Custom Scaling” box.
6. Select “Map Ranges”
a. Name the scale “Pressure Calibration.”
b. Change the “Pre-Scaled” “Maximum” value to 5 and the “Minimum” value to 1.
c. Change the “Scaled Values” to 30 and 0 for the maximum and minimum respectively.
d. In the “Units,” type “psig” in the “Scaled” box.
e. Click OK. This will return you to DAQ configuration window.
f. Under “Settings” under the “Voltage Input Setup,” change the “Signal Input Range” to
correspond to the min and the max of the calibration curve for the “scaled” output (psig).
g. Set the timing settings by selecting “Continuous Samples” from the “Acquisition Mode”
box.
7. Once done, your window should look like this.
10 |
8. Click “OK” and your block diagram should now look like the following:
11 |
Add the Gauges to Display the Measured Pressure and Flow Rates
Now that LabVIEW knows how to interpret the signals sent to the board, you need to provide a
convenient and useful display of the output results for the user in the GUI you are developing in the Front
Panel window.
1. On the Front Panel, right-click and navigate to “Numerical Indicators.”
2. Select “Gauge” and place the gauge on the front panel. (This gauge will be used to output the
pressure.)
3. Right-click on the gauge and select “Properties.”
4. On the “Appearance” tab, change the “Label” to “Pressure – psig”.
5. On the “Scale” tab, change the “Scale Range” minimum to 0 and the maximum to 30.
6. Click OK and rescale the gauge to the desired size by dragging on the Front Panel.
7. Using a similar procedure, add a digital output (Right-click>>Num Inds>>Num Ind) for the
pressure. Rename as appropriate.
8. Using a similar procedure, add a “Meter” and a “Num Ind” for the flowrate. (Don’t forget to
rename each gauge and change the range.)
9. Your window should now look like the following:
Connect the Gauges to the DAQ
All that remains is to connect the gauges to the DAQ and set up the interrelationships of the objects you
have created in the user interface.
12 |
1. Right-click on the block diagram and select “Sig Manip>>Split Signals.” (Note: on some
machines you may have to search a little for this, but you should be able to find it under Express
> Signal Manipulation > Split Signals.
2. Place the signal split icon on the block diagram as shown:
3. Drag the signal split down just enough to create two signals.
4. Connect the top signal (ai0 - the analog input channels are numbered from ai0 down starting at
the top of the icon) to one of the flowrate boxes.
5. Connect the bottom signal (ai1) to one of the pressure boxes.
13 |
6. Beginning at the unconnected flowrate box, drag a line to the middle of the line currently
connecting the signal splitter and the first flowrate box.
7. Do the same thing for the unconnected pressure box.
14 |
8. Finally, connect the DAQ to the splitter by drawing a line from the arrow next to the word “data”
to the signal splitter.
9. If your block diagram is somewhat unorganized and lines are hidden or blocked, you can clean
the diagram up by dragging objects around to where you want them (and the lines will follow and
change with the drag) or you can simply press CNTRL+U, which will organize the Block
Diagram for you.
10. You can test your set up by selecting Operate > Run from the menu in the Block Diagram
window. This provides a sinusoidal virtual input signal that oscillates between the minimum and
maximum input values that you specified. You should see your meters and numerical displays
oscillate accordingly with this virtual test.
11. Now you are ready to go into the lab and connect up the actual equipment. Labview will help you
make the right connections.
a. Right click on the DAQ and select Properties.
b. Select the “Connection Diagram” tab in the upper pane.
c. Selecting the Flow Rate channel and Labview will show the pin out for connecting the
flow transducer to the device; selecting the Pressure channel will show the pin out for the
pressure transducer. You may see something like this:
15 |
You are now ready to go to the lab and connect to the flow and
pressure transducers and try your Labview interface!
16 |
Download