Simulation to Implementation as Good Practices for Teaching Power Electronics to Undergraduate Students : Fuzzy Sliding Mode Control for DC Motors

How can students be given experience in the confused realities of engineering processes? How can undergraduate students be convinced that processes can be analyzed and improved? Computer simulations properly designed and applied could answer these challenges revolutionizing education in Power Electronics. In recent years, computer simulation has been commonly used in education to motivate students in their learning and help teachers to improve their teaching level. The present paper focuses on developing a speed controller for DC motors starting from theoretical aspects, passing through simulations, and finally reaching a control prototype.The control theory is based on a nonlinear technique known as Sliding Mode Control (SMC) involving artificial intelligence for optimization such as Fuzzy Logic (FL), Adaptive Neurofuzzy Inference Systems (ANFIS), and Genetic Algorithms (GAs).


Introduction
For the last three decades, the progressive advances in mathematical modeling, computational algorithms, and the speed of computers, among other technological developments, have prepared the way for amazing improvements in the engineering education [1,2].
Nowadays, teaching experience shows that the relationships between mathematics, science, and engineering applications are increasingly becoming unsupportive to students due to the lack of precision in communication, resulting in a high dropout rate and low retention of engineering students [1].
The experimental part is crucial in Power Electronics education; this covers all fields related to power systems, circuit theory, semiconductor devices, electric machines, control theory, analog/digital electronics, signal processing, electromagnetics, sensor, and so forth.However, most universities do not establish well-equipped experimental laboratories, so the basic level of how to do experiments is only provided [3].
Hence, the emerging issues in universities are how to educate the students and how to provide disciplinary knowledge (e.g., Electronics Engineering) within limited contact hours, as well as how to make students interested in analyzing in detail the problems faced in advanced practical systems [4].
To overpass these difficulties, instead of using instructions from a theoretical framework, students should be actively involved in using education software to simulate, analyze, design, and control features of different engineering applications.This will help students succeed in learning different technological processes by developing implementations based on simulations [1].
Computer simulation is firstly considered to absorb students' curiosity because it can improve the level of visualization.Simulations can increase the teaching efficiency as well as students' ability to put theories into practice extraordinarily [5].In other words, simulations can be used to provide a realistic context to students, increase student involvement and enthusiasm of the material, and help experiential learning of process analysis and transformation tools.
New designs of power electronic systems are the norm due to new applications and the lack of standardization in specifications because of varying customers demand.Accurate simulation is a necessity for minimizing costly repetitions 2 Advances in Power Electronics of designs and bread boarding in order to reduce the overall cost concept to production time lag [6].

Simulation in Education
Simulation is certainly mature enough to warrant the rank of scientific/academic discipline.A complete definition for simulation refers to the complete process of problem synthesis, model formulation, model order reduction (optimization), computer implementation and validation, experimental design, and analysis and presentation of the results [7].
Computer simulation of complex engineering systems has become a strong tool in engineering practice covering different areas of Power Electronics [1].Automatic control and circuit theory are the main fields treated at present.
As known, the engineering curriculum provides students with many algorithms and theoretical methods which need mathematical background and complex graph analysis, and difficult mathematical operations sometimes make lectures tedious and unexciting.Contrasted teaching could solve these issues.Some theories have a strong relation so they can be better understood by comparing simulation graphs [5].
For example, conventional Sliding Mode Control (SMC) and Fuzzy SMC (FSMC) which are, respectively, described by gray and black lines in Figure 1 are compared.Students can certainly understand these techniques and make a distinction between them in a system.The first conclusion of the students is based on the conventional SMC which has a faster response but the chattering condition affects the stability of the system, while the FSMC does not respond as fast as the conventional SMC, but the chattering is decreased when the system response reaches the set point.
In practice, simulations are broadly applied by industries with the aim of generating a first approach of what will be the last product or service.Keeping this in mind, the simulations comprise all the necessary theories to carry out the construction of a prototype.
Naturally, there are many facts not taken into account during a simulation due to the complexity of certain systems which means that simulations sometimes work with ideal scenarios, while ignoring some factors; that being considered, it would make these simulations even more lifelike.The simulation is friendly and practically when real values of the parameters are included on it; nonideal simulations result in an accurate prototyping since system losses are considered.
The following subsections treat the benefits of simulation in education, followed by a survey about the simulation in education, and finally, a methodology proposal as a guide to get a working prototype from simulation.

