Open access peer-reviewed chapter

Embedded Control of the DC Drive System for Education

Written By

Marian Gaiceanu

Submitted: September 12th, 2016 Reviewed: January 12th, 2017 Published: May 3rd, 2017

DOI: 10.5772/67461

Chapter metrics overview

1,579 Chapter Downloads

View Full Metrics


Taking into account the spread use of the DC motor in robotics, the main objective of the chapter is to promote the knowledge regarding the development of the DC drive system, in didactical manner. Basically, for one motor control the cascaded loop DC drive system is used. Numerical implementation of the DC drive system based on Z-transform discrete method is provided. The electrical drive supposes both control types: the torque and speed. The feedback signals of the control loops are provided by using incremental encoder and of an original load torque estimator. Based on the DC motor dynamics, the appropriate parameters of the speed and torque controllers are provided automatically. On line parameters estimation of the DC motor can assure the performances of the DC drive controllers. The symmetrical and modulus optimum criteria are used. In order to prove the feasibility of the proposed solution, the entire Matlab script of the cascade control of the DC drive is provided. The strategy of the cascaded loop control at constant flux is divided into dynamic regime and into steady state regime. The chapter strategy follows two directions: the first, knowledge developments, the second, the applicative research through the real time implementation.


  • Arduino
  • Matlab®
  • Simulink
  • H‐bridge
  • DC motor
  • speed control
  • torque control
  • load torque estimator
  • discrete control system synthesis
  • Z‐transform

1. Introduction

The chapter is addressed to researchers, students, and the users of industrial power converters and electric drives or mechatronics. The chapter contains the mandatory theoretical aspects and methods in order to develop successful DC drive system, being the most used in mechatronics applications. Upon implementing the proposed chapter applications, the readers will have the capability to develop own electric drive system, to bring the idea in practice very fast, and for better understanding of using the drive systems being open to add own contributions in the mechatronics field. The chapter contains the basic concepts and techniques to design, simulate, and implement an electric drive system through a well‐structured technical guide. By completing this chapter, the researchers will be familiarized with applying the concepts and techniques to manage adequately an electric drive system, widely found in industry and in mechatronics projects. The chapter strategy follows two directions: first, the theoretical approach (a practical discretization method is provided), and the second, the applicative research (numerical simulations and real‐time implementations are provided). The chapter contains a high level of the cross‐disciplinarily: electric machines, power electronics converters, Matlab/Simulink, real‐time implementation, electrotechnics, measurements, and advanced control techniques.

In Section 2, an overview of the adjustable DC drives is given with the purpose to point out the development trend in the technology. In the next section, the dynamical equations of the DC drive system are provided. Section 4 contains the design of the rotor current and speed controllers. The load torque estimator is described in Section 5. Section 6 comprises the energetically model of the DC drive. Based on the on-line parameters identification procedure [1] the energy balance of the DC drive is performed and the appropriate energetic model is deducted in the Section 6 [2]. The optimal control based on linear quadratic controller is designed in the Section 7. The numerical approach by using Z‐transform is provided in Section 8, and the simulation results are provided in Section 9. The real‐time implementation of the speed control is included in Section 10. The conclusions of the chapter are placed in Section 11. The entire Matlab script is provided.


2. Overview of the DC drives

The DC machine can be controlled by using power converters. At low speed, the DC drives are very often used. There are two mainly control techniques: armature voltage control (constant torque region) and field current control (constant power region). The armature voltage control is obtained by maintaining constant field current and the field current control by maintaining the constant armature voltage [3].


3. The mathematical model of the DC drive system

Under certain hypotheses, the mathematical model of the DC machine could be obtained in state space form.

Supposing a constant value of the DC motor parameters, the DC machine has the compensated winding, the magnetic flux maintained at the constant value, the state space mathematical model of the DC machine becomes as follows [2]:

[ d n ( t ) d t d i A ( t ) d t ] = [ F v J C m c J C e T A R A 1 T A ] [ n ( t ) i A ( t ) ] + [ 0 1 T A R A ] u ( t ) + [ 1 c J 0 ] T L ( t ) E1

