# Development of a Didactic Educational Tool for Learning Fuzzy Control Systems

Authors: Juan Aguilera-Alvarez; José Padilla-Medina; Coral Martínez-Nolasco; Víctor Samano-Ortega; Micael Bravo-Sanchez; Juan Martínez-Nolasco
Journal: Mathematical Problems in Engineering
 (2021)

---

## Abstract

This paper presents the development of a virtual didactic tool for students of mechatronic engineering taking an intelligent system course. The objective of the tool is for students to learn the structures for fuzzy control systems. This tool makes it easier for students to understand the behavior of the membership functions of input and output variables, the evaluation of the set of fuzzy rules, and the method of defuzzification, giving the students the possibility of applying a fuzzy controller in industrial processes using a data acquisition board. The proposed tool was developed with the virtual instrumentation software LabVIEW. It has the advantage that students can manipulate the internal structure of the fuzzy logic control system in a unique window where students can analyze the behavior of internal signals by looking at the response graphs. The fuzzy controller can be easily translated to a real application by using LabVIEW compatible hardware. To have feedback from students on the use of the tool and to understand if this tool allows an improvement in their academic performance, a 2-hour workshop on the proposed application was given to a group of 93 students. At the end of the workshop, a knowledge assessment and a perception survey were applied to the participants. The academic performance achieved by students who were given the workshop using the proposed teaching tool was compared with the academic performance of students who witnessed the workshop using Matlab tools. The statistical analysis of the results obtained for the knowledge assessment shows that the students that had taken the workshop using the proposed teaching tool had better compression of the topic compared to the students that had taken the workshop using the Fuzzy Logic Toolbox provided by Matlab MathWorks. The students that had taken the workshop using the proposed teaching tool obtained a mean grade of 89.63/100, while students that had taken the workshop using Matlab’s tools obtained a mean grade of 69.85/100. Also, the students’ perception of the proposed tool was that it allowed the design of fuzzy control systems in a simple and intuitive way.


---

## Body

## 1. Introduction

One of the global trends in the industrial and educational fields is known as Industry 4.0, which enables the design of intelligent and automated production systems providing digital technologies such as the Internet, integrated sensors, artificial intelligence, and big data. These technologies allow complex industrial applications [1] focused on satisfying customer needs and production standards in the modern industry [2].In response to the demand of Industry 4.0 in the educational field, in the curriculum of the Mechatronics Engineering degree at the National Institute of Technology Mexico in Celaya, Guanajuato, a specialization module was created with the subject “Intelligent Systems.” The objective of this course is for students to be able to design and implement automation and control solutions for mechatronic systems using artificial intelligence algorithms. A specific competence of this subject focuses on the use of fuzzy logic algorithms for the design of controllers which are applied in the design of process control, power electronics converters, electric machines, vehicles, and numerical control machines, among others. The objective of this competency is for students to be able to (1) know the general structure of a fuzzy logic controller (FLC), (2) design an FLC, (3) apply an FLC, and (4) implement an FLC by designing the stages of fuzzification, fuzzy inference rules, and defuzzification.Software tools such as Matlab and LabVIEW have been widely used in the design, simulation, and implementation of FLC because they allow for the evaluation of various membership functions of the input and output variables, as well as different sets of fuzzy inference rules and defuzzification methods. These tools allow the value of the output variables to be established in the event of changes in the values of input variables, defining the rules and the weights involved for each case, in addition to having a graphic representation of the system’s behavior. One of the disadvantages of using these tools is that they have all the options described above in different windows; therefore, if you want to modify the original design of an FLC, you have to navigate through these windows to manipulate the membership functions or in the fuzzy inference rules and then use other windows to analyze the effects of these changes. In addition, if you want to apply the FLC to an online process, a different environment is used, which allows you to monitor the input and output variables of the FLC, but it does not allow you to visualize the behavior of the internal structure of the FLC while operating online with the process.Due to situations such as those described above, auxiliary tool proposals have been made in the teaching-learning process in the various engineering areas for several years. These tools range from computer games such as the one proposed in [3], where a game was implemented for teaching and learning algebra topics, resulting in an increase in learning and greater motivation by the users to the study algebra topics, to what is proposed in [4], where the virtual instrumentation software LabVIEW for the development of a SCADA simulator for didactic purposes for higher-level courses at the Faculty of Engineering of the Polytechnic University of Bari in Italy was employed. The use of this virtual tool allows a higher level of understanding for the users. Additionally, among the advantages of the proposed development tool is the flexibility of the development software (LabVIEW), allowing it to scale to more complex engineering projects.Among the tools for educational purposes is the use of remote experimentation, that is, students who use mobile devices to interact in real time with physical hardware in a laboratory. In [5], a tool oriented towards the generation of a remote laboratory was developed by using LabVIEW and NI data acquisition boards; one of the advantages of the system is its easy adaptability to new experiments, allowing it to be extended to laboratories of other areas of Engineering or Sciences. In addition, in [6], a didactic simulation tool is proposed to improve the teaching-learning process in the area of computer networks; this tool was designed to have a high level of interactivity and visual information through a configurable graphical interface. Similarly, in [7], a virtual laboratory in optics focused on engineering studies was presented, which allowed students to perform simulations with results similar to those obtained in a physical laboratory, thus increasing students’ learning experience. This research presents an evaluation framework whose validity has been tested in a course with more than 70 engineering students, obtaining an increase in its evaluation of 18.1% over students who did not use the proposed tool.Currently, E-learning (virtual learning space aimed at facilitating the distance training experience) has generated a breakthrough in learning that allows the educational community to trust the use of new technologies [8]. This virtual space requires virtual teaching tools and remote laboratories, among others, which facilitate the teaching-learning process; these tools must be interactive and have a user-friendly graphic interface in addition to being able to reconfigure and scale to solve more academic problems easily [9].


### 1.1. State of the Art

