Open access

Dynamic Simulation of Electrical Machines and Drive Systems Using MATLAB GUI

Written By

Viliam Fedák, Tibor Balogh and Pavel Záskalický

Submitted: 02 December 2011 Published: 26 September 2012

DOI: 10.5772/48519

From the Edited Volume

MATLAB - A Fundamental Tool for Scientific Computing and Engineering Applications - Volume 1

Edited by Vasilios N. Katsikis

Chapter metrics overview

27,450 Chapter Downloads

View Full Metrics

1. Introduction

Since the first appearance, the fields of electrical machine and drive systems have been continuously enriched by introduction of many important topics. Progress in power electronics, microcontrollers, new materials and advances in numerical modeling have led to development of new types of electrical machines and in field of electrical drives to realization of complex control algorithms. Their verification is usually done by simulation during system design, thus the effort is concentrated to development of simulation models.

MATLAB offers almost infinite possibilities for easy development of system models. MATLAB GUI (Graphic User Interface) in connection with Simulink and specialized toolboxes present a suitable and easy programmable tool for development of purpose-oriented virtual model of any dynamical system. Easy and comfortable change of parameters by control elements in MATLAB GUIDE (GUI Development Environment), such as push- and radio- buttons, text boxes, and easy visualization of results, enable to develop virtual models without deep knowledge of their substance nor without a tedious programming and debugging the models.

Well-elaborated models of electrical drives and machines available on-line were developed by (Riaz, n.d.). (Saadat, 2012) presented application of MATLAB GUI for electrical engineering subjects, available online and MATLAB GUI was utilized in (Petropol-Serb et al, 2007) for development of virtual model of induction machine.

Our contribution aims to present methodology and results in development of unified series of virtual models for electrical machines and drive systems using MATLAB GUI. The organization of the contribution is as follows: after brief description of tasks at virtual models design in GUI MATLAB (chapter 2) in the third chapter we describe development of few typical GUI oriented models of (more complex) electrical machines starting from a simple outline of mathematic model, following by simulation model. Emphasis is put on development of the virtual model itself and description of its features. The fourth chapter deals with CAD of drive controllers using GUI MATLAB. Finally, in the fifth chapter we share some experiences from development of the GUIs and their utilization for training of students. In conclusion we also present ideas for our future work.


2. Design methodology for virtual models of electrical machines and drives

2.1. Tasks in design of the GUI screen

The GUI providing human-computer interaction presents one of the most important parts when working with the system model. User interacts with the computer easily, intuitively, without need for derivation, design, development, composition, and debugging the simulation model; without necessity to learn its operation, and finally, he gets required information in transparent, well-arranged form. In the fact, such GUI presents a functional virtual model, where the user sets system parameters, chooses mode of operation and required outputs to observe results. Design of GUI starts with careful planning of the following tasks:

  1. Derivation of system mathematical model

  2. Getting, debugging, and verification of simulation model

  3. Programming GUI

  4. Determination of input parameters changes (editing boxes, sliders)

  5. Determination of outputs in graphical and text form

  6. Design of the screen (or a set of interconnected screens)

  7. Choice of calculation modes and algorithm of their control

  8. Final refining and verification of functionality of the designed GUI screen

2.2. Principles of ergonomics of the GUI screen

When designing a functional GUI screen for the technical systems, designer must understand principles of good interface and screen design. Generally, the rules are described in (Galitz, 2007). We have adapted and extended them for design of virtual model – of a GUI MATLAB screen. The most important principles, when designing the placement of objects on the GUI screen, are:

  • Legibility — saying that information should be distinguishable.

  • Facitily —how easy is the designed GUI screen intuitively usable.

  • Readability — how information is identifiable and interpretable.

  • Attractivity —to attract and call attention to different screen elements (placement of control elements and outputs, using colors, …).

  • Guiding the eye — by placement and grouping command objects by visual lines/boxes.