Simulation Advantages in Education.
Modeling and simulation is emerging as an increasingly important tool for education and training.Part of this success is that as the cost of computer power decreases it is becoming an economically viable media.Therefore, why is the use of simulation becoming so important in education?The following list gives some ideas [8].(i) Students can apply previously learned concepts and theories to practical situations solving real designing problems.
(ii) Helps students see complex relationships that would otherwise involve expensive equipment or dangerous experiments.
(iii) Is applicable to students of all levels and ages.
(iv) Provides students with new methods of problem solving.
(v) Allows for math, science, and technical skills to be taught in an applied, integrated manner.
(vi) Provides realistic training and skills for a multitude of career areas.
(vii) Is cost effective and reduces risk to humans.
(viii) It is used extensively in industries.

Cosimulation over Simulation.
In many engineering organizations, the design of complex systems often requires the cooperation of several teams from different domains of expertise using different development and validation tools.At this point cooperative simulations or cosimulations make their appearance.
A cosimulation is a simulation methodology that allows individual components to be simulated by different simulation tools running simultaneously and exchanging information in a collaborative manner.
There are two main facts about carrying out a cosimulation instead of a conventional simulation.
(i) It provides engineers and students, before actual implementation, with the ability to create virtual prototypes of an entire system and to validate the whole system behavior as early as possible in the development cycle and at different abstraction levels.
(ii) It allows choosing the best simulation tools for each discipline.

Simulation Time/Money Savings. Something that has not
been considered yet and it is one of the most important advantages of both simulation and cosimulation is the time saved building a prototype resulting in money savings.Designing, building, testing, redesigning, rebuilding, retesting, and so on may result in an expensive project.Simulations take the building/rebuilding phase out of the loop by using the model already created in the design phase.Trying out the changes in the real system may not be an option, because the system does not yet exist, the costs are too high, there are too many scenarios to test, the test would take too much time (weeks, months, years), the changes are not legal, and so forth.In all these cases, a simulation model allows for testing various scenarios in often only a couple of minutes or hours.

Student Surveys
. Some didactical surveys have shown that most students dislike specialized courses because nonpractical classes are boring which affects their concentration.Simulation environments will guide students to have better knowledge retention than those learning through lecture [3,9].
Menn in 1993 evaluated the impact of different instructional media on student retention of subject matter.The results demonstrated that students only remember 10% of what they read, 20% of what they hear, 30% if they see visuals of what they hear, 50% if they see someone do something while explaining, and almost 90% if they do the job themselves even if only as a simulation [5].
According to the above, the next table presents the results of a survey performed on college students from Tecnológico de Monterrey Campus Ciudad de México with the aim of knowing how they feel about simulations/cosimulations in the education.The survey was applied to a population of 42 randomly selected students from different engineering careers.
The results showed that 100% of the surveyed population is in favor of simulations in education and they believe that simulations are a teaching aid for students.Table 1 presents the percentage of the students surveyed of each career.
The affirmative answers given by the students were collected and the most frequent are listed below.
Students can apply what they have seen in class and see what is actually used and thus remember it better.
(i) Give an idea of the system operation and allow correcting errors before building the physical model.
(ii) Predict the response of real experimentation and simplify the design.
(iii) Simulations are readily available and economical, and also they are flexible to future changes.
(iv) It is a fact that in the design and development a simulation is needed to get the bases and arguments of what could happen in a real system; although not the same, they are the most attached to reality.(vi) It is useful to verify the theoretical basis of control laws and machine operation.
(vii) Simulations show a reality with controlled variables which facilitates the fact that experience and knowledge put into practice have a useful impact on students.
(viii) Sometimes you do not have the right equipment or material to work.The simulation can reduce costs.
(ix) Without the need to develop the system physically, students can study its behavior and modify it.
Only the careers written in italics are directly related to Power Electronics; these represented more than 60% of the surveyed population.
Seeking to know the percentage of students from these careers that carry out a simulation before going to the laboratories and the time spent performing a complete system (simulation/implementation), another survey was conducted.The results showed that 100% of them hold previous simulations but only 63% were satisfied with the outcomes; the other 37% argued about the gap between simulation and implementation and the needs for a better simulation software.Then again, only 5% of them knew about the term "cosimulation" as a strong tool for reducing the gap.
On the other hand, the average time needed to perform a complete system was divided into three stages generally: 10 hours of theoretical fundamentals, 20 hours performing the simulation, and 13 hours building a prototype.These hours can be translated into a one week and a half of work; it has to be emphasized that their systems are not too complex.

