Check out our new course:

#### with Studio 5000 Logix Designer

Check out our new course:

# What Is A PID Controller And How It Works?

## Introduction to PID controller

A proportional-integration-derivative PID controller is a system to control different operations like speed, flow rate, pressure, temperature, and various other processing variables. It provides the ability to automatically maintain the set value and compensate for changes in process and environment.

PID controller uses a closed feedback control system that regulates the required parameters to its set point/desired value by playing with various operations.

PID controllers are considered one of the most accurate and suitable control systems.

To regulate the output variable, PID controllers perform different input operations that keep the value of a specific variable at the desired or targeted point.

PID controllers continuously monitor the difference between the output value named a process variable (PV) and setpoint (SP) and play their role using proportional, integral, and deviation mechanisms.

This correction mechanism continues automatically to minimize error e(t) for getting the value of a process variable ready to the desired point.

The first practical example of this PID control system was found in controlling the steering system for ships, this technology developed in the 1920s.

Afterward, it gained importance in the manufacturing industry as well.

Nowadays, all the accurately working equipment uses some kind of  PID system to regulate the variables at the setpoint (SP).

The schematic of the PID controller working is shown in the following Figure.

A block diagram of PID control system having feedback closed loop. Here τ(t) is the setpoint or desired value while y(t) is the value of the variable known as a process variable (PV).

The value of PV is calculated as PV = y(t) : e(t) = τ(t) – y(t), and the corrective action is applied based on the proportional, integration and deviation rules. This controller takes corrective actions by adjusting the control variable (CV) u(t).

### What Are Proportional, Integral, And Derivatives in PID?

According to this model:

• The term “P” is for a proportional system. If the error e(t) = SP – PV is large and positive, the controller’s command to the control variable will be larger consequently and small in case of a minor error. At a specific duration of time, if there is no error in the system, no corrective action will be taken by the proportional controller part. It is also known as ‘First Order’ because it responds to output only once every time period. In other words, proportional action is independent of time.
• The term “I” is associated with integration. It sums the past values of e(t) = SP – PV to get the final I value for the controller system. If there is still a residual error after taking the action of the proportional controller system, the integral control takes action by eliminating the accumulated error from past calculations. In another way, the proportional error diminishes after its action, but the integral system compensates for this effect. It is also known as ‘Second order’ because it acts as a memory of the previous changes in the system or dynamics of the system. In other words, integral action has a memory of past process behavior.
• The term “D” estimates the future error value e(t) = SP – PV by analyzing the current deviations. It is related to the rate of change, if the rate of change is larger, then the rate of action will be rapid, and if the change rate is slow, then the corrective action will be slow. Derivative action enhances control performance around setpoint conditions because it acts as the rate of change of the controller output.

## Mathematical Calculations of PID Controller

The proper mathematical relation including all the functionalities of its sub-controllers is:

Kp, Ki, and Kd are the coefficients of proportional, integral, and deviation terms. These coefficients can also be represented as P, I, and D.

In the following equation, the term Ki and Kd are replaced by Kp/Ti and Kp/Td to take advantage of their physical meaning because they represent the integration and deviation time.

## PID controller applications

Applications of a PID controller are named by the process variable that is the value that is measured or controlled by a control system.

### PID used for temperature control

Temperature control is one of the simplest applications of the PID controller – when you want to keep something hot or cold, just use an open or closed-loop form of PID.

As soon as temperature swings out of range, either turn on whatever heat source you have or release whatever cooling agent you use!

For example, a fuel valve for a heater when sensing action is performed by a thermocouple in heating equipment.

This constant is usually incorporated due to delayed action in sensing and, finally, the controlling element, such as the control valve.

### PID used for level control

For level control, it’s usually best to use a floating valve (i.e., one which opens and closes depending on the pressure in your system). The PID controller can be used by adding a feedback value.

For example, in a process industry, the chemical level in a tank is maintained by measuring the level continuously, calculating the difference between setpoint (SP) and this level, and consequently adjusting the input valve position.

### PID used for velocity control

For velocity control, you can think about using PID. Now, your system is trying to bring about equilibrium in the rate at which something changes (i.e., the acceleration and deceleration of an object).

For this type of control, it’s best to use a PID algorithm that includes the integral term.

### PID used for position control

Position control is a bit like velocity in that it’s about moving towards some position or displacement. However, this is not quite the same as bringing something to a stop (like we saw in level and flow rate control).