Further, designer should deal with user considerations, as follows:

  • Visually pleasing (user friendly) composition of the screen.

  • Organizing screen elements (balance, symmetry, alignment, proportion, grouping).

  • Screen navigation and flow.

  • Choice of implicitly pre-setting system parameters and their range (so that virtual models can be generally used in larger range of parameter changes).

  • Changing system parameters by sliders or by numerical values in editing boxes.

  • Finally, designer has to maintain ergonomic of the screen where the control elements and outputs should be organized in a legible way.


3. Virtual models for analysis of dynamical properties of electrical machines

In background of every GUI MATLAB there is working a simulation model of the system derived from its mathematical model. The same procedure is applied at development of GUI for electrical machines and drives. Let’s show the GUI MATLAB development procedure on few electrical machines – the AC induction machine (asynchronous motor) and the brushless DC motor.

3.1. AC drive with 3-phase asynchronous motor

The AC drive consists of an AC machine supplied by a converter. The variables of AC machine (an asynchronous motor in our case) like electrical quantities (supply voltages and currents), magnetic variables (magnetic fluxes), and mechanical variables (motor torque and rotor angular speed) are usually to be investigated in:

  • Various reference frames (rotating coordinate systems). In case of asynchronous motor two basic reference frames are considered:

  • {α,β}ωk=0
  • {x,y}ωk=ω1
  • Various modes of supply:

  • harmonic (sinusoidal voltage)

  • non-harmonic (stepped voltage), PWM

3.2. Asynchronous motor model

For dynamic properties investigation of asynchronous motor (influence of non-harmonic supply to properties of the AC drive, etc.) a dynamical model of AC machine is used. The AC machine is described by set differential equations. For their derivation some generally accepted simplifications are used (not listed here) concerning physical properties, construction of the machine, electromagnetic circuit, and supply source.

In order to simplify mathematical model of the squirrel cage motor, the multiphase rotor is replaced by an equivalent three-phase one and its parameters are re-calculated to the stator. Equations describing behavior of the machine are transformed from three- to two-phase system what yields to decreased number of differential equations. The quantities in equations are transformed into reference systems.

To derive dynamic model of asynchronous motor, the three-phase system is to be transformed into the two-phase one. In the fact, this transformation presents a replacement of the three-phase motor by equivalent two-phase one. The stator current space vector having real and imaginary components is defined by the equation:




Basic equations of the AC machine with complex variables (denoted by a line over the symbol of the variable) in the reference frame rotating by general angular speedωk are:


where the nomenclature is as follows:

  • u1, i1, R1, L 1– voltage, current, resistance and inductance of stator phase winding

  • u2, i2, R2, L2 – voltage, current and resistance and inductance of rotor phase winding (re-calculated to stator quantities)

  • Ψ1,Ψ2
  • ω
  • mz – load torque

  • ωkωk=ω10
  • ω1,ωω=ω1ω
  • σσ=(L1L2Lh2)/L12

For manipulation between various reference frames in the motor model the transformation formulas are used as listed in Tab. 1. All rotor parameters and variables are re-calculated to the stator side.

After inserting real and imaginary components into the complex of variables (e.g. for stator voltageu¯1=u1x+ju1y in synchronously rotating reference frame {x, y}), we get the AC motor mathematical model whose equations are listed in Tab. 2 and a block diagram shown in Fig. 1 whereK1=1/(σL1), K2=1/(σL2),.

TransformationMatrix notationBlock diagram
{a, b, c}  {α, β}
from 3-phase system {a, b, c} to 2-phase reference frame {α, β} fixed with the stator
(Clark transform)
{α, β}  {a, b, c}
from 2-phase reference frame fixed with stator {α, β}
into 3-phase system {a, b, c}
(inverse Clark transform)
[iαiβ]=[10001313] [iaibic]
{x, y}  {α, β}
from synchronously rotating reference frame {x, y} into the stationary frame {α, β}
(Park transform)
[iaibic]=[1012321232] [iαiβ]
[ixiy]=[cosρsinρsinρcosρ] [iαiβ]
{α, β}  {x, y}
from stator reference frame {α, β} }into the synchronously rotating frame {x, y}
(inverse Park transform)
[iαiβ]=[cosρsinρsinρcosρ] [ixiy]