In a study [10], the factors that influence student behavior were defined and divided into three categories: (a) the academic environment and academic resources such as laboratories, remote laboratories, conferences, and computational tools, (b) perceptions about discipline and career, and (c) experience. One of the main trends in the educational field is the development of computational tools that facilitate the improvement in the learning of engineering concepts [11]. These tools can be remote laboratories such as those developed in [12, 13], in which the problem of not having industrial processes to carry out practices in the engineering area was solved.In contrast, the methodology for designing the digital control systems is the (a) modeling of the dynamic system, (b) controller design, and (c) implementation of the digital controller that has been designed [14]. Due to these factors, the following are proposals for computational academic resources considered within the design methodology for digital FLCs. It is worth mentioning that fuzzy algorithms in the educational field are used not only for monitoring but also for calculating professional skill markers of students [15], assessing the quality of distance learning courses in higher education [16], assessing the academic performance of students [17], and inferring the best learning style [18], among others.In contrast, the incorporation of systems that use FLC in the educational field has been used for years; in [19], an educational tool was developed that uses microcontrollers for the control of a mobile robot based on fuzzy control systems that are used in the second year of undergraduate education in an optional course in the Computer Engineering Department of the University of the Near East.The integration of soft computing knowledge involving FLC in educational electrical engineering programs for the control of power electronics equipment has been considered of utmost importance. In the research carried out in [20], it is mentioned that teaching Matlab tools is a great challenge due to its complexity and the computational expense demanded by the Matlab toolkit for the design, simulation, and application of FLC algorithms; however, it is currently one of the most widely used computational tools. In [21], an FLC was applied in Matlab to monitor the condition of high voltage equipment using the thermography technique; this application has an educational orientation, using the results obtained to reinforce the knowledge of engineering and master students studying monitoring and diagnosis of electrical substations. These students assessed their knowledge before and after completing the exercises given to them with the proposed computational tool; the questionnaire was only applied to 83% of students, who showed progress in understanding the FLC improving the quality of teaching. In [22], Matlab software was used to design and simulate an FLC in charge of controlling the energy flow in electric vehicles. This tool is used in engineering and postgraduate study programs. It was considered that the membership functions and the rule base of the FLC depended largely on the experience of the designers.In study [23], an algorithm of an FLC using Matlab for the control of the electrical energy that was transferred to the AC electrical grid was proposed. The authors concluded that the FLCs presented a great variety of applications because they did not require complex mathematical models and they worked satisfactorily with nonlinear systems. Furthermore, FLCs were easily customized in terms of natural language, advantages that led [24] to the use of an FLC to automate a refrigerant charging process, and designing the FLC based on the knowledge of an expert in the field. This FLC was designed and implemented using the LabVIEW software and data acquisition boards from the NI Company. The integration of this software with the acquisition devices allowed the implementation of virtual laboratories for the design, simulation, and experimentation of controllers [14].Another use of the LabVIEW virtual instrumentation software in the educational field is the one proposed in [25], where they used this tool for the development of computer programming skills in the physics area in a course of computer-assisted instrumentation; the effectiveness of the proposal was evaluated through the statistical analysis of questionnaires and responses to interviews, obtaining, as a result, an increase in the knowledge acquired and an increase in motivation and confidence of the students. In contrast, in [2], the integration of IoT technology and electrical engineering education to develop future skills in students was proposed. To evaluate the results of the workshop given, a survey of 23 students was conducted, where the students expressed positive comments about the knowledge and skills acquired in the workshop. The following are relevant conclusions drawn from the papers described in the Introduction and in the State of the Art:(a)
The integration of knowledge about FLC in engineering areas is important because it replaces the traditional controllers when working with natural language terms, not needing complex mathematical models, operating with uncertain and nonlinear systems.(b)
The incorporation of computational tools in the academic field improves the teaching-learning process, increasing the student experience and generating advances in meaningful learning.(c)
Matlab is the most widely used computational tool for the design, simulation, and experimentation of FLC, but its learning is complex and generates considerable computational expense.(d)
The use of VIs designed with LabVIEW presents a high level of understanding, interactivity, and visual information to users, as well as having the flexibility to reconfigure and scale to more complex projects or adapt to new experiments. In addition, it has low-cost data acquisition devices for FLC experimentation.(e)
For the optimal definition of the membership functions of the input and output variables of the FLC, as of the base of fuzzy rules, the experience of the designer is considered.(f)
For the evaluation of the proposed didactic tools, evaluations of knowledge acquired after use were considered; in addition, satisfaction surveys have been used to know the point of view of the users.As a result, a Didactic Educational Tool (DET) was proposed in order to improve the teaching-learning process of FLCs in intelligent system courses taught at universities. This DET allows students to develop specific competencies to (1) recognize the general structure of an FLC, (2) acquire skills for FLC design, (3) be able to validate the control system designed in a real process to analyze the effects of set-point changes and disturbances, and (4) observe and analyze the behavior of each of the parts that make up the fuzzy control system in an integral way, allowing the modification of the design of the controller when it is operating online with the process, visualizing all the parameters of the FLC in order to improve its performance. Additionally, the Virtual Instrument (VI) on which the DET is based allows students to improve their specific skills related to (1) the increase of experience and intuition in the design of FLCs, (2) the ability to reason, reflect, and systematize facts in the design of FLCs, and (3) adapt to the new educational trend related to the delivery of online courses under Learning Management System (LMS) platforms.


## 1.1. State of the Art

