Algebraic solution beats Fuzzy Logic

Industrial automation controller logic: Find out how the computational efforts as well as the tuning efforts for a non-linear response are much reduced using a tunable algebraic equation versus the use of an inference engine with Fuzzy Logic.

 By Ernst Dummermuth

A

 characteristic of conventional proportional/integral (PI) ontrollers is that the gains selected for the proportional and the integral part remain constant over the whole range of the input signal. The input is an “error signal” and is the difference between the command and the feedback of the system. The goal is to have the feedback equal the command; in other words to reduce the error to zero.

System response generally is described by the way it reacts to a change in command or to a change in feedback that is introduced by a disturbance to the process. Standard techniques have been adopted to describe or qualify the response of a system and to select the gains for a desired response.

The most common method to observe and/or tune a control loop is to apply a step command and trace the response of the system, with, for example, a chart recorder. Observations include rise-time, overshoot, frequency of oscillation, settling time.

RELATED ARTICLE


Warm and Fuzzy
Fuzzy logic can be an effective way to extend traditional binary logic. Read about how a heater control application helped demonstrate the method.
In general, it is desirable to have a short rise time, i.e., respond quickly to a change, yet have minimal overshoot and oscillation, as well as a short settling time. It is well known that helping one of these defeats the other; and that the proportional gain Kp and the integral gain Ki have to be a best compromise. Depending on the application, one property may be more desirable at the expense of the others. Figure 1 (click the Download Now button below to see all figures) shows a step input and the response of a conventional constant gain system for various cases of rise time, overshoot, oscillation and settling time.

Non-Linear Approach With Fuzzy Logic
In a non-linear PI controller, the Kp gain and the Ki gain are not constant over the range of the Input signal. By separately altering the Kp gain and the Ki gain as a function of the Input signal, a more desirable response may be obtained.

Fuzzy Logic can be used to define arbitrary input and output membership functions to describe virtually any type of non-linear relation between input and output. However, for a non-linear PI controller and for specific applications of position, velocity, torque of motors and rotating machinery, it is useful to restrict the non-linearity to some symmetrical property around zero error (input), which is normally considered the steady state. Such restrictions narrow the descriptions of an otherwise unlimited number of variations. It also is useful to restrict the non-linearity to be monotonic, that is, if the gain increases with increasing error, then it will always increase, and not decrease again above a certain error magnitude. 

Figure 2 (click the Download Now button below to see all figures) shows samples of restricted Fuzzy Logic Input membership functions. The slope of membership functions are basically proportional to gain, yet the effective gain is a specific function of the intersection of two slopes--the result of the blending of two rules. Note that the restrictions also include that only two membership functions intersect at any one time, also only two rules are applied to a section of the Input (Error) signal at any one time.

Figure 3 (click the Download Now button below to see all figures) shows samples of Output “singletons.” Restrictions also have been applied. Discrete lines have replaced the normally triangular-shaped output functions. This reduces computational efforts, and the spacing of those singletons is again symmetrical around zero output, wherein center is normalized zero output. Since all rules that contribute to the output are combined in a weighted average, it can be seen by inspection that a concentration of singletons around zero output (Figure 3 center) calls for a low gain at the zero output and increasing gain towards the flanks.

It’s Inferred
Let’s now discuss the design and implementation of a Fuzzy Logic inference engine. Rules were written for the different ranges of the Input/Error signal. Provisions were included to allow modifications of the membership functions according to the above-mentioned restrictions using integer description; e.g., the value 50 causes a linear distribution; values such as 35, 20 cause an increasing concentration towards the center, while values such as 60, 85 move the membership functions to the flanks as illustrated in Figure 2 and Figure 3 (click the Download Now button below to see all figures).

Even with the restrictions mentioned and a single number for the shaping of a set of membership functions, it still requires the adjustment of a total of eight variables. Included in those eight variables are the four values for input and output membership functions, input range select for each input, and gain scaling for P and I to get into the proper range.



"A non-linear, tunable PI controller provides improved applications that need a closed-loop control response. Web tension benefits from non-linear PI control."


             
After adjustment of all these values towards the goal of improving the response to a step command, a substantial improvement has been observed as shown in Figure 4 (click the Download Now button below to see all figures) . In this case, the Kp gain has been increased towards the flanks while the Ki gain was reduced towards the flanks. Such an action helps to respond quickly to a large error (Kp large at the flanks) while the Ki gain reduced at the flanks avoids integrator wind-up. Even with such improvements the problem remains to make the tuning easy and simple for the user.

Non-Linear PI Block With Algebraic Equations
In the technique presented, the Kp gain and the Ki gain are considered to be normalized to 1.0 for “Zero Input” signal. In other words, the gains obtained for Kp and Ki for a conventional tuning are multiplied with 1.0 at the center of the Input signal (zero error). The separate non-linear transfer functions for Kp and Ki then either increase or decrease the gain as the “error” increases in magnitude.

