Sie sind auf Seite 1von 8

Proportional Controller using LabVIEW

PURPOSE: To gain experience using computer interfacing software and to construct and analyze a proportional controller for controlling the temperature of a furnace. Background: LabVIEW is an acronym for Laboratory Virtual Instrument Engineering Workbench. The software, produced by National Instruments, is widely used in industry and research labs to control instruments, take measurements and analyze and store data. LabVIEW is a graphical programming language (unlike C++ or FORTRAN, which are text based) that uses objects called Virtual Instruments, or VIs, to construct computer code. In this experiment, you will use LabVIEW to "wire together" several VIs into a program that will regulate the temperature of a furnace. Proportional Control Many instrument operations require control of certain parameters, that is, physical quantities that are held constant. For example, an air conditioner can be adjusted to maintain a specified constant temperature in your house, or you may set the cruise control on your car to maintain a constant speed. To regulate these parameters, the instrument must be able to produce an output that influences the parameter (e. g. move the throttle cable to adjust car speed) but must also measure the parameter to determine the required adjustment. To do this, the instrument uses a feedback mechanism whereby the needed adjustment is related to the difference in the present value of the parameter to the desired control value. A frequently used feedback mechanism is known as proportional feedback where the output adjustment is proportional to the difference between the present and desired parameter values. In PID control, the proportional feedback is used in conjunction with integral and differential feedback where the output adjustment is related to the integral over time and time derivatives of the differences between present and desired parameter values. Our furnace uses a heating coil for adjusting temperature and a thermocouple to measure temperature, as shown in figure 1. Thermocouples are temperature sensors that consist of two dissimilar metals. Two different metal wires are connected at one end and this end is placed in the furnace. The other ends of these wires extend out of the furnace and are at room temperature. A voltage is generated between the ends of the thermocouple wires outside of the furnace when the furnace temperature exceeds room temperature. Our goal is to provide an output to the heater coil (a current) that is proportional to the difference between our desired input (setpoint voltage that corresponds to our desired temperature) and actual input to our feedback circuit (the thermocouple voltage). Circuit Design The circuit we will construct will be the virtual circuit of the LabVIEW program. We must, therefore, interface our virtual computer circuit to the real furnace circuit. To do this, we will use a data acquisition board (DAQ) produced by Measurement Computing Corporation. The interfacing board allows one to measure input voltages on several analog to digital (A to D) channels and deliver output voltages to several digital to analog (D to A) channels. Since the current capabilities of the D to 1

Heater Coil

Thermocouple

Vth
Feedback Circuit

I V = Vs Vth
Figure 1. Proportional control diagram for furnace (dashed line). Current from current source is proportional to difference between setpoint voltage, Vs, and thermocouple voltage ,Vth. A channels are fairly limited (maximum current output is 5 mA), we will need to supply an external circuit that can amplify this current. The circuit shown in figure 2 is designed to do so and will be referred to as the two transistor box. The circuit, housed in a metal box, consists of two high-power transistors (labeled 2N 3055), designated in bold. The first transistor circuit on the left is called an emitter follower and is designed so that the voltage at its emitter, E, is equal to the voltage at its base, B, minus a 0.6 volt drop (much like a forward biased diode). Therefore, there is no gain in voltage from the first transistor. However, there is a tremendous gain in current due to the properties of the transistor. The small current from the DAQ (5 mA or less) that goes into the base is amplified to a much larger current at the emitter of the transistor (by as much as a factor of 50). The emitter current from the first transistor circuit then feeds into the base of the second transistor circuit and allows for even more gain in current. As with the first transistor circuit, the voltage at the emitter of the second transistor circuit is equal to the voltage at its base minus a 0.6 volt drop. The current through the attached 4-ohm resistor is then simply this emitter voltage divided by the 4-ohm resistance. From the properties of the transistor current source, approximately this same current is measured through the collector, C, of the transistor. External connections to the transistor box consist of the DAQ, a 50 volt power supply capable of providing up to 3 A of current, and the 17 ohm heater coil. A precise analysis of the relationship between the output voltage of the DAQ, VDAQ, and the current transferred through the heater coil, I, proceeds as follows. Designating the voltages at the base, VB, emitter, VE, and collector, VC, for the first and second transistor circuits with subscripts 1 and 2, respectively, one finds,

VB 2 = VE1 = VB1 0.6 V = VDAQ 0.6 V .

(1)

and V E 2 = V B 2 0.6 V = V DAQ 1.2 V

(2)

Since the heater coil current, I, is equal to the collector current, IC2, which is approximately equal to the emitter current, IE2, one further derives,

I = IC2 ~ I E2 =

VE 2 VDAQ 1.2 V = . 4 4

(3)

For example, if the DAQ outputs its maximum voltage of 10 volts, this would correspond to 8.8 V/4 = 2.2 A of heater coil current, a total current gain of over 400 from the 5 mA maximum output current of the DAQ! In addition, the circuit has the advantage that the heater coil current is linearly dependent on the DAQ voltage, but independent of the heater coil resistance, which will change with temperature.