in which J is the reduced inertia moment to the electric motor shaft, TA , the armature time constant, RA , the armature resistance, and the specific constants

c t = π 30 , C m = k ϕ , C e = c t C m , E2

in which k is the DC motor constant.

The state vector of the DC machine contains two states, x ( t ) = [ n ( t ) i A ( t ) ] , the control vector is only the rotor voltage u (t) = u A (t), the perturbation vector is the load torque w(t) = TL (t), and the output of the DC motor is the speed y(t) = n(t). Under these circumstances, the mathematical model of the DC motor becomes

x ˙ ( t ) = A x ( t ) + B u ( t ) + G w ( t ) y ( t ) = C x ( t ) , . E3

Taking into consideration the above mentioned hypothesis, the mathematical model of the DC motor Eq. (1) is linear and invariant.

In order to obtain variable speed, there are two topologies of the power converters for DC motor applications: ac‐dc and dc‐dc. The mathematical model of the power converter, under certain conditions (continuous conduction, neglecting the voltage drop in conduction mode), represents an ideal power amplifier kD [2].


4. The cascaded loop control of the DC drive system

The DC drive contains two control loops: the inner—the armature current loop and the outer—the speed loop, Figure 1 [2]. Therefore, the control is in cascaded manner. The current feedback is delivered through an adequate current sensor and the speed feedback is obtained based on numerical derivative of the encoder signals. The desired speed is set as reference signal from a potentiometer. Due to the higher power necessity, the dc‐dc four quadrants power converter is added. Therefore, by means of the DC voltage control of the DC machine, the torque and speed are adequately adjusted according to the references. The parameters of the current regulator are obtained by using the modulus criterion, and the parameters of the speed controller are delivered by using the symmetrical optimum criterion (Kessler version).

Figure 1.

Block diagram of the digital DC speed cascaded control.

By taken into account the 10 (V) voltage unified system, the transfer function of the proportional‐integral (PI) current controller is expressed as

H R I ( s ) = k 3 + k 4 s E4

with the following parameters [2]:

k 3 = T R A A 2 T Σ I k D k I , k 4 = R A 2 T Σ I k D k I E5


  • k D = U N 10 , transfer function of the dc‐dc power converter;

  • k I = 10 I A max [ V A ] , attenuation factor of the current transducer;

  • T Σ I = T I the sum of the parasitic time constant of the current loop is determined by the time constant of the current transducer.

The transfer function of the PI speed controller has the form:

H R T ( s ) = k 1 + k 2 s E6

the parameters of the speed controller [2] being deducted from symmetrical optimum criterion:

k 1 = k I c J 2 T Σ N C m k T E7
k 2 = k I c J 8 T Σ N 2 C m k T E8

in which:

  • k T = 10 n N [ V r p m ] , attenuation factor of the speed transducer;

  • T Σ N = 2 T Σ I + T N , the sum of the parasitic time constants of the speed loop, TN being the time constant of the speed transducer.


5. Load torque estimator

In Figure 2 , the operational model of the load torque estimator [4, 5] is shown. The calculus of the load torque estimator parameters is based on the imposed performances: desired pulsation ω 0 * , and the desired overshoot ξ*, respectively:

τ = 2 ξ * ω 0 * E9
c = 2 ξ * ω 0 * . E10

Figure 2.

The second‐order load torque estimator [2].


6. The energetically model of the DC drive

Based on the mathematical model of the DC machine Eq. (1), the energetic model has been deducted ( Figure 3 ) [2], in which T o is the mechanical friction torque, T Fv—the viscous force equivalent torque, T f—the Foucault currents losses equivalent torque, and T H—the hysteresis losses equivalent torque.

Figure 3.

The energetic model of the DC machine.

By using the electrical and mechanical equations of the DC motor at the constant flux, the energetic components of the DC drive are obtained:

u A ( t ) = R A i A ( t ) + L A d i A ( t ) d t + e ( t ) + Δ u p ( t ) E11
T e ( t ) = T L ( t ) + F v Ω ( t ) + J d Ω ( t ) d t . E12

