Open access peer-reviewed chapter

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

Written By

Constantin Volosencu

Submitted: 01 March 2021 Reviewed: 03 November 2021 Published: 30 November 2021

DOI: 10.5772/intechopen.101488

From the Edited Volume

MATLAB Applications in Engineering

Edited by Constantin Voloşencu

Chapter metrics overview

607 Chapter Downloads

View Full Metrics

Abstract

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.

Keywords

  • simulation
  • modeling
  • control of electric drives
  • DC motors
  • induction motors
  • permanent magnet synchronous motors
  • fuzzy PI controllers

1. 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.

Advertisement

2. 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.

Figure 1.

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

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, CNA - analog to digital and digital to analog converters, MM-ISI - DC motor with state-space equations, Lim - anti-wind-up circuit. The control system variables are: Ω* - speed reference, Ω - motor speed, Ωm - measured speed, M - motor torque, Ms - load torque, eΩ - speed error, i* - current reference, iam - measured current, ei - current error, ui - command voltage, ua - motor armature voltage, ia - current motor, ue - excitation voltage.

The Simulink block diagram of the speed control system of DC drives based on the fuzzy PI controller is presented in Figure 2.

Figure 2.

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

The block RF-w in Figure 1 represents the Simulink model of the fuzzy speed controller. The other part of the Simulink diagram is a conventional control part of a linear control system.

The block srcmcc is the internal current control loop and it has the Simulink block diagram from Figure 3.

Figure 3.

Simulink diagram of current control loop srcmcc.

The block Mcc represents the DC motor and it has the equations:

diadt=RaLaiakeLaΩ+1LauadΩdt=kmJiakfJΩ1JMsE1

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 ua 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:

E=e2dtE2

A theoretic design for fuzzy speed control systems for DC drives is presented in [27].

2.2 Induction motor

The structure of the fuzzy control system of the induction machine is presented in Figure 4.

Figure 4.

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

The meanings of the notations in the Figure 4 are 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; id*, iq*—d, q stator current references; is*—stator current reference; Ωm—measured speed; θm—measured rotor position; ism—measured stator currents; eΩ—speed error; ei—current error; Si—control signals for power converter switches with pulse width modulation; Vcc—DC converter supply voltage; us—stator voltages; Ms—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 Si for the electronic power converter CONV, fed from a DC voltage source VCC. The power converter CONV gives the stator voltages us.

The speed control system of induction motors based on the fuzzy PI controller is presented in Figure 5.

Figure 5.

Simulink diagram of the fuzzy control system of induction motors.

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]:

u¯sf=u¯sejθf,i¯sf=i¯sejθf,Φ¯sf=Φ¯sejθf,u¯rf=u¯rejθf+θ,i¯rf=i¯rejθf+θ,Φ¯rf=Φ¯rejθf+θ,u¯sf=Rsi¯sf+dΦ¯sfdt+jωfΦ¯sf,u¯rf=Rri¯rf+dΦ¯rfdt+jωfωΦ¯rf,M=32npLmReji¯sf.i¯rf,JdΩdt=MkfΩMsE3

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].

Figure 6.

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

Where np - the pole pair number, Lm,r - magnetic and rotor inductances, s - slip frequency, Rr - rotor resistance, ωs* - stator frequency reference. Two-position current controllers RG-i with hysteresis are used.

2.3 Permanent magnet synchronous motor

The structure of the fuzzy control system of the permanent magnet synchronous motor is presented in Figure 7.

Figure 7.

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

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.

Figure 8.

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

This diagram implements the rotor flux oriented control structure [14]. The block msmp + csc includes the permanent magnet synchronous motor, with Equations [14, 30]:

u¯sf=u¯sejθ,i¯sf=i¯sejθ,Φ¯sf=Φ¯sejθ,u¯sf=Rsi¯sf+dΦ¯sfdt+Φ¯sf,M=32RejΦ¯sf.i¯sf,JdΩdt=MkfΩMsE4

The current controllers and the Park inverse coordinator transformation, like in the case of the induction motor.

2.4 Fuzzy speed controller

The Simulink diagram of fuzzy speed controller RF-w is presented in Figure 9.

Figure 9.

Simulink diagram of fuzzy speed controller RF-w.