Table 1.

Transformation relations between three-phase system and two-phase reference frame and between {x, y} and {α, β} reference frames

Magnetic fluxesRelation between fluxes and currents

Table 2.

Equations of windings of asynchronous motor model in {x,y} reference frame

The corresponding Simulink model is drawn in Fig. 1. The model of squirrel cage motor (rotor voltages = 0) contains 4 inputs and 10 outputs (Tab. 3).

Figure 1.

Simulink model of 3 phase squirrel cage asynchronous motor (the variables are denoted in the magnetic field reference frame {x, y})

AM model inputsAM model outputs
U1 input voltage (axis x or α)
U2 input voltage (axis y or β)
Mz load torque
ρ=ω1treference frame angular speed
current ωk (4 components)
magnetic fluxes i¯(4 components)
motor torque M
rotor angular speed

Table 3.

Notation of inputs and outputs of the asynchronous motor model

3.2.1. Modeling of supply source

The asynchronous motor can be set into motion by various supply modes and control platforms:

  • by direct connection to the supply network or to the frequency converter

  • by frequency starting (with continuously increasing frequency of the supply voltage from the frequency converter)

Restrict our considerations to supply from indirect converter with the Voltage-Source Inverter (VSI). Based on the inverter control mode the output voltage can be:

  • unmodulated (with 120 deg. switching in the power semiconductor devices)

  • modulated by PWM

Developing inverter simulation schemes we have in mind two facts:

  • the constant stator flux (i.e. fulfilling condition of constant ratio: U1/f1 = const.) should be preserved at all modes of motor control

  • in range of very low frequency there should be kept an increased stator voltage (due to the voltage drop across the stator resistor) – so called V-curves (presenting a dependency of the supply voltage from the frequency). The V-curve can be modeled simply by a linear piecewise line.

The model of the motor supply source taking into consideration all described features is shown in Fig. 2 (signals denoted as SL and op are control signals from the GUI buttons). It has 4 inputs: supply frequency and voltage magnitude, ramp frequency and voltage (to simulate frequency starting). The switches “step/ramp” are controlled by pushbuttons from the GUI control panel.

Figure 2.

Simulink model of various modes of supply source (DC, harmonic, frequency converter and PWM)

Model of VSI converter (with constant output frequency)

We start to model the inverter output voltage based on a similarity of output converter voltage with the perpendicular harmonic voltages (Fig. 3a). The VSI voltage vector changes its position 6 times per period, after every 60° (Fig. 3b).

Proper switching instants are realized by comparators and switches (Fig. 4). Harmonic oscillator creates a core of the inverter model. Generation of six switching states during period of the output voltage is adjusted by comparing values of the sin/cos signals with pre-set values of sin 60 =Ψ¯/2 for the voltage 3and value of cos 60 = 1/2 for the voltageu1α. The amplitudes of output voltage are adjusted by constants with values 1; 0,5 for u1βand 0,866 =u1α/2 for3.

Figure 3.

Simulink model of inverter

Figure 4.

Simulation scheme realizing rectangle voltagesu1β,u1α of the inverter

Model of PWM source

The simplest way to generate a PWM signal uses the intersective method. The three-phase PWM voltage is generated directly in two axes {α, β} as shown in Fig. 5. The courses of the inverter PWM voltages u1β and u1α are shown in Fig. 6. In frequency starting mode of the asynchronous motor, the frequency of supply voltage increases from zero to required final value. To get the stator flux constant, the voltage across the motor has to increase linearly with frequency (U/f = const.), except of very low frequency range (due to voltage drop across the stator resistor). For this purpose, the connection must be completed by a compensating circuit which increases the value of supply voltage keeping the ratio U/f = const (Fig. 7). Up to the frequency of approx. 5 Hz the input voltage is kept constant on 10 % of its nominal value.

Figure 5.

Model of voltages u1β and u1αfrom the inverter with PWM

Figure 6.

Output voltages and u1β and u1β from the frequency converter: a) without and b) with PWM