By multiplying Eq. (11) with iA(t) term, and Eq. (12) with Ω(t), the power balance of the DC drive can be obtained. In this way, the specific power components are obtained:

  • The electrical power

    P 1 ( t ) = u A ( t ) i A ( t ) E13

  • Different expressions of the electromagnetic power

    P ( t ) = T e ( t ) Ω ( t ) = C m i A ( t ) Ω ( t ) = e ( t ) i A ( t ) E14

  • The rotor copper power losses

    P c u = R A i A 2 ( t ) E15

  • The accumulated power in the rotor inductance

    P L = L A i A ( t ) d i A ( t ) d t E16

  • The brush power losses

    P p ( t ) = Δ u p ( t ) i A ( t ) E17

  • The mechanical power

    P u ( t ) = T L ( t ) Ω ( t ) E18

  • The accumulated power in the rotational masses

    P j = J Ω ( t ) d Ω ( t ) d t E19

  • The viscous power losses

    P f ( t ) = T f Ω ( t ) E20

The magnetization frequency of the rotor ferromagnetic core is

f = p Ω ( t ) 2 π . E21

At the constant flux, the total core losses are

p Fe = k H f + k F f 2 E22

or by

p F e ( t ) = k H ' Ω ( t ) + k F ' Ω 2 ( t ) . E23

Taking into consideration the deducted magnetic core losses Eq. (23), the corresponding equivalent torque is as follows

T F e ( t ) = P F e Ω ( t ) = k H + k F Ω ( t ) E24

or denoted by:

T F e ( t ) = T H ( t ) + T F ( t ) . E25

The mechanical losses are constant. Therefore, the corresponding torque is as follows:

T 0 ( t ) = P 0 Ω ( t ) . E26

By applying the Laplace transform to Eqs. (11) and (12), the electromechanical model of the DC motor at constant flux is obtained:

U A ( s ) E ( s ) Δ U p ( s ) = R A I A ( s ) + s L A I A ( s ) E27
T ( s ) = T L ( s ) + T 0 ( s ) + T H ( s ) + T F ( s ) + T f + s J Ω ( s ) E28

Based on Eqs. (27) and (28), the energetic operational model of the DC motor is obtained as in Figure 3 [2].

6.1. Estimation of the DC drive losses components

By using zero‐order hold, the numerical energies are calculated as a sum of the local areas: i = 0 N V i T (N the maximum sampling interval with constant sampling time T).

The losses in the rotor windings at the k‐th sampling time are as follows:

Δ P Cu ( k T ) = R A I A 2 ( k T ) , E29

and the total rotor copper energy over the control interval can be deducted as

Δ W Cu = i = 1 N R A I A 2 ( i T ) T . E30

In the same way, the following energies are calculated:

  • The input energy of the DC motor

    W P 1 = i = 1 N U ( i T ) I A ( i T ) T E31

  • The accumulated energy in the rotor inductance

    Δ W L = i = 1 N L A I A ( i T ) [ I A ( i T ) I A ( ( i 1 ) T ) ] E32

  • The accumulated energy in the rotational mass

    Δ W J = i = 1 N J Ω ( i T ) [ Ω ( i T ) Ω ( ( i 1 ) T ) ] E33

The brush, the mechanical, and the core losses have been ignored.

By knowing the above mentioned energies, the output energy could be calculated:

W out = W P 1 Δ W Cu Δ W L Δ W J E34

By using the same methodology, the losses of the power converter and the transformer are obtained.


7. Linear quadratic control

The DC machine operates at maximum efficiency at rated operating point, therefore, in steady state. During transient regime, the copper losses component is the higher loss in the DC machine. In order to reduce the power losses in DC drive, the optimal control block diagram is proposed. The proposed solution combines the advantages of the conventional cascaded control (PI) and optimal control [6, 7]. The designed software switch goes in position 1 when the speed error is zero, otherwise goes in position 2 ( Figure 4 ).

Figure 4.

Optimal control system of the DC motor at constant flux.

7.1. Problem formulation

