A Proportional-Integral-Derivative algorithm is a generic Control Loop feedback formula widely used in industrial control systems. A PID algorithm attempts to correct the error between a measured process variable and the desired setpoint by calculating and then outputting a corrective action that can adjust the process accordingly and rapidly, to keep the Error to a minimum.

Here are some references on **PID control**:

PID without a Ph.D. By Tim Wescott

Understanding PID in 4 minutes

PID Control – A brief introduction

PID Controllers Explained

Who Else Wants to Learn about On-Off and PID Control?

We will be using an immersion heater in a cup of water to keep the temperature at a constant value. Using the Do-More Designer software we will perform an autotune on our PID instruction.

Our immersion heater will be controlled through a relay using time proportional control from our PID output. Let’s get started!

# Tag: plc pid

A PID (Proportional, Integral, and Derivative) control is possible with the Click PLC. The **Click Programming Software version 2.50** now includes PID. This features 8 full-featured control loops with an easy graphical user interface (GUI). PID will run on all of the **Ethernet-enabled Click PLC**s.

We will be using this PID along with a Factory IO scene to demonstrate PID control and Autotuning using our Click PLC.

Here are some references on **PID control**:

PID without a Ph.D. By Tim Wescott

Understanding PID in 4 minutes

PID Control – A brief introduction

PID Controllers Explained

Who Else Wants to Learn about On-Off and PID Control?

Our Factory IO scene will be controlling the level of water in a tank. PID will be used to maintain the level based on a dial pot knob on the control panel. Let’s get started!

Process control can be a bit intimidating. We will try and break down both On/Off and PID control in a fun way. This is a simple analogy without any math.

##### On-Off Control Explained

On/Off control can be used effectively with temperature control. Everyone’s house usually has a temperature controller that uses an On/Off control. When the temperature is below the set value (SV) the output switches on. The output will remain on heating the house until the present value (PV) is above the set value. At this point, the output will then go off. The house will constantly be doing this in a cyclic way. This means that the temperature of the house will vary a few degrees.

We can plot this out like the sign wave above. The setpoint is in the middle. By the time the output is turned off the thermal mass continues to heat the house, before starting to cool down. The same is true when the output is turned back on. It will cool down a little more then start to heat up again. This is called hunting. We can not get exactly on the setpoint value and stay there.

##### Observing Hunting

Let’s look at another way to explain:

You are in a car and can only use full gas or a full brake. Racing toward the stop sign at full gas, you use the full brake at the stop sign line. Naturally, you go past the stop sign and eventually come to a full stop. Putting the car in reverse, you again use full gas back toward the stop sign line. When you hit the line you apply the full brake. Missing the mark again. This is like an On/Off control action.

##### Hysteresis (Dead Band) Explained

If we wanted to control the method a little closer then we could program in a hysteresis. (Dead band) This is just a range in which nothing would happen. It would take into consideration the amount that we went over the line in both directions.

If we need to hit the stop sign target a little more accurately then we can now introduce another control method.

##### Learn PID Control

**PID** is a time-based control logic. It will look at a control period (CP) and determine what to do for the next. In a temperature control application, the control period would be 20 seconds. In a servo valve application, it can be 1 second. Let’s look at each of the control methods in the PID with respect to our car analogy.

**Proportional Control (P)**

This will increase the amount based upon the error. The closer we get to the setpoint, the control period will be on for a longer period of time. (Reference to the output percentage of control period time.)

In our example, the car can be seen applying the brakes proportionally longer and longer times before the stop sign line is reached. If it goes over the stop sign line the car will apply the brakes even longer depending on the amount over the line. This is proportional control.

**Integral (I)**

Using just proportional control would always leave us below the set point. We need a method to reset us to the actual setpoint. This is where integration comes into play. It is interesting to note that** PI** control is one of the most commonly used in the industry.

The car above is traveling along the road, following the dashed lines. If we used just proportional control we would find ourselves riding in the ditch. The integral control will move us into our lane and keep us close to the dashed line.

**Derivative (D)**

This mode of control will look at the rate of change and adapt our control to get us back to the set point. Remember that everything is based upon a control period which is time. PI relies on the fact that everything remains constant in your control. D will take into account the differences over time.

In our car analogy, the derivative function of the control will continually adjust as we move up the hill and down the other side. It will not do much as we drive along the straight roadway.

We have looked at a very basic analogy of control logic without all of the details of math. This can aid in understanding what your process is doing and methods to correct it. Further information can be obtained by the following references:

PID without a Ph.D. By Tim Wescott

Understanding PID in 4 minutes

PID Control – A brief introduction

PID Controllers Explained

Nice project using PID:

Desktop Line Following Robot

**Watch on YouTube: **Who Else Wants to Learn About On / Off and PID Control?

If you have any questions or need further information please contact me.

Thank you,

Garry

If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.

Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you **subscribe to ACC Automation**.