Open access peer-reviewed chapter

Electric Machines: Tool in MATLAB

Written By

Rabih Rammal and Mohamad Arnaout

Submitted: 11 October 2016 Reviewed: 03 April 2017 Published: 11 October 2017

DOI: 10.5772/intechopen.68957

From the Edited Volume

Science Education - Research and New Technologies

Edited by Antonio Vanderlei Dos Santos and Joao Carlos Krause

Chapter metrics overview

2,262 Chapter Downloads

View Full Metrics


This chapter presents an educational modeling and parametric study of specific types of transformers, generators, and motors used in power system. Equivalent circuit models are presented and basic equations are developed. Through tests and operating conditions, essential parameters for each presented machine are extracted. Graphical user interface (GUI) on MATLAB software is used to study and analyze each element. GUI allows better comprehension and clearer vision to analyze the performance of each electric machine, thus, a complementary educational tool. In addition, GUI permits optimal collaborative learning situations when linked with the theoretical expansion and, thus, is a teaching process that forges the connection between traditional subjects and science education.


  • GUI
  • educational tool
  • science education
  • electric machines
  • ferromagnetic material
  • transformers
  • DC machines
  • induction machines

1. Introduction

There are several ways to generate electricity which are burning fossil fuels, converting water into steam, and using the steam to spin a turbine that is connected to an electric generator. In hydroelectric power plants, generators are turned by water and via wind in wind turbines. In all cases, the electricity generated at these facilities flows across the transmission and distribution system to where it is needed to meet customer demand in cities and rural areas. The electric system is an interconnected network for generating, transmitting, and delivering electricity to consumers [1].

The conventional view of studying electric machines concentrates on concepts. The graphical user interface provides direct contact with the content, provokes curiosity, and implements the science education through scientific knowledge based on facts, laws, theories, and models. The integration of this new structure improves science comprehension and helps students to learn better and more efficiently.

The study of an efficient power system starts with understanding the behavior of each component that develops this system. Electric machines used in power systems (generators, motors, and transformers) will be examined through analytical expressions and computer simulation. The importance of simulation is that these components could be studied before it is manufactured; thus, the consequences of changing dimensions and parameters can be assessed.

This simulation will be implemented in an educational tool, going from the basic operation principles, through developing models and equations toward the solution. The graphical user interface of MATLAB allows the students to study and analyze the effect of each parameter in order to understand its electric behavior with respect to its electric model.

This chapter will discuss the implementation of ferromagnetic core using graphical user interface taking into consideration the effects of air gap and fringing of a ferromagnetic core. Then, a detailed study of output power and losses with voltage regulation and efficiency of a single- and three-phase transformer will be established. In addition, a special survey will be accomplished concerning the types of DC motors and generators. Finally, this chapter will be concluded by providing an adequate research on the induction machines including their parametric study, and it will be achieved by a general conclusion of this work.

This chapter presents learning situations going from the theoretical expansion to the graphical interpretation. It is a teaching methodology toward the science education.


2. Ferromagnetic core

Magnetic fields are the essential means by which energy is converted from one form to another in motors, generators, and transformers. The most important class of the magnetic materials is the ferromagnetic materials such as iron, cobalt, nickel, and manganese [2].

There are four basic principles which describe how magnetic fields are used [2]:

  1. A wire produces a magnetic field in the area around it when current passes through it.

  2. A change in magnetic field, by mutual inductance, induces a voltage in the coil of wire: this is the principle of transformer action.

  3. In the presence of a magnetic field, a current-carrying wire has a force induced on it: this is the principle of motor action.

  4. In the presence of a magnetic field, a moving wire has a voltage induced in it: this is the principle of generator action.

2.1. The magnetic field

The magnetic field is produced by induced current in Ampere's law:


where Inet produces magnetic field intensity and H and dl are the length integration along a path. If the core is produced from ferromagnetic material (Figure 1), then all the magnetic field produced within the core will remain inside the core. Therefore, the path of integration dl in the Ampere’s law is the mean path length lc [2].

Figure 1.

Ferromagnetic core.

