19 Programming the PID Algorithm
Introduction
The PID algorithm is used to control an analog process having a single control point and a single feedback signal. The PID algorithm controls the output to the control point so that a setpoint is achieved. The setpoint may be entered as a static variable or as a dynamic variable that is calculated from a mathematical operation.
For many years, the PID algorithm was not accepted as a function suitable for a PLC. It was included in a DCS (Distributed Control System) or configured from a number of stand-alone PID controllers. However, as PLC prices continued to fall during the 1980’s and later and more economical HMI systems were developed for the PLC, PLCs became more accepted as PID controllers. In fact, because PLCs have undercut the cost of competing systems, DCSs and other PID controllers have been forced to drop prices dramatically or no longer remain competitive.
An early hybrid design was introduced into the Allen-Bradley 1771 I/O family including 2 PID stand-alone controllers attached to a single I/O slot and executing the PID algorithm from the controller in the I/O slot. Newer control schemes have the PID algorithm executing in the PLC with other programs and controlling complicated processes with good success.
Chapter 19 uses the PID block to control a process. This chapter looks at the PID block from a view of discovery, mine. The group I worked for in industry was a controls group and there was a wall between the controls group and the instrumentation group. We worked with PLCs and they worked with PID controllers. They designed P&ID Diagrams. They worked with analog and we worked with digital systems. After accepting a teaching position, I was asked by a local company to help install a PID block in a process. I accepted (for money). That started an interest I had in process control that I have continued to this day. The chapter is organized around the path I took in discovery of how to successfully implement the PID algorithm in control processes.
The chapter describes the SLC PID block followed by the CompactLogix processor as well as the Siemens 1200 and its implementations of the PID function. Using these various PLC configurations demonstrates differences between the newer PID blocks and the SLC PID block. The SLC processor was integer-based. Integer-based blocks have the disadvantage that scaling must be used to convert numbers to more meaningful real values. Scaling adds complexity to the program that becomes transparent with a floating-point PID block. More sophisticated PID blocks such as is available in the PLC/5 and ControLogix processors as well as Siemens allow floating-point calculations. These more robust PID blocks also provide more sophistication in their functionality. All PID blocks are not created equal.
But First, a Primer on PID – Fundamentals of Closed Loop Control
Closed Loop Control Tasks
“Closed loop control is a process where the value of a variable is established and maintained continuously through intervention based on measurements of this variable. This generates a sequence of effects that takes place in a closed loop -the control loop- because the process runs based on measurements of a variable that is influenced in turn by itself.” This variable that is to be controlled is measured continuously and compared with a setpoint variable. The difference or error between these two variables determines an output that hopefully controls the input variable satisfactorily. An equation that is explained below is used to determine the best output.
The following diagram gives an over-all picture of what a PID controller sets out to accomplish. The Setpoint is the desired value of a variable. In order to achieve this Setpoint (SP), a controller is inserted in a process with two main parts – a Manipulating Element and a Process. The manipulating element may be a control valve or an inverter controlling motor speed. The process is usually unknown mathematically. That said, it is always good to strive to understand the mathematical equations that drive the process as much as possible. Fact is, it is not possible in most cases.
Fig. 19-1 A Block Diagram of a Single PID Block Controller
The controller can be looked at as a one-eyed device with feed-back from the process with a three element equation to try to manipulate the process to achieve the setpoint. The three elements are P (Proportional), I (Integral) and D (Derivative. The feedback comes from a controlled variable through a transmitter (measuring device) which outputs a signal called the controlled variable (Cm) or process variable (PV).
Proportional Controller (P-Controller)
In the case of P-controllers, the output of the controller is proportional to the error. The output of the controller goes to zero if the error is zero. This never is the case and there is always an offset between the desired value (Setpoint) and the process value. The proportional pressure regulator sketched in the figure below compares the power FS of the setpoint spring with the power FB that the pressure P2 generates in the spring-elastic metal bellows. If the forces are off balance, the lever rotates around the pivot point D. The valve position changes and accordingly the pressure P2 changes until a new balance of forces is established.
To keep the error as small as possible, a proportional factor as large as possible is selected. This has the effect of quicker response to a change. There can be over-shoots however and instability can occur. The P-controller needs help in solving the two problems of potential overshoot and not being able to move to the setpoint but only to an off-set of the setpoint.
It is interesting to note that early PID controllers were built entirely from mechanical components
– no electrical components at all. The P-controller below is an example of a mechanical only controller with only the P component.
Fig. 19-2
𝐴𝑐𝑡𝑢𝑎𝑙 𝐹𝑙𝑜𝑤 ≈ √𝑃2 − 𝑃1
𝑒(𝑒𝑟𝑟𝑜𝑟) = 𝐴𝑐𝑡𝑢𝑎𝑙 𝐹𝑙𝑜𝑤 − 𝑆𝑒𝑡 𝑃𝑜𝑖𝑛𝑡
𝑦(𝑜𝑢𝑡𝑝𝑢𝑡) = 𝐾𝑝 ∙ 𝑒
The diagram below shows the possible behavior of the P-controller:
Fig. 19-3
The problem of continuous deviation is solved best with an integral controller.
Integral Controller (I-Controller)
Integrating controllers are used to completely correct the error from the P-controller. Only when the Setpoint and controlled variable are equal is the control system in a steady state.
The mathematical formulation of this integral behavior is as follows:
𝑦 = 𝐾𝑖 ∫( ) 𝑤𝑖𝑡ℎ 𝐾𝑖 = 1
𝑇𝑛 Eq. 19-1
How fast the manipulated variable rises (or falls) depends on the error and the integration time.
image
PI-Controller
The PI-controller is a type often used in practice. It results from connecting a P-controller and an I-controller in parallel. When laid out correctly it unites the advantages of both controller types (stable and fast, no permanent system deviation).
image
The behavior with respect to time is identified by the proportional coefficient Kp and the reset time Tn. Because of the proportional component, the manipulated variable responds immediately to every system deviation e, while the integral component takes effect only in the course of time. Tn represents the time that passes until the I-component generates the same amplitude of flow as occurs immediately because of Tn to increase the integral component.
Differential Controller (D-Controller)
The D-controller generates its manipulated variable from the rate of change of the system deviation, and not, as the P-controller, from its amplitude. For that reason, it responds considerably faster than the P-controller. Even if the deviation is small, it generates (looking ahead) large amplitudes of flow as soon as an amplitude change occurs. However, the D- controller does not detect permanent deviations, because no matter how large it is, its rate of change equals zero. For that reason, the D-controller is used only rarely by itself in practice. Rather, it is used jointly with other control elements, usually in connection with a proportional component.
PID Controller
If we expand the PI controller with a D-component, the universal PID controller is created. As in the case of the PD controller, adding the D-component has the effect that, if laid out correctly, the controlled variable reaches its setpoint sooner and its steady state faster.
image
Eq. 19-2 PID Equations
The following example gives an analytical view of an Output (V) with PI control. We will leave D alone. First, observe the relationship of Output to only the Integral term:
Fig. 19-8a Graph of PI Error/Output
Next, see the response for a PI controller:
Fig. 19-8b Graph of PI Error/Output
With values assigned for the PI controller, the output can be calculated as time increases from t=0. We will not include the D or Derivative component since this variable dramatically complicates the example.
We assign numbers to the variables in the equation and observe the output. Let:
P = 2
1/Tn = .02 s-1
V0 = 32%
We use the formula for the PI controller:
Eq. 19-3
Starting at t = 0,
Eq. 19-4
image
Next, at t = 20,
Eq
Then, at t = 70,
Eq
This may be a little harder to see but look at the rectangle from 20 to 70. It is 10 high. Also, look at the time. It is 50. The integral is the sum over time of the error or the area under this curve, or 2x.02x50x10. This gives 20 to add to the total or 52+20 = 72.
Completing the graph for the 100 seconds would look like the following:
Fig. 19-8c Graph of PID Output
Using the PID Algorithm to Control a Process
The first PID algorithm implemented by this instructor was the following. This was a dog-food manufacturing facility. The basic process for making the dog food is the extruder whose function is to make dog food from dry ingredients along with some steam, fat, and other wet ingredients. As the motor speeds up, more ingredients are to be added and as the motor slows down, the added ingredients are to slow down as well. The PID block will be used to add one wet ingredient, fat.
Fig. 19-9 Extruder/Mixing System making Dog Food
Since the extruder motor speed runs the feed speeds for the other ingredients in the process, its speed sets the master speed for the process. All other feed speeds will be a percent of the motor speed.
Control signals for the Dog Food Control include:
Fig. 19-10 Cascade or Remote Signal
When the PID algorithm is in remote, the motor speed furnishes the value for the setpoint. Variables are usually multiplied by a constant with motor speed * multiplier giving the value of the setpoint when the local-remote switch is in remote.
It was discovered that the PID algorithm needed to be designed to operate in one of three modes: Manual, Auto Local and Auto Cascade. This was necessary since the start-up of the dog-food process involved manipulation of the Fat valve. The valve was checked out to see that it operated freely within the range of the signal by sending a signal through the Manual Cv path shown below. Then the algorithm for the PID solution was checked out and appropriate variables were found for P, I and D using the Local Setpoint. Then the process was turned to full auto – or remote or cascade to follow the process of the extruder. All three stages were necessary and useful to achieve a successful start-up and running the process.
Fig. 19-11 Motor Speed Settings for Ingredient Adds
The SLC Processor Used for the Extruder
In its simplest form, the SLC PID block is used as a single block with no input contacts and surrounded by only two SCP blocks. This PID instruction is located in Ladder 2. The SCP block is configured to retrieve a numerical value from the analog input channel, linearly scale the input and move the resultant value to the PID block. The input is a 4-20 mA signal from a flow transmitter. The output is a 4-20 mA signal to a variable flow valve.
The flow transmitter is the best way to find the actual flow. One could calculate the height of the liquid in the tank, the flow resistance of the pipe, the viscosity of the liquid and the flow at the valve for various pressures associated with these variables. But, it is easier and more accurate to use the pulsed input from the flow meter. The pulses are converted to 4-20 mA through an electronic circuit and then fed to the PLC.
Fig. 19-12 Simple Program of PID for SLC Processor
In the first SCP instruction, values found in the Input Min and Input Max of the SCP instruction are from the I/O card. The engineer must first decide which I/O card to use and then find the proper lower and upper limits from the literature on the card to enter values in the SCP instruction.
In this case, the analog card selected is the 1746-NIO4I Ser. A from Rockwell/Allen Bradley. This card is a combination card with 2 analog inputs and 2 analog outputs. From the web, select I/O Analog Modules, Analog I/O Modules for SLC 500 Programmable Controllers – Technical Data. Then select 4 Channel Module Configuration, 4 Channel Module Wiring, and 4 Channel Module Specifications to find the choices available for Analog Inputs and Analog Outputs.
In the section describing 4 Channel Module Specifications are found the following Channel Data sheets:
| Input Type | Signal Range | Engineering Units | EU Scale |
| +/- 10 Vdc | -10.25 to + 10.25 Vdc | -10250 to + 10250 | 1 mV/step |
| 0 to 5V dc | -0.5 to +5.5 Vdc | -500 to +5500 | 1 mV/step |
| 1 to 5V dc | 0.5 to 5.5 Vdc | 500 to 5500 | 1 mV/step |
| 0 to 10 Vdc | -0.5 to +10.25 Vdc | -500 to +10250 | 1 mV/step |
| 0 to 20 mA | -0.5 to +20.5 mA | -500 to +20500 | 1.0 uA/step |
| 4 to 20 mA | 3.5 to 20.5 mA | 3500 to 20500 | 1.0 uA/step |
| +/- 20 mA | -20.5 to +20.5 mA | -20500 to +20500 | 1.0 uA/step |
| 0 to 1 mA | -0.05 to 1.05 mA | -50 to + 1050 | 1.0 uA/step |
Fig. 19-13 Channel Data Word Values for Engineering Units
| Input Type | Signal Range | NI4 Data Format | <—- |
| +/- 10 Vdc | -10.00 to +10.00 Vdc | -32768 t0 +32767 | |
| 0 to 5 Vdc | 0.0 to 5.00 Vdc | 0 to 16384 | |
| 1 to 5 Vdc | 1.00 to 5.00 Vdc | 3277 to 16384 | |
| 0 to 10 Vdc | 0.0 to 10.00 Vdc | 0 to 32767 | |
| 0 to 20 mA | 0.0 to 20.0 Vdc | 0 to 16384 | |
| 4 to 20 mA | 4.0 to 20.0 mA | 3277 to 16384 | |
| +/- 20 mA | -20.0 to +20.0 mA | -16384 to +16384 | |
| 0 to 1 mA | 0.0 to 1.00 mA | 0 to 1000 |
Fig. 19-14 Channel Data Word Values for Scaled Data
Using the value 4 to 20 mA from the Input Type column, the value in Engineering Units is 3277 min to 16384 max. These values are entered in the SCP instruction to scale the variables correctly.
| SCP- Scale with Parameters | |
| Input | |
| Input Min | 3277 |
| Input Max | 16384 |
| Scaled Min | |
| Scaled Max | |
| Output |
Figure 19-15
The scaled min and max values that are sent to the PID’s process variable are found in the setup documentation of the PID block. The min value is 0 and the max value is 16383. A location must be selected. In this case, the process variable or PV is selected to be N10:28. It is advisable to keep the PID block data separated from other integer data. In order to do keep the data for the PID separated, the data file N10 was created to handle the PID data.
The input address may also be selected. Remember the value is I:s.w where s is the slot number and w is the relative word address down the card. In this case, the slot address chosen is 1 and the w or word address is 0, the first analog input point on the card. The other option for the input in slot 1 is I:1.1.
| SCP – Scale with Parameters | |
| Input | I:1.0 |
| Input Min | 3277 |
| Input Max | 16384 |
| Scaled Min | 0 |
| Scaled Max | 16383 |
| Output | N10:28 |
| PID | |
| Control Block | |
| Process Variable | N10:28 |
| Control Variable | |
| Control Block Length | 23 |
Fig. 19-16 Moving the Process Variable into the PID Block
The control block address is chosen. This address requires 23 contiguous words reserved in an integer table. The block N10:0 (through N10:22) was chosen. Also reserve a location for the control variable or output of the PID function. N10:29 was chosen.
This control variable or output is then sent to the analog output card. Scaling again must be chosen. The min for the PID output is 0 and the max is 16383. These are the same values as are used for the PID input. To use the entire range of values for a PID input or output, choose the range 0 to 16383. Always strive to use the entire range of the PID block when programming an integer PID block. This gives the greatest accuracy.
The scaled output must be ranged to fit a 4 to 20 mA analog output card. Use the values as were found in the reference manual, 6,242 min and 31,208 max. Use the first output point on the same card as the input. Its slot number is O:1.0. Now, the PID and two SCP blocks can be finished.
Fig. 19-17 Moving the Variables Into and Out of the PI
Wiring a 4-20 mA Current Loop
Handling wiring and other hardware issues is found from information in the instruction manual for the module. In the case above, the card used was the 1746-NI04I module from Allen- Bradley. Look specifically in the chapter on installation and wiring.
In addition to the actual wiring diagram for the application, important information including dip switch settings should be noted. If possible, all dip switch settings should be copied to the installation drawing for the card or added as notes to the schematic drawings. In the case of the 1746-NI04I card, no dip switches were found.
To wire a 4-20 mA control circuit for a PLC input, wire a loop with the power supply, transmitter, and PLC input. To wire a 4-20 mA PLC output, wire a power supply, valve and output. From the manufacturer’s diagram, it should be noted whether the 4-20 mA output requires loop power or the analog output card provides loop power.
For the analog input, the transmitter varies the resistance to the PLC input so that the current ranges from 4 mA for no flow to 20 mA for maximum flow. The transmitter “borrows” enough voltage from the 24 V dc to activate electronics inside the transmitter. The voltage drop across the transmitter does not affect the current range of the loop. The PLC analog output varies the resistance to the control valve in a similar manner.
or
Fig. 19-18 4-20 mA Analog Output – Current Loop
In the case of output cards, care must be taken to find whether or not the 24V dc power supply should be added to the loop. The drawing from the installation manual provides direction here. From the figure below, note that there is no power supply needing to be added in the output current loop diagram for this specific card (NI04I).
The figure below shows the catalog information for wiring this card. In fact, the analog output does not need a power supply since the output furnishes this power internally. The term “analog source” for the input implies inclusion of the 24V power supply. Load for the output implies no external power supply. Note the jumpers installed for inputs not used.
Fig. 19-19 4-20 mA Analog I/O – Current Loop (NI04I)
Configuring the SCP and PID Instructions for the SLC
The description of the SCP instruction mentions that the inputs may be integer, floating point, immediate data values, or indirect referenced values. The minimum and maximum values for both input and output form a range over which the variables are scaled. The instruction solves the equation y = mx + b without the user responsible to calculate actual values for ‘m’ and ‘b’.
Care must be taken to keep the program performing in an acceptable manner if the input value is less than the card minimum value. The scaled output value should continue to solve the equation and the output value should scale to less than the minimum value of the instruction. The same result should also occur if the value exceeds the maximum.
In the Instruction Help description, the PID block is described:
“This output instruction is used to control physical properties such as temperature, pressure, liquid level, or flow rate of process loops.
The PID instruction normally controls a closed loop using inputs from an analog input module and providing an output to an analog output module as a response to effectively hold a process variable at a desired setpoint.”
The PID instruction can be chosen to be operated in either the timed mode or the STI mode. In the timed mode, the instruction updates the output algorithm periodically at a rate selected in the block. In the STI mode, the PID instruction is placed in an STI (Software Timed Interrupt) subroutine. The PID block updates the PID algorithm each time the STI subroutine is called. A- B points out that the STI time interval and the PID loop update rate must be equal in order for the equation to perform properly. The suggested time duration for the STI or timed mode is .1 second.
A Setup screen is provided on the PID instruction.
Fig. 19-20 Example PID Instruction
From the A-B Text and the Instruction Help Screen is shown the Block Layout of the PID Instruction:
table
The table above corresponds to N10:0 through N10:22 found in our example above. Word 0 (N10:0) is used for bit control storage. For example, bit 1 is the AM or Auto/Manual bit. When bit 1 is on, the block is in manual. When bit 1 is off, the PID block is in auto. The address for AM in is N10:0/1. Words 1 through 22 are used for constants and variables used in the solution of the PID algorithm.
The PID Setup Screen shown below describes variables found in the table above that may be changed from the programming software.
Solving the PID Block
Once the analog value of the process variable is mapped from the SCP instruction to the PID block, the PID block solves the equation for the Control Variable (CV) or Output. A more thorough explanation of how the output is achieved may be found in a text on control systems. Equations vary but the three most common equations are given later in the chapter.
The PID block has two analog inputs. One is the PV or process variable and the other is the SP or setpoint. The setpoint is manually entered into the PID block. This may be done through the PID Setup screen, through an HMI such as PanelView, or through a program statement (a MOV). If the SP is entered manually through the program, the SP is considered static and should never be changed by operator control since an operator is not generally considered reliable enough to enter variables through the RSLogix500 Setup Screen.
The PID Setup screen is pictured below. The setup screen allows the engineer or technician full capability of modifying the PID block.
Fig. 19-21 SLC PLC Startup Block in RSLogix 500
The SP may be entered through the PID Setup screen. The PV is entered using the SCP instruction.
From the A-B Instruction Reference Manual:
“Process Variable PV is an element address that stores the process input value. This address can be the location of the analog input word where the value of the input A/D is stored. This value could also be an integer if you choose to pre-scale your input value to the range 0 to 16383.”
The output is referred to as the CV or Control Variable. It is described in the same manual as:
“Control Variable CV is an element address that stores the output of the PID instruction. The output value ranges from 0 to 16383, with 16383 being the 100% ‘on’ value. This is normally an integer value, so that you can scale the PID output range to the particular analog range your application requires.”
The PID block is very much like a black box function with inputs entering and outputs leaving the block. The block diagram for the PID block in auto is:
Fig. 19-22 Using Setup Screen
The PID algorithm is solved while the block is in auto. Auto is determined by the status of the AM bit. When AM = 0 the operation is automatic. When AM = 1, the operation is manual.
The PID algorithm does not output a value for the PID block if the block is in manual. It is as if the block has been manually disengaged. The PV or SP may change and the output stays at its last value unless a new value is written into the CV location. The CV location may be over- written in manual. In auto, the PID block constantly writes the value to the CV. The range of the CV is from 0 to 16383. Writing to the CV allows the user to manipulate the valve in the manual mode.
Fig. 19-23 Additional Use of Setup Screen
Another bit that must be set correctly for the PID block to work is the Control (CM) bit. It determines whether the error term E = SP – PV or E = PV – SP. If the CM bit is set incorrectly, the valve will quickly go to full on (100%) or full off (0%). This bit is never to be set by an operator. Use the PID Setup screen to set it. The bit is not to be changed after it is set in the initial configuration of the auto mode.
The simple PID algorithm from the SLC processor demonstrates many important steps in implementing the PID block successfully. First, the input must be correctly signal conditioned and the output signal conditioned as well. The wiring must be correct. The PID block must be correctly configured including all min and max values plus all tuning parameters. Then the engineer can control the program either in manual or auto from the programming helps menu. The PID block must be placed in a block that executes on a clocked interrupt or the PID block itself must be programmed to execute on a timer in the main or OB1 block. Either method works but the preferred method is to program the PID algorithm in a separate timed interrupt block.
Also the data must be guaranteed to be ‘fresh’. That is, the data that is used for the algorithm must have been gathered recently. This may be as recent as an immediate read or from a scanned card that reports to the main CPU on a regular basis. This data must be guaranteed to have been read less than 10% of the time since the last execution of the PID block. This is a rule of thumb – 10%.
As can be seen, the PID algorithm, to be set up properly and run in the PLC requires several steps. The inputs and outputs must be scaled properly, modes must be considered and programmed. A start-up screen is used to set up the PID block and input parameters such as P, I, D, and other limits as well as run the PID block to observe stability. Later we will be introduced to an auto-tune feature with the Siemens PLC but for now, the P, I, and D variables must be guessed. Finally, a program is written using the PID block to control the output variable y. A discussion of how the interface to the operator is discussed later. This interface is commonly referred to as the faceplate, a term used from the original PID controllers which were stand-alone controllers, each with its own interface (faceplate).
Faceplates of some stand-alone PID controllers are shown below. These include the Red Lion stand-alone TCU controller and the Honeywell stand-alone controller faceplates.
Fig. 19-24 Faceplates of Popular PID Stand Alone Controllers
Using the PID Algorithm to Control a Process – Second Experience
Some time after the first experience with the dog food PID block, another company inquired if I was interested in aiding their efforts with programming a glass furnace. I was available and interested. The process included converting the entire program from Allen-Bradley to Modicon. I was familiar with both languages so it was a good fit for me to help. In the process, I learned much about how PID blocks were used to control large processes. The basic algorithm for each zone of the furnace and forehearth used three PID blocks.
Many systems used in process control require a number of PID loops working together. In the example of the dog food extruder, the system would have included a PID controller for each ingredient. In general, each control element requires a PID block.
In the case of temperature control with gas and oxygen combustion, temperature is a PID block as well as gas and oxygen flow. The interaction of temp, gas and air are shown below:
Fig. 19-25 Layout of PID Controllers for Gas Burner in Furnace
This algorithm controls the combustion for a furnace or section of a furnace. Temperature Setpoint may come from a number of sources. The local SP may come from an entry from an operator. Setpoints may also be calculated using a formula for best performance. Setpoints from a formula would be considered as remote setpoints in the temperature PID loop.
This experience was an introduction to design of more sophisticated HMI designs. This included faceplates. Commonly used tags in the HMI are:
- Auto/Manual
- Setpoint
- Process Variable
- Output (CV)
- Error (Deviation) (May be on restricted access page.)
- Deadband (May be on restricted access page.)
- Gain, Reset, Rate (May be on restricted access page.)
Mode switches such as Auto/Manual are included in the PID block. Other modes normally used but not part of the SLC PID block include:
- Local/Remote
- Maintenance
In Local, the operator is able to change the setpoint manually and verify the output’s response while the PID loop is in auto.
In Remote, the process (program) sets the SP and the PID loop responds to the changes. The PID loop is in auto mode in both local and remote modes. Remote mode is referenced as Cascade mode by some PID controller manufacturers.
In Maintenance mode, the loop is in manual and any variable can be changed from the operator station. This mode should be password protected.
A faceplate may be drawn on the HMI similar to the one below. This faceplate is typical for a system of PID loops controlling a process.
Fig. 19-26
The triangles on the left and right side of the bar graphs are used to add or subtract 5% or 1% of the SP or CV. They provide a quick method to adjust SP or CV to get to a desired number. The more exact approach is to enter a number in the data box for either SP or CV. This approach is slower to implement than the method of touching a triangle when making small changes.
Fault Circuits For PID Used in Glass Melting Application
Faults occur at different levels in the program and require a variety of responses. Some types of faults should shut the process down. Shutting down may require that valves turn off. Many times, to shut down automatic operation is desired and the valves are to stop moving, staying in the same position. If the desire is to move from Auto to Manual, the bit in the PID algorithm labeled AM must be changed from 0 to 1. The bit is set to 0 in Auto and 1 in Manual. The fault contact represents various faults that can harm the process if the PID algorithm is allowed to continue in auto.
Two levels are present in most processes. As with the dog food application, the process is capable of being run in remote or local for both automatic modes or in manual. In a hierarchical picture, remote mode is favored over local mode and the manual mode is the least desirable mode to run the process. This may be pictured as:
Fig. 19-27
Note that when the PID block is in auto, the control bit is on. A second bit must be programmed to reverse the status of this bit to turn off the AM bit in the PID block to correctly run the PID block in the Allen-Bradley PID block.
One of the control button types in PanelView is ideal to program the Remote/Local and Auto/Manual layout for the PID block. It is the Multistate Button. It was discussed in Ch. 15 – HMI.
Multistate buttons are used for remote/local and auto/manual so one button can be used instead of two buttons. Most graphical applications encourage the use of a single button as opposed to two separate buttons. Using the multistate button provides a single button with toggle functionality. Multistate buttons also respond to program logic in the PLC and will turn on or off with logic internal to the program.
Faults that move the operation from remote to local are different than faults that move the operation from automatic to local. Always, the option most highly sought is for the operation to run in remote. However, if a fault occurs in the process but not necessarily in the individual PID block, the fault should cause the process to revert to local from remote and sound an alarm.
If a fault occurs in the PID block, the best practice is to change the block from automatic to manual. One of these faults is referred to as anti-reset windup. In manual, the algorithm is not active and the error term is reset to zero eliminating the integral term from growing with a growing error.
Example of Fault Causing Switch from Remote to Local
When looking at PV, a temperature profile may be found to form a composite PV. The values of a number of different temperature inputs are summed together. The sum is weighted with the weighted values having to add to 100%. If the weights do not add to 100%, the individual PID blocks used to control their CV outputs are switched to local mode. The local setpoint is used until the weights have been adjusted to add to 100% and the operator switches control back to remote.
Fig. 19-28
In the example, Weights 1-3 must add to 100 % for the Temperature PV to run the temperature PID block in remote.
Example of Fault Causing Switch from Auto to Manual
When operating between Auto and Manual, the PID block should be monitored so that a failure to achieve the desired result is not defeated by faulty equipment. If the equipment fails, the PID block should be faulted to the Manual Mode and an alarm sounded. For instance, if a valve is attached to the CV and the valve does not turn when the CV changes, this should be considered a fault condition. To find if this is the case, the CV or output is compared to a position on an analog scale. The sensor is usually nothing more than a potentiometer. If the CV does not keep within 10% (or other constant) over a time period such as 10 seconds, the PID block for the valve should fail.
Another type of failure is the restriction of flow that can cause the CV to travel to full ‘on’. A restriction in flow may be simulated by simply pinching off a hand valve in the line of flow. Any restriction over time can cause the CV to not be able to control the process. If the CV is allowed to go to 100% for a period of time, the PID block should fault and the output be placed in Manual. Ranges other than 100% may be used as well with a time delay appropriate to shut down the process in abnormal conditions. The programmer must be able to decide acceptable ranges for these cutoffs, usually through experience with the PID block and with the process.
Eliminating Anti-Reset Windup
In order to avoid anti-reset windup of the PID controller, the controller must be switched from auto to manual when conditions exist that would wind up the controller integral term. The integral term is reset to zero in manual mode. To detect integral error, monitor the PV. If the PV does not follow the CV after a preset time, something is perceived to be wrong with the system and action should be taken.
For example, a check valve may be turned off starving the system. When this happens, the PID controller must be placed in manual to eliminate windup and an alarm sounded.
An experienced operator will find the problem and reset the loop to auto control. And the system will continue to function with only a small upset to the system. If the PID block is allowed to wind up over several minutes or hours, the output valve may stay open 100% (or closed 100%) for long periods of time after the system comes back into operation before control is re- established. In this time period, excessive gas may flow through a gas valve causing an explosion or too much liquid may flow through a control valve flooding a process vessel downstream. In any case, the result usually upsets the entire system causing scrapped product or worse.
When switched from Auto to Manual, the error integral term is reset to zero:
Fig. 19-29
When switched from Manual to Auto, the error integral term starts at zero and adjusts:
Fig. 19-30
Changes from Manual to Auto are usually made by the operator and imply that the operator is aware that a problem occurred, has found the problem and is ready to put the process back into Auto.
Processes in Lab
While becoming familiar with PID from an industrial viewpoint, it was clear that the PID block would be a good addition to the classroom. A first process was a simple valve attached to a ¾ inch water line which allowed the flow to be controlled from 0 to about 90 gallons of water a minute. The water was allowed to flow down a drain after passing through the valve. This was a definite waste of water but demonstrated an industrial PID block to students.
The following is a bill of material to construct the flow valve system shown below in Fig. 19-18.
Fig. 19-31
The valve on the wall was a first lab for EET to activate. It had been available for students from about academic 2004. We had used it over the years with good success.
Fig. 19-32 The Flow Sensor Input
The flow sensor is a paddle wheel placed in the flow of water. There is a calibrated readout for the flow meter that displays the flow in gallons per minute. Included with the flow sensor is a flow instrument read-out. This read-out is separate from the PLC and HMI and is used by personnel in the field to read the 4-20 mA reading from the transmitter to the PLC input. It is a useful instrument in that it verifies externally from the PLC a value that can be seen in the program.
Fig. 19-33 Signet Flow Instrument as seen in Lab
The valve has been discontinued as an active lab due to the possibility of water flooding the downstairs. What had been a good lab is no more. The discussion that follows gives a guide for setting up the Allen-Bradley version of the valve using RSLogix 5000. No longer would we use an integer PID block but rather a Floating-Point block.
Allen-Bradley Analog Inputs and Outputs
Wiring diagrams for the card as well as the engineering range of the input and output channels are found on the next two pages.
Fig. 19-34 1769-IF4XOF2/A and F2F/A Analog Card
Fig. 19-35
The wiring diagram of the card is shown above. The input and output range of the 4-20 mA engineering units can be found by looking up the accuracy of the signals. Both have a range of 0 mA to 21 mA – 0 to 32640 decimal range. So, 4 mA would be 6217 (32640/21)*4 and 20 mA would be 31085. Our range for the raw input and output then is 6217 – 31085.
Instead of the SCP instruction, scaling is handled in the card set-up for the I/O card:
Fig. 19-36
Using the CompactLogix PID Block with RSView METhe PID algorithm used the CompactLogix hardware and software to provide control of the same valve used in the SLC programming experience for the Fat Valve in the Dog Food example. The graphical operator interface will be upgraded to the newer RSView ME operator interface.
Inclusion of the data tag to create the list shown above. The PID algorithm uses these data tags to calculate and control a PID block. For instance, the PV value for the block is mypid.PV. The SP or setpoint is mypid.SP. The example screens that follow show the newer IF4XOF2F/A card and are used to set up the scaling for the present system in the lab.
Fig. 19-37 Controller Configuration of the L30ERM
The task was set up to execute every 100 msec in a separate program from Main or the background task. This is shown in the figure below:
Fig. 19-39 PID Module Set in Periodic Task
Fig. 19-40 Configuration of the PID I/O Module
Fig. 19-41 Data Update Rate Set for I/O Card Here
Fig. 19-42 Configure Input Type Here
Fig. 19-43 Don’t Forget to Enable the Channel
Fig. 19-44 Entire Tag List for PID Listed
The Program Tags for the PID mypid are shown with variable contents. These variables are useful as tag references used for communicating with the variables through program control.
Fig. 19-45 PID Tag Setup-Tuning
The tuning tab shows the variables used to tune the PID block. The Kp, Ki and Kd tuning constants in Fig. 19-63 above are probably the best variables for the water valve. These constants should not vary too much from the numbers shown or the PID block may become unstable.
Fig. 19-46 PID Configuration
The configuration tab shows the variables used to set up the type of block used. There are a number of variables that are not used.
Fig. 19-47 PID Alarms
The alarms tab shows the alarm variables used to set up the block. The alarm limits are ignored for now but in a real application will be necessary when setting up a system of alarms.
The scaling tab shows the variables as set up in the block. We need to make a decision whether to scale the engineering units. The unscaled PV and CV are listed at 3200 low to 21000 high. The Engineering Units for the PV may be changed or left as is. For water, the engineered units should be 91 gpm max.
Fig. 19-48 PID Setup
Fig. 19-48 Tuning Parameters
Fig. 19-49 Setpoint Trial
Fig. 19-50 Manual Trial
Fig. 19-51 Setup of the Faceplate
Continuing the Allen-Bradley Configuration Pages
After you enter the PID instruction and specify the PID structure, you use the configuration tabs to specify how the PID instruction should function.
To specify tuning, select the Tuning tab. Changes take effect as soon as you click on another field.
To configure the PID:
| Specify Setpoint (SP) | Enter a setpoint value (.SP). |
| Set output % | Enter a set output percentage (.SO) (In software manual mode, this value is used for the output. In auto mode, this value displays the output %.) |
| Output bias | Enter an output bias percentage (.BIAS). |
| Proportional gain (Kp) | Enter the proportional gain (.KP).For independent gains, it’s the proportional gain (unitless). For dependent gains, it’s the controller gain (unitless). |
| Integral gain (Ki) | Enter the integral gain (.KI). For independent gains, it’s the integral gain (1/sec). For dependent gains, it’s the reset time (minutes per repeat). |
| Derivative time (Kd) | Enter the derivative gain (.KD). For independent gains, it’s the derivative gain (seconds). For dependent gains, it’s the rate time minutes). |
| Manual mode | Select either manual (.MO) or software manual (.SWM). Manual mode overrides software manual mode if both are selected. |
| PID equation | Select independent gains or dependent gains (.PE). Use independent when you want the three gains (P, I, and D) to operate independently. Use dependent when you want an overall controller gain that affects all three terms (P, I, and D). |
| Control action | Select either E=PV-SP or E=SP-PV for the control action (.CA). |
| Derivative of: | Select PV or error (.DOE). Use the derivative of PV to eliminate output spikes resulting from set-point changes. Use the derivative of error for fast responses to set-point changes when the algorithm can tolerate overshoots. |
| Loop update time | Enter the update time (.UPD) for the instruction. |
| CV high limit | Enter a high limit for the control variable (.MAXO). |
| CV low limit | Enter a low limit for the control variable (.MINO). |
| Deadband value | nter a deadband value (.DB) |
| No derivative smoothing | Enable or disable this selection (.NDF) |
| No bias calculation | Enable or disable this selection (.NOBC). |
| No zero crossing in dbnd | Enable or disable this selection (.NOZC). |
| PV tracking | Enable or disable this selection (.PVT). |
| Cascade loop | Enable or disable this selection (.CL). |
| Cascade type | If cascade loop is enabled, select either slave or master (.CT). |
Specify Alarms
| PV high | Enter a PV high alarm value (.PVH). |
| PV low | Enter a PV low alarm value (.PVL). |
| PV deadband | Enter a PV alarm deadband value (.PVDB). |
| Positive deviation | Enter a positive deviation value (.DVP). |
| Negative deviation | Enter a negative deviation value (.DVN). |
| Deviation deadband | Enter a deviation alarm deadband value (.DVDB). |
Specify Scaling
| PV unscaled maximum | Enter a maximum PV value (.MAXI) that equals the maximum unscaled value received from the analog input channel for the PV value. |
| PV unscaled minimum | Enter a minimum PV value (.MINI) that equals the minimum unscaled value received from the analog input channel for the PV value. |
| PV engineering units maximum Enter the maximum engineering units corresponding to .MAXI (.MAXS) | |
| PV engineering units minimum Enter the minimum engineering units corresponding to .MINI (.MINS) | |
| CV maximum | Enter a maximum CV value corresponding to 100% (.MAXCV). |
| CV minimum | Enter a minimum CV value corresponding to 0% (.MINCV). |
| Tieback maximum | Enter a maximum tieback value (.MAXTIE) that equals the maximum unscaled value received from the analog input channel for the tieback value. |
| Tieback minimum | Enter a minimum tieback value (.MINTIE) that equals the minimum unscaled value received from the analog input channel for the tieback value. |
| PID Initialized | If you change scaling constants during Run mode, turn this off to reinitialize internal descaling values (.INI) |
Shifting to the HMI Program, RS Studio is entered and the Libraries choice and then Face Plates choice is entered.
Fig. 19-54 Under Libraries – Face Plates
With RSStudio, build a screen from scratch using a face plate. There are a number of face plates in the template from which to choose.
Fig. 19-55 HMI Loop Face Plate
The various parts of the face plate are animated. The next screen shows the details:
Fig. 19-56 Animation of the Arrow
Fig. 19-57 Animation of the Numeric Entry
A Third Industrial Application–A Steel Furnace
As with the Glass Furnace, the Steel Reheat Furnace uses three PID Controllers working together as shown again below. This was programmed again for a Steel Reheat furnace with one major exception.
Fig. 19-58 PID Control for Simple Furnace Control
In some applications involving gas and oxygen, the oxygen must be guaranteed to be in excess relative to fuel. Otherwise, excess gas may build up in the chamber and explode. Above certain temperatures, gas will burn without exploding. This is an especially prevalent condition in some steel reheat furnaces.
In the case of gas and oxygen below the critical temperature for gas to burn, a cross-limiting control scheme is introduced to allow only enough gas to be present to burn with at least enough oxygen or combustion air to burn all the gas all the time. This implies that the gas valve always must be more closed than the oxygen valve (times the air-fuel ratio). Control of the cross- limiting requires the same temperature control as the master control but introduces lag control, high select, low select and other control blocks in addition to the PID control. The oxygen control for the cross-limiting control algorithm would be:
The gas control for the cross-limiting control algorithm would be:
Fig. 19-60
As can be seen, the Gas PID block selects the lower of the values of the Temperature Setpoint or the Oxygen value after a lag has occurred. The effect of the cross-limiting control is to assure a Gas-Oxygen ratio that will never allow more gas into the combustion chamber than can be burned in the combustion process. This is an example of a much more complex algorithm than was first discussed earlier with a simple PID block. The same PID blocks are still used but with more sophisticated program control in addition to perform the task at hand.
Example of PID Block for Feedforward Control – Also First Encountered in The Steel Furnace
The PID block is a device used for feedback control. Many times, however, a small amount of feed-forward control is required. Feed-forward control may include control that anticipates an action and is ready to apply control as a situation arises more quickly than the pure feedback solution is able to provide. Since there is only one set of tuning parameters for the PID block, it is not practical to switch to a second set of parameters for a special case.
The following example shows how a little tweaking of the PID block can be useful for some anticipatory or feed-forward control. The example below is of a furnace with a door on the front. This example shows just one of many additions to the PID block to give it characteristics not normally associated with PID control.
The gas burners use air for combustion and the air must be exhausted through an exhaust stack. Pressure in the furnace is adjusted by adjusting the damper in the stack. Pressure should be adjusted to be slightly negative so flames do not jump out of the door when the door is opened.
The concern of the pressure PID loop is:
What happens when the door opens?
This is a major concern because the PID loop must respond in a much different manner in this circumstance than under normal operating conditions with the door closed. The fact that an event such as the door opening occurs helps to accomplish the control of this task. While not true feed forward, augmentation of the PID block will help offset the pressure upset and keep the flames pretty much inside the furnace. (Flames coming out the furnace tend to ignite grease from bearings causing grease fires around the furnace.)
To accomplish better pressure control, place a limit switch on the door and adjust the output of the PID block so the output will open the damper rapidly and then recover. The constant of the jump is a number that should be adjustable by an operator in the maintenance mode only.
When the door swings open, perform the following operation using a one-shot rung:
CV = CV + constant
This statement should be written only once to the CV. Use a one-shot circuit to add the constant to CV. The CV then is allowed to recover to its new value but from a new higher starting point as opposed to the original value. The value of the constant is the amount shown by the arrow below. This is a constant that is adjusted to fit the application. Once set, it should not be changed.
Fig. 19-62
The response is a simulated response but makes the point that the response to a pressure change requires fast action to adjust to the conditions of the door opening. A change in the CV provides this type of change. The change in CV will start the adjustment procedure and trick the PID tuning parameters into responding to the new situation quickly instead of a slow acting controller as would be the case for the regular control of oven pressure.
While the addition of a small incremental value to CV may be considered a trick on the PID block, it is important to note that such an action may be accomplished in the PLC very easily. Ladder logic accommodates this type of programming through the use of one-shot ladder logic and math functions. This type of change to the PID block provides quick response to an upset outside the normal range of the PID block’s algorithm. The actual move may only be able in the manual mode. To move to manual, change the CV and then move back to auto is recommended for this action to occur successfully.
P&ID Symbols
To read a P&ID Diagram one needs to understand the symbols and nomenclature of the P&ID Diagram. The example below shows two PID Controllers and their associated hardware and logic. This drawing is one of many found in industry. The course uses the Process Control text from Liptak for many of its examples including this one below:
Fig. 19-63
The circles are referred to as ‘bubbles’. Inside the bubbles there are letters and usually numbers. The letters have meaning based on the tables below. To understand what is represented, look for the bubbles with xIC or xRC letters. These represent PID blocks that are to be implemented in the control logic. The third letter is ‘controller’ and the second letter is either I for ‘indicator’ or R for ‘Recorder’. The indicator label refers to a faceplate. This today symbolizes a single faceplate on an HMI screen. The recorder label refers to a histogram recording device, today usually symbolized by a historical data plot for the variable being controlled. Both I and R may be present today since it is easy to include both functions in a PID block inside a computer system such as a PLC.
If there are two arrows coming to the xIC or xRC, then one is the PV and one is the SP. It takes some intuition to determine which is which. If there is only one arrow coming into the PID controller, then this is the PV and the SP is entered through a faceplate.
First Letter Designations:
| Letter | First Position | Succeeding Positions |
| A | Analysis | Alarm |
| B | Burner Flame | |
| C | Conductivity | Control |
| D | Density / Differential | |
| E | Voltage | |
| F | Flow Rate / Ratio | |
| G | Gaging | Glass |
| H | Hand | High |
| I | Current | Indicate |
| J | Power / Scan | |
| K | Time | |
| L | Level | Light / Low |
| M | Moisture | Middle/ Manual |
| N | Choice | |
| O | Choice | |
| P | Pressure | |
| R | Radioactivity | Record |
| S | Speed | Switch |
| T | Temperature | Transmit |
| V | Viscosity | Valve |
| W | Weight | Well |
| X | Interlock | |
| Y | Choice | Relay |
| Z | Position | Drive |
|
Process Measurement |
Element Type | Element | Transmitter | Indicator | Indicator controller | Controller | Ratio Controller | Recorder |
| Code | E | T | I | IC | C | FC | R | |
| Analysis | A | AE | AT | AI | AIC | AC | AFC | AR |
| Conductivity | C | CE | CT | CI | CIC | CC | CFC | CR |
| Density | D | DE | DT | DI | DIC | DC | DFC | DR |
| Voltage | E | EE | ET | EI | EIC | EC | EFC | ER |
| Flow | F | FE | FT | FI | FIC | FC | FFC | FR |
| Dimension | G | GE | GT | GI | GIC | GC | GFC | GR |
| Hand | H | HE | HT | HI | HIC | HC | HFC | HR |
| Current | I | IE | IT | II | IIC | IC | IFC | IR |
| Time | K | KE | KT | KI | KIC | KC | KFC | KR |
| Level | L | LE | LT | LI | LIC | LC | LFC | LR |
| Humidity | M | ME | MT | MI | MIC | MC | MFC | MR |
| Power | N | NE | NT | NI | NIC | NC | NFC | NR |
| Pressure | P | PE | PT | PI | PIC | PC | PFC | PR |
| Delta Pressure |
dP |
dPE |
dPT |
dPI |
dPIC |
dPC |
dPFC |
dPR |
| Quantity | Q | QE | QT | OI | OIC | QC | QFC | QR |
| Radioactivity | R | RE | RT | RI | RIC | RC | RFC | RR |
| Speed | S | SE | ST | SI | SIC | SC | SFC | SR |
| Temperature | T | TE | TT | TI | TIC | TC | TFC | TR |
| Delta Temperature |
dT |
dTE |
dTT |
dTI |
dTIC |
dTC |
dTFC |
dTR |
| Viscosity | V | VE | VT | VI | VIC | VC | VFC | VR |
| Weight | W | WE | WT | WI | WIC | WC | WFC | WR |
| Vibration | Y | YE | YT | YI | YIC | YC | YFC | YR |
| Position | Z | ZE | ZT | ZI | ZIC | ZC | ZFC | ZR |
The table above contains descriptions of various types of transmitters, indicators, controllers and recorders. Most PID blocks are used to program controller items. There is a one-to-one programming transfer for most xIC (various, Indicating Controller) or xC controllers.
Process and Instrumentation Drawings (P&ID) are formalized drawings of a process explaining flow and movement of material. It is important to know the symbols for this type of drawing. It is also important to be able to understand the functionality of the devices on the drawing so the engineer or technologist can program the process on the PLC or other computer.
It is also hoped that down the road, the engineer or technologist is allowed to design the P&ID for others. The programmer usually understands the process as well as anyone and has insight into the complexities of the process and should be allowed to take responsibility for design of the P&ID.
A note about PID vs P&ID: Of course, the similarities are glaring. PID refers to the control block Proportional Integral Derivative, a control algorithm. P&ID refers to Process and Instrumentation Drawings. Some refer to them as Piping and Instrumentation Drawings.
|
Process Measurement |
Element Type | Hand Switch | Hand Valve | Totalizer | Indicating Totalizer | Solenoid Valve | Control Valve | Calculation |
| Code | HS | HV | Q | IQ | XV | V | Y | |
| Analysis | A | AHS | AHV | AQ | AIQ | AXV | AV | AY |
| Conductivity | C | CHS | CHV | CQ | CIQ | CXV | CV | CY |
| Density | D | DHS | DHV | DQ | DIQ | DXV | DV | DY |
| Voltage | E | EHS | EHV | EQ | EIQ | EXV | EV | EY |
| Flow | F | FHS | FHV | FQ | FIQ | FXV | FV | FY |
| Dimension | G | GHS | GHV | GQ | GIQ | GXV | GV | GY |
| Hand | H | HHS | HHV | HQ | HIQ | HXV | HV | HY |
| Current | I | IHS | IHV | IQ | IIQ | IXV | IV | IY |
| Time | K | KHS | KHV | KQ | KIQ | KXV | KV | KY |
| Level | L | LHS | LHV | LQ | LIQ | LXV | LV | LY |
| Humidity | M | MHS | MHV | MQ | MIQ | MXV | MV | MY |
| Power | N | NHS | NHV | NQ | NIQ | NXV | NV | NY |
| Pressure | P | PHS | PHV | PQ | PIQ | PXV | PV | PY |
| Delta Pressure | dP | dPHS | dPHV | dPQ | dPIQ | dPXV | dPV | dPY |
| Quantity | Q | QHS | QHV | QIQ | QXV | QV | QY | |
| Radioactivity | R | RHS | RHV | RQ | RIQ | RXV | RV | RY |
| Speed | S | SHS | SHV | SQ | SIQ | SXV | SV | SY |
| Temperature | T | THS | THV | TQ | TIQ | TXV | TV | TY |
| Delta Temperature |
dT |
dTHS |
dTHV |
dTQ |
dTIQ |
dTXV |
dTV |
dTY |
| Viscosity | V | VHS | VHV | VQ | VIQ | VXV | VV | VY |
| Weight | W | WHS | WHV | WQ | WIQ | WXV | WV | WY |
| Vibration | Y | YHS | YHV | YQ | YIQ | YXV | YV | YY |
| Position | Z | ZHS | ZHV | ZQ | ZIQ | ZXV | ZV | ZY |
Devices such as hand switches, valves and some electronic devices such as totalizers and calculation elements are described here. Most calculation elements are executed inside the computer and algorithms become much too difficult to describe on the P&ID. The designer of the P&ID is free to decide how much of the calculation information is to be included on the drawing.
Devices such as those of the table above are primarily used for checking position of switches and for various types of alarm. It is not uncommon to assign switches for end-of-travel on analog devices. With most analog systems, there is an alarm reserved for both low and low-low. Low- low is the signal that is just past low and should be attached to an alarm as well as shut-off logic. The same logic is used for high and high-high. The inner alarm is the low or high alarm bit and the low-low and high-high are the outer or fail-safe alarm.
| Element
Type |
Ratio
Calculation |
Switch
Low |
Switch High | Alarm
Low |
Alarm
Low Low |
Alarm
High |
Alarm
High |
|
| Process
Measurement |
Code | FY | SL | SH | AL | ALL | AH | AHH |
| Analysis | A | AFY | ASL | ASH | AAL | AALL | AAH | AAHH |
| Conductivity | C | CFY | CSL | CSH | CAL | CALL | CAH | CAHH |
| Density | D | DFY | DSL | DSH | DAL | DALL | DAH | DAHH |
| Voltage | E | EFY | ESL | ESH | EAL | EALL | EAH | EAHH |
| Flow | F | FFY | FSL | FSH | FAL | FALL | FAH | FAHH |
| Dimension | G | GFY | GSL | GSH | GAL | GALL | GAH | GAHH |
| Hand | H | HFY | HSL | HSH | HAL | HALL | HAH | HAHH |
| Current | I | IFY | ISL | ISH | IAL | IALL | IAH | IAHH |
| Time | K | KFY | KSL | KSH | KAL | KALL | KAH | KAHH |
| Level | L | LFY | LSL | LSH | LAL | LALL | LAH | LAHH |
| Humidity | M | MFY | MSL | MSH | MAL | MALL | MAH | MAHH |
| Power | N | NFY | NSL | NSH | NAL | NALL | NAH | NAHH |
| Pressure | P | PFY | PSL | PSH | PAL | PALL | PAH | PAHH |
| Delta Pressure | dP | dPFY | dPSL | dPSH | dPAL | dPALL | dPAH | dPAHH |
| Quantity | Q | QFY | QSL | QSH | QAL | QALL | QAH | QAHH |
| Radioactivity | R | RFY | RSL | RSH | RAL | RALL | RAH | RAHH |
| Speed | S | SFY | SSL | SSH | SAL | SALL | SAH | SAHH |
| Temperature | T | TFY | TSL | TSH | TAL | TALL | TAH | TAHH |
| Delta Temperature | dT | dTFY | dTSL | dTSH | dTAL | dTALL | dTAH | dTAHH |
| Viscosity | V | VFY | VSL | VSH | VAL | VALL | VAH | VAHH |
| Weight | W | WFY | WSL | WSH | WAL | WALL | WAH | WAHH |
| Vibration | Y | YFY | YSL | YSH | YAL | YALL | YAH | YAHH |
| Position | Z | ZFY | ZSL | ZSH | ZAL | ZALL | ZAH | ZAHH |
These tables demonstrate the breadth of labeling that can be included on a device. The devices are also numbered and contain a 3 or 4 digit number in addition to the device type name. These numbers are usually assigned sequentially and are placed on a metal tag that is attached to the device itself. In the plant, one should be able to find a device, then find its metal tag, and find the reference to the device on the P&ID. Names of devices are used on electrical drawings as well as on the P&ID. If a device is referenced as a flow transmitter and numbered 087, then FT-087 is referenced on all drawings using the same name.
The design of a P&ID may start with a senior engineer familiar with the process. Other sources for P&ID’s are reference books such as the Liptak reference handbook Process Control. Texts and company reference drawings are good sources for a starting point for a new P&ID. Of course, names such as those listed above are to be used in defining the devices used in the process.
Example Program from P&ID:
A P&ID Drawing may be used to begin the process of programming the PLC. A P&ID such as the following may be used to generate a simple program that only works in auto mode with just logic to run the PID blocks in auto using the Setup Blocks from Allen-Bradley or Siemens. This is a first step in setting up a complete PID program. This example shows the two PID blocks found (DIC, FIC) and the corresponding relationships with PV, SP and CV’s. The goal of this pseudo-coded program is to write a first pass of the PID program.
Problems at the end of the chapter give more example P&IDs.
Fig. 19-64
The P&ID above is used to generate a PLC ladder diagram as follows:
image
This program is not complete but a start. It gives the linkage between the various PID controllers. What is not included are the modes and their programming as well as any alarms and HMI interface. Also not included are the bumpless transfer programs.
Example Programming for P&ID (The PLC program is left as an exercise for the student):
Fig. 19-65
The following diagrams show more extensive P&ID drawings for a complete system.
Other Labs Built at School Using Siemens PLCs
The ball-in tube lab was built over the 2013-14 academic year. It has served students well.
The laser is the feedback device for the ball-in-tube experiment.
The laser gives an accurate position of the top of the ball. Specifications for the laser are given in the following figure.
Fig. 19-66 Instructions for Laser for Ball-in-Tube Lab
Calibration of the analog output for the laser is described in the following figure.
Tank over Tank Level Control Lab
This lab was an effort to mimic a lab from a major educational equipment manufacturer. The first attempt is pictured below. The later design is pictured further below. The number of different sensors used in the design is significant. What first seemed to work may not work in the final design. This was found to be the case in both the level and flow sensors.
Level Control of Upper Tank with Multiple Drains and Feedback from Level Sensor
Fig. 19-68
The first system used a cheap level sensor before settling on the sonic sensor (yellow) seen below. The flow sensor changed from a cheap $10 sensor to a $110 sensor and finally a better
$160 sensor. These changes were seen as necessary to control the process accurately.
The pump control was from a digital output to a drive control module and finally to the pump motor. The drive control module is shown below as attached to the system. The actual device is shown below as well. The pump is a submersible bilge pump selected by the plastics manufacturer known by him since his experience had been with boats and boat construction. The speed control of the bilge pump is the same as that used in the later DC motor designs using PWM control. These are discussed further in the description of these devices.
Fig. 19-70
Fig. 19-72
The level control selected first had been one that was attached to the Arduino microprocessor. That level control failed. It is not even on the pages of Arduino sensors at this time. Seems as if more than one discovered that it didn’t work. This is a common story with low-cost sensors. Many will work for a while. Some do not work at all.
Fig. 19-73
The level sensor below is an industrial sensor and is guaranteed to work long-term. It does cost significantly more but is worth the money. The price of the sensor shown below is approximately $250.
Fig. 19-74
Compact ultrasonic sensor in straight or right-angle housing.
- Senses from 30 to 300 mm
- Available in analog or discrete models
- Features minimal dead zone and eliminates dead zone if used in retrosonic mode
- Ideal for material handling and packaged goods applications, such as bottling or liquid level detection and control for small containers
- Available in straight or right-angle versions with a wide variety of mounting hardware for enhance sensing versatility
- Offers programmable background suppression
- Compensates for temperature, for greatest sensing accuracy
- Simplifies setup with push-button and remote TEACH-mode programming
- Shows status during setup and operation, using highly visible LEDs indicators
The yellow ultrasonic level transmitter worked very well and gives a stable accurate signal to the PLC from the tank level. The output of this device is 4-20 mA.
We now look at the flow sensors tried. The first again was a low-cost sensor. It worked for a little while (about an hour or so) only to fail. We purchased a number of these and they all failed in a short while. The electronics was not robust and the signal stopped shortly after initially running.
The flow sensor shown here is the second. The third device is shown further below. At the bottom is a fourth which was held in reserve but may be used down the road. This sensor worked (but was not accurate). We looked at it because we wanted something that would work. It worked but if we want an accurate signal across the range, it lacked accuracy in the lower end of the range.
The sensor below is the third flow sensor and is the best so far. It is more costly but is accurate across the entire range and more accurate than the one above across the entire range.
Fig. 19-77
This meter was found and is possibly a useful flowmeter for this project. Its cost is significantly less than the two above but has not been validated yet. The one above is about $160 and this one is about $60.
Speed and Position Control of a DC Motor
The figures shown below are from a shelved design by Prof. John Rich. Prof. Rich’s design was good although students were prone to mis-wire it and destroy the op-amps on an adjacent control board. This was a continuous analog solution as opposed to a digital solution using a computer.
Speed and Position Control of DC Motor
Fig. 19-79
The following gear motor replaces the geared motor shown above.
Fig. 19-81
Tape Rewind Machine
Fig. 19-80
The design shown below gives speed control for the two dc motors with tension control between the two.
Fig. 19-82
Fig. 19-83
In this design, two motors are involved with a tensioner between. The motors cannot both run at constant speed. One can run at constant speed or at a ramped speed. The second follows the first based on the angle of the dancer roll between the two. The tension on the second can be changed based on the angle of the tension arm. Weight can be added to the arm if additional tension is desired.
Combining of two speed/position-controlled motors results in a lab similar to the one above in Fig 19-83. This lab is inexpensive and provides a pair of PID loops to control the two dc motors and a third PID loop to control the tension between the two. The third loop uses the dancer roll potentiometer as a feedback device. This lab concentrates on loop-in-loop control. Also important are start-up control issues. The lab also asks the question of which loop is the master. For instance, should the right loop be constant speed? Should the left loop be constant speed?
Or should the speed be constant across the dancer roll? The program is written differently for each. Also, a sensor must be added if the dancer roll is to be constant speed. This project has many different possible results depending on where the design starts. The advances from the earlier toilet paper lab to the present design are many and include the addition of 80-20 extruded aluminum instead of the cheaper erector-set metal construction. This one addition gave added stability to the machine from the earlier design.
All present labs use the Siemens PLC due to the flexibility of the I/O to control analog quantities.
Siemens Analog Inputs and Outputs
The Siemens’ PID implementation is used in all the active applications shown above. First, the address of all I/O is required as well as the wiring diagram for each analog point. The S7-1200 has two analog inputs located on the controller.
Addressing for the two analog input channels is found below: IW64 and IW66. The two analog inputs are wired to these two points and programmed with these addresses.
Fig. 19-84
To read or write an analog value, use the immediate read or write instruction as shown below:
Use a cyclic interrupt event to house the PID function. The event is defined as an OB or Object Block. We will use OB 30 for the program containing the PID Block for the present applications.
Analog values are available from high-speed digital input pulses. Analog output values may be realized through PTO or PWM signals from digital outputs. An example is the Tank over Tank problem discussed in Chapter 25 of the Hybrid Lab Text. The configuration of the pulse input is as follows:
Under the Function tab, choose single phase unless quadrature is to be used:
Here, 0 and 0 are fine:
No need to choose an interrupt. The interrupt should be the cyclical interrupt executing the PID function:
Next, identify the actual input addressed as the hsc input:
Then, identify the input address ID:1000-1003:
The address of the input used is IW1002. It is used in the following statement as the rolling value of the input count. This logic executes each time period and calculates the pulses in the last scan:
The address of the output is QW1000. It is used in the following statement as the value of the output count.
The configuration of the PWM output for control of the bilge pump for the Tank lab as well as the gear motor lab is a single PWM 24 V output that turns on a dc motor controller input:
The pulse width modulated output is set up in microseconds. Other constants in the set-up include the overall pulse duration. The pulse length is 10 msec with a base of 10,000 counts:
The following statement identifies the output to be pulse modulated:
The following address gives the output address to load the pwm time into QW1000:
The following views of the output show various PWM settings. The first one is approximately 75% or a value in QW1000 of 7,500:
Fig. 19-87
This view shows approximately 90% on:
Fig. 19-88
A list of hardware identifiers for the various I/O points is found in the list of system constants under the system constant tab:
The final set-up of the pwm and hsc devices includes a DB for each. This is found in the OB1 code. The hardware identifier is found in this instruction and ties the device to the action:
PID control – Siemens
STEP 7 provides the following PID instructions for the S7-1200 CPU:
The PID_Compact instruction is used to control technical processes with continuous input and output variables. The PID_3Step instruction is used to control motor-actuated devices, such as valves that require discrete signals for open- and close actuation.
Both PID instructions (PID_3Step and PID_Compact) can calculate the P-, I-, and D components during startup (if configured for “pretuning”). You can also configure the instruction for “fine tuning” to allow you to optimize the parameters. You do not need to manually determine the parameters.
Note: Execute the PID instruction at constant intervals of the sampling time (preferably in a cyclic OB).
Because the PID loop needs a certain time to respond to changes of the control value, do not calculate the output value in every cycle. Do not execute the PID instruction in the main program cycle OB (such as OB 1).
The sampling time of the PID algorithm represents the time between two calculations of the output value (control value). The output value is calculated during self-tuning and rounded to a multiple of the cycle time. All other functions of PID instruction are executed at every call.
The PID (Proportional/Integral/Derivative) controller measures the time interval between two calls and then evaluates the results for monitoring the sampling time. A mean value of the sampling time is generated at each mode changeover and during initial startup. This value is used as reference for the monitoring function and is used for calculation. Monitoring includes the current measuring time between two calls and the mean value of the defined controller sampling time.
Tuning of the Siemens PID loops is somewhat automatic with an autotune feature present. If the autotune does not give adequate results (as in the DC Motor speed loop, guessing is helpful.
Link to S7-1200/1500 PID Manual: https://support.industry.siemens.com/cs/us/en/view/108210036
The tuning rules are found on pgs. 265 – 266 under the descriptions of operating modes “Pretuning” and “Fine tuning” in the 1200.
This formula is more complex than the formula explained earlier. The three variables used are the same, however. KP is the proportional constant, TI is the integral constant and TD is the derivative constant.
To set up a PID block in your program, choose ‘Technology’ from Instructions and then ‘PID Compact’. See below:
Fig. 19-90
The settings for the controller may be reached by clicking the icon in the upper right of the PID block. The block should also be placed in a Timed Interrupt OB:
An example from the Ball in Tube program is included in the following explanation. The second PID program developed is the Tank over Tank.
Inserting the PID instruction and technological object
STEP 7 provides two instructions for PID control. Use the PID_Compact instruction for the lab in this course, please!
The PID_Compact instruction and its associated technological object provide a universal PID controller with tuning. The technological object contains all of the settings for the control loop.
The PID_3Step instruction and its associated technological object provide a PID controller with specific settings for motor-activated valves. The technological object contains all of the settings for the control loop. The PID_3Step controller provides two additional Boolean outputs.
After creating the technological object, you must configure the parameters. You also adjust the autotuning parameters (“pretuning” during startup or manual “fine tuning”) to commission the operation of the PID controller.
Fig. 19-91
When programming the inputs and outputs, the following two instructions are used to scale and normalize the analog value. Use the NORM_X function first to convert the number to a real in the range 0-1 and then use SCALE_X to scale the normalized value to a range for the real value.
Descriptions of various parameters in the PID block are found below:
The values in the table above are necessary to make the PID block work correctly. Some may be set once and not included in the program as variables. Others must be included as programmed variables. For example, if Input_PER is used, this input must be represented as a percent from 0 to 100.0. This value is the value fed to the PID block from the analog process variable, in this case the laser. The variable must be represented in Input_PER as a ratio from 0 to 100.
Other variables in the table above are useful when coordinating with the faceplate. For example, if the PID algorithm is set to manual, the ManualValue variable must be set to the desired state of the output of the PID. The variable is moved to this location and the output is set to this value.
Likewise, these variables contain information to allow the PID algorithm to function properly. The state is a number from 0 to 8. We only use the values of 3 and 4 for the application given in the Ball-in-Tube program.
The I/O address of the analog input point is shown in the analog input addresses of the base processor unit. If additional analog points beyond two or if these points need a floating neutral, then an additional analog input card is needed. In our example for the ball-in-tube lab, the input addresses start at I:64. The first address is bytes I:64 and 65. The second input address is bytes I:66 and 67.
Fig. 19-92 Addresses of the Analog Inputs
Display of the analog points is done on a historical data plot shown below.
Fig. 19-94
Fig. 19-95 Setting up the Cyclic Interrupt (OB30)
A separate Cyclic Interrupt Program must be built to provide execution of the PID Block. The PID program executes the PID algorithm after reading the Process Variable input. After execution of the algorithm, the PWM output determines the state of the output to the fan.
The PID algorithm for the Ball-in-Tube program is shown below. The instruction is configured and set up from programming statements as well as constants entered into the tables above.
Fig. 19-96 The PID Block for the Ball-in-Tube Lab
The HMI panel below has a button to choose between auto and manual. In PID_PWM, the button is in automatic. When in auto, the setpoint is entered on a separate page. The manual value for the PID output may be entered below the button in manual mode.
Below the button is a data entry window for the value of percent on time for the fan. In this window is the percent on time for the output.
The Configuration editor for PID_Compact shows the following screen. Here, the user selects the units such as temperature or pressure. The user also determines whether variables such as the PV are Input or Input_Per. Most users would select ‘general’ for controller type.
Use the commissioning editor to configure the controller for auto-tuning at startup and for auto- tuning during operation. To open the commissioning editor, click the icon on either the instruction or the project navigator.
The following table lists some common suggested actions for assisting the set-up of the PID controller:
Other General Considerations for PID Programs
Building the Faceplate
The faceplates below are samples of single loop faceplates that are accepted by most industry. They resemble faceplates of actual PID controllers used prior to the computer. They may be more or less sophisticated than these and may include the 3-d look or not.
These are samples of what is expected for proper HMI design of a faceplate.
Fig. 19-99 One of Many
Choose a faceplate and begin modifying it for the application. Several tags are provided with each faceplate. These tags may set a number, allow entry of a number, move an animated arrow or fill a sliding window. Bits may be added for auto/manual and local/remote. Note that alarms may also be included such as the red and yellow tags above.
These faceplates may be modified with additional components. They may also be built from scratch using existing components. At one time, the faceplate could be unbundled. While no longer possible, the individual components may be animated by clicking them and then answering the questions.
The next two pages show the animation of the faceplates from Siemens and Allen-Bradley using the faceplate as the starting point for the animation. While the faceplate given is not available from Siemens, it can be built from parts using existing Siemens components. The up and down triangles shown in the earlier faceplate may also be added to these faceplates for a more complete system. The logic in the Siemens faceplate below show how to add the triangles.
The following logic can be used to add 1 % to the full scale value of the Setpoint. Similar logic can be used for 5% increase or for 1% or 5% decreases. The triangle buttons on the original faceplate showed these triangles. Similar buttons can be added to the CV or Output logic when the PID algorithm is in manual. Similar logic can be added to the Allen-Bradley program.
Fig. 19-100 Logic for Incremental Change of Setpoint
The following from HPHMI examples in Chapter 15 show a group of PID controllers. Each gives just the information necessary for the running of that controller. To change the mode of the controller or to run the controller in a mode other than remote requires a more complete faceplate. To add this feature, simply program an invisible button that calls a pop-up faceplate similar to the one below.
Fig. 19-101 Analog Depiction of Information
Fig. 19-102 Further Explanation of Moving Analog Indicators
Two new topics not explored in the earlier PanelView were alarm screens and trends. Alarm banners were available in the older PanelView but were not as flexible as the newer alarm screen. Also, trends are needed. Trend data is very important in that a trend of any variable can be used to diagnose a problem either in the start-up phase of a project or later during daily operation.
Historical data trends will show long-term trends as well.
Fig. 19-103 Imaginary Button calling Faceplate
This figure shows a partially finished graphic of the ‘fat’ portion of the dog food extruder. When the invisible button around the valve is energized, the PID block faceplate appears allowing control of the valve in auto and manual mode. Local and remote control may also be added to the screen with the faceplate. The pipe may be enhanced as well to show flow when the valve is open and no flow when the valve is closed.
The graphical application may be run from the PC or downloaded to a target system. The tags for the graphical screen may be those in the PLC. Care must be taken when selecting where the process is to be displayed. If it is displayed from the computer screen, then Local is selected. If the display is downloaded to the Panelview32, then Target is selected. In order to display the process locally, a number of steps must be incorporated for the local application to correctly “see” the PLC.
Tuning the PID Block
It is interesting that a number of different PID algorithms exist. No one standard equation is used in all controllers. While the PID block has the same general function, nomenclature and the action of the block may differ.
Proportional Band = 100/gain
Integral = 1/reset
Derivative = rate – pre-act
Three classifications of PID algorithms are considered major classes of design equations. They are ideal, parallel and series or interacting. Equations for the three are listed below:
Different manufacturers use one of the above control algorithms (except Siemens) as the basis for their PID block. The three do not respond identically to different situations. A control algorithm from one manufacturer cannot be guaranteed to work identically to the control algorithm of a second manufacturer. Differences in the derivative action are especially critical to the operation. For this reason, many do not use derivative action in the tuning of a loop. To not use derivative action, set the derivative or D value to zero.
Manufacturers such as Honeywell, Bailey, Allen-Bradley, Modicon, Foxboro, Fisher, and Texas Instruments pick one of the above types of equation to implement on their controllers. Some manufacturers allow a choice between which algorithm is used. It is the engineer’s or technician’s responsibility to understand the application, the PID equation, and choose the best overall solution for the application.
Bumpless Transfer
When the PID block is switched from manual to auto, the function responds to the SP presently available to the block. If the process is sensitive to sudden changes in PID output, then the program should include logic to give the output a signal matching the present flow when the block was in manual. This is referred to as bumpless transfer.
With the more advanced PID blocks of the PLC/5 and Control Logix platform, the output value that is described as the value to write to so that the output will be bumpless is the .SO value. The
.SO value of the PID block should be given the value that the operation would like the output to have when the PID block is first put in Auto. This value is usually the value of the output when the PID block is in Manual. The MOV operation should guarantee bumpless transfer when the block moves from Manual to Auto.
For example, if the block was in manual and flow was 25.5 gallons per minute, when the PID block is transferred to auto, flow should continue to maintain 25.5 gallons per minute. With PID blocks, the addition of logic requires writing the present flow rate to the setpoint when the block transfers from manual to auto.
Non-Standard Controller Modes
A number of additional modes may be created for the PID block. Bits must be programmed externally to the PID block for many of these other control modes.
An example is Control Output Tracking (COT). In COT, the loop is forced to manual and the output moves to a programmed position until conditions in the program are stable enough for the system to proceed to auto. In COT, the mode shown to the operator is AUTO with COT. The system is perceived to be in Auto but the output or CV is actually in Manual.
This mode is ideally suited for burner start-up with a large number of burners. When the burners are first turned on, the gas and combustion air are not able to be controlled under automatic control. The burners need to operate in the extreme low range of the CV but the control valve cannot be allowed to completely shut off. In the low range of most valves, proper flow rates are not accurate and control becomes very unstable. COT allows the PID loops to operate for a set period of time in manual at a preset position until the burners are all started and flows are at their mid-range positions more capable of accurately being controlled. Then the PID algorithms take effect in Auto and the PID loops begin the process of controlling the temperature in the furnace. To the operator, the system appears to be in auto but in the program, the PID algorithm is being controlled in manual until the auto mode is capable of accurately controlling the PID block.
COT is to be used only in start-up situations or in recovery operations in which it is necessary to operate at a low-end setting to keep the burner system from shutting down.
When operating in a mode such as COT or Maintenance and when the mode is removed, the loop should resume its former status.
Use a toggle input from the HMI and the following logic to program bits for A/M, L/R, COT, and Maintenance.
Use of toggle bits to turn on a mode may not at first resemble a seal or latch circuit but in fact they act in a manner similar to both. The toggle bit (B3:0/0 or /1) may be turned on by an operator through the HMI and will remain on until the operator removes the toggle or until the NC contact logic interrupt the flow. When this happens, the circuit reverts to the safer off state. In the example of auto/manual (bit B3:0/0), the bit will turn off to the manual state. Note that the actual state of the SLC Auto/Manual bit is reversed from this logic.
Loops within Loops
The discussion now describes multiple PID blocks used to control a process.
The following example shows how a PID loop can be imbedded within another PID loop:
Fig. 19-105
In the example above, the inner loop is the flow valve with its setpoint the CV from the Level PID block. The outer loop is the Level PID block controlling level in the tank.
To successfully tune loops such as these, it is important to establish the order for tuning the loops. It is also important to establish parameters for tuning them.
- Tune the inner loop first. In this case, tune the Flow PID loop first.
- Establish comfortable tuning parameters for it and then proceed to tune the outer loop. The outer loop should be tuned to respond more slowly than the inner loop. The outer loop in the example is the Level PID loop. Try to tune it to respond about 2 to 10 times slower than the inner loop.
- Stability problems occur in general if the two loops are tuned too closely together or the outer loop is tuned to respond more quickly than the inner loop. So, keep the inner loop fast, outer loop slow and observe any instability. Ramp blocks should not be used on PID blocks such as these unless they are very quick acting. The inner loop should not have a Ramp block.
Fig. 19-106 Loop in a Loop
Whether a PLC or a DCS is better at implementing Process Control
We consider whether it is better to program the process in a DCS or PLC system today. We must consider each element of the list given below. Which is more efficient and which will give the best return for the customer. Remember the PLC can program in either Ladder or FBD, the language most like that of the DCS people. Also remember that the DCS will probably need a PLC also to mop up the digital part of the job.
- Each controller and its associated I/O
- Alarm management
- Batch/recipe and PLI
- Redundancy at all levels
- Historian
- Asset optimization r
- Fieldbus device management
What is beyond the PID function? Try Kalman Filter for starters. Give Student Dave at https://www.youtube.com/watch?v=FkCT_LV9Syk or https://www.youtube.com/watch?v=NT7nYv9Ri2Y a try.
Summary
This chapter has the purpose of taking the programmer from the state of asking “What is a PID loop” to being able to program a PID loop, implement a faceplate, consider how more than one PID block can be combined to control complex processes and encourage the programming of at least one PID project complete with tuning and HMI panel.
A student should be able to accomplish each of the steps listed above from the examples in the chapter and implement a PID process in the laboratory.
Students should also be able to read a P&ID and interpret the parts of the P&ID that can be implemented in a controller including the PID algorithm.
HMI considerations also should be heeded and alarms that control the mode of the PID block were discussed.
Several Lab Text Labs expand on the discussions of this chapter.
They may be found in the Lab Text under:
- Chapter 21 Gear Motor Speed Control – PID
- Chapter 22 Ball-in-Tube – PID
- Chapter 23 Tape Rewind – PID+ Chapter
- 24 Valve on Wall
- Chapter 25 Tank Over Tank
Lab19.1 PID
Use the Extruder/Mixing System making Dog Food of Fig. 19-60 to design a PID controller for the Fat Valve. A potentiometer may be present and (if present) may be used to represent the motor speed. Input the potentiometer into a second analog input. To simulate the change of speed of the motor, change the analog value from the pot.
Demonstrate the running face-plate with auto-manual and local-remote to the instructor. When the PID algorithm crosses between auto and manual or between auto-remote and auto-local provide a bump-less transfer (optional). You may program the A-B and Siemens processors in either Ladder or FBD. Both processors must be demonstrated and their PID control discussed in a lab report. The Siemens process is the ball-in-tube and the A-B process is the water valve.
Lab 19.2 Advanced PID
Add logic to PID Lab 17.1 to program to ramp from the old setpoint to a new setpoint using a ramping block. Program the ramping only for the remote mode (although the ramping function typically done in all automatic modes since it is needed to protect the process). When a new value is entered in the remote Sp entry location, the PID’s Sp is not to immediately change to the new Sp, but rather it is to be ramped up or down from the present value (found in the Pv). Save the Pv when the new Sp is detected and determine whether the Pv is below or above the new Sp. Set a seal coil or latch coil to remember which way the ramp is going (either up or down). Also, start a timer to time out each 5 to 10 seconds. When the timer times out, add a small amount (delta) to the new Sp and then compare it to the Remote Sp. If the ramped Sp went past the Remote Sp, stop the ramp and put the Remote Sp in the PID’s Sp. Then end the ramp program and wait for another Sp change. Also, stop the ramp if the PID loop is taken to manual from auto. Add a fault circuit that detects if the flow is dangerously low for the value of the output. If this kind of fault occurs, the PID algorithm might begin to wind up (read about anti-reset-windup in the PID section of the A-B book). If the low-flow fault occurs, blink an alarm light on the PanelView and turn the PID block to manual. Set the bit in the alarm banner.
Exercises
- When a PID controller is in remote, is the mode in auto or manual?
- True or False: Windup of the controller is possible in manual mode?
- True or False: The controller performs exactly the same whether the controller is set for E = PV – SP or E = SP – PV.
- What is the purpose of the small triangles on the left and right side of the bar graphs of a faceplate?
- List the function of the following ISA symbols:
- LT
- LIC
- FIC
- dTC
- The process engineer says that you are to move the PID controller from auto to manual if any of the analog signals (4-20 mA) are invalid in the low range. Show with an example how to accomplish this in ladder logic. Assume the analog inputs are in slot 5. Label all rungs explaining your logic.
- A temperature profile of two different TT’s is to be added together in varying percentages to provide the PV for a PID controller. Show with an example how to accomplish this in adder logic. Provide a mechanism so that if the percentage is not 100%, the PID block will only run in manual mode. Label all rungs explaining your logic. You should show the PID block but do not provide logic for the SP or CV. Assume the analog inputs are wired to a 4-20 mA analog card in slot 3.
- A speed sensor has a high and low alarm attached to it. The signal from the sensor is transmitted to a computer. Draw a P&ID of the speed signal transmitter, high alarm, and low alarm. Assume the signals are attached to a computer and are field-mounted.
- A differential pressure transducer transmits a signal that is used for flow. However, flow is proportional to the square root of the differential pressure. An analog input card is to be used with range 1-5V input for the PV and an analog output card is to be used for the CV, range 1-5V. The SP is to be input from an HMI. Draw the P&ID showing the mathematical calculation of the square root. Any symbol type is appropriate. Then write a program to control the flow using the analog cards listed. Assume the input card is in slot 4 and the output card is in slot 6.
- In some temperature control, the output device is a switch that turns on or off a resistor to produce heat. If the output of a PID block is fed to a discrete output that can only turn the resistors on or off, write a program to turn the discrete output on or off a proportion of 10 seconds based on the value of the CV. Assume the output CV can range only from 0 to 100 and its value is found in a storage location.
- Build a lag controller capable of a 5-second lag with value changes each .5 second. Build a lag controller capable of an x second lag with value changes each y second.
- Using either the PID blocks from A-B or Siemens, provide a program that will work in auto mode for the following P&ID. Use variables as inputs, outputs, and internal variables as necessary. Describe these variables in a table.
- Write logic to provide a 30-second lag given that the variable is to be updated each .1 second. Use A-B ladder format to demonstrate your answer.
- Using either the PID blocks from A-B or Siemens, provide a program that will work in auto mode for the following P&ID. Use variables as inputs, outputs, and internal variables as necessary. Describe these variables in a table.
- At the end of Ch. 19 is an article:
A Discussion Comparing DCS and PLC/SCADA for Process Control
DCS and PLC/SCADA – a comparison in use
The author stipulates:It may surprise you to know that PLC, HMI, and SCADA implementations today are consistently proving more expensive than DCS for the same process or batch application. CEE finds out more…
What does the author claim for the basis of his arguments, and what would you do as a PLC programmer to counter these claims? Be specific:
Using either the PID blocks from A-B or Siemens, provide a program that will work in auto mode for the following P&ID. Use variables as inputs, outputs, and internal variables as necessary. Describe these variables in a table. - Give an example of multiple inputs being used instead of just one value for the PV (Process Variable) of a PID Loop. Write a program using either A-B or Siemens to demonstrate your answer.
- An example was given in class describing how to control the pressure in a steel furnace even when the door was opened. Describe how you would accomplish this. Be specific:
- If an input range is listed as 0 mA to 21 mA and the range is from 0 to 32640, and we want a 4-20 mA. What is the numeric range of a 4-20 mA signal?
- A good value for P for a servo:
- A good cyclic time to update the PID Control for a servo:
- A good value for P for a water loop:
- A good cyclic time to update the PID control for a water loop:
- A good value for P for a temperature loop:
- A good cyclic time for the update of the PID control for a temperature loop:
- Name a PID control loop that does fine with no derivative component:
- Name a PID control loop that is unstable if the derivative is left at zero:
- The following program is a starter program to control the wind-up of the tape. To start understanding it, provide comments for each statement in the program listing. All statements are found in the cyclic interrupt program OB30, which is run every 100 ms. The individual motor programs can be used to control the speed portion of the gearmotor project discussed in the chapter.
- The following program is a starter program to control the water level in the top tank. To start understanding it, provide comments for each statement in the program listing. All statements are found in the cyclic interrupt program OB30 and start-up program OB100. OB30 is run every 1000 ms (1 sec).
This work is licensed under a Creative Commons Attribution 4.0 International License.