25. CONTINUOUS CONTROL
25.1 INTRODUCTION
Continuous processes require continuous sensors and/or actuators. For example, an oven temperature can be measured with a thermocouple. Simple decision-based control schemes can use continuous sensor values to control logical outputs, such as a heating element. Linear control equations can be used to examine continuous sensor values and set outputs for continuous actuators, such as a variable position gas valve.
Two continuous control systems are shown in Figure 383 Continuous Systems. The water tank can be controlled valves. In a simple control scheme, one of the valves is set by the process, but we control the other to maximize some control object. If the water tank was actually a city water tank, the outlet valve would be the domestic and industrial water users. The inlet valve would be set to keep the tank level at maximum. If the level drops there will be a reduced water pressure at the outlet, and if the tank becomes too full it could overflow. The conveyor will move boxes between stations. Two common choices are to have it move continuously, or to move the boxes between positions, and then stop. When starting and stopping the boxes should be accelerated quickly, but not so quickly that they slip. And, the conveyor should stop at precise positions. In both of these systems, a good control system design will result in better performance.
A mechanical control system is pictured in Figure 384 A Feedback Controller that could be used for the water tank in Figure 383 Continuous Systems. This controller will adjust the valve position, therefore controlling the flow rate into the tank. The height of the fluid in the tank will change the hydrostatic pressure at the bottom of the tank. A pressure line is connected to a pressure cell. As the pressure inside the cell changes, the cell will expand and contract, opening and closing the valve. As the tank fills the pressure becomes higher, the cell expands, and the valve closes, reducing the flow in. The desired height of the tank can be adjusted by sliding the pressure cell up/down a distance x. In this example the height x is called the setpoint. The control variable is the position of the valve, and, the feedback variable is the water pressure from the tank. The controller is the pressure cell.
Continuous control systems typically need a target value, this is called a setpoint. The controller should be designed with some objective in mind. Typical objectives are listed below.
fastest response - reach the setpoint as fast as possible (e.g., hard drive speed)
smooth response - reduce acceleration and jerks (e.g., elevators)
energy efficient - minimize energy usage (e.g., industrial oven)
noise immunity - ignores disturbances in the system (e.g., variable wind gusts)
An engineer can design a controller mathematically when performance and stability are important issues. A common industrial practice is to purchase a PID unit, connect it to a process, and tune it through trial and error. This is suitable for simpler systems, but these systems are less efficient and prone to instability. In other words it is quick and easy, but these systems can go out-of-control.
25.2 CONTROL OF LOGICAL ACTUATOR SYSTEMS
Many continuous systems will be controlled with logical actuators. Common examples include building HVAC (Heating, Ventilation and Air Conditioning) systems. The system setpoint is entered on a thermostat. The controller will then attempt to keep the temperature within a few degrees as shown in Figure 385 Continuous Control with a Logical Actuator. If the temperature is below the bottom limit the heater is turned on. When it passes the upper limit it is turned off, and it will stay off until if passes the lower limit. If the gap between the upper and lower the boundaries is larger, the heater will turn on less often, but be on for longer, and the temperature will vary more. This technique is not exact, and time lags will often lead to overshoot above and below the temperature limits.
Figure 386 A Ladder Logic Controller for a Logical Actuator shows a controller that will keep the temperature between 72 and 74 (degrees presumably). The temperature will be read and stored in temp, and the output to turn the heater on is connected to heater.
25.3 CONTROL OF CONTINUOUS ACTUATOR SYSTEMS
25.3.1 Block Diagrams
Figure 387 A Block Diagram shows a simple block diagram for controlling arm position. The system setpoint, or input, is the desired position for the arm. The arm position is expressed with the joint angles. The input enters a summation block, shown as a circle, where the actual joint angles are subtracted from the desired joint angles. The resulting difference is called the error. The error is transformed to joint torques by the first block labeled neural system and muscles. The next block, arm structure and dynamics, converts the torques to new arm positions. The new arm positions are converted back to joint angles by the eyes.
The blocks in block diagrams represent real systems that have inputs and outputs. The inputs and outputs can be real quantities, such as fluid flow rates, voltages, or pressures. The inputs and outputs can also be calculated as values in computer programs. In continuous systems the blocks can be described using differential equations. Laplace transforms and transfer functions are often used for linear systems.
25.3.2 Feedback Control Systems
As introduced in the previous section, feedback control systems compare the desired and actual outputs to find a system error. A controller can use the error to drive an actuator to minimize the error. When a system uses the output value for control, it is called a feedback control system. When the feedback is subtracted from the input, the system has negative feedback. A negative feedback system is desirable because it is generally more stable, and will reduce system errors. Systems without feedback are less accurate and may become unstable.
A car is shown in Figure 388 Addition of a Control System to a Car, without and with a velocity control system. First, consider the car by itself, the control variable is the gas pedal angle. The output is the velocity of the car. The negative feedback controller is shown inside the dashed line. Normally the driver will act as the control system, adjusting the speed to get a desired velocity. But, most automobile manufacturers offer cruise control systems that will automatically control the speed of the system. The driver will activate the system and set the desired velocity for the cruise controller with buttons. When running, the cruise control system will observe the velocity, determine the speed error, and then adjust the gas pedal angle to increase or decrease the velocity.
The control system must perform some type of calculation with Verror, to select a new θgas. This can be implemented with mechanical mechanisms, electronics, or software. Figure 389 Human Control Rules for Car Speed lists a number of rules that a person would use when acting as the controller. The driver will have some target velocity (that will occasionally be based on speed limits). The driver will then compare the target velocity to the actual velocity, and determine the difference between the target and actual. This difference is then used to adjust the gas pedal angle.
Mathematical rules are required when developing an automatic controller. The next two sections describe different approaches to controller design.
25.3.3 Proportional Controllers
Figure 390 A Servomotor Feedback Controller shows a block diagram for a common servo motor controlled positioning system. The input is a numerical position for the motor, designated as C. (Note: The relationship between the motor shaft angle and C is determined by the encoder.) The difference between the desired and actual C values is the system error. The controller then converts the error to a control voltage V. The current amplifier keeps the voltage V the same, but increases the current (and power) to drive the servomotor. The servomotor will turn in response to a voltage, and drive an encoder and a ball screw. The encoder is part of the negative feedback loop. The ball screw converts the rotation into a linear displacement x. In this system, the position x is not measured directly, but it is estimated using the motor shaft angle.
The blocks for the system in Figure 390 A Servomotor Feedback Controller could be described with the equations in Figure 391 A Servomotor Feedback Controller. The summation block becomes a simple subtraction. The control equation is the simplest type, called a proportional controller. It will simply multiply the error by a constant Kp. A larger value for Kp will give a faster response. The current amplifier keeps the voltage the same. The motor is assumed to be a permanent magnet DC servo motor, and the ideal equation for such a motor is given. In the equation J is the polar mass moment of inertia, R is the resistance of the motor coils, and Km is a constant for the motor. The velocity of the motor shaft must be integrated to get position. The ball screw will convert the rotation into a linear position if the angle is divided by the Threads Per Inch (TPI) on the screw. The encoder will count a fixed number of Pulses Per Revolution (PPR).
The system equations can be combined algebraically to give a single equation for the entire system as shown in Figure 392 A Combined System Model. The resulting equation (12) is a second order non-homogeneous differential equation that can be solved to model the performance of the system.
A proportional control system can be implemented with the ladder logic shown in Figure 393 Implementing a Proportional Controller with Ladder Logic. The control system has a start/stop button. When the system is active Run will be on, and the proportional controller calculation will be performed with the SUB and MUL functions. When the system is inactive the MOV function will set the output to zero.
This controller may be able to update a few times per second. This is an important design consideration - recall that the Nyquist Criterion requires that the control system response be much faster than the system being controlled. Typically this controller will only be suitable for systems that don't change more than 10 times per second. (Note: The speed limitation is a practical limitation for a SoftLogix processor with reasonable update times for analog inputs and outputs.) This must also be considered if you choose to do a numerical analysis of the control system.
25.3.4 PID Control Systems
Proportional-Integral-Derivative (PID) controllers are the most common controller choice. The basic controller equation is shown in Figure 394 PID Equation. The equation uses the system error e, to calculate a control variable u. The equation uses three terms. The proportional term, Kp, will push the system in the right direction. The derivative term, Kd will respond quickly to changes. The integral term, Ki will respond to long-term errors. The values of Kc, Ki and Kp can be selected, or tuned, to get a desired system response.
Figure 395 A PID Control System shows a (partial) block diagram for a system that includes a PID controller. The desired setpoint for the system is a potentiometer set up as a voltage divider. A summer block will subtract the input and feedback voltages. The error then passes through terms for the proportional, integral and derivative terms; the results are summed together. An amplifier increases the power of the control variable u, to drive a motor. The motor then turns the shaft of another potentiometer, which will produce a feedback voltage proportional to shaft position.
Recall the cruise control system for a car. Figure 396 Different Controllers shows various equations that could be used as the controller.
When implementing these equations in a computer program the equations can be rewritten as shown in Figure 397 A PID Calculation. To do this calculation, previous error and control values must be stored. The calculation also require the scan time T between updates.
The PID calculation is available as a ladder logic function, as shown in Figure 398 PLC-5 PID Control Block. This can be used in place of the SUB and MUL functions in Figure 393 Implementing a Proportional Controller with Ladder Logic. In this example the calculation uses the feedback variable stored in Proc Variable (as read from the analog input rack:2:I.Ch0InputData). The result is stored in the analog output rack:2:O.Ch0OutputData. The control block uses the parameters stored in pid_control to perform the calculations. Most PLC programming software will provide dialogues to set these value.
A description of important PID parameters is given in the following list assuming that we have defined 'pid:PID'. At the upper end the parameters can be set to generate alarms and verify system operation. For example, many of the limit values are a function of the integers used for analog IO values, and will be limited to -4096 to 4095.
pid.EN:BOOL - the PID function is enabled and running
pid.DOE:BOOL - 0=d/dtPV; 1=d/dtError
pid.SWM:BOOL - 0 = automatic, 1 = manual
pid.PE:BOOL - 0=independent PID eqn; 1=dependent
pid.NDF:BOOL - 0=no derivative smoothing; 1=derivative smoothing
pid.NOBC:BOOL - 0=no bias calculation, 1=yes
pid.NOZC:BOOL - 0=no zero crossing calculation; 1=yes
pid.INI:BOOL - 0=not initialized; 1=initialized
pid.SPOR:BOOL - 0=setpoint not out of range, 1=within
pid.OLL:BOOL - 0=above minimum CV limit; 1=outside
pid.OLH:BOOL - 0=below maximum CV limit; 1=inside
pid.EWD:BOOL - 0=error outside deadband; 1=error inside
pid.DVNA:BOOL - 0=ok; 1=Error is below lower limit
pid.DVPA:BOOL - 0=ok; 1=Error is above upper limit
pid.PVLA:BOOL - 0=ok; 1=PV is below lower limit
pid.PVHA:BOOL - 0=ok; 1=PV is above upper limit
pid.KP:REAL - proportional gain
pid.BIAS:REAL - feed forward bias
pid.MAXS:REAL - maximum scaling
pid.MINS:REAL - minimum scaling
pid.SO:REAL - set output percentage
pid.MAXO:REAL - maximum output limit percentage
pid.MINO:REAL - minimum output limit percentage
pid.UPD:REAL - loop update time in seconds
pid.ERR:REAL - scaled Error value
pid.OUT:REAL - scaled output value
pid.PVH:REAL - process variable high alarm
pid.PVL:REAL - process variable low alarm
pid.DVP:REAL - positive deviation alarm
pid.DVN:REAL - negative deviation alarm
pid.PVDB:REAL - process variable deadband alarm
pid.DVDB:REAL - error alarm deadband
pid.MAXI:REAL - maximum PV value
pid.MINI:REAL - minimum PV value
pid.TIE:REAL - tieback value for manual control
pid.MAXCV:REAL - maximum CV value
pid.MINCV:REAL - minimum CV value
pid.MINTIE:REAL - maximum tieback value
pid.MAXTIE:REAL - minimum tieback value
pid.DATA:REAL[17] - temporary and workspace (e.g. integration sums)
When a controller is off it can drift far from the setpoint and have a large. If the controller is reengaged this error will be integrated, potentially resulting in a very large integral value. As the PID equation approaches the setpoint it may not be able to handle the large error and shoot past the setpoint. This phenomenon is known as windup. The tieback value is used to overcome this problem by allowing a smooth transfer from manual to automatic mode.
PID controllers can also be purchased as cards or stand-alone modules that will perform the PID calculations in hardware. These are useful when the response time must be faster than is possible with a PLC and ladder logic.
25.4 DESIGN CASES
25.4.1 Oven Temperature Control
Problem: Design an analog controller that will read an oven temperature between 1200F and 1500F. When it passes 1500 degrees the oven will be turned off, when it falls below 1200F it will be turned on again. The voltage from the thermocouple is passed through a signal conditioner that gives 1V at 500F and 3V at 1500F. The controller should have a start button and E-stop.
25.4.2 Water Tank Level Control
Problem: The system in Figure 400 Water Tank Level Controller will control the height of the water in a tank. The input from the pressure transducer, Vp, will vary between 0V (empty tank) and 5V (full tank). A voltage output, Vo, will position a valve to change the tank fill rate. Vo varies between 0V (no water flow) and 5V (maximum flow). The system will always be on: the emergency stop is connected electrically. The desired height of a tank is specified by another voltage, Vd. The output voltage is calculated using Vo = 0.5 (Vd - Vp). If the output voltage is greater than 5V is will be made 5V, and below 0V is will be made 0V.
25.5 SUMMARY
· Negative feedback controllers make a continuous system stable.
· When controlling a continuous system with a logical actuator set points can be used.
· Block diagrams can be used to describe controlled systems.
· Block diagrams can be converted to equations for analysis.
· Continuous actuator systems can use P, PI, PD, PID controllers.
25.6 PRACTICE PROBLEMS
(Note: Problem solutions are available at http://sites.google.com/site/automatedmanufacturingsystems/)
1. What is the advantage of feedback in a control system?
2. Can PID control solve problems of inaccuracy in a machine?
3. If a control system should respond to long term errors, but not respond to sudden changes, what type of control equation should be used?
4. Develop a ladder logic program that implements a PID controller using the discrete equation.
5. Why is logical control so popular when continuous control allows more precision?
6. Design the complete ladder logic for a control system that implements the control equation below for motor speed control. Assume that the motor speed is read from a tachometer, into an analog input card in rack 0, slot 0, input 1. The tachometer voltage will be between 0 and 8Vdc, for speeds between 0 and 1000rpm. The voltage output to drive the motor controller is output from an analog output card in rack 0, slot 1, output 1. Assume the desired RPM is stored in 'rpm'.
7. Write a ladder logic control program to keep a water tank at a given height. The control system will be active after the Start button is pushed, but it can be stopped by a Stop button. The water height in the tank is measured with an ultrasonic sensor that will output 10V at 1m depth, and 1V at 10cm depth. A solenoid controlled valve will open and close to allow water to enter. The water height setpoint is put in height, in centimeters, and the actual height should be +/-5cm.
8. Implement a program that will input an analog voltage Vi and output half that voltage, Vi/2. If the input voltage is between 3V and 5V the output 'warning' will be turned on. Include start and stop buttons that will force the output voltage to zero when not running. Do not show the bits that would be set in memory, but list the settings that should be made for the cards (e.g. voltage range).
9. List and describe the most important control memory parameters required to enable a PID function.
10. Implement the system in the block diagram below. Indicate all of the settings required for the analog IO cards. The calculations are to be done with voltage values, therefore input values must be converted from their integer values.
25.7 ASSIGNMENT PROBLEMS
1. Design a basic feedback control system for temperature control of an oven. Indicate major components, and where they are used.
2. Develop ladder logic for a system that adjusts the height of a box of plastic pellets. An ultrasonic sensor detects the top surface of the plastic pellets. The ultrasonic sensor has been calibrated so that when the output is above 5V the box is in the right height range. When it is less than 5V, a motor should be turned on until the box height results in an input of 6V.
3. Write a program that implements a simple proportional controller. The analog input card is in slot 0 of the PLC rack, and the analog output card is in slot 1. The setpoint for the controller is stored in 'Setpoint'. The gain constant is stored in 'Kgain'.
4. A conveyor line is to be controlled with either a variable frequency drive, or a brushless servo motor. Workers will place boxes on the inlet side of the conveyor, these will be detected with a `box present' sensor. The box position is also detected with an ultrasonic sensor with a range from 10cm to 1m . When present, boxes on the conveyor will be moved until they are 55cm from the sensor. Once in place, the system will stop until the box is removed. After this, the process can begin again when a new box is detected. Design all of the required ladder logic for the process.
5. A temperature control system is being developed to control the water flow rate for cooling a mold set. Unfortunately the sensor in the dies doesn't allow us to measure the temperature. But it does provide a set of bimetallic contacts that close when the die is above 110C. Luckily a Variable Frequency Drive (VFD) is available for controlling the flow rate of the water. The control scheme will increase the water flow rate when the die temperature input, HOT, is active. When the HOT input if off the flow rate will be decreased, until the flow rate is zero. In other words, when the HOT input is on, a timer will start. The time accumulated, DELAY, will be proportional to a voltage output to control the VFD. If the HOT sensors turns off the DELAY value will be decreased until it has a value of zero. Write the ladder logic for this controller.