## 1. Introduction

An electrical machine is a complex device being multidomain by nature, involving electromagnetic, mechanical, and thermal phenomena. Thus, the subject of electrical machines is highly multidisciplinary and holds a significant position in engineering education. The knowledge obtained in the electrical machines subject presents a starting point in the whole series of subjects like electrical drives, controlled drives, motion control, control of robots, control of mechatronic systems (industrial lines), etc.

This is why the subject Electrical Machines requires a solid understanding of energy conversion and a good knowledge of physics and physical thinking, supported by mathematical background. Here a student learns the principles of motion and the operation of various types of electrical machines in order to evaluate the influence of various changeable parameters on the performance of the machine. The contribution describes one of possibilities how to improve training methods from the subject of electrical machines.

The main objective of practical training from the subject Electrical Machines is to verify theoretical knowledge from the lectures. It is required that the students should have a good knowledge about the machine construction and its behavior before they enter the laboratory to measure to investigate the machine. There they learn how to understand deeper the substance of the measured machines, to avoid any damage of equipment, and to maintain safety of the work. Classical lectures and printed materials cannot offer students enough possibility to prepare themselves satisfactory for the labs. They give theoretical explanation, but the deep understanding of the machine behavior can be grasped through hands-on experimentation. Also, the time and the space available within courses on electrical machines are not elastic for the verification of various modes and for checking the influence of changeable parameters of a machine on its performance and characteristics.

Various animation models used for the explanation of the phenomena usually do not offer the required variety of a virtual experimentation to get information about the real data of the machine. By contrast, various simulation models offer a possibility to verify the machine performance, but a problem arises here-the learner should master a simulation program. Moreover, a possibility of obtaining false results is very high, not speaking about any user-friendly changing parameters of the machine and other optional parameters to change machine dynamics.

Like pointed out by Dongmei et al in [1], the verification of static and dynamic properties of electrical machines by the application of virtual models, where the mathematical and simulation models are hidden and working in the background, is becoming a key element of modern electrical engineering school. The readiness of the application of virtual dynamical models of electrical machines and drive systems for their analyzing is not disputable (not speaking about cost and time saving). Nice application of using simulation techniques applied to the learning of Electrical Machines is shown in Djeghloud et al in [2]. An example of simulation of a synchronous generator based on it a remote access to the electrical machines remote lab has been published by Martis et al in [3].

MATLAB GUI (graphical user interface) in connection with the Simulink program (and also with some special toolboxes like SimPowerSystems, SymbolicMath toolbox and Control toolbox) presents an extremely suitable tool for the development of purpose-oriented virtual model of any dynamical system. Easy and comfortable change of parameters by control elements, such as push and radio buttons, text boxes, and visualization of results, enables the operation of virtual models either without any deep knowledge of their substance or without any complex programming and debugging of the models.

The proposed chapter presents an extension of the knowledge presented in a series publications by Fedak et al. [5-7] and a continuation of the development of the teaching aids by the application of the virtual models to more specialized topics not described there – a single-phase machine and a stepper machine, including their supply and modes of the operation. This chapter is more-or-less technically oriented and presents a practical guide for the development of a whole series of virtual models of electrical machines to be utilized in the teaching process.

This chapter is organized as follows: for each motor, it starts with its brief description and some peculiarities of motor starting, followed by mathematical and simulation models, and continued by a series of graphs from the simulation to document the behavior and correctness of the model. The simulation model creates a core of the virtual model. The screen of the virtual model was carefully designed from a pedagogical point of view, having in mind easy operation and well arrangement of input (sliders, buttons, and text boxes) and output elements (graphs). Finally, the experience of using the virtual models in teaching several subjects is described, and an evaluation of questionnaires is presented.

## 2. Methodology of virtual models design of electrical machines

In designing successful virtual models, it is necessary to preserve some basic rules, especially in designing the screen, which are as follows:

The model should be easy to operate, without any special guide.

The screen should contain the basic information and cannot be overcrowded by supplementary information taking the learner’s attention and concentration. For example, the parameters of the machine that input into the solution in the beginning of any simulation should be hidden, usually on the second screen.

A proper ergonomic arrangement of the elements upon the screen should be kept. It covers the placement of:

Basic rules to place the control, input, and output elements as well as the procedures were published in previous publications [5-7].

## 3. Virtual model development of a single-phase induction machine

Single-phase induction motors are widely used in applications, and they excel in its simplicity, undemandingness, and reliability. They are also affordably priced. Usually, they are of smaller powers, approximate in the range of tens of watts to kilowatts units, and typically they are used in household appliances (because usually the single-phase supply system is available in the home distribution of electrical energy).