Teaching Methodology.
The main objective is to encourage the student learning with new tools like a cosimulation; a teaching methodology is necessary to be incorporated for sequential development.The steps are as follows.(2) Theoretical Aspects.Research the basic principles of the application with the purpose of meeting the objectives.
(3) Theory Application.Collects all the theoretical aspects and merges them to generate a technological development.
(4) Simulation.Implement the simulation or cosimulation.This part is critical; it is necessary that the chosen programs take into account more lifelike characteristics (less ideal) such that the results come closest to reality.
(5) System Prototype.Implement the simulated system, in terms of a built physical prototype.It is necessary to maintain the simulation characteristics and assumptions.
(6) Results.Finally, evaluate the results in terms of the prototype performance; if the results were close to the expected, the simulation was successful.
The teaching methodology could be expanded to students who are related to Power Electronics, careers like mechanical engineering, electronics, and mechatronics, or related.

Students' Curricula.
The task of investigating the actual curricula of engineering students from the Tecnológico de Monterrey Campus Ciudad de México was carried out.The focus was to find which subject of each career was able to incorporate the last teaching methodology, taking into account only the engineering careers related to Power Electronics which is the subject of the present application.Table 2 displays the engineering curricula where the teaching systems might be applied successfully.
Lastly, the teaching methodology was applied by the research group achieving what will be seen in the next sections.The time it took the team to get a physical prototype was two to three weeks approximately; most of the time was concentrated on doing the cosimulation, agreeing with the students.The time will vary depending on the complexity of the software tools, the learned concepts, and the system itself.No matter the time it takes, the relevant fact is that a simulation or cosimulation will decrease the time of generating a product twice or even more.

Goal Statement
The main objective is to design a speed controller for DC motors using the SMC technique as the core.This technique will be combined with artificial intelligence methods like Fuzzy Logic (FL), Adaptive Neurofuzzy Inference Systems (ANFIS), and Genetic Algorithms (GAs); this merger is expected to achieve a robust speed controller for DC motors.
Based on the above, the projection is to develop an academic control module such that students studying mechanical, electrical, electronic, mechatronic engineering, or a related subject can design different control techniques and test them with the module.This module will consist of a 12 V DC motor and the power electronic stage if necessary.The theoretical characteristics will involve the DC motor model and SMC, FL, ANFIS, and GAs fundamentals.On the other hand, previous skills in power electronics are required.The concepts will be addressed briefly; if you require further study of the topics, you must go to the references.
Finally, this work will take full advantage of two kinds of software, LabVIEW and Multisim; these tools enhance both students study interest and teaching level.LabVIEW is a platform and development environment for designing systems with a graphical programming language.It is widely recommended for testing hardware and software systems, control and design, and embedded simulated or real time simulation, accelerating productivity.Multisim is widely used in academia and industry for circuit education, electronic schematic design, and SPICE simulation.

Sliding Mode Control.
The SMC is used to drive the system error to a particular hyper plane in the state-space, named the sliding surface.When this surface is reached, the system state is kept switching until stable equilibrium is achieved [10].In the presence of switching time delays and small time constants in the actuators, the discontinuity of the control action produces a particular dynamic behavior in the vicinity of the surface, which is commonly known as chattering [11].
The chattering phenomenon is the main drawback of these controllers and all efforts are concentrated on decreasing this singularity [12].This chattering effect is directly related to the hitting control gain.
The SMC is very attractive for its easy implementation and robustness to plant uncertainties and its indifference to external disturbances, requiring the knowledge of the mathematical model of system [13].
From the state-space equations (1) the SMC can be achieved [14], which is summarized as follows: (2)

Fuzzy Logic Modeling.
A Fuzzy Inference System (FIS) is based on a set of rules capturing the characteristics of how the system should behave with certain inputs by means of ifthen rules with fuzzy predicates that establish the relations between the relevant system variables.
The FIS of the Takagi-Sugeno (TS) type are suitable for the approximation of different types of functions; in this type of FIS the rule consequent is polynomial, generally linear functions.The fuzzy model will be where   is the membership of the speed in the fuzzy sets and   is the consequent constant our consequent constants.The output  (4) is computed as a weighted sum of the all rule outputs, Different approaches have been developed to obtain fuzzy models from data.These techniques are fuzzy clustering, neural networks (NNs), GAs, Kalman filters, among others [15].

Adaptive Neurofuzzy Inference
System.An ANFIS is a graphical network representation of TS fuzzy systems, enhanced with neural learning capabilities.The objective of the ANFIS is to generate the parameters of the fuzzy system through a learning algorithm.In this application, a hybrid learning algorithm was implemented; this is a merge of least squares and back-propagation methods [16].

Genetic Algorithms.
GAs are inspired by the biological process of Darwinian evolution (selection, mutation, and crossover), where good solutions are selected and manipulated to achieve new and possibly better solutions.The manipulation is done by genetic operators that work on the chromosomes in which the parameters of possible solutions are encoded.GAs are iterative algorithms that try to find better solutions for a system; they do not always find the best [15].