In a study [10], the factors that influence student behavior were defined and divided into three categories: (a) the academic environment and academic resources such as laboratories, remote laboratories, conferences, and computational tools, (b) perceptions about discipline and career, and (c) experience. One of the main trends in the educational field is the development of computational tools that facilitate the improvement in the learning of engineering concepts [11]. These tools can be remote laboratories such as those developed in [12, 13], in which the problem of not having industrial processes to carry out practices in the engineering area was solved.In contrast, the methodology for designing the digital control systems is the (a) modeling of the dynamic system, (b) controller design, and (c) implementation of the digital controller that has been designed [14]. Due to these factors, the following are proposals for computational academic resources considered within the design methodology for digital FLCs. It is worth mentioning that fuzzy algorithms in the educational field are used not only for monitoring but also for calculating professional skill markers of students [15], assessing the quality of distance learning courses in higher education [16], assessing the academic performance of students [17], and inferring the best learning style [18], among others.In contrast, the incorporation of systems that use FLC in the educational field has been used for years; in [19], an educational tool was developed that uses microcontrollers for the control of a mobile robot based on fuzzy control systems that are used in the second year of undergraduate education in an optional course in the Computer Engineering Department of the University of the Near East.The integration of soft computing knowledge involving FLC in educational electrical engineering programs for the control of power electronics equipment has been considered of utmost importance. In the research carried out in [20], it is mentioned that teaching Matlab tools is a great challenge due to its complexity and the computational expense demanded by the Matlab toolkit for the design, simulation, and application of FLC algorithms; however, it is currently one of the most widely used computational tools. In [21], an FLC was applied in Matlab to monitor the condition of high voltage equipment using the thermography technique; this application has an educational orientation, using the results obtained to reinforce the knowledge of engineering and master students studying monitoring and diagnosis of electrical substations. These students assessed their knowledge before and after completing the exercises given to them with the proposed computational tool; the questionnaire was only applied to 83% of students, who showed progress in understanding the FLC improving the quality of teaching. In [22], Matlab software was used to design and simulate an FLC in charge of controlling the energy flow in electric vehicles. This tool is used in engineering and postgraduate study programs. It was considered that the membership functions and the rule base of the FLC depended largely on the experience of the designers.In study [23], an algorithm of an FLC using Matlab for the control of the electrical energy that was transferred to the AC electrical grid was proposed. The authors concluded that the FLCs presented a great variety of applications because they did not require complex mathematical models and they worked satisfactorily with nonlinear systems. Furthermore, FLCs were easily customized in terms of natural language, advantages that led [24] to the use of an FLC to automate a refrigerant charging process, and designing the FLC based on the knowledge of an expert in the field. This FLC was designed and implemented using the LabVIEW software and data acquisition boards from the NI Company. The integration of this software with the acquisition devices allowed the implementation of virtual laboratories for the design, simulation, and experimentation of controllers [14].Another use of the LabVIEW virtual instrumentation software in the educational field is the one proposed in [25], where they used this tool for the development of computer programming skills in the physics area in a course of computer-assisted instrumentation; the effectiveness of the proposal was evaluated through the statistical analysis of questionnaires and responses to interviews, obtaining, as a result, an increase in the knowledge acquired and an increase in motivation and confidence of the students. In contrast, in [2], the integration of IoT technology and electrical engineering education to develop future skills in students was proposed. To evaluate the results of the workshop given, a survey of 23 students was conducted, where the students expressed positive comments about the knowledge and skills acquired in the workshop. The following are relevant conclusions drawn from the papers described in the Introduction and in the State of the Art:(a)
The integration of knowledge about FLC in engineering areas is important because it replaces the traditional controllers when working with natural language terms, not needing complex mathematical models, operating with uncertain and nonlinear systems.(b)
The incorporation of computational tools in the academic field improves the teaching-learning process, increasing the student experience and generating advances in meaningful learning.(c)
Matlab is the most widely used computational tool for the design, simulation, and experimentation of FLC, but its learning is complex and generates considerable computational expense.(d)
The use of VIs designed with LabVIEW presents a high level of understanding, interactivity, and visual information to users, as well as having the flexibility to reconfigure and scale to more complex projects or adapt to new experiments. In addition, it has low-cost data acquisition devices for FLC experimentation.(e)
For the optimal definition of the membership functions of the input and output variables of the FLC, as of the base of fuzzy rules, the experience of the designer is considered.(f)
For the evaluation of the proposed didactic tools, evaluations of knowledge acquired after use were considered; in addition, satisfaction surveys have been used to know the point of view of the users.As a result, a Didactic Educational Tool (DET) was proposed in order to improve the teaching-learning process of FLCs in intelligent system courses taught at universities. This DET allows students to develop specific competencies to (1) recognize the general structure of an FLC, (2) acquire skills for FLC design, (3) be able to validate the control system designed in a real process to analyze the effects of set-point changes and disturbances, and (4) observe and analyze the behavior of each of the parts that make up the fuzzy control system in an integral way, allowing the modification of the design of the controller when it is operating online with the process, visualizing all the parameters of the FLC in order to improve its performance. Additionally, the Virtual Instrument (VI) on which the DET is based allows students to improve their specific skills related to (1) the increase of experience and intuition in the design of FLCs, (2) the ability to reason, reflect, and systematize facts in the design of FLCs, and (3) adapt to the new educational trend related to the delivery of online courses under Learning Management System (LMS) platforms.


## 2. Fuzzy Control Systems