### 3.1. Principle of operation

The mechanical construction of the single-phase induction motor does not differ much from the three-phase one. Different is the way of arrangement of the stator winding and supply: one winding in the stator of the single-phase induction motor cannot create rotating magnetic field necessary for running the machine, but it produces only a vibrant field. The rotor will not start without any auxiliary winding. This is why the motor has two stator windings – the main and the auxiliary ones. The motor power is transmitted through the main winding, which is stored in two-thirds of the stator slots and is supplied directly from the single-phase network. The auxiliary winding is rated for lower current than the main winding. In interactivity having the main winding, its aim is to develop rotating magnetic field with the form approaching as the most to the circular shape.

The single-phase induction motors are distinguished by the structure of the rotor motor with wound rotor and squirrel cage rotor. The cage motor is used only for small performances.

### 3.2. Modes of starting

To get the rotating magnetic field, the current in the auxiliary winding shall be displaced by 90° from the current in the main winding. This is achieved by connecting an inductor or a capacitor in series with the auxiliary winding and parallel connection of the circuit to the main winding connected to the supply. For this reason, a suitable reactance is connected into the auxiliary winding (Figure 1). Here we recognize the following:

The capacitor *C*_{r} connected into the auxiliary phase is optimally calculated according to the following equation:

The one-phase induction motor is supplied by an alternating sinusoidal harmonic voltage that is generated by a simple harmonic oscillator in the model, having on its output the signal of harmonic voltage with the amplitude

### 3.3. The one-phase induction motor model

The motor mathematical model consists of models of electrical and mechanical parts. The electrical part is represented by the scheme in Figure 2.

Based on the equivalent circuits and dynamic equation of the motor, the mathematical equations with their representations are shown in Table 1.

Combining all schemes together, we get the block diagram of the motor (Figure 3), which presents a core of the virtual model enabling deeper understanding of the phenomena in the motor at various modes of operation and supply.

In investigating various modes of starting and operation, it is suitable to complete the model by supplementary blocks, like harmonic oscillator generating sinus and cosinus voltages, by the switches switching the capacitors according to the chose mode of operation, and by block generating the load torque in the optional time instant of loading the machine. The final scheme, used for the virtual model, is shown in Figure 4.

### 3.4. Verification of the motor model with permanently connected capacitor

The speed can be changed by the frequency, by changing the number of poles, and-in a small scale-by change of the voltage or value of the capacitor. The change of the direction of rotation is simply done by the pole change of the auxiliary winding.

Time courses of the motor basic variables, motor torque, speed, and currents in both windings, are shown in Figure 5.

Simulation parameters:

### 3.5. One-phase motor with a double capacitor

To improve the motor performance during start period, a higher capacity is required in the auxiliary phase circuit. This is done by a capacitor *C*_{s} connected in parallel to the existing one (Figure 1b) up to the time instant the motor runs by speed about 70% *ω*_{N,} which is followed by a centrifugal switch. After disconnecting, only the capacitor *C*_{r} of a lower value remains connected permanently. The next figure (Figure 6) shows performance graphs of the motor with double capacitor.

Simulation parameters: *U*_{1} = 230 V, *f*_{1} = 50 Hz, *M*_{load} = 5 Nm, *C*_{s} = 53 µF, *C*_{r} = 32 µF, *ω*_{n} = 110 rad/s, *T*_{sim} = 0.8 s, and *T*_{load} = 0.5 s.

### 3.6. Comparison of the motor performance supplied by the voltages of different frequencies

To get the best motor performance, the constant stator flux must be preserved at various supply frequencies. From this condition, it follows up that *U/f* = const. (Figure 7).

### 3.7. GUI application for the one-phase induction motor

After the verification of the mathematical model of the single-phase motor by simulation, we can design and develop the motor virtual model-graphical user interface in the MATLAB program. The application is designed so that the user is granted simple handling in adjusting motor parameters, and waveforms show typical values of the motor. Graphical user interface (GUI) allows you to visualize four different graphs: the input supply voltage, torque, angular velocity of the rotor, components of stator and rotor currents, and components of magnetic fluxes motor when starting the motor, during steady-state operation, and after loading it the chosen time. The ergonomics of handling and pedagogical respects should be strictly taken into consideration, as widely analyzed in the previous publications [1-3]. Moreover, these aspects of using the model should be also considered-they should be suitable.

### 3.8. GUI screen description

The developed GUI for the one-phase induction motor consists of two screens:

The first (auxiliary) screen (Figure 8) serves:

The second (main) screen (Figure 9) shows the graphs of the motor variables and contains control elements for simulation models and displaying the graphs.