It is developed based on the block diagram of the fuzzy controller RG-F from Figure 10.

Figure 10.

The block diagram of the fuzzy controller RG-F.

The fuzzy controller has Mamdani’s structure with the fuzzification of the input variables xi, inference of the fuzzy values xf, with a rule base, and defuzzification of the fuzzy command uf. The fuzzy block gives the command ud. 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.

A program for defining the function of triangle membership:function [m]=triunghi(x,a,b,c) % parameters: a<b<c / m(a)=m(c)=0, m(b)=1 n=length(x); for i=1:n if x(i)<=a | x(i)>=c m(i)=0; elseif x(i)>a & x(i)<b m(i)=1/(b-a)*x(i)+a/(a-b); elseif x(i)==b m(i)=1; else m(i)=x(i)/(b-c)+c/(c-b); end end

A program for defining the function of decreasing trapezoidal membership:function [m]=trapezd(x,a,b) % parameters: a<b, m(a)=1, m(b)=0 n=length(x); for i=1:n if x(i)<=a m(i)=1; elseif x(i)<b & x(i)>a m(i)=x(i)/(a-b)+b/(b-a); else m(i)=0; end end

A program for defining the function of increasing trapezoidal membership:function [m]=trapezc(x,a,b) % parameters: a<b, m(a)=0, m(b)=0 n=length(x); for i=1:n if x(i)<=a m(i)=0; elseif x(i)>=b m(i)=1; else m(i)=x(i)/(b-a)+a/(a-b); end end end

A program for calculating the rule base 3–3 for DC motors:% Loading control system parameters: load pudmcc % Calculating the margins of discourse universes: diN=IN/Ki/5/Ti; diM=IM/Ki/5/Ti; ewM=KCAN*KTw*2*wb; ewb=ewM/2; deMt=KCAN*KTw/J*(MMt+kf*wb); deMc=KCAN*KTw/J*(MMc+kf*wb); pdi=diM/20; pe=ewM/20; pde=deMt/20; % discourse universes: udi=[-diM:pdi:diM]; ue=[-ewM:pe:ewM]; ude=[-deMt:pde:deMt]; % Definition of fuzzy values: NBdi=trapezd(udi,-diN,0); ZEdi=triunghi(udi,-diN,0,diN); PBdi=trapezc(udi,0,diN); NBe=trapezd(ue,-ewb,0); ZEe=triunghi(ue,-ewb,0,ewb); PBe=trapezc(ue,0,ewb); NBde=trapezd(ude,-deMc,0); ZEde=triunghi(ude,-deMc,0,deMc); PBde=trapezc(ude,0,deMc); % Normalization of discourse universes: ue=ue/ewb; ude=ude/deMc; udi=udi/diN; subplot(3,1,1),plot(ue,NBe,ue,ZEe,ue,PBe); xlabel('ew');ylabel('me');grid subplot(3,1,2),plot(ude,NBde,ude,ZEde,ude,PBde); xlabel('de');ylabel('mde');grid subplot(3,1,3),plot(udi,NBdi,udi,ZEdi,udi,PBdi); xlabel('di');ylabel('mdi');grid % Table of rules A1=[NBe; ZEe; PBe; NBe; ZEe; PBe; NBe; ZEe; PBe]; A2=[NBde; NBde; NBde; ZEde; ZEde; ZEde; PBde; PBde; PBde]; B=[NBdi; NBdi; ZEdi; NBdi; ZEdi; PBdi; ZEdi; PBdi; PBdi]; save daterf3 ue ude udi A1 A2 B ewM deMt

A program for fuzzy block implementation in Simulink scheme:function [dip]=bdf(e,de,A1,ue,A2,ude,B,udi) % Input variables: error e, error deivative: de % Output variable: dip % Inference with Larsen max-min method: dif=infermm(A1,e,ue,A2,de,ude,B); % Defuzzification with centre of gravity method: dip=defzfir(dif,udi,1); end

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].

Advertisement

3. 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 11ac show the speed characteristics for the DC machine, induction machines, and the permanent magnet synchronous machine, respectively.

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.

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].

Advertisement

4. 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.

Advertisement

Conflict of interest

The author has no conflict of interest.

