FUZZY PID CONTROLLERS

Niranjana Madathil
K. R. I. S. S
Published in
10 min readJun 1, 2020

Table of Contents

  1. Introduction
  2. PID controller
  3. Fuzzy logic
  4. Fuzzy logic system architecture
  5. Fuzzy logic controller
  6. Fuzzy PID controller

Introduction

Classical PID controllers are the most popular controllers due to the simplicity of operation and low cost. Fuzzy logic is used to enhance them due to its ability to translate the operator’s control action into a rule base. This paper presents an affirmative analysis of Fuzzy PID controllers. Here, an attempt is made to explain the working of classical PID controllers, Fuzzy logic, Fuzzy logic controllers, advancement of classical PID controllers using fuzzy logic and the mathematical working of fuzzy PID controllers.

PID Controller

The term PID stands for the three terms- Proportional, Integral and, Derivative.The combined output of all three branches is fed to the plant till it achieves the desired setpoint value or the error signal is constant at zero. Below is the block diagram of a typical PID controller.

The proportional branch takes the error signal as input and outputs a signal proportional to the same. The integrator block outputs a summation of all previous errors multiplied by a suitable gain factor. The derivative measures the rate of change of the error and hence outputs the same multiplied by gain factor. The time-domain representation is as follows;

Fuzzy Logic

The term fuzzy refers to things that are not clear or are vague. In the real world many times we encounter a situation when we can’t determine whether the state is true or false, their fuzzy logic provides valuable flexibility for reasoning. It is a form of many-valued logic. In this way, we can consider the inaccuracies and uncertainties of any situation. In the boolean system truth value, 1.0 represents absolute truth value and 0.0 represents absolute false value. But in the fuzzy system, the truth values of variables may be any real number between 0 and 1 both inclusive. It is employed to handle the concept of partial truth, where the truth value may range between completely true and completely false.

Fuzzy models or sets are mathematical means of representing vagueness and imprecise information. These models have the capability of recognizing, representing, manipulating, interpreting, and utilizing data and information that are vague and lack certainty.

Fuzzy Logic System Architecture

It has four main parts as shown −

● Fuzzification Module −Fuzzification is the process of assigning the numerical input to fuzzy sets with some degree of membership.(This degree of membership may be anywhere within the interval [0,1].) A fuzzification module transforms the system inputs, which are crisp numbers, into fuzzy sets. It splits the input signal into say five steps such as —

● Knowledge Base − It stores IF-THEN rules provided by experts.

● Inference Engine − It simulates the human reasoning process by making fuzzy inference on the inputs and IF-THEN rules. IF-THEN rules map input or computed truth values to desired output truth values.

● Defuzzification Module − It transforms the fuzzy set obtained by the inference engine into a crisp value.

The membership functions work on fuzzy sets of variables. Let’s have a closer look at the mathematics involved.

Fuzzy Sets

Classical set is a collection of distinct objects. For example, a set of students passing grades. Classical set is defined in such a way that the universe of discourse is split into two groups members and non-members. Hence, In the case of classical sets, no partial membership exists. The membership function can be used to define a classical set A is given by:

Fuzzy set is a set having degrees of membership between 1 and 0. Fuzzy sets are represented with tilde characters(~). For example, number of cars following traffic signals at a particular time out of all cars present will have membership value between [0,1]. Partial membership exists when a member of one fuzzy set can also be a part of other fuzzy sets in the same universe. The degree of membership or truth is not the same as probability, fuzzy truth represents membership in vaguely defined sets. A fuzzy set A~ in the universe of discourse, U, can be defined as a set of ordered pairs and it is given by

Membership Functions

Membership functions allow you to quantify linguistic terms and represent a fuzzy set graphically. A membership function for a fuzzy set A on the universe of discourse X is defined as μA:X → [0,1]. Here, each element of X is mapped to a value between 0 and 1. It is called membership value or degree of membership. It quantifies the degree of membership of the element in X to the fuzzy set A.

● x axis represents the universe of discourse.

● y axis represents the degrees of membership in the [0, 1] interval.

There can be multiple membership functions applicable to fuzzify a numerical value. Simple membership functions are used as the use of complex functions does not add more precision in the output. All membership functions for LP, MP, S, MN, and LN are shown as below −

The triangular membership function shapes are most common among various other membership function shapes such as trapezoidal, singleton, and Gaussian. Here, the input to 5-level fuzzifier varies from -10 volts to +10 volts. Hence the corresponding output also changes.

Fuzzy Logic Controller

Fuzzy logic controllers use a very flexible set of if-then rules. The solution is then applied to appropriate membership functions. Conventional computing is based on Boolean logic, meaning everything is represented as either zero or one. In some situations, this leads to oversimplification and inadequate results. Fuzzy logic controllers, and by extension, fuzzy control, seek to deal with complexity by creating heuristics that align more closely with human perception of problems. Any uncertainties can be easily dealt with the help of fuzzy logic.

Example Of a Fuzzy Logic Controller

Let us consider an air conditioning system with a 5-level fuzzy logic system. This system adjusts the temperature of the air conditioner by comparing the room temperature and the target temperature value.

Steps:

● Define linguistic Variables and terms :

Temperature (t) = {very-cold, cold, warm, very-warm, hot} Every member of this set is a linguistic term and it can cover some portion of overall temperature values.

● Construct membership functions for them:

● Construct a knowledge base of rules :

Create a matrix of room temperature values versus target temperature values that an air conditioning system is expected to provide.

Build a set of rules into the knowledge base in the form of IF-THEN-ELSE structures.

● Convert crisp data into fuzzy data sets using membership functions. (fuzzification)