Figure 7.

The model of converter realizing the frequency starting under consideration of the law of constant stator flux (U/f = const.)

The model supposes that amplitude of the DC link voltage is changed in the frequency converter. This solution is suitable for drives with low requirements to motor dynamics. The DC link contains a large capacitor what causes the DC link voltage cannot be changed step-by-step. The output inverter voltage can change faster if the PWM control is used. Output voltages of the inverter model with linear increasing frequency and voltage are shown in Fig. 8 (observe a non-zero amplitude of the voltage that at the starting what is consequence of described V-curve block).

Figure 8.

VSI output voltages u1α and u1α at increased frequency (the frequency time course is on the top figure)

3.2.2. Model verification

The AC induction motor model was simulated using following motor parameters: R1=1,8 Ω; R2=1,85 Ω; p=2; J=0,05 kgm2, K1=59,35; K2=59,35; K=56,93.

Time courses of mechanical variables are shown in Fig. 10 (they are the same regardless the used reference frame). Motor dynamical characteristics ω =fM at various modes of supply are compared in Fig. 11.

Figure 9.

Time responses of asynchronous motor speed and torque at harmonic voltage supply at starting and loading the motor

Figure 10.

Dynamic characteristic of the asynchronous motor ω = f(M) supplied: a) by harmonic voltage, b) from frequency converter, c) from frequency converter with PWM

3.2.3. GUI design and realisation

After debugging the motor model (Fig. 11), development of GUI continues with careful design of the program flowchart and design of GUI screen.

Figure 11.

Arrangement of asynchronous motor subsystems in the Simulink GUI model

Description of the GUI functionality

The GUI screen (Fig. 13) consists of several panels. Their functionality is as follows:

  • Input data panel (“Motor parameters”) in the bottom left part. The panel is used to system parameters entry. Their values can be changed by inserting numeric values into editing boxes. There is a possibility to return to original (default) parameters by pushing the button Default (in the pane Mode).

  • Choice of Coordinate reference frame system (the panel on the right top part) enables to display motor output variables:

  • in the synchronously rotating reference frame

  • in the reference frame associated with the stator

  • at harmonic supply

  • at nonharmonics supply from the VSI

  • at nonharmonics supply from the VSI with PWM

  • Output graphs. Output variables are displayed in four graphs:

  • supply voltage time courses and in two coordinates

  • mechanical variables - motor torque and speed

  • stator currents or magnetic fluxes

  • rotor currents or magnetic fluxes

  • The graph to be displayed can be chosen by pushing radio button in the menu Graphs. Time courses are chosen by the button Time; dependency of one variable on other is chosen by the button Rectangular.

  • Mode of starting the motor can be selected in the panel Motor supply:

  • Direct connection to the supply – the button Step. The voltage U1 (effective rms value) and frequency f1 can be pre-set in the editing boxes.

  • Frequency starting – the button Linear enables to pre-set the frequency time rise starting from zero.

  • Using the buttons in the panel Mode we start Simulation, at pressing Default (original) parameters are set, and the Simulink scheme is shown by pushing the button Model.

Figure 12.

GUI screen of the AC drive with induction machine

Screen outputs

Samples of the screens displaying variables in the stator reference frameu1β are shown in Fig. 13:

  1. time courses at supplying motor by frequency converter – button Time )

  2. chracteristics{α,β}, M=f(ω), i1α=f(i1β)- button Rectangular )

  3. time coursesψ1α=f(ψ1β), i1α=f(t)at supplying from the PWM frequency converter

Figure 13.

Examples of diplaying various graphs in the GUI for asynchronous motor

3.3. BLDC motor

The Brushless Direct Current (BLDC) motor is rapidly gaining popularity by its utilization in various industries. As the name implies, the BLDC motor do not use brushes for commutation; instead of this they are commutated electronically.

The BLDC motors have many advantages over brushed DC motors and induction motors. A few of these are: (1) Better speed versus torque characteristics; (2) High dynamic response; (3) High efficiency; (4) Long operating life; (5) Noiseless operation; (6) Higher speed ranges. In addition, the ratio of torque delivered to the size of the motor is higher, making it useful in applications where space and weight are critical factors (Indu, 2008).