Still, instead, we’re talking about trying to aim for an exact value – this means setting up your bounds so that your system either ends up at the desired place or stops immediately.

You can use PID with position control, but you’ll probably need to tune your I term so that it’s larger than usual.

### PID used for flow control

The simplest flow control method is On-Off Control, where the pump or valve is either on or off.

However, this method has several problems, such as:

• Large changes in flow rate when starting and stopping the pump.
• Non-linear flow characteristics (the amount of flow is not directly proportional to the speed of the pump/valve).
• Non-continuous circulation (there are low points where fluid is not circulated).
• Overfilling (the pump will continue to fill the piping with liquid if it is not stopped).

PID control is a more advanced flow control method that uses feedback to constantly monitor the process and adjust the current according to how far from preset limits it is operating.

The output of the PID is connected to a pump via VFD, and the flow control is done by varying the speed of the motor, which in turn varies the flow.

Or the output of the PID is connected to an analog valve with 4-20mA output. The flow control, in this case, is done by varying the opening of the valve, which in turn varies the flow.

### PID used for pressure control

There are various ways to control the pressure in a system, but you can choose the P controller because it is simple to implement and very quick to tune.

You can use a P controller for systems that require burst cutting or suction control, typically any time you need a fast response up to your maximum.

Pressure control is used when large flow changes are needed to maintain output pressure at a constant value.

### PID used for motor control

In this application, the position of a motor is controlled by using PID control.

The speed command and the error value between actual speed and desired value are usually obtained from the motor drive (VFD).

## Customized or selective use of PID controller

Most industries and houses use equipment integrated with the PID control system to get a good result in controlling the system variables.

There is still some application in which we can selectively use the P, I, PI, or PD control system to meet the desired requirements. In this case, the unused parameter is set to zero or an inherently designed P, I PI, or PD control system.

PI controller is commonly used in different applications where the deviation system measures error while the integration system plays a role in eliminating that error.

Different PID Controllers:

• Proportional-Integral-Derivative (PID) controller is the most common type of feedback control. The PID controller uses all three components, P, I, and D.
• A proportional (P) controller uses only proportional action to correct deviations from desired parameter value while acting on the error signal generated by the controller output.
• Proportional-Integral (PI) controller also uses the integral action to maintain closed-loop performance for extended time periods at steady-state conditions. As a result, it is very stable, but it may cause system overshoot due to its delayed corrective action.
• Proportional-Derivative (PD) controller uses the derivative action to correct deviations from desired parameter value measured by the rate of change of process variable, i.e., error signal generated by the controller output.

## Benefits of PID Control

• PID controller is reliable: A PID controller’s first advantage is that it’s super reliable. If you set up your system correctly, you’ll find that the PID algorithm is so simple to understand and implement that you can almost take it for granted. This means there’s less chance of errors being introduced during implementation – which means a more reliable system!
• Wide range of applications: The next advantage is that a PID controller can deal with a wide range of applications. Many control algorithms exist, but they’re usually only suitable for specific tasks. If your application is a bit outside of what they can do, you’ll probably need to use something else. Not so with PID, which makes it easy to use this algorithm wherever required!
• Processing power: PID controllers don’t require much processing power. This means that many systems can run PID, including industrial PLCs or simple micro-controllers, which would struggle to run other algorithms that need more processing power.
• Easy to understand: PID algorithm itself is straightforward to understand and implement. This means that if something goes wrong, then it’s easier to find and fix any problems. This is not always the case with other control systems, which can be more complicated to understand.
• Easy to tune: PID controllers are much easier to tune than other methods. It’s not always easy to work out how it will behave in your system, though, especially if you’re trying to do something precise.
• Supported by all PLC programming software: PID function is supported in all PLC programming software. The parameters can be named differently, but the overall operation is the same.

## Limitations and drawbacks of PID controller