The problem statement of the optimal control supposes a design of the performance index (functional cost). By minimizing the functional cost, the optimal control solution is obtained without any constraints. The optimal control limits are controlled by introducing the weighting matrices [6, 7]. The objectives of the optimal control include the objectives of the conventional drive system (regulation, stability assurance, and robustness to perturbations) and the energy reduction.

The gate drive control is denoted by GDC, the voltage control by uc ( Figure 4 ), the load torque estimator by TL estimator block, the tacho generator by TG, the imposed speed reference and the imposed firing angles. The switch is toggled between position 1 (for conventional control) and fixed position 2 (for optimal control). The conventional control is activated during the steady‐state regimes, and the optimal control is activated during transients (starting, stopping, and reversing regimes).

In order to control the DC motor in an optimal manner ( Figure 5 ), the adopting functional cost is with infinite time horizon:

J = 1 2 0 [ x T ( t ) Q x ( t ) + u T ( t ) R u ( t ) ] d t . E35

Figure 5.

The optimal DC drive system.

By minimizing the adopted performance function, the optimal control is delivered:

u * ( t ) = R 1 B T K x ( t ) , E36

in which the symmetrical gain matrix K:

K = [ k 11 k 12 k 21 k 22 ] > 0 , E37

is the solution of the algebraic Riccati equation (ARE):

K A + A T K K B R 1 B T K + Q = 0 . E38

8. Numerical implementation of the DC drive system

The continuous signals are converted into digital format by using sampling and hold stages. The reversibility takes place through the digital‐to‐analog converters (DACs), that is, the digital signals are converted into continuous ones.

The properties of the zero‐order hold are to maintain the captured signal at the constant value over the entire sampling period. Therefore, the obtained transfer function is

H zoh ( s ) = 1 e s T s . E39

8.1. Mathematical model of the digital current control loop

In Figure 6 , the block diagram of the numerical model of the current loop is shown [2].

Figure 6.

The armature current control loop.

The switch symbol from Figure 6 represents the sampling and hold process, T being the sampling time.

The transfer between the “s” plane and “Z” one is made by using the Z‐transform. By using the transfer function of the zero‐order hold, the discrete transfer function could be obtained according to

H FI ( z 1 ) = Z [ H EOZ ( s ) H FI ( s ) ] E40

or in the other form

H FI ( z 1 ) = Z [ 1 e s T s 1 1 + s T FI ] . E41

Taking into account that z = e s T , the discrete transfer function Eq. (41) becomes

H F I ( z 1 ) = 1 z 1 T F I Z [ 1 s ( s + 1 T F I ) ] . E42

Taking into account the residuum theorem of the simple poles, the Z‐transform can be calculated as

H F I ( z 1 ) = 1 z 1 T F I [ 1 1 T F I 1 1 z 1 e T 0 + 1 1 T F I 1 1 z 1 e T T F I ] . E43

By the other side:

H FI ( z 1 ) = I FI * ( z 1 ) I A * ( z 1 ) . E44

By taking into consideration Eqs. (43) and (44), the following recurrent relation is obtained

I FI * ( k ) = I FI * ( k 1 ) e T T I + I A * ( k 1 ) ( 1 e T T I ) . E45

By starting from the current transducer transfer function

I R ( s ) I A ( s ) = k I 1 + s T I E46

a similar recurrent equation for the current feedback is obtained:

I R ( k ) = I R ( k 1 ) e T T I + I A ( k 1 ) ( 1 e T T I ) k . I E47

The discrete implementation of the current controller

H RI ( s ) = k 2 + k 4 s , E48

is made by using in the similar manner as for the current filter and using the linearity propriety of the Z‐transform

H RI ( z 1 ) = k 3 ( 1 z 1 ) Z [ 1 s ] + k 4 ( 1 z 1 ) Z [ 1 s 2 ] . E49

On the other hand

H R I ( z 1 ) = U C ( z 1 ) I F I * ( z 1 ) I R ( z 1 ) . E50

Taking into account the Z‐transform table, and using Eqs. (49) and (50), the digital implementation of the current regulator is

