Matlab Program Library for Modeling and Simulating Control Systems for Electric Drives Based on Fuzzy Logic

Fuzzy control of the speed of electric drives is an alternative in the field of the control system. Modeling and simulation of electric drive control systems based on fuzzy logic is an important step in design and development. This chapter provides a complete means of modeling and simulation of fuzzy control systems for DC motors, induction motors, and permanent magnet synchronous motors, made in the Matlab/Simulink program environment, useful for performing complex analyzes. The functioning of the programs is demonstrated by an example of characteristics obtained practically, with a functioning regime often encountered in practice.


Introduction
Electric drives play an important role in the development of machine tools, production systems, means of transport, and many other practical applications.The purpose of using electric drive control systems is to ensure good performance indicators.The use of fuzzy logic in the control of electric drives ensures the realization of high-performance systems.Modeling and simulation of electric drive control systems based on fuzzy logic are an important means in their design.This chapter presents a library of Matlab/Simulink programs designed to model and simulate electrical drive control systems based on fuzzy speed PI controllers.
In the literature, the control of electric drives based on fuzzy logic is studied in many works.Several Matlab programs for modeling and simulating electric drive systems based on fuzzy logic are presented on the Matlab website as well.Programs for modeling and simulating fuzzy DC drive systems are presented in [1][2][3].Programs for modeling and simulating fuzzy driving systems of induction motors are presented in [4,5].The Matlab software has the facilities for modeling and simulating fuzzy systems [6] and electric drive systems [7,8].The problem of intelligent control of electric drives has been addressed in numerous papers over the years, including application of expert systems, fuzzy logic and neural networks in electric drives [9], fuzzy control of switched reluctance motor drives [10], or fuzzy adaptive vector control of induction motor drives [11].The basic management systems of electric actuators have been treated in numerous works in the literature as well.The problem of using electric machines in variable speed control systems is treated in [12], principles of motion control with induction motors are presented in [13] and with permanent magnet, AC machines in [14], the issues of pulse-width modulation for electronic power conversion are presented in [15], principles of modeling and simulation of electric drive control systems are presented in [16].The basic design of fuzzy PID controllers is shown in [17].
The author of this chapter published the results of his research in the field of fuzzy control of electric drives in specialized literature, addressing the following issues: speed control based on fuzzy PI controllers of DC machines [18], of synchronous machines with permanent magnets [19], of AC machines in general [20], demonstration of the robustness of fuzzy control systems of electric machines [21], analysis of the basic properties of fuzzy control systems [22,23], tuning of fuzzy PID regulators [24,25] and analysis of the stability of fuzzy control systems [26].
The chapter presents program libraries dedicated to fuzzy speed regulation of the main electric motors used in practice: direct current motors, induction motors, and permanent magnet synchronous motors, respectively in subsections 2, 3, and 4. For each element of the control systems are presented the equations used in modeling and the related subprograms.For each control system, the transient regime characteristics obtained by simulation are presented.Based on the transient regime characteristics, the values obtained for the performance indicators of the control systems are highlighted, such as overshoot, rise time, error, and others.

Library programs 2.1 DC motor
The developed programs solve the problem of speed control of the DC machine with the control system from Figure 1.
The speed control structure from Figure 1 has the following components: MCC -DC motor, ML -load machine, CONV -power converter, RG-i -current controller, RF-Ω -fuzzy speed controller, Ti -current sensor, TΩ -speed sensor, CAN, CNAanalog to digital and digital to analog converters, MM-ISI -DC motor with statespace equations, Lim -anti-wind-up circuit.The control system variables are: Ω*speed reference, Ω -motor speed, Ω m -measured speed, M -motor torque, M s -load torque, e Ω -speed error, i* -current reference, i am -measured current, e i -current error, u i -command voltage, u a -motor armature voltage, i a -current motor, u eexcitation voltage.
The Simulink block diagram of the speed control system of DC drives based on the fuzzy PI controller is presented in Figure 2.
The power converter has the block CONV and the current sensor has the block Ti.Their transfer functions are presented in their blocks.The current controller has a PI linear transfer function.The armature voltage u a is limited.The speed sensor has the block Tw.The current controller has anti-windup protection.The current reference is limited.The simulation diagram allows simulations in four quadrants for speed and torque.The diagram calculates a quadratic performance criterion of speed error with the formula: A theoretic design for fuzzy speed control systems for DC drives is presented in [27].

Induction motor
The structure of the fuzzy control system of the induction machine is presented in The speed control system of induction motors based on the fuzzy PI controller is presented in Figure 5.
The model from Figure 5 implements an induction motor control structure with indirect field orientation in rotor coordinates [13,28].The block mas represents the induction motor and it has the Equations [13,29,30]: The Eqs. (3) are written for the general flux, and in the case of vector control with rotor flux orientation, the flux is the rotor flux: θ f = θ r .CONV is a power inverter functioning in comutation, TCI is the inverse Park coordinate transformation [30], BCC is for calculating the reference currents in the vector control structure of the asynchronous machine with rotor flux orientation.BCC has the block diagram from Figure 6 [13,30].
Where n p -the pole pair number, L m,r -magnetic and rotor inductances, s -slip frequency, R r -rotor resistance, ω s * -stator frequency reference.Two-position current controllers RG-i with hysteresis are used.