The torque of the BLDC motor is mainly influenced by the waveform of back-EMF (the voltage induced into the stator winding due to rotor movement). Ideally, the BLDC motors have trapezoidal back-EMF waveforms and are fed with rectangular stator currents, which give theoretically constant torque. However, in practice, a torque ripple exists, mainly due to EMF waveform imperfections, current ripple, and phase current commutation. The current ripple follows up from PWM or hysteresis control. The EMF waveform imperfections result from variations in the shapes of slot, skew and magnet of BLDC motor, and are subject to design purposes. Hence, an error can occur between actual value and the simulation results. Several simulation models have been proposed for analysis of BLDC motor (Jeon, 2000).

3.3.1. Construction and operating principle

The BLDC motor is also referred to as an electronically commuted motor. There are no brushes on the rotor and the commutation is performed electronically at certain rotor positions. In the DC commutator motor, the current polarity is reversed by the commutator and the brushes, but in the brushless DC motor, the polarity reversal is performed by semiconductor switches which are to be switched in synchronization with the rotor position. Besides of the higher reliability, the missing commutator brings another advantage. For the DC brushed motor the commutator presents also a limiting factor in the maximal speed. Therefore, the BLDC motor can be employed in applications requiring high speed (Jeon, 2000).

The BLDC motor is usually considered as a three-phase system and thus it has to be powered by a three-phase power supply. The rotor position must be known at certain angles, in order to align the applied voltage with the back-EMF. The alignment between the back-EMF and commutation events is very important.

A simple motor model of BLDC motor consisting of a three-phase power converter and a brushless DC motor is shown in Fig. 14.

3.3.2. Mathematical model of the BLDC motor

Modeling of a BLDC motor can be developed in the similar manner as a three-phase synchronous machine. Since there is a permanent magnet mounted on the rotor, some dynamic characteristics are different. Similarly, the model of the armature winding for the BLDC motor is expressed as follows:


where L is armature self-inductance, R - armature resistance, ua, ub, uc - terminal phase voltages, ia, ib, ic - motor input currents, and ea, eb, ec - motor back-EMF.

Figure 14.

BLDC motor model

In the three-phase BLDC motor, the back-EMF is related to a function of rotor position and the back-EMF of each phase has 120º phase angle difference so the equation for each motor phase is as follows:


where Kw is back EMF constant of one phase, θe - electrical rotor angle, ω - rotor speed. The electrical rotor angle θe is equal to the mechanical rotor angle θm multiplied by the number of poles p:


Total torque output Te can be represented as summation of that of each phase:


The equation of mechanical part is represents as follows:


where Tl is load torque, J - rotor inertia, b - friction constant.

3.3.3. Simulink model of the BLDC motor

Fig. 16 shows the block diagram of the BLDC motor SIMULINK model in the rotor reference frame.

Figure 15.

Simulink model of the BLDC motor

Fig. 16 shows detail of the BLDC motor block. Fig. 17a shows Simulink diagram of trapezoidal back-EMF and in Fig. 17b there is Simulink model of sinusoidal back-EMF. The trapezoidal functions and the position signals are stored in lookup tables that change their output according to the value of the electrical angle (Indu, 2008).

Unlike a brushed DC motor, the commutation of a BLDC motor is controlled electronically. To rotate the BLDC motor, the stator windings should be energized in sequences. In order to understand which winding will be energized following the energizing sequence, it is important to know the rotor position. It is sensed using Hall Effect sensors embedded into the stator. Most of the BLDC motors contain three Hall sensors embedded into the stator on the non-driving end of the motor. The number of electrical cycles to be repeated to complete a mechanical rotation is determined by rotor pole pairs. Number of electrical cycles/rotations equals to the rotor pole pairs. The commutation sequences are shown in Tab. 4.

Figure 16.

Detailed overview of the BLDC motor block

Figure 17.

