You are on page 1of 14

Home Forced Air Heating System Controlled by a Thermostat To understand where, how and why a PID loop would

be used, think about the typical home forced air heating system that is controlled by a thermostat. This system does not make use of a PID loop controller but does include many of the same elements, and generally would be considered a basic on/off control type application. It can be said the home heating system is Closed Loop because it is able to measure the present temperature and tune its operation on this value. The ability to deal in a desired temperature is our Set Point. Measuring the current temperature becomes our Process Variable. And controlling the heat source becomes our output. Older style thermostats include an Anticipator that prevents the room temperature from overheating. Using an anticipator is much the same reason we would use a PID loop controller, that is, to keep the end result controlled.

Home Forced Air Heating System Operational Sequence Room temperature falls below thermostat set point and the gas burner is ignited. Temperature rises in the plenum and the fan/limit switch tern on the blower when its upper limit is reached. Hot air circulated into the house with the warm air rising.

Anticipator in the thermostat causes the thermostat to reach the set point before the actual temperature has been reached and turns off the gas burner. The blower continus to run until the fan/limit swich falls below the loer limit and the blower is turned off. If all conditions are set correctly, actual room temperature should be within a degree or two of set point and the occupant should feel comfortable. Home Forced Air Heating System Controlled by a PID Loop Now take a look at the same heating system, but replace the gas burner with an electrical heating element with the ability to vary the amount of wattage (BTUs) that can be produced. As with a gas burner, the heating element is our controlled output. We still use a Set Pioint value to let the system know our desired temperature, and we retain the ability to measure the actual temperature, which we call our Process Variable.

Now replace the thermostat with a PID loop control such as the functionality built into the Productivity 3000. What will this do for us? First, using a PID will allow for more accurate control of the room temperature, and second, because we are able to control the amount of heat needed to maintain the Set Point, based on the PID calculation, most likely will use less energy. In the next series of slides we will briefly cover the functions of the Proportional, Integral & Derivative terms and formulas used in our PID loop controller example. Automobile Cruise Control PID Loop Controlled Obtain your desired speed, press ON to enable the cruise control, and press SET to lock in the current speed of the vehicle. (Set Point) Sensor measures current speed and continuously updates. (Process Variable) A small comparator in the vehicle runs a PID program to calculate and make corrections. Any difference between the desired speed and sensed speed becomes an Error which causes the computer to either increase or decrease the vehicles throttle. If a hill is encountered, the throttle is smoothly increased, and a with a downgrade, the throttle is locked off. Press ACCEL (+) or DECEL (-) to increase or decrease speed in 1 MPH increments. Press OFF or Hit the Brake to disengage the cruise control.

Typical PID Loop Operation To better understand how a process is controlled with the use of a PID loop controller such as the function that is abailable in the Productivity 3000, take a look at the key elements shown in the diagram below. The Set Point (SP) value, our desired result, is summed with the Proecess Variable, our feedback. PPV lets the control know where the result is in real time. The difference between SP and PV becomes the Error Term. Within the loop calculations, the magnitude of the Error Term value is used with the Proportional gain value to produce a number that will be used to determine how much correction we need from the Output to get the PV closer to the SP. The Proportional gain acts on the present error. The Output correction is further modified by the integral rate value, which is calculated from the accumulation of past error. The Derivative rate, when used, is included in the final Output correction based on a prediction of future errors, determined by the current rate of change.

The description and diagram in the next slide represents the PID control scenario for the working example used in this tutorial. In short, the example PID loop control maintains a liquid volume in a tank by measuring the level. Converts this value to a volume, and replace loss fluid with a variable rate pump. Proportional, Integral & Derivative To simplify an explanation on how the PID loop control works, start by looking at just the Proportional calculation. Its result is the error difference between the Set Point value and the Process Variable value multiplied by the value assigned to the Proportional term, also called the Gain. Diagram 1 shows what happens when the Set Point is changed and the Gain value is set too low. The PV will take a long time to get up to the SP. Diagram 2 in an example of having the Gain too high, with the PV overshooting the SP, and the PV going into oscillating. Diagram 3 reflects the ideal result, with the Gain set to have the fastest response time without a large overshoot. Depending on the application and system response, Integral & Derivative values are adjusted to achieve minimum oscillations.

The next slide shows a typical PID formula used for calculating the output base on the three main terms. Propoertional, Integral & Derivative, that are summed together for the final output correction at any given instance. A more detailed explanation of a PID loop operation can be found at the reference listed in the example.

P, I & D Terms Explanation

Proportinal (P) - Depends on the present error. Integral (I) on the accumulation of past errors. Derivative (D) is a prediction of future errors based on current rate of change.

