Chapter 3 Computer-Based Control OBJECTIVES Explain how basic digital systems can implement alarms and two-position controllers. • Define the hardware characteristics of computer-based controllers. • Describe how a computer can implement the PID mode of controller action. • Explain the concept behind fieldbuses in control systems. • Describe the basic characteristics of Foundation and Profibus fieldbuses. 2. DIGITAL APPLICATIONS There are still situations in control systems wherein basic digital electronics can provide the needed action. In some cases the use of a computer or programmable-logic-controller (PLC) is overkill for some simple need. Thus, for example, the basic two-position control needed for a simple run-off temperature control may be easier to implement with basic digital logic in lieu of a computer or PLC. 2.1 Alarms One area where simple digital logic can be of practical and fiscal value is the implementation of alarms. An alarm is defined as an on/off condition wherein a warning is issued when some process variable passes a critical value. For example, we may need an alarm when a pressure exceeds some limit or when a temperature falls below some limit. The alarm may do something as simple as turning on a warning light or something as sophisticated as issuing a signal to a computer for corrective action. Single Variable alarm Multivariable Alarms In many cases an alarm is dependent not upon the value of a single variable but rather on the combined values of one or more variables. Thus, for example, a tank with high pressure and high level may represent some unpleasant condition for which an alarm should be issued. In these cases we can use comparators combined with appropriate logic circuits to produce an alarm. In general, hysteresis should again be used to protect against noise and nonlinear effects. The following example shows how such an alarm can be constructed. (The hysteresis has not been shown on the comparators.) Holding tank level-control system for Example 2. A logic gate solution for Example 2. 2.2 Two-Position Control • It is possible to develop a two-position controller using digital electronics methods. Such a controller differs from the simple alarm comparator just presented by the deadband that exists between ON and OFF state transitions. • The hysteresis comparator can be used for two-position control. T he only problem is that the equations given for HIGH and LOW trip points are only good if the deadband is small, which requires Rf>>R • In a more general way, it is possible to develop two-position control using a combination of comparators and digital logic circuits. Figure 4 shows one such circuit. Two comparators and a D flipflop (F/F) are used. One comparator determines the upper trip voltage and the other, the lower. 3. COMPUTER-BASED CONTROLLER 3.1 Hardware Configurations • Any microprocessor-based computer has a standard array of devices as shown in Figure 6. • All of the devices shown are available as small integrated circuits that can be mounted on a relatively small printed-circuit board. • The ROM stands for read-only-memory, nonvolatile memory that holds the programs that the processor executes. • Typically the ROM consists in part of electrically erasable memory so that programming updates can be downloaded • over the communication network. • The RAM stands for read-write memory and is used to hold the transient results of calculations and other results of data processing. • The data I/O typically consists of ADCs and DACs as well as digital I/O channels. • The final element is the network interface communication system. • This provides for serial communication of the computer over a serial fieldbus or LAN. Smart Sensors • One of the most exciting developments of modern process control is to embed the controller computer directly into a sensor. • Figure 7 shows one possible implementation of such a system. • Here you see that the sensor and computer are housed directly at the site of the measurement. • In this case we see that the feedback signal is delivered to the valve via the standard 4–20 mA current transmission. • Operation of the flow control loop is monitored via the serial interface, which is also used to update the setpoint, controller mode gains, and other operating parameters. Multiple-Loop Controllers • In some cases there may be an advantage to having a single computer operate as the controller of more than one process-control loop. • This may be to account for interactions between loops, for example, or just for economy. • Historically this was done because computers were relatively large and expensive investments and economics showed that multiple-loop control was called for. • Furthermore, computers were (and are) fast enough that such multiple-loop control • was feasible. Read page 562 Software Requirements Error The computer accepts an input of the value, y, of the controlled variable from an ADC or over the bus (network) from the sensor. The value will have been encoded as a binary number. In describing the algorithms we assume the measurement range of the controlled variable is known, ymin to ymax. Earlier we wrote the error as percent of range, For the purposes of algorithm description we will assume the variable has been converted from a binary encoding to its actual value as a floating-point variable (pressure, temperature, etc.) in the control program. This may entail linearization as well as scaling. In the program the error will be used as a fractional quantity rather than a percent. Thus, the error will be as in Equation (4) but without the 100. Furthermore, we note that the variable value, and hence error, are only available as samples taken every t seconds. Thus, the error will be expressed as, Again, we assume that when the binary number is brought into the computer it is passed to a floating-point processor (i.e., yi is a base 10, floating-point number). This is typical of modern computers. Flowchart for proportional mode. Flowchart for the integral mode using rectangular integration. Flowchart of the derivative mode. PID Control Mode Algorithm page 572+ example 8 OTHER COMPUTER APPLICATIONS Data Logging General features of a data-logging system using a computer. Fixed Loggers Data-Acquisition System (DAS) The data-acquisition system is the switchyard by which the computer inputs samples of process variable values. The reason for concern over this point is that there are situations where the sample rate can be such that erroneous information about the variable time dependence results. The rate at which samples of a process variable can be taken depends on how long it takes for the DAS to acquire a value, how long it takes the computer to process the value, and how many other variables are to be sampled. This is illustrated in Example 9. Alarms An important part of any data-logging circuit is an alarm system that monitors inputs from excursions beyond some specific limits. With scan rates of the data as high as 5000 per second, it is possible for a computer to maintain tight vigilance over variable values. Every time the computer inputs a particular variable, the value is compared to its preset limits which, if exceeded, trigger an alarm. Computer The computer, of course, is the central element in the system. Through programming, the computer accepts inputs and performs prescribed reductions of the data through mathematical operations. The results are evaluated by further programmed tests to oversee the operation of the entire process from which the inputs are taken. Projections of future yields, evaluations of efficiency, deviation trends, and many other operations can be performed and made available to process personnel. Peripheral Units The peripheral units are the support equipment to communicate computer operations to the outside world. These units include the operator console where the programs are entered and through which commands can be given to initiate specific actions, such as calculations and data outputs by the computer. The console usually has a CRT/keyboard and a typewriter unit for input and outputs. A massstorage system, such as magnetic tape, is used to store data, such as periodically sampled inputs from the process, that can be used in later, more detailed analysis of process performance. Portable Data Loggers Supervisory Control • It is a natural extension of a computer data-logging system involves computer feedback on the process through automatic adjustment of loop setpoints. • In general, the choice of setpoint is a function of many other parameters in the process. The process specifications are 1. Reactants A and B combine such that one part A to two parts B produces one part C. 2. Volume production of C varies as the square root of the A and B flow rate product. 3. The operating temperature must be linearly decreased with C volume production rate. 4. For stability, the reaction must occur with the pressure maintained below a critical value. A decision is made to increase production in this operation. The first step to accomplish this is to increase the flow rate of A by a change in setpoint. Let us see the consequences of this in the rest of the process. 1. The setpoint of B flow must be set to twice the A setpoint, keeping pressure below . 2. The setpoint of C flow must be increased by the square root of the new A and B flow rates. 3. The temperature setpoint must be decreased by a proportion of the new C setpoint. Flowchart To describe the steps a computer must go through to operate in some specified manner, we use an event flowchart. This is the same as the flow diagram used by computer programmers, and in fact some required programs can often be written (coded) directly from such a process-operation diagram.