The panel *Motor Parameters* (Figure 10a) enable to input motor parameters and thus to verify and compare behavior of various motors. After pushing the return button, the main program starts model simulation with the actual parameters.

In the bottom-right corner, there are three buttons: the *model* button displays the motor model in the Simulink program, as shown in Figure 4 (and inside the block of the motor, the full scheme appears according to the Figure 3). The *default* button sets the preset values of the parameters, and the *return* button causes return to the second screen with the graphs, and immediately, the simulation starts with the set parameters.

### 3.9. Description of the control panels

The panel *Coordinate system* (Figure 11a) contains three switches to choose the supply mode: (1) supply by the harmonic voltage in the {*α, β*} coordinate system connected with the stator, (2) supply with the permanently connected capacitor, and (3) supply with the double capacitor.

The panel *Graphs* (Figure 11b) consists of two parts: the upper one contains four buttons serving to choose the graphs to display stator/rotor currents or stator/rotor magnetic fluxes. By the buttons in the lower part, the time graphs

The panel *Load and Stop* (Figure 11c) shows the edit boxes for setting the values of the capacitors: permanently connected

The panel *Model* (Figure 11d) contains the possibility to finish simulation and exit from the program (*Close*), displaying motor model in Simulink (*Model*), and after pushing the button *Parameters*, we switch to the screen with parameters (Figures 8 and 10a).

The panel of tools (Table 2) makes the work with the GUI comfortable. The *Tools* panel consists of five icons. The *Context* menu enables to set up line widths for the simulation courses (Line Width), to make a copy of the screen (screenshot) by saving it (Save), to run help (Help), and to close the graphical interface (Close).

## 4. Virtual model development of a stepper motor

Stepper motor is an asynchronous machine, the stator of which contains a control winding. The rotor is either fitted with a permanent magnet or made up of a toothed ferromagnetic magnetic circuit. The stepper motor is an impulse-excited electric machine, the movement of which is not continuous but is done stepwise. Its main advantage consists of motor performance without the necessity of any controllers, and when the motors are not overloaded, they can work without feedback. The precise control of position or rotation at a constant speed is done simply by counting steps.

According to the construction, the stepper motors are divided into three groups, [8]:

### 4.1. Hybrid stepper motor

The hybrid stepper motor accumulates benefits both of stepper motors with variable reluctance and permanent magnets. It has a very small step and high power per unit of weight. The arrangement of the stator winding is similar to this stepper motor with variable reluctance. It differentiates by the rotor that is made from a cylinder permanent magnet with mounted rotor poles along the circumference having teeth. The number of teeth determinates an angle step. Typically, the motors with 50 teeth are produced, in which one step is equal to the angle of 1.8°. In the stator of the hybrid stepper motor, there are usually two windings having terminals arranged as shown in Figure 12.

### 4.2. Control of stepper motors

According to the types of the windings, the stepper motors are divided into the unipolar stepper motor and the bipolar one. Similarly, the control of the stepper motors is divided into the following:

Unipolar control, which is mostly used for a four-phase stepper motor with variable reluctance or for hybrid stepper motors.

Bipolar control, which is used for stepper motors with permanent magnets of for hybrid stepper motors. In this type of control, the current flows through the windings are placed opposed.

#### 4.2.1. Four-tact control magnetizing one phase

In a simple drawing (Figure 13), the rotor is replaced by a rotating permanent magnet having the north pole (red) and the south pole (blue). By switching the stator winding phases in the in the opposite coils, the north and the south poles are also excited.

The principle of the control consists of exciting (and magnetizing) one phase only. According to the cyclogram in Figure 13a, the sequence of excitation A1-B1-A2-B2 ensures the rotation of the magnetic field in the positive direction. The change of the direction is done through reverse switching of the motor phases. Here the current flows through one winding only.

In case of bipolar control (Figure 13b), the current flows simultaneously through two opposite coils. This means the current is twice higher in comparison with the unipolar type. The bipolar control differs by the necessity of change the current direction.

#### 4.2.2. Four-tact control magnetizing two phases

When two neighboring coils are excited simultaneously, according to the cyclogram in Figure 14, the motor torque is

#### 4.2.3. Eight-tact control

Combining the previous two control algorithms leads to doubling the number of stable states (cyclogram in Figure 15). Consequently, an increase of positioning accuracy is achieved (called “soften up”), without changing the structural adjustment. The previous commutation (four-tact control) was the symmetrical one, and the asymmetrical eight-tact commutation causes doubling of the number of rotor steps.

#### 4.2.4. Further modes of the control