Power Supply 50 V
C

DAQ Output

2N 3055
E B

17 Heater Coil

2N 3055
E

100 k

4 50W

Figure 2. Two-transistor-box circuit. Two transistor circuits are housed in a metal box, designated by a double line. External connections to the DAQ board, a power supply and heater coil are indicated. Virtual Circuit As indicated in equation 3, the heater coil current is proportional to the quantity, VDAQ - 1.2 V. Therefore, the LabVIEW program should be written so that this quantity, VDAQ - 1.2 V, is proportional to the difference, Vs - VTh, as shown in figure 1 or,

I VDAQ 1.2 V VS VTh

VDAQ 1.2 V = (Gain) (VS VTh ),

(4) (5)

or VDAQ = (Gain) (VS VTh ) + 1.2 V ,

where "Gain" is the gain factor of the proportional controller. Since thermocouple voltages vary by only a few millivolts for changes in temperature of a few hundred degrees, the gain factor should be at least 1000 to make any significant impact on the output voltage to the DAQ and ultimately the current through the heater coil.

PROCEDURE: You will be constructing the virtual feedback circuit using LabVIEW on the computer, and will also make external connections to the DAQ, the two-transistor box, and the heater coil and thermocouple. Each member of the lab group should read and follow all parts of the procedure, but it may be advantageous to delegate responsibility so that one person is mainly responsible for the computer work, that is, the software, while the other person is mainly responsible for the external connections, that is, the hardware. On the LabVIEW workstation computer, log on to 8-228-01B (this computer). The user is "researchers" and the password is "el_che". Software Development Due to time constraints, you won't be able to develop each discrete component of the proportional controller software from scratch but will piece together several previously developed subVIs (or subroutines). This practice is quite common using LabVIEW and emphasizes the modular nature of the programming language. Open the folder on the desk top PHYSICS 430L. Then double click on the LabVIEW instrument, Student Proportional Controller VI. You should see the front panel of the virtual instrument which consists of a couple of charts and two controls (that is, input parameters that may be adjusted), like the picture in figure 3. The front panel is designed to simulate a stand alone instrument that would perform the exact same tasks as the software. From the Window menu, select, Show Block Diagram. The block diagram of the program shows a number of functions and subVIs that will perform the code of the program much like a flow chart, and should appear like the diagram in figure 4. The two control components from the front panel, Enter Number of Data Points and Enter Setpoint Temperature in Celsius, are displayed as unique icons on the block diagram. In addition, the two charts from the front panel, Temperature (Celsius) and Heater Current (A), are displayed as icons indicating graphs. The large rectangle enclosing most of the components of the program is actually a FOR loop and will perform each function of the program (measurement of input and application of output and storage of data in a file) N times where N is the number of data points input by the user. The items within the FOR loop on the block diagram consist of input parameters on the left side and output parameters on the right side. The items across the bottom, both inside and outside the FOR loop, consist of functions associated with file manipulation (opening, writing to, formatting and closing). At the top center of the block diagram is a timer function that pauses the program 3 seconds (3000 ms) between each data point. The missing items, which you will be providing, are the components necessary to connect the input to the output so that the program functions as a proportional controller. The broken wire segments, designated as crossed-out dashed lines in figure 4, specify the missing section for the proportional controller branch of the circuit. To construct the missing proportional controller branch, one must first understand the function of the existing input and output subVIs. The user enters a setpoint (or control) temperature in Celsius degrees and the subVI, Back Therm, then converts this temperature into a corresponding voltage based on the known calibration curve of the thermocouple (Type K). The subVI, Therm Input, reads the thermocouple voltage on the input (A to D) channel 0 of the DAQ board and passes this voltage to its right terminal and, in addition, converts this voltage into a corresponding temperature (again using the thermocouple calibration curve) which it passes to its lower left terminal.

Figure 3. Front Panel diagram of LabVIEW program, Student Proportional Controller VI.

Figure 4. Block diagram of LabVIEW program, Student Proportional Controller VI. On the right side of the block diagram, the subVI, Voltage Output, reads the input voltage on its middle left terminal and passes this voltage to the output (D to A) channel 0 of the DAQ board. In addition, it calculates the heater current that would be associated with this output voltage and passes 5