U c ( k ) = U c ( k 1 ) + k 3 [ I F I * ( k ) I R ( k ) ] + ( k 4 T k 3 ) [ I F I * ( k 1 ) I R ( k 1 ) ] . E51

Taking into consideration the dc‐dc power converter ideal amplifier model, the rotor voltage is obtained:

u A ( k ) = k D u c ( k ) . E52

By taken into consideration one of the following equations, the output signal of the rotor current loop is obtained:

  • By neglecting the electromotive voltage

    I A ( k ) = I A ( k 1 ) e T T A + u A ( k 1 ) ( 1 e T T A ) 1 R A E53

  • By considering the electromotive voltage

    I A ( k ) = I A ( k 1 ) e T T A + [ u A ( k 1 ) C e N ( k 1 ) ] ( 1 e T T A ) 1 R A . E54

8.2. Mathematical model of the digital speed control loop

In Figure 7 , the block diagram of the digital speed control loop is shown, in which the equivalent closed loop transfer function of the armature current control is replaced by current loop block.

Figure 7.

The speed control loop.

Taking into consideration the block diagram shown in Figure 7 , in the similar manner, the digital implementation of the speed loop is obtained.

Therefore, the imposed filtered speed is

N F T * ( k ) = N F T * ( k 1 ) e T T F T + N ( k 1 ) ( 1 e T T F T ) . E55

The digital equation of the recurrent feedback speed is

N R ( k ) = N R ( k 1 ) e T T T + N * ( k 1 ) ( 1 e T T T ) k T . E56

The speed controller for numerical implementation is as:

I A * ( k ) = I A * ( k 1 ) + k 1 [ N F T * ( k ) N R ( k ) ] + ( k 2 T k 1 ) [ N F T * ( k 1 ) N R ( k 1 ) ] , E57

with the obtained numerical signal of the speed feedback

N ( k ) = N ( k 1 ) + T c J [ C m I A ( k 1 ) T L ( k 1 ) ] . E58

By organizing the numerical equations in the specified order Eqs. (55)(57), (45), (47), (51)(53), (58), the digital representation of the DC drive system is obtained.


9. Numerical simulation results

Taking into consideration the following DC motor of 12 W, 12 V/1 A, 90 r.p.m. at rated load torque of 1.37 Nm, the cascaded control loops are implemented in Matlab by using the deducted numerical equations. The following numerical results have been obtained.

In Figure 8 (left side), the dynamic mechanical characteristic for a starting under different load torque variation ( Figure 8 , right side) is shown. At the same time, in Figure 9 , the implemented load torque estimator result is presented.

Figure 8.

Mechanical characteristic of the DC motor (left side). Real (step signal) and the estimated load torque (delayed signal).

Figure 9.

The control signals of the DC drive.

Based on the above mentioned digital implementation and taking into consideration that the DC drive is formed by two parts, control and power, the following simulation results are obtained. Therefore, on the control side, there are only analog voltages ([0–10] V unified system) ( Figure 9 ). On the power side, the real signals are shown ( Figure 10 ). In Figure 9 , the following DC dive signals are shown: the filtered speed reference (nfilter), the feedback speed (Nfbck), the output of the speed controller (i.e., the reference of the rotor current, ref. rotor current), and the filtered rotor current reference (Ifilter).

Figure 10.

The power signals of the DC drive.

On power side, the real values of the DC drive signals are presented: the rotor voltage (Ua), the rotor current (Ia), the controlled feedback speed as the output signal of the DC drive (n), and the load torque signals (the real, TL and the estimated, TLe). The more accurate estimator performances are presented on the [0.4–0.8]s time interval, in Figure 11 .

Figure 11.

The performances of the second‐order load torque estimator.


10. Real‐time speed control