Advertisement

The parameters of the three motors taken as examples are presented below.

The DC motor: Pn = 1 kW, Un = 220 V, nn = 3000 rot./min., η = 0,75, p = 2, J = 0,006 kgm2, Mn = 3,2 Nm, Ωn = 314 rad/s, In = 6A, IM = 10,8 A, Ra = 2,01 Ω, La = 0,034 H, Ta = 0,017 ms, ke = 0,664 Vs, km = 0,533 Nm/A, kf = 8.10−4 Nms, KCNA = KCAN = 1, Ilim = IM, UaM = 240 V.

The induction motor: Rs = 12,4 Ω; Rr = 12,4 Ω; Lm = 0,8 H; L = 0,06 H; L = 0,06 H; p = 4; kf = 0,008 Nms; J = 0,01 kgm2; MMc = 7 Nm; MMt = 24 Nm; nb = 750 rot/min; PN(Mc) = 550 W; IsN = 1,77 A; IsM = 8 A; UsN = 220 V.

The permanent magnet synchronous motor: PN = 400 W; IN = 3 A; IM = 8 A; nm = 4000 rot/min; nb = 3000 rot/min; MMc = 1,3 Nm; MMt = 3,4 Nm; J = 0,001 kgm2; kf = 0,0001 Nms; Rs = 0,6 Ω; Ld = 4 mH; Lq = 5 mH; p = 4; Φe0 = 0,072 Wb; Vcc = 200 V.