PID Loop Application Example Explanation For the PID loop application used in this tutorial, we will control the volume of a liquid in a water storage tank. Refer to the application diagram shown on the next slide as the process is explained. Set Point (SP) used to set the desired volume in gallons of water required in the water tank. PID Loop Calculation an Error based on the difference between the Set Point and feedback from the Process Variable is used to determine an output correction calculated by the Proportional, Integral and Derivative values. Output - this is the calculated result from the loop calculation that determines the water pump rate at any given instance. Process Variable (PV) - feedback used to determine how much the actual voume is off from the desired (SP) value. A ten (10) gallon cylindrical water tank is used as our main process focus. A sixteen (16) gallon rectangular tank is uses as a reservoir. A variable output diaphragm pump is used to fill the process tank from the reservoir. The rate of the pump is 0 to 1 gallon per minute and is controlled by a DC motor controller that will accept a 0 - 10 VDC analog signal to produce the output pumping rate. The liquid in the process tank drains back to the reservoir tank by means of a siphon tube and the rate at which it drains is controlled by a manually adjustable ball valve. There is a flow indicator to visibly show the liquid draining. The ball valve can be adjusted to speed up or slow down the drainage rate.

The volume is calculated by determining the level in the storage tank using an ultrasonic probe that produces a 0 - 10 VDC analog signal in relationship to a 100 to 600 mm distance between the top of the process tank and the current water level. A hand operated primer bulb as might be found on an outboard motor boat engine gas tank, is used to initially start the drainage flow, with a siphon tube used to prevent loss of flow once the system is primed. A fill tube is use in the process tank to reduce ripple effect of the entering liquid that can cause the ultrasonic probes output to fluctuate. PID Loop Application Equipment from ADC The automationDirec equipment used for the PID loop example application consists of the following: Productivity 3000 PAC (Base, Power supply, CPU DC Input, DC Output, Analog Input, and Analog Output Modules) C-more 6 Touch Panel TFT, LED Backlight ZipLink Pre wired Modules and PLC Cables Ultrasonic Sensor, 18 MM, 0 10 VDC Analog Output Rhino 24 VDC Power Supplies, DIN Rail Mount Relays and Octal Sockets, 75 Series

Laton CH Stack Light Tower and Audio Alarm Laton CH 30 MM Pushbuttons Single Pole Supplementary circuit Protectors Stride Unmanaged Ethernet Switches Ethernet Cat 5 Patch Cable

PID Loop Application Equipment Wiring (Schematics) The next series of four slides cover the schematics used for the PID loop application wiring. The Productivity 3000 Programmable Automation Controller is the heart of the control system by providing the PID functionality required. Care was taken to use protective devices for the various circuits, and it should be noted that two different 24 VDC power supplies were used to help isolate the analog circuitry from the general DC device circuitry. Also the use of a separate 12 VDC power supply provides power to the Dart DC motor controller that operates the diaphragm pump motor. A Power On/E-Stop push button and relay circuit was included as a safety to stop all action in case of an emergency or if the float switch is actuated due to an overflow condition. The Productivity 3000 and the C-more Touch Panel are networked together using Stride Ethernet switches. Analog Input Module Jumper Settings The analog input module used for the PID Loop application has the ability to be configured for different input current and voltage ranges, such as 0-5 VDC, 0-10 VDC, 4-20mA, etc.

The ultrasonic Sensor we are using has an analog output of 0 to 10 VDC. The P3-04ADS Analog Input Module is in setup so that all channels will accept a 0-10 VDC signal. This will provide a 0-65535 count range. PID Analog Input Calculating & Scaling Tank Volume Using a PID loop is always easier if you are able to use the process Variable values in familiar engineering units. The Productivity 3000 programming software includes various scaling and math instructions that make this task simple. In our application we need to control the water volume in a 10 gallon tank. We are using an ultrasonic sensor that can read a distance of 100 to 600 mm from the front face of the sensor with an analog output of 0 to 10 VDC. Converting metric to inches, the water level close to the sensor would be 3.94 inches and furthest would be 23.62 inches. Keep in mind the volume relationship to sensor distance is inverted. With the most volume being at the closest distance. One (1) gallon = 231 cubic inches The inside diameter of the 10 gallon process tank measures 12.5 inches. Water_Height_per_Gallon = 231/(*r2) = 231/(*6.252) = 1.88 inches Maximum_Volume equals Total tank height of 18.75 inches , mines sensor face at 2 inches into tank, minus minimum sensor distance at 3.94 inches = 12.8 inches difided by 1.88 inches height per gallon = 6.80 gallon The closest distance the Ultrasonic Sensor can measure is 3.94 inches (100 mm) from the face of the sensor, and the sensor is mounted through the process tanks lid at a distance of 2 inches. This is a total of 5.94 inches, subtracted from the tanks total height of 18.75 inches would be at 12.81 inches from the bottom of the tank. Because each 1.88 inches of height in the tank represents 1 gallon of water, the highest level that can be read by the sensor will be 12.81 divided by 1.88 inches height per gallon = 6.80 gallons. Minimum_Volume equals This calculation takes a little more thought in what is going on here. The Ultrasonic sensor can measure out to a distance of 23.62 inches. Since the process tank has a height of 18.75 inches, the sensor could actually see past the bottom of the process tank if there were no obstructions, but we want to keep the final volume valve at zero when the tank is empty, and still use the total 0 to 65,535 count range of the analog input module to maintain our resolution. Total tank height of 18.75 inches, mines sensor face at 2 inches into tank, minus maximum sensor distance at 23.62 inches = negative 6.87 inches divided by 1.88 inches height per gallon = negative 3.65 gallons