Figure 5 (click the Download Now button below to see all figures) shows the proposed maximum and minimum shaping functions representing the gain curve. Assuming a certain input range (e.g.,+/-400 counts), the gain may be shaped to increase to 4.0 at the outer edges, or to decrease to 0.0 at the outer edges. Input signals larger then the specified range would then use the edge value. In order to select a particular shape for the left half and for the right half, the user simply enters a number between 4.0 and 0.0 for each side; entering 1.0 certainly provides the special case of constant gain.

The PI Block Gets Help
At this point, I would propose including the restricted non-linear capability--as explained above--into the PI block of an automation controller. The three functions: scaling, shaping and multiply, will be provided, with the scaling adjustable by a parameter, and the continuous shaping functions being tunable by one parameter each, separately for P and I.

A parabolic shaping function as shown in Figure 5 is given here in its general form as y = ax2+b (quadratic equation).

A linear shaping function would be y = ax + b; shown dotted in Figure 5.

Specifically we have:
y = (Shape_ Prop - 1.0)*x2 + 1.0 for the proportional shaping
y = (Shape_Int  - 1.0)*x2 + 1.0 for the integral shaping

In this equation y is the resulting gain multiplier in the range of 4.0 to 0.0 as shown in Figure 5.

The absolute element b is a constant equal to 1.0. Shape_Prop and Shape_Int are tunable parameters between the values of 4.0 and 0.0.

The variable x is the ratio Input/Input_Range limited to -1.0 <= x <= +1.0 or for convenience of computation |Input|/Input_Range  0.0 <= x <= 1.0. As an example:
if Input = 300 and Input_Range = 400 then x = 0.75; 
if Input = 520 and Input_Range = 400 then x = 1.0

Computations needed: 
x = |Input|/Input Range 
If x is greater 1.0, then x = 1.0.

Evaluate the formula above (separately for p and i): one subtract, three multiplies, one add (the first subtract is more like a constant and does not need to be performed every scan).

Summary
The computational efforts as well as the tuning efforts for a non-linear response are much reduced using tunable algebraic equation versus the use of an inference engine with Fuzzy Logic. Also Fuzzy Logic with arbitrary membership functions requires the definition and adjustment of all membership functions and rules at a substantial risk to the user, and at increased computational efforts.

Figure 6 (click the Download Now button below to see all figures) shows a conventional PI block with the additional inputs Input_Range, Shape_Prop_Left, Shape_Prop_Right, Shape_Int_Left, Shape_Int_Right in order to make this a tunable non-linear PI block.

If the “shape” parameters are selected to a value of +1, then the non-linear PI block functions like a conventional constant-gain PI controller.

As a final postscript, I should mention that Figure 2 and Figure 3 are shown only to illustrate how to create a non-linear monotonic function using Fuzzy Logic. The Fuzzy rules that describe the Kp gain and the Ki gain are not listed here. For a more detailed description of Fuzzy Logic see Control Design, November 2003: Warm and Fuzzy.



Web tension benefits from non-linear PI control

T

he non-linear PI algorithm has been applied successfully to control the tension on a web-line. Figure 7 (click the Download Now button below to see all figures) is a partial view of such a web-line. In operation, Motor M1 runs at a constant speed and thus the material is supplied at a constant linear feed to the wind-up spindle S1.

The objective is to have a constant tension while winding-up the material. Low tension creates gaps between layers, or buckles while high tension stretches the material, making it thinner--which may cause breakage. 

The approximate speed of the wind-up spindle S1 is computed in real-time from the starting diameter, the thickness of the material and the number of layers being applied. In order to fine-tune the tension, the material is routed via roller R1 to a dancer D1, to roller R2 and to the wind-up spindle S1. Dancer D1 is another roller held by a spring SP1; and the vertical displacement of the dancer D1 is measured by an encoder. Thus an error signal (deviation from the desired set-point) is obtained. A PI controller processes this error signal to provide a correction to the spindle drive to hold a nearly constant tension.

A PI controller with constant Kp and Ki gains was used. While increasing the line speed from low to medium, the jitter of the dancer increased to the point of instability. Essentially the characteristic of Figure 1 was at hand.

A Fuzzy controller was implemented with the non-linear membership functions. Tuning efforts and computational efforts were extensive. To eliminate computational drag on the rest of the system, an additional CPU card was used to evaluate the Fuzzy rules. The line speed could be increased substantially; and a characteristic similar to Figure 4 was realized.

Since the Fuzzy rules and membership functions were restricted to have a monotonic behavior, a much simpler algebraic solution was then used to compute the gain Kp and Ki as a linear or quadratic function of the Input (error) signal. Stability was similar and even exceeded the Fuzzy solution. The additional CPU was no longer needed.


Dr. Ernst Dummermuth is a consultant in the area of process control, motion control, automation and intellectual property. He has been involved in advanced technology endeavors including architecture proposals, fast prototyping, concept verification, standardization, and product development. His work has yielded 41 patents and numerous publications, among them U.S. Patent 5,936,368, Nonlinear Proportional/Integral Feedback Controller. You can reach him at ehdummermuth@juno.com.


Read our article The Not-So-Odd Couple, by Ernst Dummermuth. This article talks about how motor and its generator are bound together. One does not exist without the other.