Trapezoidal (a) and simusoidal (b) model of the back-EMF

Electrical degreeHall sensor value (ABC)PhaseSwitches
0º - 60º101A-CS1-S2
60º - 120º001B-CS2-S3
120º - 180º011B-AS3-S4
180º - 240º010C-AS4-S5
240º - 300º110C-BS5-S6
300º - 360º100A-BS6-S1

Table 4.

Electrical degree, Hall sensor value and corresponding commuted phase in clockwise rotation of the rotor

3.3.4. Mathematical and simulink model of the three-phase converter

The converter supplies the input voltage for three phases of the BLDC motor. Each phase leg comprises two power semiconductor devices. Fig. 18 shows the scheme of the considered three-phase converter.

Figure 18.

Modelled three-phase converter

Appropriate pairs of the switches (S1 to S6) are driven based on the Hall sensors input. Three phases are commutated in every 60° (el. degrees). The model of the converter is implemented using the equations:


where Uan, Ubn, Ucn are line-neural voltages, Ud – the DC link voltage, Uf – the forward diode voltage drop.

Fig. 19a shows the Simulink model of the three-phase converter block. In the simulation we assumed an ideal diode with neglected voltage drop Uf. The Commutation sequences block was developed based on the commutation sequence shown in Tab. 4. Converter voltage waveforms that are switched according to the commutation sequences in Tab. 4 are shown in Fig. 19b.

Figure 19.

Detailed overview of the three-phase converter (a) and voltage source waveforms (b)

3.3.5. GUI of the BLDC motor

The simulated BLDC motor is presented in a graphical user interface GUI (Fig. 20).

By the buttons in the panel Mode we start the Simulation, put Default (original) values and show the Simulink Model.

Figure 20.

GUI for the BLDC motor

The default parameters of the BLDC motor for simulation are: Ud=80 V, Tl=0,35 Nm, R=4,98 Ω, L=2,05 mH, ψ=56,23.10-3 Wb, b=0 Nm/rad.s-1, J=15,17.10-6 kgm2, p=4.


4. Virtual models applied for synthesis of drive systems

MATLAB GUI presents an extremely suitable tool for development of models to support CAD design of drive controllers, whose algorithms are known. Two simple cases are presented below: design of controllers in the frequency and time domains, other cases are mentioned in the subchapter 5.1.

4.1. CAD design of controller parameters for DC motor drive in frequency domain

The DC drive controllers in the frequency domain are calculated mostly by using the following criteria:

  1. The current controller of the PI type is calculated on basis of the Optimum Modulus Criterion (OMC) from the drive system parameters:

  1. After calculation of the current controller parameters and current control loop simplification, the speed controller is calculated based on the Symmetrical Optimum Criterion (SOC). It is again of PI type having the transfer function:


Fig. 22 shows the principal block diagram of the system and in Fig. 23 there is view on the virtual GUI model of speed controlled DC drive.

Figure 21.

Control circuit of DC motor drive with current and speed controllers

Virtual model features

The user has a possibility to tune controller parameters in each design step according to displayed time response. The GUI screen consists of several panels:

  • Time response - the graph with time courses of the motor current and speed. Immediately after change of any system parameter (motor -, drive -, or controller parameters) by a slider or inserting a numeric value into editable box the simulation starts and new time responses are drawn (like in a real drive).

  • Block diagram - displays the block diagram of the system

  • System parameters are changed by sliders or inserting values into the boxes.

Before starting the model, implicit parameters are set up, but they can be changed later. After pushing the button Computed value the parameters of controllers are calculated from the actual values of parameters. Simultaneously a small window appears there with a question whether the calculated values of controller parameters are acceptable or not (if not, user can set up own parameters and can to tune them according to the time responses of the drive). To return to starting values, the user pushes the button Default (similar to the system restart).

Figure 22.

GUI screen for designing DC motor drive controllers in the frequency domain

4.2. CAD design of controller parameters for DC motor drive in time domain

The computing algorithm is different from calculation of the controllers in the frequency domain and the task belongs to more complex one. The computation starts from the state-space model of the DC motor having two inputs in one output, in the form of state equations:


where A is system matrix, x – state vector, b – input vector, cT output (row) vector e-disturbance vector, u – input variable, y - output variable.

The final control structure with the feedback through the state controller vector rT is clear from the Simulink model Fig. 23. The integrator at the input serves to reject constant or slowly changing disturbances what is a common case.

The state control structure parameters:y=cTx=[10]x, Kiand r1are designed by known pole placement method where for a prescribed position of poles the required polynomial is compared with the system polynomial and missing parameters of the controller are calculated from a set of linear algebraic equations.

The control structure in Simulink to simulate the system is shown in (Fig. 23).

Figure 23.

Simulink model of the state-space control of DC drive

Fig. 24 shows the GUI screen of the virtual model that enables to calculate state-space controller parameters and visualize time responses of the current and speed. It is a more complex GUI involving synthesis of the state-space controllers and giving the possibility to tune theoretically calculated parameters.

Figure 24.

GUI screen for designing DC motor drive controllers in the state space domain

The panel Controller parameters serves to setting parameters of the state controller – by tuning or selecting the button Optimal parameters to calculate poles position placement.


  • r1 – feedback from state variable x1 (motor speed),

  • r2 – feedback from state variable x2 (motor current),

  • Ki – gain of the integrator (to reject steady-state disturbances).

The state controller parameters are calculated automatically on basis of required values of control time and damping (panel Poles, the item Required poles of the system). In the upper part of the panel the real positions of poles are shown.


5. Experiences with utilization of virtual models

5.1. Utilization of virtual dynamical models

Except of the presented GUI screens of virtual models a series of tens other models from fields of electrical engineering and mechatronic systems was developed to suit institutional needs. They cover topics from Electrical Machines, Power Electronics, Electrical Actuators and Drives, Servodrives, Mechatronic Systems, Control Theory, and others. We have also developed some more complex GUIs, reported e.g. by (Ismeal & Fedák, 2012), calculating artificial intelligence algorithms - to design PID controllers using fuzzy logic and genetic algorithms with various objective functions to evaluate the best PID controller.

The developed GUIs serve as virtual models to clarify phenomena and enhance features of the systems during lectures, and to prepare students for laboratory work. In order students to get more skills and practical experiences prior entering lab their work consists of two phases:

Design and simulation – for a given system motor or drive a student has:

  • to derive mathematical model,

  • to compose the block diagram,

  • to design control law and controllers (in case of drives),

  • to verify system behavior by simulation.

Verification and analysis – a student has:

  • to verify the design using a virtual reference model,

  • to perform system analysis (“to play himself” with the virtual model) in order to investigate system behavior at various values of system parameters and in various working points (small experiments round working point).

5.2. Application of MATLAB compiler in virtual model development

A disadvantage of using GUI MATLAB consists in the fact, that the program can run only on a computer having installed the MATLAB program (and appropriate toolboxes containing instructions that are used in the main GUI program). This disadvantage can be suppressed by development of an executable (.exe) file from the original program. In this case the developer must install the Compiler Runtime program. The MATLAB Compiler creates a standalone executable file from the MATLAB code, which can then run in a runtime engine called Matlab Compiler Runtime (MCR). Once compiled, the standalone application, along with MCR, can be shared with other users for free. The only problem is that the original GUI MATLAB program cannot contain any Simulink model (mdl file). As the GUI MATLAB systems usually contain Simulink models, they have to be replaced by MATLAB programs solving mathematical model by various algorithms.


6. Conclusion

The chapter describes principles and methodology of virtual models development in GUI MATLAB for few chosen electrical machines and controlled drives. The models perform analyses of real machines and drives in various working points and they enable easily to show system performance in various working points and to analyze influence of variable system parameters, modes of supply, and control parameters to system behavior. Presented virtual models have been of various complexity – the simpler ones enable virtual analysis of electrical machines and more complex virtual models also deal with algorithms for synthesis of drive controllers.