Based on the Arduino platform, the conventional control of the DC drive system is implemented in real time ( Figure 12 ). It consists of the cascaded control, on‐line estimation of the DC motor parameters ( Figure 13 ) based on the recursive least squares method [1], and real‐time estimation of the load torque ( Figure 14 ) [2]. The speed feedback is assured by using an incremental encoder [8]. In order to improve the speed response of the DC drive system, a feedforward additional voltage component has been introduced, as in Figure 15 [9]. In Figures 16 18 , the build s‐function and the associated Simulink blocks for speed and position calculus from the encoder signals are shown.

Figure 12.

The embedded DC drive cascaded control.

Figure 13.

The on‐line estimator of the DC motor.

Figure 14.

The second‐order load torque estimator.

Figure 15.

The feedforward control voltage component.

Figure 16.

The s‐function block of the encoder [8].

Figure 17.

The calculus of the DC rotor position [8].

Figure 18.

The numerical derivation of the position [8].

The appropriate Matlab functions [1] from Figure 13 are delivered as follows:

function tetael=cmmp_el(in)

global tetael_an Pel_an lambda_el Kfi T








function tetamec=cmmp_mec(in)

global tetamec_an Pmec_an lambda_mec alpham denumm Pm Kfi T











By applying the numerical derivative of the position adapted to gear ratio the real speed value is obtained ( Figure 19 ).

Figure 19.

The DC drive platform.

11. Conclusions

This chapter is designed in the didactical manner that allows students and researchers to implement autonomously the mechatronic projects based on the DC drive. Starting from the nameplate data of the DC motor, the provided Matlab software has the ability to calculate the DC motor parameters, the parameters of the current and speed controllers, and includes the numerical implementation of the DC motor cascaded control, energy balance and of the load torque estimator. The price of the proposed DC drive is down due to the fact that the load torque is very expensive and it is replaced by the load torque estimator. By using the Z‐transform, the procedure of numerical control is implemented. The implementation of the digital filters and controllers are also provided. Numerical simulations confirm the accuracy of the proposed DC drive discretization method. Moreover, the real‐time control based to Arduino platform has been performed. In order to increase the DC drive performances, the on‐line estimator of the DC motor parameters is provided, and the feedforward control voltage component has been added.


This work was supported by a grant of the Romanian National Authority for Scientific Research, CNDI–UEFISCDI, project number PN‐II‐PT‐PCCA‐2011‐3.2‐1680.




% Nameplate Data

%  ‐Rated Power

     Pn=12    %W

%  ‐Rated Voltage

     Un=12     %V

%  ‐Rated Speed

     nn=90     %rot/min

%  ‐moment of inertia

   Jt=0.02    %kgm^2


%  ‐Rated efficiency

     etan=0.86 %

% Main data calculus

%  ‐Electrical Power(input)

     P1=Pn/etan  %W

%  ‐Rated current

     Ian=P1/Un  %A

%  ‐DC motor losses

     deltap=P1‐Pn  %W

%   ‐Rated winding losses

      pcun=deltap/2  %W

%  ‐Rotor resistance

     Ra=pcun/(Ian^2)  %ohmi

%  ‐Electromagnetic Power

     P=Pn+deltap/2  %W

%  ‐Electromagnetic torque

     Mn=30*P/pi/nn  %Nm

%  ‐Mechanical constant



%  ‐Electrical constant



%  ‐Electromotive voltage

     E=Ce*nn  %V

%  ‐Rotor resistance value check Ra

     Ra=(Un‐E)/Ian  %ohmi

%  ‐volant moment

     g=9.81;  % gravit. acc.

     GD2=4*g*Jt  %m^2

%  ‐Maximum torque

     Mmax=2*Mn  %Nm

%  ‐Maximum rotor current

     Iamax=Mmax/Cm  %A

%  ‐Electrical constant (from identification procedure)Ta

     Ta=7/(10^3)  %sec

%  ‐Rotor inductance

     La=Ta*Ra  %H

%  ‐Load torque

     Mr=1*Mn;  %Nm



%        Current loop‐ tuning of the controller parameters

%    (modulus criterion ‐ KESSLER variant)


%current transducer


%  ‐for DC motor

     ka=1/Ra  %(1/ohmi)

%  ‐attenuation factor of the current transducer

     ki=10/Iamax  %(V/A)