The current passing in the path of the integration Inet is NI since the coil of the wire divides the path of integration into N times when the current passes through it:


The magnetic field intensity H is the effort in which a current is applying to establishment of a magnetic field. Strength of the magnetic field depends on the material of core. There is a relationship between the magnetic field intensity, the material magnetic permeability µ, and the magnetic flux produced within the material as shown in Eq. (3):


The permeability of free space is called µ0 and equal to 4π × 10− 7H/m, and the relative permeability is the permeability of any other material compared to the free space permeability:


In the core (Figure 1), the magnitude of the flux density is given by


Therefore, the total flux in a given area is expressed in Eq. (6). This equation reduced if the flux density vector is perpendicular to any plane of area, and if the flux density is constant throughout the area, then to


2.2. Magnetic circuits

Magnetic flux is produced when the current in a coil of wire is wrapped around a core. This is similar to a voltage in an electric circuit producing a current flow. Thus, a “magnetic circuit” is defined by equations that are similar to that of an electric circuit. In the design of electric machines and transformers, the magnetic circuit model is used to simplify the complex design process [2].

The voltage or electromotive force drives the current flow in the electric circuit. The magnetomotive force of the magnetic circuit is denoted by where is the magnetomotive force in ampere-turns. In the magnetic circuit, the applied magnetomotive force causes flux (φ) to be produced (Figure 2).

Figure 2.

(a) A simple electric circuit. (b) The magnetic circuit analogue to a transformer core.

The relationship that governs the magnetomotive force and flux is given by


The permeance of a magnetic circuit is the reciprocal of its reluctance. Therefore, the relation between magnetomotive force and flux can be expressed as


It is easier to work with the permeance of a magnetic field than with its reluctance.

The resulting flux and reluctance of a core are shown in Eqs. (9) and (10), respectively:


The equivalent reluctance of a number of reluctances in series is just the sum of the individual reluctances:


The equivalent reluctance of a number of reluctances in parallel is just the sum of the individual reluctances:


The reluctance of each leg of a ferromagnetic core is


The air-gap reluctance at leg X is


The total flux of the ferromagnetic core is


2.3. Implement in MATLAB GUI

When implementing in MATLAB, the user will add certain input which will then be calculated, and the result will be displayed. Below is a block diagram of the system.

The user fills the number of regions with availability of air gap indicating which leg is available and the details for core type such as relative permeability of the material and number of turns with the current (Figure 3). The results of the calculated parameters such as total flux and total reluctance and magnetomotive force of ferromagnetic core are displayed (Figure 4).

Figure 3.

Ferromagnetic core GUI block diagram.

Figure 4.

Graphical user interface for ferromagnetic core.

Also, the user should add the parameters of the ferromagnetic core such as length, area, air gap, and fringing percentage of each leg of the core; the ferromagnetic core is displayed after entering the inputs. Push buttons are added to load, save data, clear, and quit.


3. Single- and three-phase transformer

3.1. Introduction

Transformer allows developing different voltage levels across the system for the most cost-effective price. Transformer functioning principle is based on the idea that energy can be transferred by means of magnetic induction from one winding at the primary side to another winding at the secondary side. This is done by varying the magnetic field produced by alternating current [2, 3].

In this section, graphical user interface (GUI) on MATLAB software will be used to calculate the circuit parameters, efficiency, and voltage regulation of single-phase and three-phase ac transformer. The MATLAB results have been verified and compared with manual calculation in order to ensure they are correct and reliable.

Using GUI in electrical simulation, the instructor/teacher could show the effect of variation for different parameters and then permit to analyze and conclude without the need of manual solving.

3.2. Single-phase transformer model

A single-phase transformer consists of one primary winding and one secondary winding. The exact equivalent circuit with its parameter is shown in the figure below [4].

The parameters of this transformer are as follows (Figure 5):

Figure 5.

Exact model of transformer.

Primary side:

  1. Primary voltage terminal (VP)

  2. Primary current (IP)

  3. Primary resistance (RP)

  4. Primary leakage reactance (XP)

  5. Core resistance (RC)

  6. Magnetize in reactance (XM)

  7. Number of turns (NP)

    Secondary side:

    1. Secondary voltage terminal (VS)

    2. Secondary current (IS)

    3. Secondary resistance (RS)

    4. Secondary leakage reactance (XS)

    5. Number of turns (NS)