Within the curricula of electrical, electronic, electromechanical, and mechatronic engineering careers, courses oriented to teaching and learning classical control are contemplated. In these courses, students learn to design and implement P, PI, PD, and PID control systems. However, the design of these control actions is complex when the mathematical model of the process to be controlled presents a high degree of nonlinearity, which affects the stability of the controller. Consequently, subjects oriented to learning intelligence control techniques based on FLCs have been included in the engineering curricula as an alternative for the design of controller systems with a high degree of nonlinearity and uncertainty [23], in addition to not needing the mathematical model of the process to be controlled in order to perform the controller design [26].The fuzzy set theory was developed by Lotfi Zadeh [27] in 1965 to deal with imprecise and uncertain phenomena that often occur in real-world applications [28]. The advantage of fuzzy logic has motivated universities in practically the entire world to consider learning about the design and construction process of FLCs in their engineering degree courses; consequently engineering students learn the basic structure of an FLC shown in Figure 1 and understand the function of each of the elements that form an FLC, as well as its interaction and importance in the design of a control system, which consists of the components described as follows:(i)
Fuzzifier: The inputs measured in the control process are converted into fuzzy linguistic values using a fuzzy reasoning mechanism. In this stage, the student learns to determine the degrees of membership for each of the membership functions of the input variables; for this, it is important to familiarize one’s self with linguistic variables, to know the geometric functions most used as membership functions, and to relate the real values with fuzzy membership values.(ii)
Fuzzy rules: This is a compilation of the expert control rules necessary to achieve the control objective. The student learns to build the knowledge base using linguistic rules, transmitting his knowledge as an expert in an area, deciding which are the most important parameters in solving a problem, and establishing their relationships.(iii)
Fuzzy inference machine: This unit is the fuzzy reasoning mechanism, which performs several fuzzy logical operations to infer the control action for a given fuzzy input. In this section, the student learns to interpret the type of rules defined in the knowledge base in order to obtain the weights that will be assigned to the output linguistic variables. For this, the student will develop competencies on operations with fuzzy sets and properties of fuzzy sets.(iv)
Defuzzifier: The inferred fuzzy control action becomes the clear control value required in this unit. The student learns how the process of associating a numerical value to a fuzzy set is carried out. To perform this action, the student uses the centroid method.Figure 1
Components of a fuzzy logic controller.The design of an FLC implies defining a series of parameters prior to its application. These parameters are fuzzy sets, rules, scale factors at entry and exit, inference methods, and defuzzification procedures. If an FLC is incorporated into a closed-loop control system such as the one presented in Figure2, fuzzy control structures are generated. In this diagram, r (t) is the set-point, y (t) is the process variable, u (t) is the control signal, and e (t) is the deviation (error) between the set-point and the variable of the process [29]. The FLC calculates the values of the control signal (fuzzy controller P) or the variations of the control signal (fuzzy controller I or PD + I), based on the error values and their changes.Figure 2
Block diagram of a fuzzy control system in closed loop.The fuzzy controller P calculates the values of the control signalu (t) from the values of the error e (t). The structure of this controller is illustrated in Figure 2; the rule base is based on the reduction of the deviation between the set-point r (t) and the process variable y (t) [30]. The fuzzy controller I calculates the values of the variations of the control signal u (t) from the values of the error e (t). Figure 3 shows the structure of the fuzzy controller I; the rule source is based on the elimination of the steady-state error [30]. This controller has a slow settling time, if you want to increase the response speed, it will have oscillations and a high overshoot value.Figure 3
Fuzzy controller I.By adding the derivative control action, the control system allows an increase in the response speed without generating oscillations, in addition to decreasing the overshoots and keeping the error in a null steady state. The fuzzy controller PD + I regulate the process by observing the errore (t) and its changes. The structure of this controller is presented in Figure 4, which has two input variables and one output variable [31].Figure 4
Fuzzy controller PD + I.The methods section should contain sufficient detail so that all procedures can be repeated. It may be divided into headed subsections if several methods are described.


## 3. Design of the Didactic Educational Tool

As described in the Introduction and in the State of the Art, the design of computational teaching tools based on VIs using the virtual instrumentation software LabVIEW presents advantages such as a high level of understanding, interactivity, and visual information for users, in addition to having the flexibility to reconfigure and scale to more complex projects or adapt to new experiments. Besides, it has low-cost data acquisition devices for FLC experimentation. All these advantages were considered for the design of the VI that will function as DET. The DET works with fuzzy control system structures of one or two input variables and one output variable, allowing users to design applications such as Proportional (P), Integral (I), and Proportional-Derivative-Integral (PID), and fuzzy controllers. This tool was developed using LabVIEW virtual instrumentation software designed by National Instruments Corporation. The environment provides a visual programming language for data flow, which is represented in a flowchart style [32]. The DET would allow users to develop the following competencies:(1)
Knowledge of the internal structure of an FLC.(2)
Understanding the function of each of the elements that form an FLC, as well as its interaction and importance in the design of a control system.(3)
Determining their membership degrees for different values in the entries.(4)
Understanding the Mamdani fuzzy inference process.(5)
Analyzing the effect of modifying the weight of fuzzy rules.(6)
Defining the forms of the membership functions of the output variable with the weights obtained.(7)
Knowledge of the process to evaluate the centroid as a method of defuzzification.(8)
Analyzing the effects of the variations in the membership functions of the input and output variables, as well as the fuzzy rules, to obtain the membership degrees, weights, and the new outline of the membership functions of the output variable and centroid calculation.(9)
Applying FLC to a discrete process in real time using a discrete first-order system. Designing membership functions for the input variables of an FLC.(10)
Applying the designed FLC to a real-time process using a data acquisition board.(11)
Optimizing the design of an FLC operating in real time, analyzing the behavior of each of the parts that make up the fuzzy control system in an integral way, allowing modification of the design of the controller when it is operating in line with the process, and visualizing all FLC parameters to improve its performance.In the following section, the development of the VI used as DET is presented.


### 3.1. General Structure of the VI of the Fuzzy Control System

Figure5 shows the general diagram of the VI of the DET; this VI consists of five subVIs, which correspond to (a) fuzzification of the inputs 1 and 2, (b) fuzzy inference rules, and (c) defuzzification method.Figure 5
Diagram of the main VI of the DET.


### 3.2. Calculation of the Degrees of Belonging

The first stage in the design of a fuzzy controller is to define the membership functions of the input variables and the output variables. The use of triangular and trapezoidal membership functions also allows students a better and faster understanding of the need to convert the real values of variables to representations in the fuzzy domain. It has been proven that the use of these membership functions in the design of fuzzy control systems provides satisfactory results, simplifying the representation of information and generating less computational expenditure at the time of being implemented in hardware [33].The software implementation of the membership functions is carried out using the general equation of liney = ax + b; the coefficients a and b are given by (1) and (2), where points P1x1y1 and P2x2y2 represent the degree of minimum and maximum membership in each fuzzy set in Cartesian coordinates, respectively.(1)a=y2−y1x2−x1,(2)b=y1−y2−y1x2−x1∗x1.An example of an input variable with five membership functions of an FLC is presented in Figure6; these membership functions are Very Negative (VN), Negative (N), Zero (Z), Positive (P), and Very Positive (VP). For the design of the membership function “Z,” two lines are used; in the first line, P1−0.4,0 and P20,1 are considered, obtaining the equation y = 2.5x + 1; for the second line, P10,1 and P2−0.4,0 are considered, obtaining the equation y = −2.5x + 1. In this way, the equations that are obtained (see Table 1) represent all the membership functions of the variable in Figure 6. Figure 7 shows the section of the VI that calculates the degrees of belonging from the definition of the equations of membership functions.Figure 6
Membership functions.Table 1
Design of membership functions.
Membership functionRankEquationVN[−1, −0.8]y = 1VN[−0.8, −0.4]y = −2.5x−1N[−0.8, −0.4]y = 2.5x + 2N[−0.4, 0]y = −2.5xZ[−0.4, 0]y = 2.5x + 1Z[0, 0.4]y = −2.5x + 1P[0, 0.4]y = 2.5xP[0.4, 0.8]y = −2.5x + 2VP[0.4, 0.8]y = 2.5x−1VP[0.8, 1]y = 1Figure 7
Calculation of the degrees of belonging.