%  ‐Current transducer time constant

     Ti=0.003  %sec


%DC‐DC Power Converter


%  ‐gain factor



% PI Current Controller


%  ‐sum of the parasitic constant of the current loop

     Tsi=Ti  %sec

%  ‐Proportional coefficient

     tau1=Ta  %sec

%  ‐gain factor


%  ‐Time constant of the current filter

     Tf1=Ti  %sec


%        Speed loop‐ tuning of the controller parameters

%     (symmetrical criterion ‐ KESSLER variant)


%speed transducer


%  ‐attenuation factor of the speed transducer

     kt=10/nn  %(V/r.p.m.)

%  ‐Time constant

     Tt=Ti  %sec

%  ‐gain factor of the mechanical inertia(1/s*Jt)



%  ‐sum of the parasitic constant of the speed loop

     Tst=2*Tsi+Tt  %sec

%  ‐Proportional coefficient

     tau2=4*Tst  %sec

%  ‐gain factor


%  ‐Speed time constant



%  ‐ sampling time

     T=Ta/10;  %sec

%  ‐initial conditions

%  a)current loop

    Ir=0;  %A  %output signal of the current transducer

    If=0;  %A  %output signal of the current filter Ii

    U=0;   % V  % DC‐DC voltage

    Ia=0;  %A  % rotor current

%  b)speed loop

    Nf=0;  %r.p.m.  %output signal of the speed filter Ni

    Nr=0;  %r.p.m.  %output signal of the speed transducer

    Ni=10; % V  reference speed

    N=0;  %r.p.m.  real speed

    Ii=0;  %A  reference current ‐initial value

    t=0;  %sec  % initial time

    tf=1; %sec  %final time

    i=1;  %counter


%power balance estimation


   swcu=0;   %estimation of the copper losses

   swl=0;   %estimation of the accum. energy in the rotor inductance

   swj=0;   %estimation of the accum. energy in thea motion masses

   wpr=0;   %estimation of the input energy



%Load torque estimator


T0=0.0024  %2*T;


Mre=0;  vt2=0;  vt4=0;



while (t<=tf),

   vtnf(i)=Nf;  %speed vector

   vtnr(i)=Nr;   vtii(i)=Ii;

   vtn(i)=N;    vtir(i)=Ir;

   vtif(i)=If;   vtu(i)=U;

   vtia(i)=Ia;   mre(i)=Mre;