These parameters can be calculated by open-circuit test and short-circuit test procedure.

3.3. Transformer test

Two tests are applied on the transformer in order to determine its parameters: short-circuit and open-circuit tests [2].

The results permit to determine the equivalent circuit of the transformer, its voltage regulation, as well as its efficiency.

3.3.1. Short-circuit test

A voltmeter, ammeter, and wattmeter are connected in the HV side of the transformer. Then, the voltage at rated frequency is applied to that HV side using a variable ratio autotransformer. We will then short circuit the LV side of the transformer. Keep increasing the applied voltage, slowly, till reaching the rated current of the HV side (ammeter reading).

Once the rated current is reached on the HV side, the readings extracted on all three instruments, voltmeter, ammeter, and wattmeter, are recorded. The full-load current equivalent corresponds to the ammeter reading.

The transformer core losses could be neglected in this test. In fact, the voltage applied during the short-circuit test on the transformer is very small when compared to the rated voltage of the transformer.

The copper losses in the transformer could be read on the wattmeter. In fact, the wattmeter indicates the input power during the short-circuit test, when the voltmeter is showing the short-circuit voltage VSC. At this time, no output power will appear (short circuited), the core losses are neglected due to the low applied voltage, and, thus, the copper losses in the transformer correspond to the input power.

The extracted values, when the test is accomplished on the transformer’s HV side, are referred to the HV side. We can also refer these values to the LV side dividing by the squared turn ratio of the transformer.

Let us consider that the wattmeter reading is PSC:


If Ze is the equivalent impedance of the transformer, then


Therefore, if the equivalent reactance of transformer is Xe, then


Power factor of the current and angle of power factor are shown below:


3.3.2. Open-circuit test

The open-circuit test consists of connecting an ammeter, a voltmeter, and a wattmeter to the LV side of the transformer. At rated frequency, a voltage is applied to the LV side using a variable ratio autotransformer.

Increasing this applied voltage until the LV side rated voltage is reached (using the voltmeter readings). The HV side of the transformer is kept open. Now, the three readings, voltage, current, and power, are recorded.

The recorded current is the no-load current Ie. It has a small value when compared to the transformer’s rated current, and, thus, we can neglect the voltage drop due to this electric current. The recorded voltage V is now equal to the transformer’s secondary induced voltage.

The wattmeter indicates the input power, which corresponds to the core and copper losses in the transformer, since no output power will appear (open circuit). Copper losses could be neglected since the no-load current is very small compared to the full-load current, and, thus, the core losses in the transformer are considered equal to the wattmeter reading, Po:


where Rm is the transformer’s shunt branch resistance.

If Zm is the shunt branch impedance of the transformer, then


Therefore, if shunt branch reactance of transformer is Xm, then


The test is applied on the LV side of the transformer, so the calculated values are referred to the LV side. We could calculate the referred HV side values by multiplying these values with the squared turn’s ratio of the transformer. The open-circuit test on transformer is used to determine the parameters of the shunt branch of the equivalent circuit of transformer:


The excitation admittance is therefore


The equivalent series impedance is therefore


The voltage regulation is


And the efficiency is


3.4. Three-phase transformer

A three-phase transformer is made of three transformers that are either separated or combined in one core. The primary side and secondary side of any given three-phase transformer can be connected independently in either delta (∆) or wye (Y) [2].

3.5. Implementation on GUI MATLAB

The user will enter certain values into the GUI interface, and then the result will be displayed with respect to this flow chart (Figure 6).

Figure 6.

Flow chart for GUI.

The graphical user interface for single-phase transformer is shown in Figure 7.

Figure 7.

Graphical user interface for single-phase transformer.

The user will add the inputs which are values of short-circuit test and open-circuit test. And then, choose between leading and lagging load. The results of the equivalent circuits referred to primary and secondary side are displayed after adding the parameter and clicking on to calculate the equivalent circuit, and the equivalent circuit of the transformer referred to the primary side and secondary side are displayed with their parameter.