Scale (Linear) Instruction The final task for the Analog Input from the Ultrasonic Sensor is to use the Scale (linear) Instruction to provide our tank volume in engineering units of gallons of water. Use the Hardware Configuration to assign the Tagname Ultrasonic_600 to the first channel input (AIS32-0.1.3.1) on the P3-04ADS analog input module. Tank_Volume equals: Input Min from Ultrasonic_600 0 To Input Max from Ultrasonic_600 65,535 PRODUCING: Output Min from Maximum_Volume (6.80gal.) To Output Max from Minimum_Volume (-3.65 gal.) Again, maximum volume is seen when the water level is closest to the face of the Ultrasonic Sensor. PID Analog Output The 12 VDC diaphragm motor/pump is capable of producing a rate up to 1 gallon per minute of liquid transfer. With the use of the Dart DC motor controller we can vary the pump rate from 0 to 1 GPM by providing a 0 to 10 VDC analog signal to the DC motor controller 0 to 10 VDC is represented by a count value of 0 to 65,535. As will be seen in the PID Loop Instruction that follows, we can use the PIDs Process Output directly to control the pump rate to produce the maximum resolution without the need to scale. The tagname for the process output is labeled Pump_Speed. But, it would be nice to have the C-more Touch Panel display the actual pump rate in GPM. We use a Scale (Linear) Instruction to take the Pump_Speed, scale it to a 0 to 1,000 value, and give it a tagname called Cmore_PID_Output. Within the C-more, 3 decimal places to the left are used to display 0 to 1,000 GPM. PID Loop Instruction Create the PID loop by dragging and dropping the PID Loop instruction in the ouput portion of the ladder rang. Fill in the Loop Name and Tag Names. Loop Name Water Volume Control

Set Point Tank_Volume_SP Process Variable Tank_Volume Input Range Max - Maximum_Volume Input Range Min Minimum_Volume Process Output Pump_Speed Output Range Max 65,535 Output Range Min - 0 Output Upper Limit - 65,535 Output Lower Limit 0 Proportional (Gain) Proportional Integral (Reset) Time- Integral (Sec.) Derivative (Rate) Time Derivative (Sec)

-Data Type Looking at the Tag Database, Floating Point and 32-bit Integer Data Type were assigned to the various tagnames used in the PID Loop Instruction. Floating Point data types were chosen for the Process Tanks volume. Set Point and minimum/maximum volume range to allow for measurements read to the hundredths of a gallon. A 32-bit integer data type was chosen for the Proportional, Integral and Derivative forms. The 32-bit integer has plenty of resolution for the values that are typically used for final tuning of the PID loop. The PID Loop instruction requires two rungs of control. The first is for enabling the PID execution, and the second for setting the PID to automatic mode or manual mode. Discrete bits controlled from push buttons on the C-more Touch Panel, are used to Enable the PID loop and also for placing the loop in Auto mode. When the PID loop is not in Auto mode, it is in Manual mode. We will see how Manual mode is used for initial startup and Auto tuning the PID loop.

Miscellaneous Logic The process tank includes a float switch mounted through the tanks lid and is used to kill the power via the Power On/E-Stop circuit to prevent water overflow. Included in the ladder logic is a rung shown here to sound the available alarm if the float switch is actuated. A three color Stack Light tower is also used to indicate if the desired volume is OK. Below desired volume or above desired volume. Here is a couple of Math Instructions that are being used to create a 0.02 gallon upper and lower alarm point actual and set point.

