PID controller
A PID controller (proportional, integral and derivative controller) is a control mechanism that through a feedback loop allows to regulate the speed, temperature, pressure and flow among other variables of a process in general. The PID controller calculates the difference between our actual variable against the desired variable
The PID control algorithm consists of three different parameters: the proportional, the integral, and the derivative. The proportional value depends on the current error, the integral depends on past errors, and the derivative is a prediction of future errors. The sum of these three actions is used to adjust the process by means of a control element, such as the position of a control valve or the power supplied to a heater.
Historically, it has been considered that when there is no knowledge of the process, the PID controller is the most appropriate controller. By adjusting these three variables in the PID control algorithm, the controller can provide a control action tailored to the specific process requirements. The controller's response can be described in terms of the control's response to error, the degree to which the controller overshoots the set point, and the degree of system oscillation. Note that the use of the PID for control does not guarantee optimum system control or system stability.
Some applications may require only one or two modes provided by this control system. A PID controller can also be called PI, PD, P or I in the absence of the respective control actions. PI controllers are particularly common, as the derivative action is very sensitive to noise, and the absence of the integral process can prevent the desired value from being reached due to the control action.
History and applications
The first PID controllers began with the design of speed limiters. Later, PID controllers were used for automatic steering of ships. One of the earliest examples of a PID controller was developed by Elmer Sperry in 1911, while the first theoretical analysis of a PID controller was published by Russian American engineer Nicolas Minorsky in 1922. Minorsky was designing automatic steering systems for the Navy. of the United States and performed his analysis by observing the helmsman, noting that the helmsman was controlling the ship not only by current error, but also based on past errors and the current rate of change, thus allowing Minorsky to develop a mathematical model for this. His goal was to achieve stability, not overall control, which simplified the problem significantly. While proportional control provides stability against small disturbances, it was insufficient to deal with constant disturbances, such as a strong windstorm, which required an integral term. Finally, the derivative term was added to improve control.
The controller was tested on the USS New Mexico (BB-40), where it was in charge of controlling the angular rate of the rudder. The PI control was kept turning with an error of ±2°. Adding the D element achieved an error of ±1/6°, much better than what a helmsman could achieve.
Ultimately, due to personnel resistance, the Navy did not adopt this system. Similar works were carried out and published in the 1930s.
Because it has a greater accuracy than proportional, proportional derivative and proportional integral controllers it is used in more crucial applications such as control of pressure, flow, force, speed, in many chemical applications, and other variables. In addition, it is used in automobile speed regulators (cruise control or cruise control) and residual ozone control in contact tanks.
A very simple example that illustrates the basic functionality of a PID is when a person enters a shower. Initially, it opens the hot water faucet to increase the temperature to an acceptable value (also called setpoint). The problem is that there may come a time when the water temperature exceeds this value, so the person has to open the cold water tap a little to counteract the heat and maintain balance. The cold water is adjusted until reaching the desired temperature. In this case, the human is the one who is exercising control over the control loop, and is the one who makes the decisions to open or close any of the keys; but wouldn't it be ideal if instead of us, it was a machine that made the decisions and maintained the temperature we want?
This is the reason why PID loops were invented: to simplify the tasks of the operators and to exert a better control over the operations. Some of the most common applications are:
- Temperature bonds (air conditioning, heaters, refrigerators, etc.)
- Level bonds (level in liquid tanks such as water, dairy, mixtures, crude, etc.)
- Pressure bonds (to keep a predetermined pressure in tanks, tubes, containers, etc.)
- Flow links (maintain the flow within a line or pipe)
Operation
For the correct operation of a PID controller that regulates a process or system, it is necessary, at least:
- A sensor, which determines the state of the system (thermometer, flowmeter, gauge, etc.).
- A controller, which generates the signal governing the actuator.
- An actuator, which modifies the system in a controlled manner (electric resistance, motor, valve, pump, etc.).
The sensor provides an analog or digital signal to the controller, which represents the current point at which the process or system is located. The signal can represent that value in electric voltage, electric current or frequency. In this last case, the signal is alternating current, unlike the two previous ones, which can also be direct current.
The controller receives an external signal that represents the value to be achieved. This signal is called the set point (or reference point, desired value or setpoint), which is of the same nature and has the same range of values as the signal provided by the sensor. To make this compatibility possible and, in turn, the signal can be understood by a human, it will be necessary to establish some type of interface (HMI-Human Machine Interface), they are screens of great visual value and easy to use that are used to make more intuitive to control a process.
The controller subtracts the current point signal from the set point signal, thus obtaining the error signal, which determines at each instant the difference between the desired value (set point) and the measured value. The error signal is used by each of the 3 components of the PID controller. The 3 added signals make up the output signal that the controller will use to govern the actuator. The signal resulting from the sum of these three is called manipulated variable and is not directly applied to the actuator, but must be transformed to be compatible with the actuator used.
The three components of a PID controller are: Pproportional part, Iintegral action, and Dderivative action. The weight of the influence that each of these parts has on the final sum is given by the proportional constant, the integral time and the derivative time, respectively. The aim is to ensure that the control loop effectively corrects the effects of disturbances in the shortest possible time.
Proportional
The proportional part consists of the product of the error signal and the proportional constant to bring the steady-state error close to zero, but in most cases, these values will only be optimal in a certain portion of the time. total range of control, with different optimum values for each portion of the range. However, there is also a limit value in the proportional constant from which, in some cases, the system reaches values higher than those desired. This phenomenon is called overshoot and, for safety reasons, it should not exceed 30%, although it is convenient that the proportional part does not even cause overshoot. There is a continuous linear relationship between the value of the controlled variable and the position of the final control element (the valve moves at the same value per unit of deviation). The proportional part does not consider time, therefore, the best way to solve the permanent error and make the system contain some component that takes into account the variation with respect to time, is by including and configuring the integral and derivative actions.
The proportional formula is given by: Psal=Kpe(t){displaystyle P_{mathrm {sal} }=K_{p},{e(t)}}
Where:
Kp{displaystyle K_{text{p}}} is proportional gain, tuning value.
e(t)=SP− − PV(t){displaystyle e(t)=mathrm {SP} -mathrm {PV} (t)} is error (SP is the point of establishment, and PV(t) is the process variable)
t{displaystyle t} is instant time or time (the current one),
The error, the proportional band and the initial position of the final control element are expressed in so much per one. It will indicate the position that the final control element will occupy.
Example: Change the position of a valve (final control element) proportionally to the deviation of the temperature (variable) from the set point (desired value).
Comprehensive
The Integral control mode is intended to reduce and eliminate the error in steady state, caused by external disturbances and which cannot be corrected by proportional control. The integral control acts when there is a deviation between the variable and the set point, integrating this deviation in time and adding it to the proportional action. The error is integrated, which has the function of averaging or adding it for a determined period; It is then multiplied by a constant Ki. Subsequently, the integral response is added to the Proportional mode to form the P + I control in order to obtain a stable response of the system without stationary error. The integral mode presents a lag in the response of 90° which added to the 180° of the feedback (negative) brings the process closer to having a lag of 270°, then it will only be necessary for the dead time to contribute 90° of delay to cause the oscillation of the process. <<< the total gain of the control loop must be less than 1, and thus induce an attenuation in the controller output to lead the process to stability. >>> It is characterized by the integral action time in minutes per repetition. It is the time in which before a step signal, the final control element repeats the same movement corresponding to the proportional action.
The integral control is used to obviate the drawback of the offset (permanent deviation of the variable with respect to the set point) of the proportional band.
The whole formula is given by: Isal=Ki∫ ∫ 0te(Δ Δ )dΔ Δ {displaystyle I_{mathrm {sal} }=K_{i}int _{0}{t}{e(tau)}{,{dtau }}}}
Where:
Ki{displaystyle K_{text{i}}} is the integral gain, an adjustment parameter,
Δ Δ {displaystyle tau } is the integration variable (take into account the value from the instant 0 to the current instant t{displaystyle t}).
Example: Move the valve (final control element) at a speed proportional to the deviation from the set point (desired variable).
Derivative
The derivative action is manifested when there is a change in the absolute value of the error; (if the error is constant, only the proportional and integral modes work).
The error is the deviation between the measurement point and the set point, or "Set Point".
The function of the derivative action is to keep the error to a minimum by correcting it proportionally with the same speed that it occurs; in this way it prevents the error from increasing.
It is derived with respect to time and multiplied by a constant Kd and then added to the above signals (P+I). It is important to adapt the control response to changes in the system since a higher derivative corresponds to a faster change and the controller can respond accordingly.
The derivative formula is given by: Dsal=Kddedt{displaystyle D_{mathrm {sal} }=K_{d}{frac {de}{dt}}}}}
Where:
Kd{displaystyle K_{text{d}}} is the derivative gain, an adjustment parameter,
t{displaystyle t} is instant time or time (the present)
The derivative control is characterized by the derivative action time in minutes in advance. Derivative action is appropriate when there is a delay between the movement of the control valve and its impact on the controlled variable.
When the derivative action time is large, there is instability in the process. When the derivative action time is short, the variable oscillates too much in relation to the set point. It is rarely used due to its sensitivity to noise and the complications that this entails.
The optimal time of derivative action is the one that returns the variable to the set point with the minimum oscillations
Example: Corrects the position of the valve (final control element) proportionally to the rate of change of the controlled variable.
The derivative action can help reduce the overshoot of the variable during process startup. It can be used in systems with considerable delay times, because it allows a rapid repercussion of the variable after a disturbance occurs in the process.
Meaning of constants
Kp proportionality constant: can be set as the value of the controller gain or the percentage of proportional band. Example: Changes the valve position proportionally to the deviation of the variable from the set point. The P signal moves the valve by faithfully following the temperature changes multiplied by the gain.
Ki constant of integration: indicates the speed with which the proportional action is repeated.
Kd derivation constant: makes the response of the proportional action present by doubling it, without waiting for the error to double. The value indicated by the derivation constant is the period during which the proportional action corresponding to 2 times the error will manifest and then disappear. Example: Moves the valve at a speed proportional to the deviation from the set point. The I signal adds the different areas between the variable and the set point, repeating the proportional signal according to the derivative action time (minutes/repetition).
Both the Integral action and the Derivative action affect the dynamic gain of the process. The integral action serves to reduce the stationary error, which would always exist if the constant Ki were zero. Example: Corrects the valve position proportionally to the rate of change of the controlled variable. The signal d is the slope (tangent) by the curve described by the variable.
The output of these three terms, the proportional, the integral, and the derivative are added to calculate the output of the PID controller. Defining y(t) as the controller output, the final form of the PID algorithm is:
- and(t)=MV(t)=Kpe(t)+Ki∫ ∫ 0te(Δ Δ )dΔ Δ +Kddedt{displaystyle mathrm {y(t)} =mathrm {MV(t)} =K_{p}{e(t)}{i}int _{0}{t}{e(tau)}}}}{,{dtau }+K_{d}{frac {de}{dt}}}}{
PID parameter setting
The objective of the PID parameter adjustments is to ensure that the control loop corrects efficiently and in the minimum time the effects of disturbances; the minimum integral of error has to be achieved. If the PID controller parameters (proportional, integral and derivative gain) are chosen incorrectly, the process to be controlled can be unstable, for example, that its output varies, with or without oscillation, and is limited only by saturation or mechanical breakage. To adjust a control loop means to adjust the control system parameters to the optimum values for the desired control system response. The optimal behavior before a change of the process or change of the "setpoint" varies depending on the application. Generally, stability to the response given by the controller is required, and the controller must not oscillate under any combination of process conditions and changing "setpoints". Some processes have a degree of non-linearity and some parameters that work well under full load conditions do not work when the process is in the 'no load' state. There are several methods to tune a PID loop. The most effective method generally requires developing some form of process model, then choosing P, I, and D based on the dynamic model parameters. Manual tuning methods can be very inefficient. The choice of a method will depend on whether the loop can be "disconnected" to adjust it, and the response time of the system. If the system can be switched off, the best tuning method is often to tune the input, measuring the output as a function of time, and using this response to determine the control parameters. We now describe how to perform a manual adjustment.
Manual adjustment
If the system is to be kept online, one method of tuning is to first set the values of I and D to zero. Next, increase P until the loop output oscillates. Then set P to about half of the previously set value. Then increase I until the process adjusts to the required time (although increasing I too much can cause instability). Finally, increase D, if needed, until the loop is fast enough to reach its reference after a sudden change in load.
A very fast PID loop reaches its setpoint quickly, a not so fast PID loop reaches its setpoint not so quickly. Some systems are not capable of accepting this abrupt trigger; In these cases, another loop is required with a P less than half the P of the previous control system.
Ziegler-Nichols method
The Ziegler-Nichols method allows a test to be carried out on the system to be controlled and from this test the necessary PID parameters are calculated to achieve a good fast response with little overshoot.
Limitations of a PID control
While PID controllers are applicable to most control problems, they can be poor in other applications. PID controllers, when used alone, can give poor performance when the PID loop gain must be reduced so that it does not trip or oscillate above the "setpoint" value.. Control system performance can be improved by combining the closed loop of a PID control with an open loop. Knowing the system (such as the acceleration needed or the inertia) can be driven and combined with the PID output to increase the final performance of the system. Only the forward value (or Feedforward Control) can provide the largest portion of the controller's output. The PID controller can be used primarily to respond to any difference or "error" that remains between the setpoint and the current value of the process. As the output of the forwarding loop is not affected by the feedback of the process, it can never cause the system to oscillate, increasing system performance, response and stability.
For example, in most motion control systems, to accelerate a mechanical load, more force (or torque) is needed from the motor. If a PID loop is used to control the speed of the load and drive the necessary force or torque to the motor, it may be useful to take the desired instantaneous acceleration value for the load, and add it to the output of the PID controller. This means that regardless of whether the load is being accelerated or decelerated, a proportional amount of force is being handled by the motor in addition to the PID feedback value. The PID loop in this situation uses the feedback information to increase or decrease the difference between the setpoint and the value of the first. Working together, the feed-feedback combination provides a more reliable and stable system.
Another problem with the PID is that it is linear. Mainly the performance of PID controllers in nonlinear systems is variable. Also another common problem that the PID has is that in the derivative part, noise can affect the system, making these small variations make the output change very large. Generally a Low Pass Filter helps, as it removes the high frequency components of the noise. However, an FPB and a derivative control can cause them to cancel each other out. Alternatively, the derivative control can be taken out on some systems without much loss of control. This is equivalent to using a PID controller like PI only.
Practical examples
You want to control the flow rate of an inlet stream into a chemical reactor. In the first place, a valve must be installed to control the flow of said flow, and a flow meter, in order to have a constant measurement of the value of the flow that circulates. The controller will monitor that the flow that circulates is the one established by us; When it detects an error, it will send a signal to the control valve so that it will open or close, correcting the measured error. And thus we will have the desired and necessary flow. The PID is a mathematical calculation, what sends the information is the PLC.
It is desired to maintain the internal temperature of a chemical reactor at its reference value.
There must be a temperature control device (it can be a heater, an electrical resistance,...), and a sensor (thermometer). The P, PI or PID will control the variable (in this case the temperature). The moment this is not correct, it will notify the control device so that it acts, correcting the error.
Anyway, the most correct thing is to put a PID; if there is a lot of noise, a PI, but a P is not very useful since it would not correct up to the exact value.
A very common example is the altitude control of a drone, where the signal to be controlled is the altitude by means of an altitude sensing instrument (it can be an ultrasonic sensor on the drone or possibly a camera connected externally in wireless communication, etc), and where the variable to control is the speed and therefore the upward thrust of the ground of the drone. A P control would directly give a response to each variation trying to compensate the error, immediately, as this is not practical, the Derivative part (D) is added, where this part of the control is dedicated to compensating the variations "smoothing them" and allowing a temporal-longitudinal space between the spaces and the responses of the control, in this case, since it cannot react in the same way, it is not enough to compensate the error generating an "offset", finally a Integral part to the control (I), giving it the facility to adjust the variations between responses to the error, minimizing the "offset" generated.