• Tuning: The performance of the PID controller depends on good tuning to be good enough. If the process is not tuned correctly, it will not work as well as expected and will not produce the optimal results needed for it to be efficient.
• The big picture: Even with a tuned PID controller, there are still tradeoffs that must be considered. When using a PID controller, the process must be controlled using an input that is not used for any other purpose. This often means that the PID controller must now control another variable that a human previously controlled. The problem is that humans are better than machines at controlling multiple variables since they can look at the entire picture and choose an appropriate response. Since the PID controller looks at one variable, it is possible that the controller will not choose the most appropriate response to changes in other variables.
• Process dynamics: The PID controller also has very strict operating requirements. A PID can be used without much trouble when the process’s dynamics are linear and time-invariant. However, if these conditions are not met, the controller’s performance will decrease significantly. In addition, the PID must be tuned when either gain or time delay changes. This means it is possible to go from a well-tuned system to an unstable one in just one step if changes in time delay and/or gain are made simultaneously.
• Disturbance: The PID controller cannot distinguish between an offset and disturbance, making it difficult to differentiate between changes in the process that are worth reacting to and those that are not. This causes problems because when a PID responds to disturbances or offsets, it forces the process out of its normal range of operation. As a result, the process becomes more challenging to control, and the PID’s ability to track trends in the process is compromised.
• Time Delay: since the PID controller has a known delay in its response time, it often reacts too late to changes in an unstable process. This causes problems with the regulation of final variables because if there are any changes within that delay due to oscillations, the PID controller will not respond to these until the next oscillatory cycle. This problem makes it difficult to control a final variable when there are any changes within that delay frequency.
• No guarantees in real-life applications: When using a PID controller, there are no guarantees regarding how well it will perform in terms of stability and regulation. This is because there are several types of PID controllers, each with unique advantages and disadvantages. For example, some PID controllers are more stable than others, while some are better suited for regulating a process.

## Tuning A PID Controllers

A balance for different operations of the PID control system is achieved by “loop tuning” to get the desired control function.

Usually tuning constant is denoted by a “K” letter, and it is derived from the application of the control system. Thus, this tuning constant K depends on the sensor’s behavior and the final control element.

An approximation can be made of K by observing the application. The good practice is to see this behavior using “bumping analysis” in this procedure, the setpoint is changed, and the constituent behavior of the control system is observed.

The tuning of a PID controller involves with a step response that can be achieved by changing the setpoint and observing the response of the PV (Process variable) and the output associated with the specific gaines P, I, and D.

There are several methods for tuning a PID loop:

### Manual tuning

The most common way of tuning your PID controller is to use a slow manual approach. This means that you’ll have to look at the results from your system and find a P gain, I gain, and D gain, which let it work as expected.

This process can be very time-consuming, making this approach less useful for more complex applications with high demands for control!

A fast PID loop tuning usually overshoots slightly to reach the setpoint quickly; however, some systems cannot accept overshoot.

Behavior and comments in the response time of the PID control system

Manual tuning procedure:

2. increase P until oscillations occur
3. the amplitude of the oscillations is proportional to the error in your system – so it helps determine how good your controller is.
4. then the P  K p {\displaystyle K_{p}}  should be set to approximately half of that value
5. increase I by a small amount and repeat step 2. Keep doing this until you can’t find any more improvements
6. increase D by a small amount and repeat step 2. Keep doing this until you can’t find any more improvements and the loop is acceptably quick to reach its reference after a load disturbance

### Ziegler–Nichols tuning method

The Ziegler–Nichols method, developed by John G. Ziegler and Nathaniel B. Nichols in the 1940s, is another heuristic tuning approach.

As in the previous technique, the I and D gains are initially set to zero. Then, the proportional gain is gradually increased until the loop’s output begins to oscillate steadily at Ku.

Ku and the oscillation period Tu are used to set the gains as follows:

### The Tyreus - Luyben tuning method

The Tyrus-Luyben tuning technique is derived from the Ziegler-Nichols method. The only change is gains calculation:

### The Cohen-Coon tuning method

The Cohen-Coon tuning technique is also derived from the Ziegler-Nichols method, but it requires more information from your system. The approach was developed in 1953 and is based on a first-order + time delay model.

Because of the extra process data used in this method, control performance is significantly better.

Three parameters define the procedure:

The Cohen-Coon tuning technique isn’t appropriate for every application. It can only be applied to self-regulating processes.

Most control loops, e.g., flow, temperature, pressure, speed, and composition, are, at least to some extent, automated processes. On the other hand, the most common integrating process is a level control loop.

### Tuning software

The majority of today’s industrial plants no longer use the above methods to tune loops. Instead, PID adjustment and loop optimization programs are used to guarantee consistent outcomes.

These software programs will collect data, create process models, and suggest optimum adjustments. Some packages even can produce tuning by gathering information from previous changes.

The mathematical PID loop tuning method uses a controlled system’s frequency response to create the PID loop values.

Numerical loop tuning is advised in loops with response times of several hours because trial and error may take days to find a stable set of loop values. Finding optimal settings is more complicated.