### 3.3. Calculation of the Weights of the Membership Functions

Once students understand the relationship between real variables and fuzzy sets using linguistic terms, the next step in the teaching-learning process is to evaluate the fuzzy relationships using fuzzy inference rules. The degrees of membership of the input variables are used to evaluate the set of fuzzy rules and the inference machine to generate the fuzzy set of output used by the defuzzifier. The design of the fuzzy controller considers rules of the “AND” type and a defuzzification system of the “Mamdani” type. For example, to calculate the “A” weight of the inference rules in Table2, equation (3) is used. For example, in order to calculate the weight corresponding to “A,” the rules in bold in Table 2 are used. These rules are: If (Input Variable 1 is Function 1) and (Input Variable 2 is Function 1) then (Output Variable is A); (2) If (Input Variable 1 is Function 2) and (Input Variable 2 is Function 5) then (Output Variable is A); (3) If (Input Variable 1 is Function 4) and (Input Variable 2 is Function 5) then (Output Variable is A); and (4) If (Input Variable 1 is Function 5) and (Input Variable 2 is Function 1) then (Output Variable is A). In Figure 8, section of the VI used to calculate the weights of the membership functions of the output variable is presented.Table 2
Fuzzy rules type AND.
Input variable 2Function 1Function 2Function 3Function 4Function 5Input variable 1Function 1ABCDEFunction 2EDCBAFunction 3CCCCCFunction 4EDCBAFunction 5ABCDEFigure 8
Calculation of weights.(3)WeightA=maxminInput1Function1,Input2Function1,minInput1Function5,Input2Function1,minInput1Function2,Input2Function5,minInput1Function4,Input2Function5.


### 3.4. Determination of Centroid Method

In this FLC design stage, the student must learn the concept of defuzzification as a process that turns the fuzzy solution into a real solution. DET uses the centroid method to perform this process, because, according to the literature, it provides satisfactory solutions [34]. With this method, the fuzzy output is transformed into a real number, which is the coordinate (x) of the center of gravity of the area in the fuzzy sets of output. Equation (4) represents the expression to determine the center of gravity, where μy is the membership function of the output set Y, whose output variable is y. S is the domain or range of integration. Figure 9 shows the VI used to perform the adjustment of earnings (generation of membership functions that are used for the centroid method) and the sub-VI used to calculate the centroid, while in Figure 10, the internal algorithm for defuzzification is presented.(4)yd=∫Syμyydy∫Sμyydy.Figure 9
Profit adjustment and defuzzification method.Figure 10
Centroid method.


## 3.1. General Structure of the VI of the Fuzzy Control System

Figure5 shows the general diagram of the VI of the DET; this VI consists of five subVIs, which correspond to (a) fuzzification of the inputs 1 and 2, (b) fuzzy inference rules, and (c) defuzzification method.Figure 5
Diagram of the main VI of the DET.


## 3.2. Calculation of the Degrees of Belonging

The first stage in the design of a fuzzy controller is to define the membership functions of the input variables and the output variables. The use of triangular and trapezoidal membership functions also allows students a better and faster understanding of the need to convert the real values of variables to representations in the fuzzy domain. It has been proven that the use of these membership functions in the design of fuzzy control systems provides satisfactory results, simplifying the representation of information and generating less computational expenditure at the time of being implemented in hardware [33].The software implementation of the membership functions is carried out using the general equation of liney = ax + b; the coefficients a and b are given by (1) and (2), where points P1x1y1 and P2x2y2 represent the degree of minimum and maximum membership in each fuzzy set in Cartesian coordinates, respectively.(1)a=y2−y1x2−x1,(2)b=y1−y2−y1x2−x1∗x1.An example of an input variable with five membership functions of an FLC is presented in Figure6; these membership functions are Very Negative (VN), Negative (N), Zero (Z), Positive (P), and Very Positive (VP). For the design of the membership function “Z,” two lines are used; in the first line, P1−0.4,0 and P20,1 are considered, obtaining the equation y = 2.5x + 1; for the second line, P10,1 and P2−0.4,0 are considered, obtaining the equation y = −2.5x + 1. In this way, the equations that are obtained (see Table 1) represent all the membership functions of the variable in Figure 6. Figure 7 shows the section of the VI that calculates the degrees of belonging from the definition of the equations of membership functions.Figure 6
Membership functions.Table 1
Design of membership functions.
Membership functionRankEquationVN[−1, −0.8]y = 1VN[−0.8, −0.4]y = −2.5x−1N[−0.8, −0.4]y = 2.5x + 2N[−0.4, 0]y = −2.5xZ[−0.4, 0]y = 2.5x + 1Z[0, 0.4]y = −2.5x + 1P[0, 0.4]y = 2.5xP[0.4, 0.8]y = −2.5x + 2VP[0.4, 0.8]y = 2.5x−1VP[0.8, 1]y = 1Figure 7
Calculation of the degrees of belonging.


## 3.3. Calculation of the Weights of the Membership Functions