Theory Application
Now the theory must be attached in such a way that combining all the previous concepts can generate a new development, in this case, a new automatic control design.Replacing the DC motor constants in (2), the SMC expression becomes Table 3 shows the optimal hitting gain for different angular speed references.
The data from the last table does not have a linear behavior and that is the reason why an FIS model was used.A first approach was acquired by means of an ANFIS and then optimized by GAs.
The optimization was given by 87%. Figure 3 displays the input membership functions already optimized.
The rule base, including the output constants, is Lastly, merging the conventional SMC with the fuzzy model, the new controller is the FSMC.

System Cosimulation
NI Multisim was used to model and analyze the power stage.NI LabVIEW FPGA and the LabVIEW control design and simulation module were used to design the FSMC.
In the cosimulation, the two respective simulators, Multisim and LabVIEW, perform nonlinear time-domain analysis concurrently, exchanging data at the end of each time step and negotiating future time steps, resulting in a strongly combined and accurate simulation.Figure 4 shows the common case where Multisim simulates the power stage circuitry and LabVIEW executes the FPGA-based control system algorithms; the control code resides in LabVIEW, while the plant and sensor are designed by Multisim [17].
The plant model is designed in Multisim and consists of a 12 V DC motor, an H-bridge, an encoder, an operational amplifier for raising the encoder pulse signal, and other circuitry elements.These elements accurately meet real parameters with the aim of having a precise cosimulation.Figure 5 shows the plant model or analog power stage design.
With the analog power stage model and the FSMC complete (theory application), the entire system was analyzed using cosimulation as seen in Figure 6.The loop contains the three stages of the implementation: sensing (encoder), controlling (FSMC), and actuating (PWM duty cycle).

System Prototype and Implementation
The power stage was prototyped on a printed circuit consisting of an H-bridge L293B, an operational amplifier TL074CN, rectifier diodes 1N4001, and a couple of resistors; these elements together with the 12 V DC motor and an encoder of 64 slots completed the analog power stage system.The controller was implemented on a Single Board RIO 9632 (sbRIO 9632) provided by National Instruments.Figure 7 shows the resulting prototype.
The FPGA processing elements gave the possibility of using the same system code for both cosimulation and implementation.If the code does not match the code used during the simulation stage, design validation efforts based on simulation have significantly reduced value.The main control loop of the system is presented in Figure 8.

Results
The behavior of the DC motor speed by changing the set point is presented in Figures 9 and 10; a response obtained by both the cosimulation (dotted line) and the implementation (solid line) can be seen.

Conclusions
To validate the cosimulation/implementation, it is needed to maintain in the same way the control programming blocks (FSMC); any change causes a nontruthful validation.The  most relevant conclusions about the entire development can be summarized as follows.
Methodology Results.Excellent agreement was observed between the simulation and experimental results.The small difference between them is purely reaction times; the cosimulation showed a quicker response which is comprehensible.The cosimulation methodology demonstrated that it can be used for evaluating a complete application before creating a prototype, in this case an FSMC applied to a DC motor.
The proposed methodology was accomplished.An example of simulation is presented leading to the construction of the prototype.It shows the effectiveness of modeling and simulation in engineering education.
The teaching methodology is proposed to be incorporated in engineering careers related to Power Electronics.
A rapid prototyping of motor controllers is a methodology that enables the control engineer to quickly deploy control algorithms and find eventual problems.
Simulation in Education (Literature/Survey).A simulation can discover a possible number of problems and determine optimal parameters increasing the possibility of getting the prototype on first attempt.
Students benefit from computer simulation because they can apply previously learned concepts and theories to practical situations solving real designing problems.
The students are encouraged to understand simulation as a helpful tool for doing their studies work at university as well as for their future industrial activities.
Simulation in Power Electronics.The introduction of simulation software stimulates students' interest and helps to make Power Electronics courses more attractive.
It is much cheaper to do a thorough analysis than building a circuit in which component stresses are measurable.
Simulation in teaching Power Electronics does not replace conventional analytical calculation practical  experiments in the laboratory but it can help to illustrate the basic operation of Power Electronics circuits.
Final Notes.As modern engineering is becoming more complex and more costly, simulation technologies are becoming increasingly crucial to their success.New design tools are needed to support all the software development, testing, and validation efforts made during the simulation stage; this is crucial because it will cause less time (more than twice as long) to move into physical prototype and commercial deployment.

( 1 )
Goal Statement.What is going to be developed, how will it be developed, what theoretical tools are required, what programs are needed, and what are the expected achievements.

Table 1 :
Students survey: simulation in education.

Table 2 :
Simulation in Power Electronics: students' curricula.

Table 3 :
Relationship between the desired speed and hitting gain.