Some digital loop controllers feature a self-tuning capability in which tiny setpoint adjustments are sent to the process, allowing the controller to determine ideal tuning values.

Modern digital technology has also enabled the development of PID loop tuning algorithms for dynamic and non-steady-state situations.

The software will simulate a process’s dynamics following a disturbance and compute PID control parameters in the response.

## PID Controller Stability

The stability of the PID controller is one of the essential aspects that should not be ignored.  The control system will be unstable if the gain of integral, proportional, and derivative mechanisms is chosen incorrectly.

For example, if a change occurs without any oscillation, this control is restricted by limitations (mechanical breakage or saturation point) of the final control element, such as a valve.

The instability is usually due to a significant lag in response or excessive gain. Therefore, the process should not oscillate for any combination of a set point and the conditions of the process.

Mathematically, the Laplace domain is an effective methodology used to perform stability analysis in a process.

The overall loop transfer function is:

G(s) is a plant transfer function

K(s) is the transfer function of the PID system

The system is considered unstable when the divergence takes place for some s. This phenomenon happens when the product of K(s) and G(s) is equal to
-1. There will be no stability in the system when G(s)*K(s) < 1.

## Complex PID Architecture

This is a system where the controller is composed of not just one or two PID modules but also several in series or parallel.

### Parallel processing

This means combining multiple controllers to form a bigger controller with increased functionality and better performance.

Parallel designs tend to be more complex than standard systems and might use unique algorithms, making them more likely to cause problems.

### Series processing

This is where you split your controller into modules with specific functions, then combine these to form your final controller.

You might want to use series processing to keep things simple or increase performance – but if you’re designing a new controller, it’s much better to start simple!

Using series designs is also more likely to let you use conventional PID modules.

## PID Function from different brands of PLCs

Although the programming of the PID controllers is typically similar from one brand to another, several important features can differ from one controller to another.

These differences are mainly due to how the controllers are programmed and mostly have to do with configuring how they operate.

Below are some screenshots of PID components in different PLCs brands, including Rockwell, Siemens, Schneider Electric, and Omron.

### how to use PID in rockwell automation - Studio5000

A key feature of RSLogix 5000 (or with the new name Studio 5000)  is the ease and speed with which we can start using PID control.

We simply drag and drop a PID component from libraries into our application, configure it and run it like any other function block.

Using an off-the-shelf PID controller means that you won’t need to do as much work to get your system running, but it will also mean that you’ll be restricted on what you can do with the PID controller.

There are two types of PID functions in Studio5000.

The old PID function:

the suggested PID function – PIDE:

The PIDE function includes autotuning capabilities. This process will automate the tuning of your system.

Autotuning is helpful if you need a controller fast, but it can be hard to get right – especially for more complex applications where manual tuning is usually better.

### how to use PID in Siemens - TIA Portal

Siemens products are much more configurable than Rockwell’s but are also less user-friendly and harder to configure.

This means that you’ll need to spend more time worrying about how to set up your controller, but it will also let you do much more once you’ve got things working.

Some Siemens controllers can be used with a PID tuning wizard, which automatically runs through the tuning process, but this could make the tuning process harder for less experienced users.

### how to use PID in schnider electric - Unity

The PID control block is a standard ProTool/Unity tool used for many years in process control applications.

The PID controller can be configured with unity to have versatile functions, but it will need some tuning and configuration before being put into operation.

The user must understand what parameters are available for tuning and how these affect the way the PID controller operates.

Unity Pro provides a standard PID controller block that allows for tuning these parameters and provides the user with different modes of operation.

## Conclusion

Proportional-integral-derivative (PID) is nowadays used in most automatic process control applications used in industry to regulate temperature, pressure, flow rate, and various other process variables.

As a control engineer, it is almost guaranteed that you will face a PID controller, and it sometimes can be confusing, and I hope this article helped you understand the basics of a PID controller operation.

### Studio 5000 PLC Programming Software Review

Studio 5000 PLC Programming Software is an outstanding tool for control and automation engineers. Its user-friendly interface, versatile programming language support, tag-based programming, and seamless integration with Rockwell Automation hardware make it a top choice for developing complex automation systems

FactoryTalk View is a powerful Human-Machine Interface (HMI) and Supervisory Control and Data Acquisition (SCADA) software from Rockwell Automation, designed to help you monitor, control, and gather data from your industrial processes.