● Evaluate rules in the rule base. (Inference Engine)

● Combine results from each rule. (Inference Engine)

● Convert output data into non-fuzzy values. (defuzzification)

Fuzzy PID Controller

PID Challenges

The mathematics in a PID control equation is complex with multiple variables and constants interacting. Three issues common to almost every process control application are:

● Time delays or lag

● Step function response

● “Ramp & Soak” function response

In many situations the output can take a long, and perhaps also variable, time to react to input changes. To give one example, a furnace will cool when “charged” with new metal and could take several minutes to come back up to temperature. This can lead to temperature overshoots which may damage the contents. When the target value changes instantaneously PID forces the system to apply a large correcting factor, which again can lead to overshoot.

How Do We Incorporate Fuzzy Logic With PID Principles

Classical proportional plus integral plus derivative(PID) controllers are still the most widely adopted method in industry for various control applications, due to their simple structure, ease of design, and low cost in implementation. However, the PID controller being linear is not suited for strongly nonlinear systems. Fuzzy PID control is often mentioned as an alternative to PID control because some of the techniques and algorithms used to tune the PID gains(Kp,Ki,Kd) demonstrate that further retuning is necessary by a skilled human operator during the application of the controller to a process. Fuzzy controllers have been applied to industrial processes with some degree of success, where the rule buffer codifies the experience of a skilled human operator.

A General Structure Of Fuzzy PID Algorithm

The fuzzy PID algorithm was developed based on a classic PID algorithm. The general diagram of the fuzzy PID algorithm is shown in the figure above, the determination of signal domains. This significantly impedes the algorithm pre-tuning process in case of slowly changing systems.

The ep (k) signal is the control error, the eI(k) is the control error integral and the I (k) e is the control error derivative. The control error integral and the derivative is D (k) numerically calculated using the simplest approximations (equation (1) and (2))

where Ts is the sampling rate, e(k) control error calculated in each k using the equation:

The SP(k) is a reference value and PV (k) is a value of the controlled signal. First, eP (k),eI (k),eD (k) signals are scaled by GE, GIE and GDE factors respectively. Then, a fuzzification using the triangular membership function is performed on them. The main advantage of the scaling factor is a fast correlation of signal range and required signal range (Fig. 3 (a)) that is range without membership functions saturation. Unfortunately, factor values must be chosen experimentally likewise the determination of signal domains. This significantly impedes the algorithm pre-tuning process in case of slowly changing systems.

Three linguistic values are used for every variable in the algorithm. Therefore 27 combinations of fuzzified inputs and 27 inference rules R are formulated as follows:

A premise of each rule ri is assessed using the AND operator. A COG (centre of gravity) defuzzification is applied in the algorithm using a triangular membership function (Fig. 3 (b)) and is calculated as follows:

A classic PID algorithm can be very accurately reconstructed using the designed fuzzy PID algorithm with triangular membership functions intersecting in the 0.5 points, a linear inference and a COG defuzzification method. One of the main sources of nonlinearity could be an incomplete rule base not covering all possible combinations of linguistic labels.

In Fig. 4 the control surface of the proportional-integral fuzzy PID algorithm is presented. Diagrams show that fuzzy PID works exactly as classic linear PID in the assumed eP(k) and eI(k) signals ranges.

Making The Linear Fuzzy PID Algorithm Nonlinear

Nonlinearity in the fuzzy PID algorithm can be obtained by:

1.rule removal from the rule base

2. using nonlinear membership functions

3.application of nonlinear inference operators

4. using nonlinear defuzzification methods.

The control surface within a given range of signal variation is no longer a plane while using any of these modifications.

Tuning The Nonlinear Fuzzy PID Algorithm

A process of tuning the fuzzy PID algorithm can be done by GE, GIE, GDE, GU factors modification. This is comparable to tuning a classic PID algorithm. However, some inequalities must be satisfied:

where A(∗) is the amplitude. Exceeding the limits results in transitioning into a state of saturation which is a logical ON-OFF control state. In that case, the fuzzy PID algorithm is ineffective. The scaling factors influence on static and dynamic integral performance. Conclusions will help the designer in tuning the fuzzy PID algorithm analogously to a classic PID algorithm. Additional fuzzy PID algorithm modifications could result from the rule base modification. However, this manipulation distorts the control surface and changes the control system response.

Conclusion

This paper presents the development and elaborates on the working of PID controllers. Proportional integral derivative (PID) control is a well-established way of driving a system towards a target position or level. Fuzzy logic is developed to handle the fuzziness found in human concepts such as those embedded in the knowledge base of an expert system. Fuzzy logic provides a certain level of artificial intelligence to the conventional PID controllers, giving them adaptation to nonlinear, time-varying, and uncertain systems. It has been observed that fuzzy PID controllers perform much better than classical PID controllers.

References

  • Vineet KUMAR, B. C. NAKRA and A. P. MITTAL : Research paper- A Review on Classical and Fuzzy PID Controllers
  • Chun-Tang Chao, Nana Sutarna, Juing-Shian Chiou * and Chi-Jo Wang : Research paper -An Optimal Fuzzy PID Controller Design Based on Conventional PID Control and Nonlinear Factors
  • Fuzzy Logic|Geeks for Geeks;https://www.geeksforgeeks.org/fuzzy-logic-introduction/
  • Sławomir Jaszczak and Joanna Kołodziejczyk :Research paper -A Method of Fast Application of the Fuzzy PID Algorithm Using Industrial Control Device
  • Engin Yesil, Müjde Güzelkaya, Ibrahim Eksin : Research paper — Fuzzy PID controllers ; An overview

--

--