Permanent magnet synchronous motor
The structure of the fuzzy control system of the permanent magnet synchronous motor is presented in Figure 7.
The meanings of the notations in Figure 7 are the same as in Figure 4, and MSMP is the permanent magnet synchronous machine.The permanent magnet synchronous motor is vector controlled with rotor flux orientation with rotor q current i * q as a torque reference, the rotor d current i * d at zero as a flux reference ϕ * r , and the measured rotor position θ m .The speed control system of induction motors based on the fuzzy PI controller is presented in Figure 8.
The current controllers and the Park inverse coordinator transformation, like in the case of the induction motor.

Fuzzy speed controller
The Simulink diagram of fuzzy speed controller RF-w is presented in Figure 9.It is developed based on the block diagram of the fuzzy controller RG-F from Figure 10.
The fuzzy controller has Mamdani's structure with the fuzzification of the input variables x i , inference of the fuzzy values x f , with a rule base, and defuzzification of the fuzzy command u f .The fuzzy block gives the command u d .Different membership functions for the input and output variables, different inference methods, and different rule bases may be chosen [17,19,21,22].Here are some Matlab programs for fuzzy computing, as follows.The fuzzy block RG-F has algebraic properties and the sector property presented in [22][23][24].The fuzzy controller RF-w may be designed using a pseudo-equivalence with a linear PI controller with a grapho-analytical method [25][26][27], based on its input-output transfer characteristics [22][23][24].

Speed characteristics
With the help of the programs presented above, transient characteristics can be obtained for various operating regimes, which can be chosen by the signals applied to the speed prescription inputs and to the disturbing inputs of the load torques.Thus, transient regime characteristics can be obtained for speeds, currents, voltages, fluxes, mechanical torques, regulation errors, and others.These programs allow complex analyzes of the behavior of speed control systems based on fuzzy PI controllers.The fuzzy PI controller can be replaced with a conventional, linear PI controller.In order to demonstrate the good functioning of the programs, the following is an example of an operating regime often encountered in practice for the three-speed regulation structures.The simulated operating regime consists of: starting the machine idle up to the nominal speed, loading it with a nominal mechanical torque, and reversing the load.It was also chosen to exemplify the case when a conventional linear PI speed regulator is used.The characteristics in the two cases -fuzzy and linear -are presented in the same graph, and the same coordinate axes, for example.Figure 11a-c show the speed characteristics for the DC machine, induction machines, and the permanent magnet synchronous machine, respectively.
It is observed that in the case of fuzzy control better quality control indicators are obtained: zero overshoot, shorter rise time, shorter time for elimination of load torque effect, etc. [18][19][20].The fuzzy control structures are global absolute internal stable and external BIBO stable [28].The fuzzy control structures are robust at parameter identification errors and at the perturbation from the load torque [21].

Conclusion
The chapter presents a library of Matlab/Simulink programs for the control of electric drives.Thus, Simulink schemes are presented for modeling and simulating the fuzzy speed control systems of direct current machines, induction machines with vector control with rotor flux orientation, and synchronous machines with permanent magnets.Matlab/Simulink programs are presented for modeling and simulating fuzzy PI controllers based on the Mamdani structure.To demonstrate the operation of the programs, the characteristics of the speed obtained in the case of the three adjustment structures are presented.Fuzzy system modeling programs can be developed for various types of membership functions, inference methods, and rule bases.

Figure 1 .
Figure 1.Block diagram of the DC motor fuzzy speed control system structure.

Figure 2 .
Figure 2. Simulink block diagram of the fuzzy control system of DC drive.

Figure 4 .
The meanings of the notations in the Figure4are as follows: MAS -induction machine; ML-working machine; CONV-power electronic convertor; RG-i -stator phase current controllers; Ti-current sensor; Tθ-position sensor; TΩ-speed sensor; TCI-inverse Park coordinate transformation; BCC-block for calculating the reference currents in the vector control structure of the asynchronous machine with rotor flux orientation; RF-Ω-speed fuzzy PI controller; Ω-rotor speed; Ω*speed reference; M*-torque reference; ф r *-rotor flux reference; θ s *-stator phasor position reference; i d *, i q *-d, q stator current references; i s *-stator current reference; Ω m -measured speed; θ m -measured rotor position; i sm -measured stator currents; e Ω -speed error; e i -current error; S i -control signals for power converter switches with pulse width modulation; V cc -DC converter supply voltage; u s -stator voltages; M s -load torque.The induction motor is vector controlled with rotor flux orientation, with rotor flux reference ϕ * r and torque reference M * and the measured rotor position θ m .The reference stator currents are calculated with the block TCI.The current regulators RG-i give the pulse width modulation signals S i for the electronic power converter CONV, fed from a DC voltage source V CC .The power converter CONV gives the stator voltages u s .

Figure 4 .
Figure 4. Block diagram of the induction motor fuzzy speed control system structure.

Figure 5 . 4 MATLAB
Figure 5. Simulink diagram of the fuzzy control system of induction motors.

Figure 6 .
Figure 6.The block for calculating the reference currents in the vector control structure of the asynchronous machine with rotor flux orientation (BCC).

Figure 7 .
Figure 7. Block diagram of the induction motor fuzzy speed control system structure.

Figure 8 .
Figure 8. Simulink diagram of the fuzzy control system of permanent magnet synchronous motors.

Figure 9 .
Figure 9. Simulink diagram of fuzzy speed controller RF-w.

Figure 10 .
Figure 10.The block diagram of the fuzzy controller RG-F.

Figure 11 .
Figure 11.Speed characteristics for direct current machine a), induction machine b) and synchronous machine with permanent magnets c), for fuzzy regulation with continuous line and for conventional regulation with a dashed line.