# PID math demystified, part 3: More on derivative control

## Consider how a PD controller would work, without an integral function. Would you ever want to use that approach?

To investigate how derivative action works, let’s look at a proportional derivative or PD controller. PID controllers are far more common than PD alone, but we already have an understanding of the integral component’s effects from the first two parts of this series, so we don’t need to review it again.

For a PD controller, we add the derivative of the error into the equation. Similar to what we discussed in the previous posts, we’re not really interested in deriving a derivative of the error function. Conceptually, the derivative in this case refers to how fast the error is changing. So, if we take the change in error divided by the change in time we get the slope.

To explain how this works, let’s look at the pseudo code for this controller. The calculation of error is the same as before: setpoint minus process value. Since the derivative reduces down to the change in error, the output is now the same proportional component as before: gain times error. The current error minus last error is multiplied by the gain and divided by the derivative time constant. The current error is stored in last error for use in the next scan.**Error : = Setpoint – ProcessValue;Output : = K * Error + K/tau_i * (Error – LastError);LastError : = Error; // save for next scan**

**So what does this mean?**

The proportional component is affected by the error at that time, in the present. The integral component is affected by an accumulation of the error, or the past. The derivative component is a measure of how fast the error is changing, or a prediction of the future error.

How is this prediction of the future used? At first glance you might think that this term would be used to get you to your setpoint that much faster. But, that is not really the case. In practice, the derivative component is used to detect when the process variable is changing too fast, and it puts the brakes on to prevent overshooting the setpoint.

So if the derivative component acts as brakes on the momentum, how does it get you to the setpoint faster? It does this by allowing you to use a higher proportional gain to get you there quickly, but dampening the overshoot that would normally make that level of gain unstable.

The tuning constants for derivative control are typically the same units as the time constant for reset. A couple of other considerations though are important. On many controllers the derivative term is filtered independently. This prevents signal noise or spurious disturbances from being interpreted as a change in momentum, which causes the derivative action to overreact. Also, on some controllers the derivative does not actually derive from the error, but instead on the process variable signal alone. This prevents a change is set point from being seen as a change in momentum.

This video summarizes our PID discussions with a graphical explanation.

I hope this helps to demystify PID, at least a little.

Read Demystifying PID part 1.

Read Demystifying PID part 2.

Also read Understanding Derivative in PID Control.

*This post was written by Scott Hayes. Scott is a senior engineer at MAVERICK Technologies, a leading automation solutions provider offering industrial automation, strategic manufacturing, and enterprise integration services for the process industries. MAVERICK delivers expertise and consulting in a wide variety of areas including industrial automation controls, distributed control systems, manufacturing execution systems, operational strategy, business process optimization and more.*

## Case Study Database

Get more exposure for your case study by uploading it to the *Plant Engineering* case study database, where end-users can identify relevant solutions and explore what the experts are doing to effectively implement a variety of technology and productivity related projects.

These case studies provide examples of how knowledgeable solution providers have used technology, processes and people to create effective and successful implementations in real-world situations. Case studies can be completed by filling out a simple online form where you can outline the project title, abstract, and full story in 1500 words or less; upload photos, videos and a logo.

Click here to visit the Case Study Database and upload your case study.

### Annual Salary Survey

**Participate in the 2013 Salary Survey**

In a year when manufacturing continued to lead the economic rebound, it makes sense that plant manager bonuses rebounded. Plant Engineering’s annual Salary Survey shows both wages and bonuses rose in 2012 after a retreat the year before.

Average salary across all job titles for plant floor management rose 3.5% to $95,446, and bonus compensation jumped to $15,162, a 4.2% increase from the 2010 level and double the 2011 total, which showed a sharp drop in bonus.

Derivative control is often derided as "noisy" and "destabilizing" and switched off without consideration. The particular implementation shown in the pseudocode example can share part of the blame. It substitutes a simple difference of measured terms as an estimate for the actual derivative (which is in general unknown). When this is used by a digital controller at a sample rate sufficient to produce a good, smooth response, there is little time for the last two terms to change by much. To get any meaningful effect out of the difference, it is necessary to apply a very high gain factor. Or an equivalent way to think of this, the derivative approximation is really the difference of the last two terms DIVIDED BY the sampling time interval, and the impact of that division is equivalent to a large scaling factor. Either way, the side effect of a large multiplier is to increase sensitivity to the noise included in the measured terms. But on the other hand, a naive application of a smoothing filter to counteract the noise can produce time lags that impair stability -- the opposite of the desired "damping effect." Not all derivative estimators are created equal.

One thing is non-linearity of control elements, all math formulas is good for linear models only; I have understood that almost 4 years ago and did try to rectify that problem by putting variable gain K in conformance with Valve flow characteristics (control element). Just recently I have discovered, that information has been discussed later on ISA conference and full article can be accessed and read via link: http://www.isa.org/InTechTemplate.cfm?Section=Current_Issue&template=/ContentManagement/ContentDisplay.cfm&ContentID=92938

Second one is by manipulating of values of gain K can be achieved fast reaction of PID controller. Each PID controller has “idle mode” close where Error small, but since process disbalanced, when the Error between SP and PV is rising, would be good to have derivative action value in place for some time. Working with PLC I have seen that in PID controllers exist FF (Feed Forward) input with value minus-zero-plus. In simple words by creating additional logics calculating FF signal on process error I have achieved that PID controller have been reacting incrementally faster as error was rising and going slower as error back to normal to idle conditions. Probably someone can put it in Math calculations and I would be happy to see feedback, for control engineer’s consideration.