The user may also choose the type of core of the transformer whether circular or rectangular in shape (Figure 8).

Figure 8.

Transformer core shape calculated.

Push buttons were used to load and save data as well as to display the performance of the transformer (Figure 9).

Figure 9.

Single-phase transformer performance.

The graphical user interface for three-phase transformer is shown in Figure 10.

Figure 10.

Graphical user interface for three-phase transformer.

Here, the user has to choose the type of connection. An example of calculation is shown in Figure 11.

Figure 11.

Per unit equivalent circuit of three-phase transformer.


4. DC machines

4.1. Introduction

This chapter discusses the types of DC machines with implementation of graphical user interface and plotting the torque speed characteristics and terminal characteristic for each DC machine [5].

In DC machines, the armature or loops of the rotor can be connected in many ways to the segments of the commutators. The rotor output voltage and the number of parallel current paths are affected by these several ways of connection [2, 5].

In any given machine, the voltage induced in EA depends on three factors:

  1. The flux φ in the machine

  2. The speed ωm of the rotor of the machine

  3. A constant K that depends on the construction of the machine

The voltage of the real machine armature is given by


In any DC machine, the torque depends on three factors:

  1. The flux φ in the machine

  2. The armature current IA of the machine

  3. A constant K that depends on the construction of the machine

The torque on the armature of a real machine is


4.2. DC motors and DC generators

DC machines can be used as DC motors or DC generators. The difference between the motor and generator is the power flow direction. The equivalent circuit of DC motors and DC generators is similar to each other, but the direction of the current flow of the DC motors is opposite to the direction in DC generators [2].

In a DC machine, the induced voltage is directly proportional to the flux and the speed of rotation of the machine. The magnetomotive field force is produced by field current, which in turn produces flux along with its magnetization curve.

As long as the field current is proportional to the magnetomotive field force and the induced voltage is proportional to the produced flux, it is usual to present the magnetization curve as a plot of EA-induced voltage with respect to the current of the field for a constant speed ω0.

4.2.1. Types of DC motors

  1. Separately excited DC motor: is a DC motor where the field circuit is supplied by a separate voltage supply.

  2. Shunt DC motor: is a DC motor whose field circuit gets its power directly across the armature terminals of the motor.

  3. Series DC motor: is a DC motor where the field windings consist of few turns that are connected in series with the armature circuit.

  4. Compounded DC motor: is a motor that consists of both a shunt and a series field. It consists of two types: cumulative and differential compounded DC motor.

In cumulative compounded motor, the current flows into the dots of both field coils. The resulting magnetomotive forces add to produce a larger total magnetomotive force.

In differential compounded motor, the current flows into the dot on one of the field coils and out of the dot of the other field coil, the resulting magnetomotive forces subtract.

4.2.2. Types of DC generators

  1. Separately excited generator: a separate power source, independent of the generator, supplies the field flux to the DC generator.

  2. Shunt generator: the field circuit is connected directly to the generator terminals in order to produce the field flux to the DC generator.

  3. Series generator: the field circuit is connected in series with the generator armature to produce the field flux to the DC generator.

  4. Cumulatively compounded generator: is a DC generator in which both the shunt and the series fields are available, and their effects are added.

  5. Differentially compounded generator: is a DC generator in which both the shunt and the series fields are available, but their effects are subtracted.

4.3. Implementation on GUI MATLAB

A graphical user interface is implemented for DC machine with types of generators and motors. The first GUI will obtain the armature resistance for any DC machine (Figure 12).

Figure 12.

GUI to determine the armature resistance of DC machines.

The user will determine the type of winding and enter the inputs which are pole number. Coil numbers and turn numbers with the plex and resistance per turn then calculate results. The armature resistance (RA) is expressed by


The results will be displayed with armature resistance included. This value will be installed in the other part of the graphical user interface for DC generators and DC motors.

The graphical user interface for the types of DC generators and DC motors is shown in Figure 13.

Figure 13.

Graphical user interface for the types of DC motors and DC generators.