Once students understand the relationship between real variables and fuzzy sets using linguistic terms, the next step in the teaching-learning process is to evaluate the fuzzy relationships using fuzzy inference rules. The degrees of membership of the input variables are used to evaluate the set of fuzzy rules and the inference machine to generate the fuzzy set of output used by the defuzzifier. The design of the fuzzy controller considers rules of the “AND” type and a defuzzification system of the “Mamdani” type. For example, to calculate the “A” weight of the inference rules in Table2, equation (3) is used. For example, in order to calculate the weight corresponding to “A,” the rules in bold in Table 2 are used. These rules are: If (Input Variable 1 is Function 1) and (Input Variable 2 is Function 1) then (Output Variable is A); (2) If (Input Variable 1 is Function 2) and (Input Variable 2 is Function 5) then (Output Variable is A); (3) If (Input Variable 1 is Function 4) and (Input Variable 2 is Function 5) then (Output Variable is A); and (4) If (Input Variable 1 is Function 5) and (Input Variable 2 is Function 1) then (Output Variable is A). In Figure 8, section of the VI used to calculate the weights of the membership functions of the output variable is presented.Table 2
Fuzzy rules type AND.
Input variable 2Function 1Function 2Function 3Function 4Function 5Input variable 1Function 1ABCDEFunction 2EDCBAFunction 3CCCCCFunction 4EDCBAFunction 5ABCDEFigure 8
Calculation of weights.(3)WeightA=maxminInput1Function1,Input2Function1,minInput1Function5,Input2Function1,minInput1Function2,Input2Function5,minInput1Function4,Input2Function5.


## 3.4. Determination of Centroid Method

In this FLC design stage, the student must learn the concept of defuzzification as a process that turns the fuzzy solution into a real solution. DET uses the centroid method to perform this process, because, according to the literature, it provides satisfactory solutions [34]. With this method, the fuzzy output is transformed into a real number, which is the coordinate (x) of the center of gravity of the area in the fuzzy sets of output. Equation (4) represents the expression to determine the center of gravity, where μy is the membership function of the output set Y, whose output variable is y. S is the domain or range of integration. Figure 9 shows the VI used to perform the adjustment of earnings (generation of membership functions that are used for the centroid method) and the sub-VI used to calculate the centroid, while in Figure 10, the internal algorithm for defuzzification is presented.(4)yd=∫Syμyydy∫Sμyydy.Figure 9
Profit adjustment and defuzzification method.Figure 10
Centroid method.


## 4. Use of the Didactic Educational Tool

Students, teachers, and researchers who wish to use the proposed DET must have previous competencies in the installation and management of computational tools; in addition, they must understand the functions for decision-making in control structures using FLC; if they want to use the experimental part of the DET it is necessary to know how to implement a process. The minimum necessary characteristics of the computer on which it is possible to run the DET are (1) 2 Gb of RAM, (2) processor speed of 1.8 GHz, (3) 300 Mb of free storage, and (4) Windows 7 or higher.


### 4.1. Input and Output Variables

The proposed DET allows students to describe the input variables using a maximum of 5 membership functions. Figure11 shows the configuration interface for each of the membership functions; these functions can be “triangular,” “trapezoidal,” or “none”; in case the last option is selected, that membership function will remain deactivated.Figure 11
Membership functions configuration interface.When configuring the points of each of the membership functions, the DET has a graphical interface that allows you to visualize the configured membership function. The configuration of an input variable with five membership functions is illustrated in Figure12; in this configuration, trapezoidal functions were selected for membership functions 1 and 5, and triangular functions for membership functions 2, 3, and 4. DET has the option of using up to two input variables. In the same way that the membership functions for the input variables are defined, the membership functions for the output variable are defined.Figure 12
Membership functions of the input variables.For a better understanding of the relationship between input variables and fuzzy sets, the DET allows us to visualize the degrees of belonging of each one of the functions before changes in the input variables, facilitating for the user the interpretation of the stage of fuzzification in the structure of a fuzzy controller. The corresponding values of the degrees of belonging for three different values of the input variable are presented in Figure13. This evaluation was performed considering the functions defined in Figure 12.Figure 13
Degrees of belonging.
(a)(b)(c)


### 4.2. Fuzzy Rules Base

Figure14 shows the interface to define the basis of fuzzy rules; this figure shows the basis of the rules that was presented in Table 2. This interface enables students to generate the knowledge base that the controller requires and to easily assess how each of the rules influences the controller’s response.Figure 14
Interface to define the AND rule base.The DET has a section where the degrees of belonging of the membership functions of the input variables are presented, relating them to the basis of fuzzy rules and generating the corresponding weights for each of the membership functions of the output variable. This allows users to know the effects on the weights by modifying the fuzzy rules, the degrees of belonging, the membership functions, and the values of the input variables; by this way, the user can evaluate the efficiency of the knowledge included in the set of rules. Figure15 shows the section of the DET where the degrees of belonging of each membership function of the input variables, the weights obtained with the rule base, and their effect on the membership functions of the output variable are presented.Figure 15
Obtaining weights and their effects on the graphs of the output variable.


### 4.3. Defuzzification

With the weights obtained in the previous stage applied in the membership functions of the output variable, the area is defined to calculate the fuzzy output using the centroid method. In Figures16 and 17, two case studies are presented, in which the weights of each exit membership function are entered as inputs and the evaluation of the centroid method as output. In addition, the graph of the curve used to calculate the output of the fuzzy system is presented. This graph allows students to evaluate the effectiveness of the fuzzy rules formulated.Figure 16
Method of defuzzification case study I.Figure 17
Method of defuzzification case study II.


### 4.4. Fuzzy Proportional Control System

The DET can also be used in the design of fuzzy control systems applied to a discrete process that operates in real time and to an online process using a data acquisition board to obtain the emitted signal from the sensor and send the control signal to the actuator. Figure18 shows the use of the DET for the design of the fuzzy proportional controller applied to the control of a first-order system with unit gain and a time constant of one second; this system was discretized and programmed in the same tool. When designing this controller, only one of the DET inputs is used, while the second one remains disabled. The use of this tool allows users to check the behavior of the designed controller, visualizing all the internal parameters that are involved in the fuzzy system such as the degrees of belonging of the membership functions of the entrance, the weights obtained when applying the basis of fuzzy rules, and the application of those weights in membership functions to apply the centroid method.Figure 18
Behavior of the DET with the fuzzy proportional controller.


### 4.5. Fuzzy Integral Control System