% perturbation load torque wp




   %output signal of the speed filter at the current step(k)


   % speed feedback at the current step(k)


  %output signal of the speed controller=reference of the rotor current(k)


   % allowable limits of the rotor current

   if Iiu>10,


   elseif Iiu<‐10,





  % filtered reference of the rotor current,at the current step(k)


   %feedback rotor current (k)


   % output of the current controller= rotor voltage (k)


   %load torque estimator



   %rotor current(k)


   wl(i)=La*Iau*(Iau‐Ia); %acum. en. in the L.rotor the current sampling

   swl=swl+wl(i);   % acum.en. in the L.rotor through the starting period

   %rotor speed(k)



   %load torque variation

   if t<=0.5,


   elseif (t<=0.6) & (t>0.5),


    elseif (t<=0.7) & (t>0.6),


     elseif(t<=0.8) & (t>0.7),

         wp=1*Mr; %alfa*t;

   elseif(t<=0.9) & (t>0.8),





   % acum. the rotational mass



   %energy estimation

   pcu(i)=Ra*(vtia(i)^2);  % copper power losses

   swcut(i)=pcu(i)*T;  % energy losses at each sampling time

   swcu=swcu+swcut(i);  % rotor energy losses

   pr(i)=vtu(i)*vtia(i);  % the input electrical power

   wpr=wpr+pr(i)*T;  % the input energy

   Nf=Nfu;   Nr=Nru;   Ii=Iiu;


   Ir=Iru;   %Ir(k‐1)

   If=Ifu;   %If(k‐1)

   U=Uu;   %U(k‐1)

   Ia=Iau;   %Ia(k‐1)

   Mre=Mreu;   vt2=vt2u;   vt4=vt4u;

   t=t+T;   % simulation time increment

   i=i+1;   % counter increment


  wu=wpr‐swcu‐swl‐swj % DC motor output poweren.

  eta=wu/wpr; %the efficiency of the DC drive




  title('electromechanical characteristic','FontSize',12)

  xlabel('electromagnetic torque[Nm]','FontSize',12)

  ylabel('speed [rot/min]','FontSize',12)


  fprintf('vizualizati caracteristica mecanica')









  ylabel('Nf [r.p.m.]','FontSize',12)






  ylabel('Nfbck [r.p.m.]','FontSize',12)




  title('ref. rotor current','FontSize',12)


  ylabel('Ia* [A]','FontSize',12)






  ylabel('filtered Ia*[A]','FontSize',12)





  title('Rotor Voltage','FontSize',12)


  ylabel('Ua[ V ]','FontSize',12)






  ylabel('Ia [A]','FontSize',12)






  ylabel('speed [r.p.m.]','FontSize',12)




  title('TL =f(t),TLe =f(t)','FontSize',12)


  ylabel('TL, TLe[N*m]','FontSize',12)


  fprintf('vizualizati fig.2')





  title('TL =f(t),TLe =f(t)','FontSize',12)


  ylabel('TL, TLe[N*m]','FontSize',12)


  fprintf('vizualizati fig.3')






  title('Mr =f(t)','FontSize',12)


  ylabel('Mr [N*m]','FontSize',12)




  title('Mr^ =f(t)','FontSize',12)


  ylabel('Mre [N*m]','FontSize',12)


  fprintf('vizualizati fig.4')

  %energy components

  swcu %copper losses

  wpr %input energy

  swl %accum. Energy in rotor inductance Lrotor

  swj %accum. Energy in rotational mass

  eta %efficiency during starting




  1. 1. Gaiceanu M, Solea R, Codres B, Eni C. On‐line Identification of the DC Motor Parameters by using Least Mean Square Recursive Method. Resita: Analele Universitatii “Eftimie Murgu”. 2014. 1453–7397. 2(ANUL XXI):ISSN.
  2. 2. Rosu E, Bivol I, Nichita C, Gaiceanu M. Energetical Optimization of the Electromechanical Conversion Systems (Optimizarea energetica a sistemelor de conversie electromecanice). Bucharest: Technical House. 1999. 210 p. ISBN 973‐31‐1329‐8.
  3. 3. Puangdownreonga D, Nawikavatan A, Thammarat C. Optimal design of I‐PD controller for DC motor speed control system by Cuckoo Search. Procedia Computer. 2016;86:1877–0509/83–86. DOI: 10.1016/j.procs.2016.05.021.
  4. 4. Grignion D, Chen X, Tan Y, Qian H, Kar N. Robust load disturbance torque estimation for a DC motor drive system. IFAC Proceedings Volumes. 2012;45(13):460–466. DOI: 10.3182/20120620‐3‐DK‐2025.00139.
  5. 5. Babaei M, Asgharei R, Ahmarinejad A. Electromagnetic torque and speed estimators for permanent magnet synchronous motor drive systems. Energy Procedia. 2016;100:291–296. DOI: 10.1016/j.egypro.2016.10.180.
  6. 6. Thanga Raj C, Srivastava SP, Agarwal P. Differential evolution based optimal control of induction motor serving to textile industry. IAENG International Journal of Computer Science. 2008;35(2):IJCS_35_2_03.
  7. 7. Gaiceanu M. Linear quadratic regulator for the three‐phase grid connected power converter. In: 2nd International Conference on Micro Nano Devices, Structure and Computing Systems; January 23–24; Shenzhen, China. 2013.
  8. 8. Carnegie Mellon University. Control Tutorials for MATLAB and Simulink [Internet]. 2006.Available from: [Accessed: 2016].
  9. 9. Springer International Publishing AG, Switzerland

Written By

Marian Gaiceanu

Submitted: September 12th, 2016 Reviewed: January 12th, 2017 Published: May 3rd, 2017