Strong advantage of developed virtual models consists in the fact user does not need to know the complexity of dynamical system whose simulation scheme is working in the background. He changes only system parameters, selects input signals (shape and amplitude of reference values, forcing and load signals), select mode of calculations and outputs (graphs displaying). The parameters of virtual models can be changed by a slider or by editing numerical values in editable boxes.

Based on the procedure a whole series of virtual models designed in GUI MATLAB has been developed at the authors’ institution in recent years which are partly accessible trough the website of the Virtual Laboratory for Control of Mechatronic Systems (KEM TU Kosice, 2010). The virtual dynamical models contribute to e-learning support at teaching and they also serve for preparation of students for laboratory experimentation. Their utilization makes more attractive lectures and considerably enhances explanation of systems properties. By simulation model students generally easier understand physical processes and they are better prepared to the laboratory work.

Shortcoming of developed models consists in the fact they run on computers having installed the MATLAB program. To overcome this, recently our work was concentrated to applications of the MATLAB Compiler to develop excecutable files. It should be noted that this application enables to run MATLAB operation without simulation (i.e. without a Simulink scheme), without 3D virtual reality views and without animation. The advantage on one side makes development of virtual models more difficult using more complex mathematical subroutines. Also some known problems with GUI MATLAB should be noted - cross platform appearance may not be the same and during the GUI development, often must be used tricks and somehow unfriendly techniques.



The financial support of the Slovak Research and Development Agency under the contract No. APVV-0138-10 is acknowledged. The work was also supported by Slovak Cultural and Educational Agency of the Ministry of Education of Slovak Republic under the contract KEGA 042TUKE-4/2012 “Teaching Innovation in Control of Mechatronic Systems”.


  1. 1. GalitzW. O.2007The Essential Guide to User Interface Design. An Introduction to GUI Design Principles and Techniques,Wiley Publishing, Inc., 978-0-47005-342-3Indianapolis, Indiana
  2. 2. HillS.2011How to Make an Executable From MATLAB Code, Date of access: Mach 31, 2011, <>
  3. 3. InduB.AshlyR.TomM.2008Dynamic Simulation of Brushless DC Drive Considering Phase Commutation and Backemf Waveform for Electromechanical Actuator. IEEE TENCON, Hyderabad 2008. 978-1-42442-408-5
  4. 4. IsmealG. A.FedákV.2012Overview of Control Algorithms for DC Motor Drive as a Basis for Development of GUI in MATLAB. XXVI. microCAD International Scientific Conference, Miskolc, 2012, 9 p., 978-9-63661-773-8
  5. 5. JeonY. S.MokH. S.ChoeG. H.KimD. K.RyuJ. S.2000A New Simulation Model of BLDC Motor with Real Back EMF waveforms. IEEE CNF on Computers in Power Electronics, COMPEL 2000, 217220July 2000
  6. 6. KEM TU Kosice2010Virtual Laboratory of Mechatronic Systems Control., In: Date of access: March 31, 2012, Available from <>in Slovak)
  7. 7. MathWorks.(n.d.DeploytoolR2012a Documentation MATLAB Compiler
  8. 8. ParspourN.HanitschR.1994Fuzzy Controlled Brushless DC Motor For Medical Applications. Industrial Electronic, Control and Instrumentation IECON, IEEE, Bologna, 1994, 0-78031-328-3
  9. 9. Petropol-SerbG. D.Petropol-SerbI.CampeanuA.PetrisorA.2007Using GUI of Matlab to create a virtual laboratory to study an induction machine. EUROCON, 2007. The International Conference on Computer as a Tool, 978-1-42440-813-9Warsaw, September 9-12, 2007
  10. 10. RiazM.(n.d.Simulationof.ElectricMachine.DriveSystems.UsingM. A. T. L. A. B.SimulinkUniversity of Minnesota.
  11. 11. SaadatH.2012MATLAB Graphical User Interface for EE Students. Date of access: March 31, 2012, Available from <

Written By

Viliam Fedák, Tibor Balogh and Pavel Záskalický

Submitted: 02 December 2011 Published: 26 September 2012