References

  1. 1. Sekar A. Fuzzy PI DC motor Speed Control. 2021. Available from: https://www.mathworks.com/matlabcentral/fileexchange/74291-fuzzy-pi-dc-motor-speed-control. MATLAB Central File Exchange. The Mathworks, Inc., Natick, MA, USA. [Accessed 2021-01-06]
  2. 2. Malla S. Fuzzy controller based Speed Control of DC Motor. 2021. Available from: https://www.mathworks.com/matlabcentral/fileexchange/36508-fuzzy-controller-based-speed-control-of-dc-motor. MATLAB Central File Exchange. The Mathworks, Inc., Natick, MA, USA. [Accessed 2021-01-06]
  3. 3. Merah A. Speed control of DC motor using Fuzzy Logic Controller. 2021. Available from: https://www.mathworks.com/matlabcentral/fileexchange/64993-speed-control-of-dc-motor-using-fuzzy-logic-controller. MATLAB Central File Exchange. The Mathworks, Inc., Natick, MA, USA. [Accessed 2021-01-06]
  4. 4. Elbesealy M. A Fuzzy V/F Control for High Performance Induction Motors Drive. 2021. Available from: https://www.mathworks.com/matlabcentral/fileexchange/59454-a-fuzzy-v-f-control-for-high-performance-induction-motors-drive. MATLAB Central File Exchange. The Mathworks, Inc., Natick, MA, USA
  5. 5. Sang N.T. Fuzzy controller induction motor. 2021. Available from: https://www.mathworks.com/matlabcentral/fileexchange/68377-fuzzy-controller-inductin-motor. MATLAB Central File Exchange. The Mathworks, Inc., Natick, MA, USA. [Accessed 2021-01-06]
  6. 6. Zadeh LA. Fuzzy Logic Toolbox User's Guide. The Math Works, Inc., Natick, MA, USA.; 1995-2020
  7. 7. Sybille G, Dessaint LA. et al. Simscape Electrical Reference (Specialized Power Systems). Hydro-Québec and The MathWorks, Inc., Natick, MA, USA; 1998–2020
  8. 8. Sybille G, Dessaint LA. et al. Simscape Electrical Reference. The MathWorks, Inc., Natick, MA, USA; 2013–2020
  9. 9. Bose BK. Expert System, Fuzzy logic and neural network applications in power electronics and motion control. Proceedings of the IEEE. 1994;8:1303-1323. DOI: 10.1109/5.301690
  10. 10. Bolognani S, Zigliotto M. Fuzzy logic control of a switched reluctance motor drive. In: Conference Record of the 1993 IEEE Industry Applications Conference Twenty-Eighth IAS Annual Meeting; 2–8 October 1993; Toronto. Ontario, Canada: IEEE; 2005. DOI: 10.1109/IAS.1993.299145
  11. 11. Cerruto E, Consoli A, Raciti A, Testa A. Fuzzy adaptive vector control of induction motor drives. IEEE Trans. on Power Electronics. 1997;6:1028-1040. DOI: 10.1109/63.641501
  12. 12. Slemon GR. Electrical machines for variable-frequency drives. Proc. of the IEEE. 1994;8:1123-1139. DOI: 10.1109/5.301681
  13. 13. Lorenz RD, Lipo TA, Novotny DW. Motion control with induction motors. Proc. of the IEEE. 1994;8:1215-1240. DOI: 10.1109/5.301685
  14. 14. Jahnd TM. Motion control with permanent magnet AC mashines. Proc. of the IEEE. 1994;8:1241-1252. DOI: 10.1109/5.301686
  15. 15. Holtz J. Pulse width modulation for electronic power conversion. Proc. of the IEEE. 1994;8:1194-1214. DOI: 10.1109/5.301684
  16. 16. Mohan N, Robbins WP, Underland TM, Nilsen R, Mo O. Simulation of power electronic and motion control systems - an overview. Proc. of the IEEE. 1994;8:1287-1302. DOI: 10.1109/5.301689
  17. 17. Buhler H. Reglage par logique floue. Lausanne: Press Polytechniques et Universitaires Romands; 1994. p. 20
  18. 18. Volosencu C. Fuzzy control of electrical drives, based on fuzzy logic. WSEAS Transactions on Systems and Control. 2008;9(3):809-822
  19. 19. Volosencu C. Speed Control of a Permanent Synchronous Motor, Based on a Quasi-Fuzzy Controller, In Proceedings of the 10th European Conference on Power Electronics and Applications, European Power Electronics and Drives Association, 2003, Toulouse, France
  20. 20. Volosencu C. Some Consideration about Using Fuzzy Logic for Speed Control of Electrical Drives, In The 7-th European Congress on Intelligent Techniques and Soft Computing EUFIT’99, 1999. Aachen, Verlag Mainz, Germany
  21. 21. Volosencu C. Demonstration by Simulation of the Robustness of the Fuzzy Control System of a DC Motor at Errors at the Parameter Identification, In Pemc’98 Conference, 1998, Prague, Czech Technical University, Czech Rep
  22. 22. Volosencu C. Introductory Chapter: Basic Properties of Fuzzy Relations, In Volosencu C, editor. Fuzzy Logic, IntechOpen, London, UK; 2020. p. 3-10. DOI: 10.5772/intechopen.88172
  23. 23. Volosencu C. Properties of fuzzy systems. WSEAS Transactions on Systems. 2009;2(8):210-228
  24. 24. Volosencu C. On Some Properties of Fuzzy Systems, In Proceedings of the 8th WSEAS International Conference on Signal Processing, Robotics and Automation (ISPRA09), Feb. 21–23, 2009; Cambridge, UK, 2005
  25. 25. Volosencu C. Tuning Fuzzy PID Controllers, In Rames C. Panda, editor. Theory, Tuning and Application to Frontier Areas, IntechOpen, London, UK.; 2012. 171-190. DOI: 10.5772/32750
  26. 26. Volosencu C. Pseudo-equivalence of fuzzy PID controllers. WSEAS Transactions on Systems and Control. 2009;4(4):163-176
  27. 27. Volosencu C. Pseudo-Equivalence of Fuzzy PI Controller, In Proceedings of the 8th WSEAS International Conference on Signal Processing, Robotics and Automation (ISPRA09), Feb. 21–23; Cambridge, UK, 2009, WSEAS Press, Athens, Greece
  28. 28. Volosencu C. Stabilization of fuzzy control systems. WSEAS Transactions on Systems and Control. Athens, Greece: WSEAS Press; 2008;10(3):879-896
  29. 29. Leonhard W. Control of Electrical Drives. Berlin: Springer Verlag; 1985
  30. 30. Boldea I, Nasar SA. Vector Control of A.C Drives. Boca Raton, Florida: C. R. C. Press; 1992

Written By

Constantin Volosencu

Submitted: 01 March 2021 Reviewed: 03 November 2021 Published: 30 November 2021