Figure19 shows the graphical interface of the fuzzy integral control system presented in Figure 3. This controller is applied to the discrete system of the previous case. In Figures 18 and 19, the capture of the system is presented when it operates in a steady state; in both figures, you can see the fuzzy sets for the input and output variables, the degrees of belonging, the basis of fuzzy rules, the weights obtained, the shape of the area used for the centroid and the monitoring of the process variable when making a change in the set-point. It is important to mention that these parameters are modified in real time as the response of the system changes; this allows the optimization of the FLC design.Figure 19
Behavior of the FLC with the fuzzy integral controller.


### 4.6. Fuzzy PD + I Control System

Figure20 shows the graphical interface of the proportional control system + derivative + fuzzy integral presented in Figure 4. This controller is applied to the discrete system of the previous case. In this case, the two inputs of the DET are used; in this case, the maximum potential of the proposed DET is used.Figure 20
Behavior of the DET with the fuzzy controller PD + I.


## 4.1. Input and Output Variables

The proposed DET allows students to describe the input variables using a maximum of 5 membership functions. Figure11 shows the configuration interface for each of the membership functions; these functions can be “triangular,” “trapezoidal,” or “none”; in case the last option is selected, that membership function will remain deactivated.Figure 11
Membership functions configuration interface.When configuring the points of each of the membership functions, the DET has a graphical interface that allows you to visualize the configured membership function. The configuration of an input variable with five membership functions is illustrated in Figure12; in this configuration, trapezoidal functions were selected for membership functions 1 and 5, and triangular functions for membership functions 2, 3, and 4. DET has the option of using up to two input variables. In the same way that the membership functions for the input variables are defined, the membership functions for the output variable are defined.Figure 12
Membership functions of the input variables.For a better understanding of the relationship between input variables and fuzzy sets, the DET allows us to visualize the degrees of belonging of each one of the functions before changes in the input variables, facilitating for the user the interpretation of the stage of fuzzification in the structure of a fuzzy controller. The corresponding values of the degrees of belonging for three different values of the input variable are presented in Figure13. This evaluation was performed considering the functions defined in Figure 12.Figure 13
Degrees of belonging.
(a)(b)(c)


## 4.2. Fuzzy Rules Base

Figure14 shows the interface to define the basis of fuzzy rules; this figure shows the basis of the rules that was presented in Table 2. This interface enables students to generate the knowledge base that the controller requires and to easily assess how each of the rules influences the controller’s response.Figure 14
Interface to define the AND rule base.The DET has a section where the degrees of belonging of the membership functions of the input variables are presented, relating them to the basis of fuzzy rules and generating the corresponding weights for each of the membership functions of the output variable. This allows users to know the effects on the weights by modifying the fuzzy rules, the degrees of belonging, the membership functions, and the values of the input variables; by this way, the user can evaluate the efficiency of the knowledge included in the set of rules. Figure15 shows the section of the DET where the degrees of belonging of each membership function of the input variables, the weights obtained with the rule base, and their effect on the membership functions of the output variable are presented.Figure 15
Obtaining weights and their effects on the graphs of the output variable.


## 4.3. Defuzzification

With the weights obtained in the previous stage applied in the membership functions of the output variable, the area is defined to calculate the fuzzy output using the centroid method. In Figures16 and 17, two case studies are presented, in which the weights of each exit membership function are entered as inputs and the evaluation of the centroid method as output. In addition, the graph of the curve used to calculate the output of the fuzzy system is presented. This graph allows students to evaluate the effectiveness of the fuzzy rules formulated.Figure 16
Method of defuzzification case study I.Figure 17
Method of defuzzification case study II.


## 4.4. Fuzzy Proportional Control System

The DET can also be used in the design of fuzzy control systems applied to a discrete process that operates in real time and to an online process using a data acquisition board to obtain the emitted signal from the sensor and send the control signal to the actuator. Figure18 shows the use of the DET for the design of the fuzzy proportional controller applied to the control of a first-order system with unit gain and a time constant of one second; this system was discretized and programmed in the same tool. When designing this controller, only one of the DET inputs is used, while the second one remains disabled. The use of this tool allows users to check the behavior of the designed controller, visualizing all the internal parameters that are involved in the fuzzy system such as the degrees of belonging of the membership functions of the entrance, the weights obtained when applying the basis of fuzzy rules, and the application of those weights in membership functions to apply the centroid method.Figure 18
Behavior of the DET with the fuzzy proportional controller.


## 4.5. Fuzzy Integral Control System

Figure19 shows the graphical interface of the fuzzy integral control system presented in Figure 3. This controller is applied to the discrete system of the previous case. In Figures 18 and 19, the capture of the system is presented when it operates in a steady state; in both figures, you can see the fuzzy sets for the input and output variables, the degrees of belonging, the basis of fuzzy rules, the weights obtained, the shape of the area used for the centroid and the monitoring of the process variable when making a change in the set-point. It is important to mention that these parameters are modified in real time as the response of the system changes; this allows the optimization of the FLC design.Figure 19
Behavior of the FLC with the fuzzy integral controller.


## 4.6. Fuzzy PD + I Control System

Figure20 shows the graphical interface of the proportional control system + derivative + fuzzy integral presented in Figure 4. This controller is applied to the discrete system of the previous case. In this case, the two inputs of the DET are used; in this case, the maximum potential of the proposed DET is used.Figure 20
Behavior of the DET with the fuzzy controller PD + I.


## 5. Results

