- •Table of Contents
- •Preface
- •Chapter 1 - Ladder Diagram Fundamentals
- •1-1. Objectives
- •1-2. Introduction
- •1-3. Basic Components and Their Symbols
- •1-4. Fundamentals of Ladder Diagrams
- •1-5. Machine Control Terminology
- •1-6. Summary
- •Chapter 2 - The Programmable Logic Controller
- •2-1. Objectives
- •2-2. Introduction
- •2-4. PLC Configurations
- •2-5. System Block Diagram
- •2-6. ... - Update - Solve the Ladder - Update - ...
- •2-7. Update
- •2-8. Solve the Ladder
- •2-9. Summary
- •Chapter 3 - Fundamental PLC Programming
- •3-1. Objectives
- •3-2. Introduction
- •3-3. Physical Components vs. Program Components
- •3-4. Example Problem 1
- •3-5. Disagreement Circuit
- •3-6. Majority Circuit
- •3-7. Oscillator
- •3-8. Holding (also called Sealed, or Latched) Contacts
- •3-9. Always-ON and Always-OFF Contacts
- •3-10. Ladder Diagrams Having More Than One Rung
- •Chapter 4 - Advanced Programming Techniques
- •4-1. Objectives
- •4-2. Introduction
- •4-3. Ladder Program Execution Sequence
- •4-5. RS Flip Flop
- •4-6. One Shot
- •4-8. T Flip Flop
- •4-9. J-K Flip Flop
- •4-10. Counters
- •4-11. Sequencers
- •4-12. Timers
- •Chapter 5 - Mnemonic Programming Code
- •5-1. Objectives
- •5-2. Introduction
- •5-3. AND Ladder Rung
- •5-4. Handling Normally Closed Contacts
- •5-5. OR Ladder Rung
- •5-6. Simple Branches
- •5-7. Complex Branches
- •Chapter 6 - Wiring Techniques
- •6-1. Objectives
- •6-2. Introduction
- •6-3. PLC Power Connection
- •6-4. Input Wiring
- •6-5. Inputs Having a Single Common
- •6-6. Output Wiring
- •6-7. Relay Outputs
- •6-8. Solid State Outputs
- •Chapter 7 - Analog I/O
- •7-1. Objectives
- •7-2. Introduction
- •7-3. Analog (A/D) Input
- •7-4. Analog (D/A) Output
- •7-5. Analog Data Handling
- •7-6. Analog I/O Potential Problems
- •Chapter 8 - Discrete Position Sensors
- •8-1. Objectives
- •8-2. Introduction
- •8-3. Sensor Output Classification
- •8-4. Connecting Discrete Sensors to PLC Inputs
- •8-5. Proximity Sensors
- •8-6. Optical Proximity Sensors
- •Chapter 9 - Encoders, Transducers, and Advanced Sensors
- •9-1. Objectives
- •9-2. Introduction
- •9-3. Temperature
- •9-4. Liquid Level
- •9-5. Force
- •9-6. Pressure/Vacuum
- •9-7. Flow
- •9-8. Inclination
- •9-9. Acceleration
- •9-10. Angle Position Sensors
- •9-11. Linear Displacement
- •Chapter 10 - Closed Loop and PID Control
- •10-1. Objectives
- •10-2. Introduction
- •10-3. Simple Closed Loop Systems
- •10-4. Problems with Simple Closed-Loop Systems
- •10-5. Closed Loop Systems Using Proportional, Integral, Derivative (PID)
- •10-6. Derivative Function
- •10-7. Integral Function
- •10-8. The PID in Programmable Logic Controllers
- •10-9. Tuning the PID
- •10-10. The “Adjust and Observe” Tuning Method
- •10-11. The Ziegler-Nichols Tuning Method
- •Chapter 11 - Motor Controls
- •11-1. Objectives
- •11-2. Introduction
- •11-3. AC Motor Starter
- •11-4. AC Motor Overload Protection
- •11-5. Specifying a Motor Starter
- •11-5. DC Motor Controller
- •11-6. Variable Speed (Variable Frequency) AC Motor Drive
- •11-7. Summary
- •Chapter 12 - System Integrity and Safety
- •12-1. Objectives
- •12-2. Introduction
- •12-3. System Integrity
- •12-4. Equipment Temperature Considerations
- •12-5. Fail Safe Wiring and Programming
- •12-6. Safety Interlocks
Chapter 10 - Closed Loop and PID Control
As the previous example illustrates, attempting to improve the performance of a closed loop system by simply increasing the proportional gain kp has lackluster results.
Some performance improvement can be achieved up to a point, but any further attempts to increase the proportional gain result in an unstable system. Therefore, some other method must be used to “tune” the system to achieve more desirable levels of performance.
10-5. Closed Loop Systems Using Proportional, Integral, Derivative (PID)
In the example previously used, there were three fundamental problems with the simple system using only proportional gain. First, the system had a large offset; second, it was slow to respond to changes in the SP (both of these problems were caused by a low proportional gain kp), and third, when the proportional gain was increased to reduce the offset and minimize the response time, the system became unstable and oscillated. It was impossible to simultaneously optimize the system for low offset, fast response, and high stability by tuning only the proportional gain kp.
To improve on this arrangement, we will add two more functions to our closed loop control system which are an integral function ki ∫ and a derivative function kd dtd , as shown
in Figure 10-7. Notice that in this system, the error signal is amplified by kp and then applied to the integral and derivative functions. The outputs of the proportional gain
amplifier, kp, the integral function ki ∫ , and the derivative function, kd dtd , are added together
at the summing junction to produce the CV. The values of kp, ki, and kd, are multiplying constants that are adjusted by the system designer, and are almost always set to a positive value or zero. If a function is not needed, it’s particular k value is set to zero.
For the proportional kp function, the input is simply multiplied by kp. For the integral ki function, the input is integrated (by taking the integral) and then multiplied by ki. For the derivative kd function, the input is differentiated (by taking the derivative), and then multiplied by kd. There is some interaction between these three functions; however, generally speaking each of them serves a specific and unique purpose in our system. Although the names of these functions (integral and derivative) imply the use of calculus, an in-depth knowledge of calculus is not necessary to understand and apply them.
10-7
Chapter 10 - Closed Loop and PID Control
|
ERROR |
|
CV |
SP |
kp |
kiI |
CONTROLLED |
MACHINE |
|||
|
|
d |
SUMMING |
|
|
JUNCTION |
kd dt
PV
Figure 10-7 - Closed Loop Control System with Ideal PID
The PID system shown in Figure 10-7 is called an ideal PID and is the most commonly used PID configuration for control systems. There is another popular version of the PID called the parallel PID or the electrical engineering PID in which the three function blocks (proportional, integral and derivative) are connected in parallel, as shown in Figure 10-8. When properly tuned, the parallel PID performs identical to the ideal PID. However, the values of ki and kd in the parallel PID will be larger by a factor of kp because the input to these functions is not pre-amplified by kp as in the ideal PID.
|
kp |
CV |
|
ERROR |
|
SP |
kiI |
CONTROLLED |
MACHINE |
||
|
d |
SUMMING |
|
JUNCTION |
|
|
kd dt |
|
|
|
PV |
Figure 10-8 - Closed Loop Control System with Parallel PID Type
10-6. Derivative Function
By definition, a true derivative function outputs a signal that is equal to the graphical slope of the input signal. For example, as illustrated in Figure 10-9a, if we input a linear ramp waveform (constant slope) into a derivative function, it will output a voltage that is
10-8
Chapter 10 - Closed Loop and PID Control
equal to the slope m of the ramp, as shown in Figure 10-9b. For a ramp waveform, we can calculate the derivative by simply performing the “rise divided by the run” or m = )y/)t, where )y is the change in amplitude of the signal during the time period )t. As Figure 10-9b shows, our ramp has a slope of +0.5 during the time period 0 to 2 seconds, and a slope of -0.5 for the time period 2 to 4 seconds.
y |
|
|
t |
|
|
|
|
m |
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
1 |
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
y |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
0.5 |
|
|
|
|
|
|
0.5 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
t (seconds) 0 |
|
|
|
|
|
|
|
|
|
|
t (seconds) |
|
0 |
1 |
2 |
3 |
4 |
|
1 |
|
2 |
|
|
3 |
|
4 |
|
|||||||
|
|
|
|
|
|||||||||||||||||
|
|
|
|
|
(a) |
|
|
-0.5 |
|
|
|
|
(b) |
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
-1 |
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Figure 10-9 - Slope (Derivative) of a Ramp Waveform
As another example, if we input any constant DC voltage into a derivative function, it will output zero because the slope of all DC voltages is zero. Although this seems simple, it becomes more complicated when the input signal is neither DC nor a linear ramp. For example, if the input waveform is a sine wave, it is difficult to calculate the derivative output because the slope of a sine wave constantly changes. Although the exact derivative of a sine wave (or any other waveform) can be determined using calculus, in the case of control systems, calculus is not necessary. This is because it is not necessary to know the exact value of the derivative for most control applications (a close approximation will suffice), and there are alternate ways to approximate the derivative without using calculus. Since the derivative function is generally performed by a digital computer (usually a PLC or a PID coprocessor) and the digital system can easily, quickly, and repeatedly calculate )y/)t, we may use this sampling approximation of the derivative as a substitute for the exact continuous derivative, even when the error waveform is non-linear. When a derivative is calculated in this fashion, it is usually called a discrete derivative, numerical derivative, or difference function. Although the function we will be using is not a true derivative, we will still call it a “derivative” for brevity. Even if the derivative function is performed electronically instead of digitally, the function is still not a true derivative because it is usually bandwidth limited (using a low pass filter) to exclude high frequency components of the signal. The reason for this is that the slopes of high frequency signals can be extremely steep (high values of m) which will cause the derivative circuitry to output extremely high and erratic voltages. This would make the entire control system overly sensitive to noise and interference.
10-9
Chapter 10 - Closed Loop and PID Control
We will now apply the derivative function to our motor control system as shown in
Figure 10-10. For this exercise, we will be adjusting the proportional gain kp and the derivative gain kd only. The integral function will be temporarily disabled by setting ki to zero.
|
ERROR |
|
CV |
|
SP |
kp |
kiI |
CONTROLLED |
TACHO-GENERATOR |
MACHINE |
||||
|
|
d |
SUMMING |
|
|
|
JUNCTION |
|
|
|
|
kd dt |
|
|
PV
Figure 10-10 - Closed Loop Control System with Ideal PID
Previously, when we increased the proportional gain of our simple closed loop DC motor speed system example, it began to exhibit instability by hunting. This particular instance was shown in Figure 10-5, and for easy reference, it is shown again below in
Figure 10-11.
Figure 10-11 - Motor Speed Control Response
with High kp Only
Without changing the proportional gain kp , we will now increase the derivative gain kd a small amount. The resulting response is shown in Figure 10-12.
10-10
Chapter 10 - Closed Loop and PID Control
Figure 10-12 - DC Motor Speed Control with High kp and Low Derivative Gain kd
The reader is invited to study and compare Figures 10-11 and 10-12 for a few moments. Notice in particular the way the motor speed accelerates at time t = 0+, the top speed that the motor reaches while the system is hunting, and the length of time it takes the speed to settle.
To see why the addition of derivative gain made such a dramatic improvement in the performance of the system we need to consider the dynamics of the system at certain elapsed times.
First, at time t = 0, the SP is switched from zero to a voltage corresponding to a motor speed of 1000 rpm. Since the motor is not rotating, the tacho-generator output will be zero and the PV will be zero. Therefore, the error voltage at this instant will be identical in amplitude and waveshape to the SP. At time zero when the SP is switched on, the waveshape will have a very high risetime (i.e., a very high slope) which, in turn, will cause the derivative function to output a very large positive signal. This derivative output will be added to the output of the proportional gain function to form the CV. Mathematically, the
CV at time t = 0+ will be
CV(t = 0+) = kp SP + kd mSP
where mSP is the slope of the SP waveform. Since the slope mSP is extremely large at t = 0+, the CV will be large which, in turn, will cause the motor to begin accelerating very rapidly. This difference in performance can be seen in the response curves. In Figure 10-11, the motor hesitates before accelerating, mainly due to starting friction (called
10-11
Chapter 10 - Closed Loop and PID Control
stiction) and motor inductance, while in Figure 10-12 the motor immediately accelerates due to the added “kick” provided by the derivative function.
Next, we will consider how the derivative function reacts at motor speeds above zero. Since the SP is a constant value and the error is equal to the SP minus the PV, the slope of the error voltage is going to be the opposite polarity of the slope of the PV. In other words, the error voltage will increase when the PV decreases, and the error voltage will decrease when the PV increases. Since the waveshape of the PV is the same as the waveshape of the speed, we can conclude that the slope of the error voltage will be the same as the negative of the slope of the speed curve. Additionally, since the output of the derivative function is equal to the slope of the error voltage, then we can also say that the output of the derivative function will be equal to the negative of the slope of the speed curve (for values of time greater than zero). Mathematically, this can be represented as
CV(t > 0) = kp (SP - PV) + kd m(SP - PV)
Since the SP is constant, its slope will be zero. Additionally, as we concluded earlier, the PV is the same as the speed. Therefore, we can simplify our equation to be
CV(t > 0) = kp (SP - speed) - kd mspeed
In other words, the CV is reduced by a constant kd times the slope of the speed curve. Therefore, as the motor accelerates, the derivative function reduces the CV and therefore attempts to reduce the rate of acceleration. This phenomenon is what reduced the motor speed overshoot in Figure 10-12 because the control system has “throttled back” on the motor acceleration. In a similar manner, as the motor speed decelerates, the negative speed slope causes the derivative function to increase the CV in an attempt to reduce the deceleration rate.
Since the derivative function tends to dampen the motor’s acceleration and deceleration rates, the amount of hunting required to bring the motor to its final operating speed is reduced, and the system settles more quickly. For this reason, the derivative function is sometimes called rate damping. If the machine is diesel, gasoline, steam, or gas turbine powered, this is sometimes called throttle damping. Also, if the hunting can be reduced by increasing kd, we can then increase the proportional gain kp to help further reduce the offset without encountering instability problems.
It would seem logical that if the derivative function can control the rate of acceleration to reduce overshoot and hunting, then we should be able to further improve the motor control performance shown in Figure 10-12 by an additional increase in kd. Figure 10-13 shows the response of our motor control system where kd has been increased by a factor of 4. Note that now there is only a slight overshoot and the system settles very quickly. It is possible to achieve even faster response of the system by further increasing
10-12