The user will choose the type of DC generator/motor and enter the corresponding parameters. Push buttons are available to load and save the data, calculate the armature resistance, and quit the program. Results will be displayed with the terminal characteristic and torque speed characteristics (Figures 14 and 15).

Figure 14.

DC motor terminal characteristics.

Figure 15.

DC generator terminal characteristics.

The equivalent circuit of the type of motor or generator will be displayed after calculating the result.


5. Induction machines

5.1. Induction motors and induction generators

An induction machine is a machine with only a continuous set of amortisseur windings. They are induction machine because the voltage of the rotor is induced in the rotor winding instead of being physically connected with wires. To run the machine, it does not require a DC field current. Induction machines can be used as either generators or motors. Induction machines are not used as generators except in some special applications due to their disadvantages. Therefore, induction machines are most of the time referred to as induction motors [2].

After applying a three-phase voltage to the stator, current flows into the stator which produces magnetic field that rotates in a counterclockwise direction. The rotation speed of the magnetic field is expressed by


The relative motion of magnetic field and rotor is defined with two terms, which are

  1. Slip speed: It is the synchronous speed minus rotor speed.

  2. Slip: It is the relative speed expressed as ratio of slip speed to synchronous speed in a percentage basis.


Note that the rotor turns at s = 0, whereas at s = 1, the rotor is stationary.

5.2. The equivalent circuit of an induction motor

The equivalent circuit of an induction motor is similar to that of the transformer, with a difference between the magnetization curve of the transformer and induction machine (Figures 16 and 17).

Figure 16.

The transformer model of an induction motor, with rotor and stator connected by an ideal transformer of turn ratio aeff.

Figure 17.

The magnetization curve of an induction motor compared to that of a transformer.

5.3. Implementation on GUI MATLAB

A graphical user interface is implemented on MATLAB for induction machines (Figure 18).

Figure 18.

Graphical user interface for three-phase induction machine.

The user has to enter details related to the induction machine:

  1. In this part the user can calculate and display the result of induction machine torque characteristics (Figure 19).

  2. Single- and double-cage rotor characteristic (Figure 20).

Figure 19.

Equivalent circuit and torque speed characteristic.

Figure 20.

Single- and double-cage rotor characteristic.

As we noticed, the double-cage design, when compared to the single-cage rotor, has a high starting torque with smaller maximum torque and a slightly higher slip in the normal operating range.


6. Conclusion

Ferromagnetic materials were discussed and implemented with respect to its magnetic model in graphical user interface using MATLAB.

Single-phase and three-phase transformers were discussed with implementation of transformer model in GUI on MATLAB. We also checked the parameter referred to secondary and primary side with the effect of load of the transformer.

DC machines were discussed with implementation of different types of DC motors, obtaining the plots of torque speed characteristic. Different types of DC generators were also implemented on GUI, and the terminal characteristics were also obtained.

Induction machines were examined through implementation of the parameters of induction motor in the GUI on MATLAB, obtaining the torque speed characteristics and the terminal characteristics.

Implementing an educational model on GUI MATLAB for the ferromagnetic core, single- and three-phase transformer, DC machines, and induction machines allows the students to study and analyze the effect of each parameter in order to understand its electric behavior with respect to its electric model.


  1. 1. Afsar MN, Birch JR, Clarke RN, Chantry GW. The measurement of the properties. Proceedings of the IEEE. 1986;74:183-199
  2. 2. Chapman SJ. Electric Machinery Fundamentals. 4th ed. New York: McGraw-Hill; 1991
  3. 3. Coltman JW. The transformer [historical overview]. Industry Applications Magazine. 2002;8(1):8-15
  4. 4. Winders J. Power Transformers: Principles and Applications. CRC Press; 2002 ISBN 9780824707668
  5. 5. Fitzgerald AE, Kingsley C Jr., Umans SD. Electric Machinery. 6th ed. New York: McGraw-Hill; 2003

Written By

Rabih Rammal and Mohamad Arnaout

Submitted: 11 October 2016 Reviewed: 03 April 2017 Published: 11 October 2017