ME 322: Instrumentation Lecture 19 March 4, 2015 Professor Miles Greiner LabVIEW program, A/D converter characteristics, actual measured grounded output, Input resolution error Announcements/Reminders • Please fully participate in each lab and complete the Lab Preparation Problems – For the final you will repeat one of the last three labs, solo, including performing the measurements, and writing Excel, LabVIEW and PowerPoint. – The labs help prepare you for the final • HW 7 due Friday • Lab 6 (wind tunnel) this week – Please see schedule on WebCampus and be on time – Bring Excel from HW 6 – How are things going in lab this week so far? LabVIEW • LabVIEW is available in the Engineering Computer Center (ECC) • You can buy LabVIEW on the web for around $20, but you don’t have to – http://www.studica.com/us/en/National-Instruments-students-ni-labview-mydaq/labviewstudent-edition/77925202.html?utm_source=google&utm_medium=ppc&kpid=371806&gclid=COPM1PymbwCFdBqfgodUF4A4A • If you purchases it, you will need to download and install DAQmx after installing LabVIEW to use the Measurement I/O icons we use in class – http://www.ni.com/dataacquisition/nidaqmx LabVIEW Five Main Acquisition Steps Measurement I/O, NI DAQmx 1) Create a channel 2) Timing 3) Start Process 4) Read Data analog waveform – – – 1 Channel N-Samples Output voltage – convert to Μ C 5) Clear the test Programming; Dialog and User Interface simple error handler • In this class we give and modify example LabVIEW programs. • The intent is to help you quickly learn to perform data acquisition programing. • However, we don’t deal with structured programming. LabVIEW program Computer Data Acquisition (DAQ) • Sensors detect measurands and produce signals – Voltages, currents, resistances, pulses,… • Conditioners convert those output signals to moderately large voltages • Multiplexer (MUX) sweeps channel-to-channel and feeds individual signals, at different times, to the Analog-to-Digital (A/D) converter • A/D converter samples real voltages (7.674337…V) and converts them to integers (0, 1, 2,…) that the digital computer can work with. • Computer programs store and/or process the data – In ME 322: LabVIEW and DAQmx drivers How “could” an A/D Converters work? VRU 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 01234567 VST x V x x VRL 0 IOUT = 1 TS VMeasured IOUT = 2 2TS IOUT = 5 3TS t • One “method:” Saw Tooth Compare (not really used) – Function generator produces ramps from VRL to VRU within period TS – Converter break TS into M (= 2N, N = integer) equal sub-steps – IOUT for each time step is the first sub-step when VST ≥ VMEASURED • To interpret IOUT – VDigitized = VRL + (IOUT +1/2)[(VRU-VRL)/M] ± (1/2)(VRU-VRL)/M • Uncertainty decreases as M = 2N increase, and/or FS = VRU-VRL decreases • Measurement is associated with center of time period – Time uncertainty: ±TS/2 Characteristics of A/D Converters • Full-scale range VRL ≤ V ≤ VRU – FS = VRU - VRL – For myDAQ the user can chose between two full-scale ranges • ± 2 V, ± 10 V • for Lab 7, 0 to 2.5 V, which range is used? • Number of Bits (in its digital word) N – The A/D converter breaks the full scale range into 2N subranges – For myDAQ, N = 16, 216 = 65,536 – What does this mean? • For example, a 2 bit word __ __ , in which each bit can be 0 or 1 • Has 22 = 4 combinations: 00, 01, 10, 11 • These are the digital signals (words) the A/D converter passes to the computer Sampling Rate • Sampling Frequency – fS = samples converted to digital per second [Hz] • Sampling Period – TS = 1/ fS; timed required to find IOUT • myDAQ – (fS)max = 200,000 Hz, TS = 0.000,005 sec = 5 msec – User can chose lower rates – If both channels are used, then (fS)max = ? Hz myDAQ Absolute Voltage Uncertainty (0.11%FS) (0.19%FS) (0.12%FS) (0.22%FS) • More information myDAQ – user guide, page 36-38 – http://wolfweb.unr.edu/homepage/greiner/teaching/MECH322Instrumentation/Labs/Lab%2007%20Boiling %20Water%20Temperature/Lab7%20Index.htm • Demonstration – Short myDAQ Analog Input 1 and observe signal • What “should” the reading be when shorted? – In my office: • ±10 V range: V ~ -0.0008 to -0.0026 V = 1.7 ± 0.9 mV (0.009% FS) • ±2 V range: V ~ -0.0003 to -0.0009 V = 0.6 ± 0.3 mV (0.02% FS) • Is it larger at higher voltages? – Same in class? Example • For a ±10 Volt, N = 2 bit A/D converter, what digitized voltages will it report for -∞ < V < +∞? – M = 2N = __ sub-ranges • Break input range into __ steps • IOUT can be 0, 1, 2, 3 – Step size = ππ π −ππ πΏ π = 10π −(−10π) 22 = 20π 4 =5π – How do we interpret IOUT (VDigitized) and what is its uncertainty? IOUT 3 A/D Converter Transfer Function 2 1 0 -15 -10 -5 0 VIN [volts] 5 10 15 Input Resolution Error • πΌπ πΈ = 1 πΉπ 2 2π = ππ π −ππ πΏ 2π+1 • At edge of range πΌπ πΈ → ∞ – Don’t go there! (by design) • IRE quantifies the random error from digitization process – IRE decreases (improves) as • N increases • πΌπ πΈ πΉπ = 1 2π+1 • For N = 16, πΌπ πΈ πΉπ = 1 217 = 7.6 × 10−6 , IRE = 0.000,76%FS A/D Converter Characteristics • Full-scale range VRL ≤ V ≤ VRU – FS = VRU - VRL – For myDAQ the user can chose between two ranges • ±10 V, ±2 V (FS = 4 or 20 V) • Number of Bits N – Resolves full-scale range into 2N sub-ranges – Smallest voltage change a conditioner can detect: • DV = FS/2N – For myDAQ, N = 16, 216 = 65,536 • ±10 V scale: DV = 0.000,31 V = 0.31 mV = 310 mV • ±2 V scale: DV = 0.000,076V = 0.076mV = 76 mV • Sampling Rate fS = 1/TS – For myDAQ, (fS)MAX = 200,000 Hz, TS = 5 msec Input Resolution Error • The reported voltage is the center of the digitization sub-range in which the measured voltage is found to reside. – So the maximum error is half the sub-range size. • Inside the FS voltage range – πΌπ πΈ = 1 πΉπ 2 2π = ππ π −ππ πΏ 2π+1 • At edge or outside of FS range – πΌπ πΈ → ∞ – To avoid this, estimate the range of voltage that must be measured before conducting an experiment, and choose appropriate A/D converter and/or signal conditioners. • The IRE is the uncertainty caused by the digitization process myDAQ Uncertainties Scale ±10 Volts ±2 Volts Absolute Absolute Accurcacy Accurcacy 23°C 18-28°C 22.8 mV 4.9 mV 38.9 mV 8.6 mV 0.1% FS 0.2% FS Measurd Shorted Voltage Error Input Resolution Error (IRE) 2.4 mV 0.9 mv 0.15 mV 0.03 mV 0.01 -0.02% FS 0.0008% FS • What are these? – AA: Maximum error of the voltage measurement reported by the manufacturer for all voltage levels • At different temperatures – MSVE: Maximum error measured at V = 0V for one device – IRE: Random error due to digitization process • Which one do you think characterizes voltage uncertainty? Example (cont) Break Range into 4 Steps Input Range (V) -10 to -5 -5 to 0 0 to 5 5 to 10 Iin B2 00 01 10 11 B10 0 1 2 3 How to interpret Iout and its error 1 πππ’ − πππ πππ’π‘π· = πΌππ’π‘ + + πππ π 2 2 1 = πΌππ’π‘ + 5 π + −10 π 2 Vout (V) -7.5 -2.5 2.5 7.5 Eror ∞ ± 2.5 ± 2.5 ∞ Transfer Function First Order: Generic Where Example Second Order ζ ≡ damping ration ωn ≡ natural frequency without damping Example Second Order