this quantity to its right terminal. The upper and lower left terminals of this subVI are connected to the number of data points entry, N, and the number of FOR loop iterations, i. These connections ensure that once the number of iterations is equal to the specified number of data points (that is, the program is finished), the output of the DAQ will rezero and shut off the heater current. The salient elements of the program most pertinent to the proportional controller branch are indicated in figure 5. Comparison of figure 5 to equation 5 indicates that the proportional controller must perform the following tasks in the following order: subtract Vth from Vs, multiply V by the gain and then add 1.2 to the result. To do this, you must insert the appropriate functions. From the block diagram, on the View menu, select Functions Palette. Select the Numeric Palette and locate the Subtract, Multiply and Add functions. To copy these functions to your program, one at a time, click and drag them to your block diagram, releasing the mouse button when the function is at the desired location. We will first concentrate on the Subtract Function. To start, right click on this function and select, Visible Items and then select, Label. Next, right click on the function again and select Help. A window should appear that explains the operation of the Subtract function. As indicated, the function performs the task of subtracting the value connected to its bottom left terminal from the value connected to its top left terminal and passing the difference to its right terminal. To "wire" this function appropriately, return to the block diagram, and from the View menu, select Tools Palette. On the Tools Palette select the symbol that looks like a spool of wire. Your cursor will then appear as a spool. To wire the Subtract function to the outputs of the Back Therm and Therm Input subVIs, move the cursor to the right side of one of these subVI's and click the mouse when a terminal appears, then move the mouse to the left side of the Subtract function and click when a terminal appears on that icon. From the Tools Palette, go back and select the arrow symbol and the cursor will behave again as a selection tool. You may use this tool to select the previous broken wire segments from the right terminals of the two subVIs, if they still exist, and delete these segments.

VS VTh

Control Functions

VDAQ

Figure 5. SubVIs pertinent to proportional control branch with associated inputs and outputs. To wire the other math functions, you will need to insert both a user control and a numerical constant. From the Numeric Palette, locate the Numeric Constant function and copy this function to your program. Since this constant must be changed to the value 1.2, it must be changed from its original representation (integer) to a decimal representation. To do this, right click on the constant and select, Representation, and then select the Double icon which will change the representation from 32bit single precision integer to double precision floating point decimal. . Now to change your numerical constant to 1.2, you will use the labeling tool, (the A) on the Tools Palette. To add an input control to your program, go back to the front panel window and under View select, Controls Palette. Under the Numeric Controls Palette select the Numeric Control icon and copy this control onto your front panel. Using the labeling tool, you can label this control as, "Enter Gain Factor". Return to the block diagram of your program and, using the same methods as previously described, wire the rest of your program together so that it carries out the mathematics dictated by

equation 5. Note that the output of your last function (the add function) should be wired to the left middle terminal of the Voltage Output subVI. Hardware Connections The pin out diagram for the DAQ board is shown in figure 6. The DAQ board is provided with two ribbon cables that are attached to a terminal board in a metal box, to facilitate making external connections. The left side and right sides of the box correspond to connections 1 -50 and 51-100 of the pin out diagram, respectively. The thermocouple will be connected to the input (A to D) channel 0 and the DAQ output will be connected to D to A channel 0. Because of the short length of its wires, the thermocouple should first be connected to a separate isolated terminal strip and wires should then connect between this strip and the terminal board. The more positive thermocouple wire (the wire encased in yellow thread) will be connected to input channel high and the other wire to input channel low. In addition, the low connection must also be connected to the input ground of the board, labeled LLGND. The output will consist of two wires, a D to A out and D to A GND.

Figure 6. Pin out diagram of PCI-DAS6014 data acquisition board. You should be able to make all necessary connections to the two transistor box based on the diagram on the top of the box. Recall that both the DAQ output and the power supply must be 7

grounded and the ground connection is indicated on the diagram. The connections to the heater coil are made to the red and white banana plug wires protruding from the furnace. Data Collection Adjust the power supply to 50 volts output AND NOT HIGHER TO AVOID DESTROYING THE TRANSISTORS. Adjust the current limiting knob all the way clockwise so that the current is not limited. To make input adjustments to your VI, access the front panel of your program and, from the Tools Palette, select the hand icon (the operating tool). You can then use this tool to input values into your various controls. We will start controlling temperature at 50 C and use a fairly low gain value (10,000). You would like the program to proceed for enough time so that you can analyze the operation of the controller, that is, determine how well it keeps the furnace at your constant specified temperature. Keeping in mind that data are collected every 3 seconds, input the appropriate number of data points to control temperature for a period of about 20 minutes. Once you have input all three input parameters, start your program by selecting the RUN button (the right pointing arrow at the upper left corner of the window). The program asks for a file name, and once you have provided one, the program will run until the last data point is recorded. As it runs, notice how the heater current changes as the furnace gets closer to its control temperature. For the second run, try a very high gain value (1,000,000) and control at a temperature of 80 C, again for about 20 minutes. Such a high gain value ensures that maximum heater current will be applied when the furnace temperature drops even slightly below the control temperature. Again, observe the heater output as the temperature of the furnace changes. Data Analysis Make graphs of temperature and heater current versus time for your two runs. Comment on the controlling properties for the two gain values. Items that you may wish to comment on include: accuracy of control, how close is the actual temperature to the control temperature; temperature overshoot, by how much is the control temperature exceeded on initial warm up; stability of control, how much variation is there in temperature about the control temperature; current stability, how stable is the current while controlling; and any other factors that you deem interesting.

EQUIPMENT: 1. 2. 3. 4. 5. 6. Lindberg Tube Furnace with control electronics and power cord removed Two transistor box LabVIEW workstation: Computer on cart with LabVIEW software, DAQ card and external terminal block Topward TPS2000 Power Supply Terminal strip Connecting wires: banana wires and single strand copper wires

Das könnte Ihnen auch gefallen