C-more PID FacePlate & Parameters Screen As a finishing touch to our PID Loop application, we used a C-more Touch Panel. The C-more application software has within its library a PID Faceplate Bar Meter that works perfectly with our PID application. The use of the faceplate makes PID setup, control, monitoring and tuning. The PID Faceplate incorporates bar graphs for Set Point, Process Variable and Process Output. It also displays status of operation mode (auto/manual) and alarm monitoring. Along with the PID faceplate, we have used the C-more to add push buttons to enable the PID loop and selecting the auto or manual mode. A Numeric Entry object from the C-more object list is used to enter the Set Point for the process tanks desired volume. A Screen Change push button is used to get us to the PID Parameters screen. A second C-more screen is available adjusting the Proportional, Integral and Derivative terms values as required. This screen also includes status indicators (Indicator Lights) for the main control power, overflow float switch conditions, and the health of the Productivity 3000 optional battery used to retain the Time and Date, and retentive tagname values. The Stack Light tower indicator used to show the process tanks volume condition are duplicated on this screen. This is ideal if remote access to the C-more were done over the internet. Finally a Screen Change push button is available on this screen to get us back to the main PID Loop monitoring screen. PID Loop Tuning Manual Once we have all of the equipment in place, wired, and checked out, we can next start process, monitor it with the built-in PID Tuning feature, and step through manual tuning to test functionality and check response. Start with applying power to the equipment and pr5ess the Power On push button. Via the C-more touch Panel, enter a value for P, I, & D as described on the next slide, enter a volume such as 3.00 gallons, enable the PID, and enable Auto mode. The pump should run at maximum output filling the process tan from the reservoir tank. Our purpose at this point is to get enough water into the process tank so that the level is above the bottom of the siphon tube located toward the bottom of the process tank. Under safe condition, and being ready to hit the Emergency Stop push button, it is usually a good idea to start with a Proportional value of 10, disable the Integral reset by entering the maximum value of 65,535 and also disable the Derivative term by entering 0. As can be seen with the PID Tuning window, the volume has trouble reaching our Set Point, mainly because a Proportional gain of 10 along with no Integral reset time, just isnt enough for our particular application. But once we have a couple of gallons in the process tank, we can open the ball valve and use the primer squeeze bulb to start a drainage flow. This will get us ready for the next step, which is making manual changes to our P, I and D term values to have the pump increase the level to obtain the desired volume.

Without changing our Proportional gain at this time, we change the Integral result time to 1 which allows for a faster correction of the accumulation of past errors, as we learned earlier in this tutorial. As seen with the PID tuning window, the pump is driven at full output, bringing the volume up to our Set Point value, with some overshoot. After oscillating around the Set Point for a period of time, the volume settles down, but the time it takes to do so is very slow.

Our next step in manually tuning the PID Loop will be to increase the Proportional gain to obtain a faster response, enter a new Set Point value, monitor the response using the PID Tuning window, and make adjustments to the Integral reset time value to reduce oscillation, also called hunting. The manually tuning process takes some trial and error in making changes to the various Proportional and Integral term values, changing the Set Point, waiting for the results while

monitoring the response, and repeating those steps. Eventually you should see improvement with the PV getting to the SP with little overshoot and no oscillations. Our goal is to obtain optimal performance in the PID Loop response, and seen here we were able to obtain our best results with a Proportional gain of 200 and on Integral reset time value of 5 seconds. Because our process is a slow responding type application, we do not require any Derivative time. In fact, in our application, adding any Derivative actually causes the PID loop to become unstable. PID Loop Tuning Auto To use the built in Auto Tune feature, switch to Manual Mode and place the PID loop in a steady state by manually adjusting the Process Output value. We used an Initial PV Bump of 5% and leave the PV Deadband at 0. Again our process did not require a Derivative value, so only the PI Radio button was checked. Now click on the Auto Tune Start button in the PID Tuning window. The current Process Variable will be copied to the Set Point value, in our example this became a volume of 3.0116088 gallons. The Process Output will go to the upper limit (65,535) and drive the pump full on to increase the volume in the tank. Once the Process Variable reaches the Initial PV Bump, in our case 5%, or approximately 3.15 gallon, the Process Output will go to the lower limit (0).

When the Process Variable falls to the Set Point, the Output is then driven to the Output upper limit. When the Process Variable rises to the Set Point, the Output is driven to the Output lower unit again. The Output cycling pattern continues for three full cycles, and when completed, the Auto Tune routine calculates the new values for the P, I & D terms and writes them to the appropriate Tagnames. Proportional Gain 193 Integral Time 4

Derivative Time - 0

These values are almost identical to the values that were determined by way of our trial and error manual tuning effort.

You might also like