Other ways of controlling hybrid stepper motors exist, but due to simplification, we do not deal with them in detail here (although the modes are also included into the virtual model):

Vector control. The commutation consists in simultaneous supplying both phases by different voltages. This enables to rotate the stator magnetic field vector by a softer step.

Microstepper. This is done by commutation at supplying the coils by harmonic voltages that are mutually shifted by

*π*/2. This causes a smooth, continuous movement of the rotor.

### 4.3. Simulation model of the hybrid stepper motor

The model of the motor consists of the electrical part (Figure 16) and mechanical part, described by the dynamic equation.

The mathematical models of all motor subsystems together with corresponding simulation schemes are displayed in Table 3.

Figure 17 shows the complete simulation scheme consisting of the schemes of subsystems.

### 4.4. Simulation results of hybrid bipolar stepper motor at various control modes

A series of experiments before developing the GUI was done in order to verify correctness of the developed motor simulation model.

The hybrid bipolar stepper motor parameters used for simulation are as follows: *L*_{a} = *L*_{b} = 0.058 H, *R*_{a} = *R*_{b} = 30 Ω, *S*_{a}= 1.8°, *N*_{r} = 50, *K*_{m} = 0.8 Nm/A, *T*_{d} = 0 Nm, *b*_{m} = 8.10^{-4} Nms/rad (damping coefficient), *M*_{load} = 0.1 Nm, *U* = 12 V, and *J* = 6.10^{-6} kg m^{2}.

The motor simulation schemes were completed by schemes of simplified voltage sources, enabling control of the chosen stepper motor by whether the full step, half step, reduced (or shortened) step, or microstep.

Just note that the time courses in Figures 18-22 were obtained from the graphical user interface of the hybrid bipolar stepper motor (explained in detail later, in the subchapter 4.5). The graphs display the motor torque *M*, the angular speed *ω*, and the angle of displacement *θ*, and there are courses of the current and supply voltage at the bottom.

#### 4.4.1. Motor control at full step and magnetizing one phase only

The angular displacement starts after the voltage is connected to phase B (Figure 18). The angular step displacement is 1.8° (i.e., 90/50). The load torque influence on the angular displacement is very small.

#### 4.4.2. Motor control at full step and magnetizing two phases

The step displacement in this control mode control comes to a half in comparison with the previous case 0.9° (Figure 19). Also, the load torque has lesser influence on the angular displacement like in the previous case.

#### 4.4.3. Motor control at the half step

Interchange of active coils results in a varying torque and angular velocity, as shown in the simulation results of half-step (Figure 20). The angle displacement step is 0.9°.

#### 4.4.4. Vector control of the motor

In the vector control, two phases are supplied by different voltages (Figure 21). This allows the rotation of the vector of the stator magnetic field. In our case, the nominal value of the voltages *U*_{1} and the second one has the value that ensures the constant step. In this case, this is *U*_{2} = 0.4*U*_{1.}

#### 4.4.5. Microstepper of the motor

At microstepper, one phase is supplied by the sine voltage and the second phase by the cosine voltage (Figure 22). It is possible to replace the harmonic voltage by a discrete course with a low frequency of 1.5 Hz. The achieved final step is 0.21°.

### 4.5. GUI for the hybrid stepper motors

Similarly, like in the previous case, GUI application was developed for analyzing both the bipolar and unipolar hybrid stepper motors. The chosen supply mode is selected by a button. The application allows to implement a simple change of parameters to choose the mode of the motor run to load the motor and to visualize results in four basic charts: for the motor torque, angular speed, the angle of the rotation of the rotor and the line voltage, and the currents in the respective phases.

#### 4.5.1. Description of the screen with graphs

The GUI screen (Figure 23) displays the motor torque *M*, the angular speed ω, the angle of displacement *θ*, and there are courses of the current and supply voltage at the bottom.

The panel *Type of Motor* (upper right) contains two buttons: Bipolar SM and Unipolar SM, where the user selects the mode of basic control of the stepper motor. After selecting the chosen mode, the button turns green.

The panel *Control Mode* (Figure 24a) contains three further subpanels. In the subpanel *Direction*, a direction of rotation is chosen; in the subpanel *Step Modes*, a value of the step is chosen from the choice: full step, half step, reduced or shortened step for the vector control, and, the last choice, microstep. In the last subpanel *Power Supply Phase*, it is possible to choose either the active one or both phases of the motor (this possibility is available only when the full step is chosen).