To evaluate the effectiveness of the proposed DET, a workshop was given to 2 different groups of 43 students of the Mechatronic Engineering degree with previous knowledge of fuzzy logic. These students knew the theoretical principles of fuzzy logic and the design of fuzzy controllers using the Matlab and LabVIEW toolkits. In addition, they had knowledge of the design and implementation of classical control algorithms.The workshop lasted two hours and the following activities were developed: (1) theoretical introduction was given in which concepts of fuzzy systems and their structures in control systems were explained, (2) an explanation for participants on how to use and interpret the different parts of the FLC in the proposed DET, this with the aim that the students carry out a detailed analysis of the behavior of the FLC, and (3) participants were provided with an executable file of the tool so that they could implement a fuzzy control system, allowing an interaction between the DET and each of the workshop participants. At the end of the workshop, a satisfaction survey was carried out to know the point of view of the users, whose answers were placed on the Likert scale [35]; the purpose of this survey was to find out if the proposed DET made it easier for students to increase their knowledge of fuzzy controller design. The questions focused on the content, forms, and structure of the proposed DET.The following are the questions used in the survey:(1)
Has the use of the DET allowed you to increase your knowledge of fuzzy control systems?(2)
Has the interaction with the DET motivated your interest in the knowledge of fuzzy controller structures?(3)
Has the structure and access of the information presented facilitated the learning of fuzzy control systems?(4)
Has the educational model used favored the learning of fuzzy controllers?(5)
Has the presentation of the topics facilitated the assimilation, acquisition, and retention of knowledge of fuzzy control systems?(6)
Have the icons and menus of the DET facilitated knowing the processes and functions that were presented?(7)
Was the use of the DET utilities simple and intuitive?(8)
Has the DET allowed you to develop specific competencies in the area of fuzzy control systems?(9)
Has the DET provided all the (virtual) hardware and software necessary to perform fuzzy control tasks?(10)
Does the DET present relevant and organized information in a way that allows a fluid interaction throughout its use?The students had the following options to answer the questions:(1)
Strongly disagree.(2)
Disagree.(3)
Neither agree nor disagree.(4)
Agree.(5)
Strongly agree.The results of the surveys carried out on students (Figures21 and 22) show that the opinion regarding the teaching-learning process of fuzzy control systems was positive. The highest satisfaction rates were presented when the students gave their opinion regarding the icons and menus of the DET and about the relevance of the information shown in the DET, questions 6 and 10, respectively. A smaller number of students stated, through their response to questions 3, 4, and 7, that they agree that the interactive use of DET facilitated the learning of fuzzy control systems. The document “Surveys” in the Supplementary Materials (available here) includes the information of the 43 digitized surveys.Figure 21
Results of the surveys for questions 1 to 5.Figure 22
Results of the surveys for questions 6 to 10.To compare the improvement in the academic performance of the participants when using the proposed DET, 2 new workshops were given to two different student groups to reinforce their skills in the design of fuzzy controllers. In one group (G1), the proposed DET was used and, in another group (G2), Matlab tools were used for the design of FLCs. In both workshops, the basic concepts of fuzzy systems, the internal structure of an FLC, and the function of each of the elements of the internal structure of an FLC were presented. Subsequently, an FLC was implemented defining the membership functions of the input and output variables and the fuzzy inference rules, and the behavior of each element for different values of the input variables was analyzed by applying the centroid method in defuzzification of the FLC. Finally, each participant implemented a fuzzy control, using the proposed DET for the first workshop and Matlab’s traditional tools for the second workshop. The documents “P1” and “P2” in the Supplementary Materials include the presentations used for the teaching of the workshops.At the end of each workshop, an evaluation of the skills developed in each of the workshops was applied. This evaluation was developed using Google Forms. The document “Skills” in the Supplementary Materials presents the skills assessment that was applied for the workshops. In addition, in the documents “A1” and “A2,” one can see an analysis of the responses of the workshops’ participants. “A1” is for the first workshop and “A2” for the second one.A statistical analysis of the evaluations obtained by the students of groups G1 and G2 was carried out in order to establish the difference between the average evaluations of both groups. Table3 shows the results of Student’s t-test performed considering as a null hypothesis. The average of the G1 evaluations is greater than the average of the G2 evaluations; the case of nonequal variances was considered.Table 3
Statistical Student’st-test of the evaluations of groups G1 and G2.
μG1±σμG2±σαp-valueHo:μG1>μG289.63 ± 8.6369.85 ± 20.970.012.61 × 10–4AcceptedµG1 and µG2 : mean G1 and G2. σ: standard deviation. α: significance level. Ho: null hypothesis.


## 6. Discussions and Conclusions

The statistical analysis shown in Table3 makes it possible to assert that the proposed DET allows an improvement in the students’ academic performance; the authors attribute this improvement to the ease with which fuzzy controllers are designed and tested with the proposed DET.From the analysis of the results of the satisfaction surveys applied to a total of 43 students who were given the workshop using the proposed DET, it is possible to infer that the perception of the students was favorable compared to the design tools and traditional implementation. This allows improvement in the teaching-learning process for the design and implementation of FLCs. These results are like those obtained by studies focused on the educational environment. Gomez et al. [36] evaluate the perception of competencies before and after the application of the proposed method, demonstrating that they obtained improvements with their proposal of a working laboratory for learning to detect and diagnose failures in mechatronic systems.Regarding the results of the satisfaction survey applied in this paper, the students surveyed expressed high satisfaction with the icons, menus, and the relevance of the information shown in the DET. In addition, they said that they agreed that the interactive use of DET facilitates the learning of fuzzy control systems. These results coincide with those reported by Martinez et al. [37], who developed a virtual tool for the design and analysis of the administration and control of the energy of photovoltaic systems in a DC microgrid, obtaining as a result that the tool allows the dynamic simulation of different control algorithms. On the other hand, Chen et al. [11] in their proposal for simulator hardware in the loop used a satisfaction survey applied to the 30 students, which indicates that they totally agree that it is an effective educational tool.The main contribution of this research is that the proposed DET focuses on learning the fundamentals, basic structure, and application of FLC with an innovative computing tool similar to those presented in [10, 11], where students have at their provision of resources to carry out simulations of control systems, managing to break down barriers in the learning process such as the high cost of having access to real processes and the gap that students perceive between theoretical concepts and practice, as demonstrated in [12, 13]. When making a comparison of the proposed DET with the research carried out in [20–23], the advantage that was found was that the developed DET has the visual integration of all the elements that make up an FLC, allowing for the understanding of the designers’ effects of the modifications in the control system by modifying any parameter or variable that intervenes in the controller and system to be controlled. Another advantage is that the tool allows fuzzy controllers to interact with real processes through a National Instrument brand data acquisition board, in addition to allowing the use of low-cost Arduino development boards similar to those proposed in [24, 25]. It is important to mention that the design platform used for the implementation of the DET has the versatility of reconfiguring its applications, allowing to include different intelligent control techniques and various industrial applications in the future.



---

*Source: 3158342-2021-07-31.xml*