Hacking a nonlinear process for linear control: Part 1 of 3
This is part one of a three part series:
- Introduction and identification of a nonlinear process
- Data collection, consolidation and cleaning
- Quantifying the nonlinearity and constructing the linearization algorithm from nonlinear data
----
Part 1:
Introduction and Identification
of a nonlinear process
----
The bane of a "controls guy" is watching a process for hours after making a tuning parameter change in a PID, only to see you, as the controls guy, have decreased the performance of the control. Then, you reverse your changes, and it gets worse. This is especially painful for a slow process, as in hours or even days. Even when auto-tune software is employed the repeatability of the process variable control is... well, not repeatable.
Of course, the expert knows there are many possible reasons for such odd behavior. This article covers one such possibility and offers a solution that does not require in-depth knowledge of regression computations.
The "hack" offered here is not limited in application to process control. If you are in a role requiring data analysis and must offer solutions to correct values that are "out of whack" then you can benefit from the method demonstrated here. (In fact, I used this with great success to predict the monthly cost of natural gas for budgeting at a previous employer.)
---Step back---
First, lets take a step back, especially for those reading and have no idea what a PID is or those who think I am referring to a "process identification value."
--PID?--
In process control, PID is an acronym for Proportional Integral Derivative. A PID is an algorithm, and there are many variations, that monitors a changing value in a process against a setpoint and outputs a counter disturbance to the process by way of some controlling element with the aim of canceling the disturbance and thus returning the monitored process value to the setpoint. You have used this algorithm and it is coded in your brain. Think of driving a car. The "process" is the car moving down the highway. The changing variable being monitored is the position of the car within the lane. The controlling element is the steering wheel. You are the algorithm. A gust of wind, or a change in slope of the road is the disturbance. You sense, and create a counter disturbance with the steering wheel. Really, that is all there is to the root conceptualization of a PID.
--Limitations--
Of course, a human mind controlling anything cannot be reduced to such a limited algorithm as a PID. A key, and often overlooked limitation of a PID is its inability to repeatably control a nonlinear process. Nonlinearity can be caused by, and refer to, many different elements in a process. In this article I speak to a specific type of nonlinearity: controlling element vs. process variable.
--Linear--
Belaboring the automobile example: when you turn the steering wheel, say, one quarter of a full circle, you intuitively know how the car will move. The amount of direction change in the motion of the car is the same for one quarter turn in either direction. Also, one half turn results in a predictable doubling of the cars change in direction. (It could be a factor other than two, as long as the factor is constant.) This is an example of linear control.
Chart A
Chart A has three examples of linear processes. The green trend, with a process gain of 1 (Gp = 1), is the ideal linear process. For every 1% change in the controlling element there is a 1% change in the process variable. The purple trend, with a process gain of one half (Gp = 0.5), is an example of a sluggish process. The controlling element is sized too small for the process; thus, the controlling element saturates at 100% while the process variable is only at 50%. The off orange trend, with a process gain of 2 (Gp = 2), is a fast process. The controlling element is too large. When the controlling element is at 50% the process variable is already clipped at 100%.
Process gain, or Gp, is simply the slope of the above lines. Recalling the slope of a line is rise over run and commonly represented by m:
Equation A
So, process gain is the change in process variable divided by the change in the controlling element that caused the process variable to "move:"
Equation B
--Nonlinear--
Now imagine the confused and dangerous state you would find yourself in, if, one quarter of a turn in one direction resulted in a different amount of direction change as compared with one quarter of a turn in another direction. And to make matters worse, one half turn results in some direction change that is, for the first quarter, significantly less than the second quarter. This is an example of a specific flavor of nonlinearity: controlling element vs. process variable.
--Example of a nonlinear process--
One of the best known nonlinear process control scenarios is pH. The details of why pH is nonlinear will be left to another post but a short overview is in order.
pH is a logarithmic scale that represents the hydrogen ion concentration of an aqueous solution. The pH scale ranges from 0 to 14 where 0 is extremely acidic, 7 is neutral (pure water) and 14 is strongly caustic, aka, basic. One method of control is injecting acid (low pH) into a basics process stream (high pH); another is injecting a base (high pH) into an acidic process stream (low pH) and there is a combination of the two for a wide ranging pH process stream (the so named "split range control", which will also be left to another post).
Instead of a straight line with a constant slope- excuse me... process gain, you see a curve like this:
Chart B
Qualitatively, it is easy to see process gain varies widely. On the far left of the curve, the rise is very little while the run is large. This would present as a controlling element moving, and moving, and moving, and moving.... and nothing seems to happen with the process variable. Then, in the middle of the curve, the process variable suddenly jumps wildly while the controlling element hardly moves, and then, again, the process is not responsive on the far right. Think of this in terms of steering the automobile: you would be in serious danger.
Let's break this curve down into relations of process gain, quantitatively:
Chart C
First, there are some key features of Chart C to point out:
- The process curve is the thin blue curve and its vertical axis is on the left.
- The process gain curve is the thick red curve and its vertical axis is on the right.
- The right vertical axis is a logarithmic scale while the left vertical axis is a linear scale.
The red curve is a plot of the slope of the blue curve. As you can see, at about 65% on the controlling element, the process variable jumps. As expected, the slope (aka process gain) spikes- very literally a spike!
- From a CE (controlling element) of 0% to approximately 62% Gp is less than 1
- From a CE of about 67% to 100% Gp is again less than 1
- For the CE between the above two ranges Gp changes by 4 orders of magnitude!
- Over the entire range we have a process gain that changes by multiple orders of magnitude.
Here's a general rule of thumb when testing the "controllability" of a process using PID: if the maximum process gain is no more than a multiple of 3 of the minimum process gain, then it is within the capabilities of a PID. I will leave the derivation of this rule of thumb to another day. Concisely put, if
Equation C
then a PID can manage it.
The situation presented by pH control, as represented in Chart C, fails the above rule of thumb in the most extreme. If we, conservatively, set the minimum process gain to 0.1 and the maximum process gain to 500 the ratio of maximum to minimum is 5000. No, this is not controllable by a PID, alone.
Stay tuned, Part 2: Data collection, consolidation and cleaning is a work in progress and will be posted soon.
Credits:
- Cover photo edited by the author using Inkscape and Gimp
- Equation gifs created using an online implementation of LaTeX at CodeCogs.
- Charts created using Google Sheets.
About the author:
A puzzle junky who thoroughly enjoys solving problems, especially when the solution involves an implementation of technology.
If you spot any typos, technical errors, missing links, graphics, etc. please let me know. I have no editorial staff, except you.
Do you have any questions? I am glad to help.
I am not worthy. I am not worthy. Great intro to loop tuning.
thank you for this useful information
Very interesting. Thanks for sharing this information.
Looks like a good start. One comment, neutral pH of 7.0 is not necessarily "pure water". It just means there is a balance of hydrogen and hydroxyls present. There could be considerable amount of contaminants present and still maintain a neutral pH. Actually "ultra pure water" (UPW) will be slightly acidic (pH~5.5) when exposed to air as it will quickly absorb CO2 and create carbonic acid.
Nice topic , would be waiting for the part-2