In the panel *Other Simulation Parameters* (Figure 24b), the user inputs further information required by some modes of control. Here the first panel box is accessible only if a reduced step is chosen in the control mode panel. This gives a possibility to choose a reduced step divided into four parts or into eight. The next panel box is available when the microstep is chosen. The choice gives a possibility to change the frequency of the input sinus-cosinus signals. By the Slider Step Size, it is possible to soften the step size. In the last panel box, it is possible to change the time of simulation *T*_{s}, and the parameter *T*_{v} is related to the microstepper (the text box is available only when the microstepper mode is chosen).

The tools panel and the context menu have similar meaning like in the previous case (see Table 2). At the mentioned step choice, the user can change the direction of rotation of the motor to select other cyclogram of motor supply, to choose the length of each cyclogram (by the parameter *T*_{v}), to change the frequency of a voltage supply at the microstepper, and to choose the step size when the movement of the rotor is continuous.

#### 4.5.2. The screen for inputting parameters of the bipolar stepper motor

The GUI screen enables easy change of parameters of a chosen stepper motor. This GUI screen (Figure 25) appears after choice of bipolar motor-the button *Bipolar SM* in the panel *Type of Motor* (see the GUI main screen in Figure 23). The screen also displays differential equations of the mathematical model of the bipolar stepper motor and equivalent diagram of the motor one phase.

The parameters for any arbitrary bipolar motor are set in the bottom panel *Parameters*. After clicking the model, the Simulink model of the motor is displayed. Pushing the return button causes switch over the main screen.

### 4.6. Integration of the realized virtual models into virtual laboratory of electrical machines

The subject electrical machines taught in the second year of the undergraduate course is devoted to the explanation of the phenomena in the machine, which is supported by various animation models. During lectures, when explaining static and dynamic characteristics of each machine by presentation of demo pictures, animations, videos, and of course using the blackboard for derivation of the dependencies, the virtual models are briefly introduced. The students have a free access to the models through the institutional LAN (the access is also available in the student hostels).

In the laboratory, they measure the characteristics of the motors and compare them with those from virtual models. They also discuss and explain in detail the motor behavior and the influence of motor parameters on the characteristics.

The work with the virtual models saves time at virtual experimentation, but it requires a careful and detailed explanation and analysis of the obtained characteristics by the teacher-how and why is the behavior of the motor corresponding to the form of the characteristics. Otherwise, the students do not fully understand the graphs.

To get feedback from the students and their opinion of introducing the virtual models in the regular teaching, inspired by a questionnaire presented in [9] for Electrical Drives subject we have applied the questionnaire for the Electrical Machines subject and evaluated it (Table 4). Altogether, 36 full-time students of the bachelor study in four groups answered the questions.

The student ratings on the evaluation of incorporating the virtual models into teaching – both into lectures and prior laboratory work – are generally positive. It was observed that majority of students found it useful, interesting, and contributing to increasing knowledge about the subject.

The students works with the virtual models also in the following years in the subjects like:

The subject Electrical Drives where the dynamic characteristics and the influence of parameters on the motor behavior are analyzed in connection with the power electronic converter.

The subject Controlled Drives, for which specialized virtual modules for the subject were developed, which facilitate the calculation and verification of controllers and enable to analyze the influence of the controller parameters on the dynamic behavior of the controlled electrical drives. Of course, a connection with the practical realization is pointed out at each utilization of the virtual model.

## 5. Conclusion

The aim of this study was to present the methodology and results in the development of virtual models of two types of electrical machines in the MATLAB graphical development environment: the one-phase induction motor used in home applications and the stepper motor used widely in automation.

The MATLAB GUIDE, on the one hand, presents a comfortable tool enabling the development of GUI in a very easy and understandable way. On the other hand, it limits the utilization of virtual models by the necessity of the MATLAB program purchase. We do consider it as a limitation because MATLAB is widely distributed and presents a standard tool at the universities. Another solution is to use MATLAB server features through the Internet, which enables registered users (students) to utilize the developed interfaces for free. In the boundary case, a stand-alone .exe program can also be developed, but here, some special features of the MATLAB program are lost (Simulink, SymbolicMath toolbox, Animation toolbox, and some other specialties), and they are replaced by bothersome programming.

The two developed GUIs of the one-phase induction motor and of the stepper motor complete the series of virtual modules developed earlier [5] for the subject of electrical machines, like the virtual models of the DC motor, the three-phase AC motors, and the BLDC motor. The virtual models show system performance in various working points and analyze the influence of variable system parameters, modes of supply, and control parameters on system behavior.

The virtual dynamical models, on one hand, contribute to the e-learning support of teaching and, on the other hand, serve for preparation of students before entering the laboratory experimentation. Their utilization also supports and makes more attractive lectures and considerably enhances the explanation of properties of machines.