ch en 475: introduction to instrumentation and signal ... · ch en 475: introduction to...

21
1 | 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: 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 Detector (RTD) Rotameter Bellows Electrical conductivity 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 = = Sensing Element Transmitter output signal measured process variable Transducer

Upload: others

Post on 11-Mar-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

1 |

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:

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 Detector (RTD)

Rotameter Bellows Electrical conductivity 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

𝐾𝐾 =𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝐼𝐼𝐼𝐼𝑂𝑂𝑂𝑂𝑂𝑂 =

𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂 𝑟𝑟𝑟𝑟𝐼𝐼𝑟𝑟𝑟𝑟𝑆𝑆𝑂𝑂𝑟𝑟𝐼𝐼

Sensing Element

Transmitter output signal

measured process variable

Transducer

Page 2: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

2 |

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

100℃= 0.16 𝑚𝑚𝑚𝑚/℃

and the output from the transducer for a measured temperature, T, would be

𝑦𝑦 = 0.16mA℃

(𝑇𝑇 − 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:

DEVICE

A/D converter

Transducers Analog Input Channels, ain

VI

Front Panel Block Diagram

Computer running Labview

Page 3: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

3 |

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 closed-loop 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 Express>>Exec Control and click on “While Loop with button” 4. Draw a loop on the block diagram. Your window should resemble the one shown here:

Page 4: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

4 |

Note: This while loop comes with a stop button pre-attached (see front panel for the button), chosen for convenience, as opposed to the while loop found in Programming>>Structures, where a stop button would need to be manually added in the front panel and attached in the block diagram. A while loop tells Labview to do what is in the loop while the VI is running. The stop button tells it when to stop executing the command and is necessary for this type of application.

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. b. You will then see a page with the DAQ devices listed.

Note: The DAQ Assistant represents the physical module that one uses to collect data or send signals. There can be input DAQs or output DAQs. An input DAQ collects information, while an output DAQ sends out signals, in this application to power devices. There needs to be one DAQ Assistant for every physical module attached to the computer. The NI-6008 comes pre-configured to read voltage signals (mostly 1-5 Volts), while the NI-9211 comes pre-configured to read thermocouples (other DAQs can read them but would require specific scaling parameters to have accurate temperature readings). For this tutorial, you will use only an input DAQ assistant. For the PBL you will you both input and output DAQs. On an output DAQ, one chooses generate signal >> digital output (note: the input DAQ is analog) and either line (for one channel) or port (for all channels on the module). Then timing setting are usually designated as 1 sample on demand.

Page 5: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

5 |

3. This window allows you to configure what the analog signal from channel ai0 will do. 4. 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.”

5. 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).

Page 6: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

6 |

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. 6. Under the “Custom Scaling” box, select “Create New.” 7. 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.

Page 7: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

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.

8. Select “Linear” and rename the calibration “Flow Meter – Linear.” a. Figure 2 contains a linear fit of the calibration data found in Figure 1.

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.

9. 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.

10. Once done, your window should look like this:

y = 0.20006x R² = 0.99999

0.0

0.2

0.4

0.6

0.8

1.0

1.2

0.00 1.00 2.00 3.00 4.00 5.00 6.00

Flow

rate

(L/m

in)

Voltage (V)

Page 8: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

8 |

11. 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.

Page 9: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

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.

Page 10: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

10 |

8. Click “OK” and your block diagram should now look like the following:

Page 11: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

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.

Page 12: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

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.

Page 13: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

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.

Page 14: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

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), by right clicking on the wire and selecting Clean up Wire or you can simply press CNTRL+U, which will organize the Block Diagram for you.

10. 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 on the last page.

Create Temperature DAQ This section will cover how to make a new DAQ assistant for the thermocouple. Most of the steps will be omitted to test what you have learned.

1. Create a new DAQ assistant to use a thermocouple input within the while loop 2. Specify the thermocouple type within the configuration tab (look at the connector to

determine type) 3. Set the acquisition mode to match the pressure/flow DAQ

Page 15: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

15 |

4. Create two read outs on the front panel

Create Write to Measurement file loop Now you will learn how to write the flow, pressure and temperature data to a measurement file. At this point your block diagram should look something like what is shown on the next page: (It is not intended that you copy the front panel indicators. The indicators pictured here are not likely to be used for this application. They are intended to be place holders, allowing you to learn the idea and then apply it to your system.)

1. Add a case structure loop to the right of the temperature DAQ Programming >>Structures>>Case Structure

Page 16: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

16 |

2. Right click the green question mark of the case structure and select Create Control. This will create an on/off Boolean switch in the front panel with a corresponding figure wired to the loop, which can be retitled as appropriate.

3. Place a write to measurement file inside the case structure Programming>>File I/O>>Write

Meas F.. 4. Choose parameters for the file. The ones chosen as follows allow for new data to be

appended or added each time data is written saved in an Excel file with one time column. It is recommended that the file be saved on the students J:\ drive. Click OK. The block diagram should look as on the next page.

Page 17: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

17 |

Page 18: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

18 |

5. Now connect the data channels from both DAQs to the signals input on the write to measurement file using a merge signals found in Express>>Sig Manip>> Merge Signals. The lines should be branched, meaning the wire spool cursor should be held over the wire until it is blinking and then clicked. On the flow/pressure DAQ the line should be taken before the split signal. It will look something like below:

Page 19: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

19 |

Create Digital Output to Start/Stop Pump Labview allows one to send out a signal as well as process an incoming one. In this part you will configure a digital output that will allow you to start and stop the peristaltic pump.

1. Right-click on the block diagram and navigate to Functions>>Express>>Output>>DAQ Assistant Note: Like the Input DAQ, each output DAQ represents a physical module (or in this case a side of one – the NI USB-6008). You can tell the difference between the input and output DAQ by the way the arrow points from data.

2. The DAQ will then process and open a dialogue box as shown below. Here you want to generate a signal that is a digital output. There are two options line or port output. Line means one channel. Port means every channel. Here choose line output.

3. Next you will be prompted to select the channel where the output will be attached. Take a moment to review the digital terminal assignments for the USB-6008, found on the UO Lab webpage under hints for the instrumentation and labview experiment (or follow the hyperlink). Note where the digital output are on the USB-6008. In this case select Port 0/line 0 and then click finish.

Page 20: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

20 |

4. A dialogue will pop up that will ask you to invert the line and allow you to change the timing settings. Keep these on 1 sample on demand.

5. The last task is to create a control (on/off button) for the pump and wire it to the DAQ. The way it is wired, what is normally thought of as on (i.e. a lighted indicator) will be off. Keep switched as demonstrated below when the pump is off.

Page 21: Ch En 475: Introduction to Instrumentation and Signal ... · Ch En 475: Introduction to Instrumentation and Signal Processing with Labview Measurement Instrumentation . Rapid, on-line

21 |

6. The system is now ready to be wired. Double click on either DAQ Assistant, click on the Connection Diagram in the upper left and a diagram like below will appear.

7. The positive and negative wires for the flow meter and pressure transducer are found in the hints folder on the UO Lab website under Transducer instructions and flow sensor instructions. The thermocouple wires are shown on the wiring diagram. All thermocouples are consistent in their color coding. The wiring for the pump can be found here. Use that with the digital terminal assignments (the ground is the negative end).

You are now ready to connect to the flow meter, pressure transducer and thermocouple! Have Mike or John check your wiring

before you plug the cart in or turn anything on.